@wangeditor-next/core 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,2 +1,13 @@
1
- import{Transforms as t,Editor as e,Operation as n,Path as r,isObject as o,Text as i,Range as a,Element as s,Node as u,Point as l,createEditor as c}from"slate";import f from"lodash.clonedeep";import d from"lodash.foreach";import h,{css as p,append as g,addClass as v,removeClass as m,hasClass as y,on as b,focus as w,attr as x,removeAttr as S,hide as O,show as E,offset as C,width as k,height as N,parent as T,parents as L,is as M,dataset as R,val as D,text as P,html as A,children as j,remove as I,find as $,each as F,empty as B}from"dom7";import"nanoid";import _ from"lodash.toarray";import W from"lodash.debounce";import z from"lodash.throttle";import{isKeyHotkey as U,isHotkey as V}from"is-hotkey";import{jsx as H,init as K,classModule as q,propsModule as J,styleModule as G,datasetModule as Y,eventListenersModule as X,attributesModule as Q,h as Z}from"snabbdom";import tt from"lodash.camelcase";import et from"@uppy/core";import nt from"@uppy/xhr-upload";var rt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ot(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var it,at,st={};function ut(){if(at)return it;at=1;var t=function(t){return t&&t.Math===Math&&t};return it=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof rt&&rt)||t("object"==typeof it&&it)||function(){return this}()||Function("return this")()}var lt,ct,ft,dt,ht,pt,gt,vt,mt={};function yt(){return ct?lt:(ct=1,lt=function(t){try{return!!t()}catch(t){return!0}})}function bt(){if(dt)return ft;dt=1;var t=yt();return ft=!t(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function wt(){if(pt)return ht;pt=1;var t=yt();return ht=!t(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})}function xt(){if(vt)return gt;vt=1;var t=wt(),e=Function.prototype.call;return gt=t?e.bind(e):function(){return e.apply(e,arguments)},gt}var St,Ot,Et,Ct,kt,Nt,Tt,Lt,Mt,Rt,Dt,Pt,At,jt,It,$t,Ft,Bt,_t,Wt,zt,Ut,Vt,Ht,Kt,qt,Jt,Gt,Yt,Xt,Qt,Zt,te,ee,ne,re,oe,ie,ae,se,ue,le={};function ce(){if(St)return le;St=1;var t={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,n=e&&!t.call({1:2},1);return le.f=n?function(t){var n=e(this,t);return!!n&&n.enumerable}:t,le}function fe(){return Et?Ot:(Et=1,Ot=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}})}function de(){if(kt)return Ct;kt=1;var t=wt(),e=Function.prototype,n=e.call,r=t&&e.bind.bind(n,n);return Ct=t?r:function(t){return function(){return n.apply(t,arguments)}},Ct}function he(){if(Tt)return Nt;Tt=1;var t=de(),e=t({}.toString),n=t("".slice);return Nt=function(t){return n(e(t),8,-1)}}function pe(){if(Mt)return Lt;Mt=1;var t=de(),e=yt(),n=he(),r=Object,o=t("".split);return Lt=e(function(){return!r("z").propertyIsEnumerable(0)})?function(t){return"String"===n(t)?o(t,""):r(t)}:r}function ge(){return Dt?Rt:(Dt=1,Rt=function(t){return null==t})}function ve(){if(At)return Pt;At=1;var t=ge(),e=TypeError;return Pt=function(n){if(t(n))throw new e("Can't call method on "+n);return n}}function me(){if(It)return jt;It=1;var t=pe(),e=ve();return jt=function(n){return t(e(n))}}function ye(){if(Ft)return $t;Ft=1;var t="object"==typeof document&&document.all;return $t=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(t){return"function"==typeof t}}function be(){if(_t)return Bt;_t=1;var t=ye();return Bt=function(e){return"object"==typeof e?null!==e:t(e)}}function we(){if(zt)return Wt;zt=1;var t=ut(),e=ye();return Wt=function(n,r){return arguments.length<2?(o=t[n],e(o)?o:void 0):t[n]&&t[n][r];var o},Wt}function xe(){if(Vt)return Ut;Vt=1;var t=de();return Ut=t({}.isPrototypeOf)}function Se(){if(Kt)return Ht;Kt=1;var t=ut().navigator,e=t&&t.userAgent;return Ht=e?String(e):""}function Oe(){if(Jt)return qt;Jt=1;var t,e,n=ut(),r=Se(),o=n.process,i=n.Deno,a=o&&o.versions||i&&i.version,s=a&&a.v8;return s&&(e=(t=s.split("."))[0]>0&&t[0]<4?1:+(t[0]+t[1])),!e&&r&&(!(t=r.match(/Edge\/(\d+)/))||t[1]>=74)&&(t=r.match(/Chrome\/(\d+)/))&&(e=+t[1]),qt=e}function Ee(){if(Yt)return Gt;Yt=1;var t=Oe(),e=yt(),n=ut().String;return Gt=!!Object.getOwnPropertySymbols&&!e(function(){var e=Symbol("symbol detection");return!n(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&t&&t<41})}function Ce(){if(Qt)return Xt;Qt=1;var t=Ee();return Xt=t&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function ke(){if(te)return Zt;te=1;var t=we(),e=ye(),n=xe(),r=Ce(),o=Object;return Zt=r?function(t){return"symbol"==typeof t}:function(r){var i=t("Symbol");return e(i)&&n(i.prototype,o(r))}}function Ne(){if(ne)return ee;ne=1;var t=String;return ee=function(e){try{return t(e)}catch(t){return"Object"}}}function Te(){if(oe)return re;oe=1;var t=ye(),e=Ne(),n=TypeError;return re=function(r){if(t(r))return r;throw new n(e(r)+" is not a function")}}function Le(){if(ae)return ie;ae=1;var t=Te(),e=ge();return ie=function(n,r){var o=n[r];return e(o)?void 0:t(o)}}function Me(){if(ue)return se;ue=1;var t=xt(),e=ye(),n=be(),r=TypeError;return se=function(o,i){var a,s;if("string"===i&&e(a=o.toString)&&!n(s=t(a,o)))return s;if(e(a=o.valueOf)&&!n(s=t(a,o)))return s;if("string"!==i&&e(a=o.toString)&&!n(s=t(a,o)))return s;throw new r("Can't convert object to primitive value")},se}var Re,De,Pe,Ae,je,Ie,$e,Fe,Be,_e,We,ze,Ue,Ve,He,Ke,qe,Je,Ge,Ye,Xe,Qe,Ze,tn,en={exports:{}};function nn(){return De?Re:(De=1,Re=!1)}function rn(){if(Ae)return Pe;Ae=1;var t=ut(),e=Object.defineProperty;return Pe=function(n,r){try{e(t,n,{value:r,configurable:!0,writable:!0})}catch(e){t[n]=r}return r}}function on(){if(je)return en.exports;je=1;var t=nn(),e=ut(),n=rn(),r="__core-js_shared__",o=en.exports=e[r]||n(r,{});return(o.versions||(o.versions=[])).push({version:"3.47.0",mode:t?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"}),en.exports}function an(){if($e)return Ie;$e=1;var t=on();return Ie=function(e,n){return t[e]||(t[e]=n||{})}}function sn(){if(Be)return Fe;Be=1;var t=ve(),e=Object;return Fe=function(n){return e(t(n))}}function un(){if(We)return _e;We=1;var t=de(),e=sn(),n=t({}.hasOwnProperty);return _e=Object.hasOwn||function(t,r){return n(e(t),r)}}function ln(){if(Ue)return ze;Ue=1;var t=de(),e=0,n=Math.random(),r=t(1.1.toString);return ze=function(t){return"Symbol("+(void 0===t?"":t)+")_"+r(++e+n,36)}}function cn(){if(He)return Ve;He=1;var t=ut(),e=an(),n=un(),r=ln(),o=Ee(),i=Ce(),a=t.Symbol,s=e("wks"),u=i?a.for||a:a&&a.withoutSetter||r;return Ve=function(t){return n(s,t)||(s[t]=o&&n(a,t)?a[t]:u("Symbol."+t)),s[t]}}function fn(){if(qe)return Ke;qe=1;var t=xt(),e=be(),n=ke(),r=Le(),o=Me(),i=cn(),a=TypeError,s=i("toPrimitive");return Ke=function(i,u){if(!e(i)||n(i))return i;var l,c=r(i,s);if(c){if(void 0===u&&(u="default"),l=t(c,i,u),!e(l)||n(l))return l;throw new a("Can't convert object to primitive value")}return void 0===u&&(u="number"),o(i,u)}}function dn(){if(Ge)return Je;Ge=1;var t=fn(),e=ke();return Je=function(n){var r=t(n,"string");return e(r)?r:r+""}}function hn(){if(Xe)return Ye;Xe=1;var t=ut(),e=be(),n=t.document,r=e(n)&&e(n.createElement);return Ye=function(t){return r?n.createElement(t):{}}}function pn(){if(Ze)return Qe;Ze=1;var t=bt(),e=yt(),n=hn();return Qe=!t&&!e(function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a})}function gn(){if(tn)return mt;tn=1;var t=bt(),e=xt(),n=ce(),r=fe(),o=me(),i=dn(),a=un(),s=pn(),u=Object.getOwnPropertyDescriptor;return mt.f=t?u:function(t,l){if(t=o(t),l=i(l),s)try{return u(t,l)}catch(t){}if(a(t,l))return r(!e(n.f,t,l),t[l])},mt}var vn,mn,yn,bn,wn,xn,Sn,On={};function En(){if(mn)return vn;mn=1;var t=bt(),e=yt();return vn=t&&e(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}function Cn(){if(bn)return yn;bn=1;var t=be(),e=String,n=TypeError;return yn=function(r){if(t(r))return r;throw new n(e(r)+" is not an object")}}function kn(){if(wn)return On;wn=1;var t=bt(),e=pn(),n=En(),r=Cn(),o=dn(),i=TypeError,a=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u="enumerable",l="configurable",c="writable";return On.f=t?n?function(t,e,n){if(r(t),e=o(e),r(n),"function"==typeof t&&"prototype"===e&&"value"in n&&c in n&&!n[c]){var i=s(t,e);i&&i[c]&&(t[e]=n.value,n={configurable:l in n?n[l]:i[l],enumerable:u in n?n[u]:i[u],writable:!1})}return a(t,e,n)}:a:function(t,n,s){if(r(t),n=o(n),r(s),e)try{return a(t,n,s)}catch(t){}if("get"in s||"set"in s)throw new i("Accessors not supported");return"value"in s&&(t[n]=s.value),t},On}function Nn(){if(Sn)return xn;Sn=1;var t=bt(),e=kn(),n=fe();return xn=t?function(t,r,o){return e.f(t,r,n(1,o))}:function(t,e,n){return t[e]=n,t}}var Tn,Ln,Mn,Rn,Dn,Pn,An,jn,In,$n,Fn,Bn,_n,Wn,zn,Un={exports:{}};function Vn(){if(Ln)return Tn;Ln=1;var t=bt(),e=un(),n=Function.prototype,r=t&&Object.getOwnPropertyDescriptor,o=e(n,"name"),i=o&&"something"===function(){}.name,a=o&&(!t||t&&r(n,"name").configurable);return Tn={EXISTS:o,PROPER:i,CONFIGURABLE:a}}function Hn(){if(Rn)return Mn;Rn=1;var t=de(),e=ye(),n=on(),r=t(Function.toString);return e(n.inspectSource)||(n.inspectSource=function(t){return r(t)}),Mn=n.inspectSource}function Kn(){if(Pn)return Dn;Pn=1;var t=ut(),e=ye(),n=t.WeakMap;return Dn=e(n)&&/native code/.test(String(n))}function qn(){if(jn)return An;jn=1;var t=an(),e=ln(),n=t("keys");return An=function(t){return n[t]||(n[t]=e(t))}}function Jn(){return $n?In:($n=1,In={})}function Gn(){if(Bn)return Fn;Bn=1;var t,e,n,r=Kn(),o=ut(),i=be(),a=Nn(),s=un(),u=on(),l=qn(),c=Jn(),f="Object already initialized",d=o.TypeError,h=o.WeakMap;if(r||u.state){var p=u.state||(u.state=new h);p.get=p.get,p.has=p.has,p.set=p.set,t=function(t,e){if(p.has(t))throw new d(f);return e.facade=t,p.set(t,e),e},e=function(t){return p.get(t)||{}},n=function(t){return p.has(t)}}else{var g=l("state");c[g]=!0,t=function(t,e){if(s(t,g))throw new d(f);return e.facade=t,a(t,g,e),e},e=function(t){return s(t,g)?t[g]:{}},n=function(t){return s(t,g)}}return Fn={set:t,get:e,has:n,enforce:function(r){return n(r)?e(r):t(r,{})},getterFor:function(t){return function(n){var r;if(!i(n)||(r=e(n)).type!==t)throw new d("Incompatible receiver, "+t+" required");return r}}}}function Yn(){if(_n)return Un.exports;_n=1;var t=de(),e=yt(),n=ye(),r=un(),o=bt(),i=Vn().CONFIGURABLE,a=Hn(),s=Gn(),u=s.enforce,l=s.get,c=String,f=Object.defineProperty,d=t("".slice),h=t("".replace),p=t([].join),g=o&&!e(function(){return 8!==f(function(){},"length",{value:8}).length}),v=String(String).split("String"),m=Un.exports=function(t,e,n){"Symbol("===d(c(e),0,7)&&(e="["+h(c(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!r(t,"name")||i&&t.name!==e)&&(o?f(t,"name",{value:e,configurable:!0}):t.name=e),g&&n&&r(n,"arity")&&t.length!==n.arity&&f(t,"length",{value:n.arity});try{n&&r(n,"constructor")&&n.constructor?o&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var a=u(t);return r(a,"source")||(a.source=p(v,"string"==typeof e?e:"")),t};return Function.prototype.toString=m(function(){return n(this)&&l(this).source||a(this)},"toString"),Un.exports}function Xn(){if(zn)return Wn;zn=1;var t=ye(),e=kn(),n=Yn(),r=rn();return Wn=function(o,i,a,s){s||(s={});var u=s.enumerable,l=void 0!==s.name?s.name:i;if(t(a)&&n(a,l,s),s.global)u?o[i]=a:r(i,a);else{try{s.unsafe?o[i]&&(u=!0):delete o[i]}catch(t){}u?o[i]=a:e.f(o,i,{value:a,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return o}}var Qn,Zn,tr,er,nr,rr,or,ir,ar,sr,ur,lr,cr,fr,dr,hr,pr,gr={};function vr(){if(er)return tr;er=1;var t=function(){if(Zn)return Qn;Zn=1;var t=Math.ceil,e=Math.floor;return Qn=Math.trunc||function(n){var r=+n;return(r>0?e:t)(r)},Qn}();return tr=function(e){var n=+e;return n!=n||0===n?0:t(n)}}function mr(){if(rr)return nr;rr=1;var t=vr(),e=Math.max,n=Math.min;return nr=function(r,o){var i=t(r);return i<0?e(i+o,0):n(i,o)}}function yr(){if(ir)return or;ir=1;var t=vr(),e=Math.min;return or=function(n){var r=t(n);return r>0?e(r,9007199254740991):0}}function br(){if(sr)return ar;sr=1;var t=yr();return ar=function(e){return t(e.length)}}function wr(){if(lr)return ur;lr=1;var t=me(),e=mr(),n=br(),r=function(r){return function(o,i,a){var s=t(o),u=n(s);if(0===u)return!r&&-1;var l,c=e(a,u);if(r&&i!=i){for(;u>c;)if((l=s[c++])!=l)return!0}else for(;u>c;c++)if((r||c in s)&&s[c]===i)return r||c||0;return!r&&-1}};return ur={includes:r(!0),indexOf:r(!1)}}function xr(){if(fr)return cr;fr=1;var t=de(),e=un(),n=me(),r=wr().indexOf,o=Jn(),i=t([].push);return cr=function(t,a){var s,u=n(t),l=0,c=[];for(s in u)!e(o,s)&&e(u,s)&&i(c,s);for(;a.length>l;)e(u,s=a[l++])&&(~r(c,s)||i(c,s));return c}}function Sr(){return hr?dr:(hr=1,dr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function Or(){if(pr)return gr;pr=1;var t=xr(),e=Sr().concat("length","prototype");return gr.f=Object.getOwnPropertyNames||function(n){return t(n,e)},gr}var Er,Cr,kr,Nr,Tr,Lr,Mr,Rr,Dr,Pr,Ar,jr,Ir={};function $r(){return Er||(Er=1,Ir.f=Object.getOwnPropertySymbols),Ir}function Fr(){if(kr)return Cr;kr=1;var t=we(),e=de(),n=Or(),r=$r(),o=Cn(),i=e([].concat);return Cr=t("Reflect","ownKeys")||function(t){var e=n.f(o(t)),a=r.f;return a?i(e,a(t)):e},Cr}function Br(){if(Tr)return Nr;Tr=1;var t=un(),e=Fr(),n=gn(),r=kn();return Nr=function(o,i,a){for(var s=e(i),u=r.f,l=n.f,c=0;c<s.length;c++){var f=s[c];t(o,f)||a&&t(a,f)||u(o,f,l(i,f))}},Nr}function _r(){if(Mr)return Lr;Mr=1;var t=yt(),e=ye(),n=/#|\.prototype\./,r=function(n,r){var u=i[o(n)];return u===s||u!==a&&(e(r)?t(r):!!r)},o=r.normalize=function(t){return String(t).replace(n,".").toLowerCase()},i=r.data={},a=r.NATIVE="N",s=r.POLYFILL="P";return Lr=r}function Wr(){if(Dr)return Rr;Dr=1;var t=ut(),e=gn().f,n=Nn(),r=Xn(),o=rn(),i=Br(),a=_r();return Rr=function(s,u){var l,c,f,d,h,p=s.target,g=s.global,v=s.stat;if(l=g?t:v?t[p]||o(p,{}):t[p]&&t[p].prototype)for(c in u){if(d=u[c],f=s.dontCallGetSet?(h=e(l,c))&&h.value:l[c],!a(g?c:p+(v?".":"#")+c,s.forced)&&void 0!==f){if(typeof d==typeof f)continue;i(d,f)}(s.sham||f&&f.sham)&&n(d,"sham",!0),r(l,c,d,s)}}}function zr(){if(Ar)return Pr;Ar=1;var t=xr(),e=Sr();return Pr=Object.keys||function(n){return t(n,e)}}!function(){if(jr)return st;jr=1;var t=Wr(),e=sn(),n=zr();t({target:"Object",stat:!0,forced:yt()(function(){n(1)})},{keys:function(t){return n(e(t))}})}();var Ur,Vr,Hr,Kr,qr,Jr,Gr,Yr={};function Xr(){if(Vr)return Ur;Vr=1;var t={};return t[cn()("toStringTag")]="z",Ur="[object z]"===String(t)}function Qr(){if(Kr)return Hr;Kr=1;var t=Xr(),e=ye(),n=he(),r=cn()("toStringTag"),o=Object,i="Arguments"===n(function(){return arguments}());return Hr=t?n:function(t){var a,s,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(s=function(t,e){try{return t[e]}catch(t){}}(a=o(t),r))?s:i?n(a):"Object"===(u=n(a))&&e(a.callee)?"Arguments":u}}!function(){if(Gr)return Yr;Gr=1;var t=Xr(),e=Xn(),n=function(){if(Jr)return qr;Jr=1;var t=Xr(),e=Qr();return qr=t?{}.toString:function(){return"[object "+e(this)+"]"}}();t||e(Object.prototype,"toString",n,{unsafe:!0})}();var Zr,to,eo,no,ro,oo,io,ao,so,uo,lo,co,fo,ho,po,go,vo,mo,yo,bo,wo,xo,So,Oo={};function Eo(){return to?Zr:(to=1,Zr={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0})}function Co(){if(no)return eo;no=1;var t=hn()("span").classList,e=t&&t.constructor&&t.constructor.prototype;return eo=e===Object.prototype?void 0:e}function ko(){if(oo)return ro;oo=1;var t=he(),e=de();return ro=function(n){if("Function"===t(n))return e(n)}}function No(){if(ao)return io;ao=1;var t=ko(),e=Te(),n=wt(),r=t(t.bind);return io=function(t,o){return e(t),void 0===o?t:n?r(t,o):function(){return t.apply(o,arguments)}},io}function To(){if(uo)return so;uo=1;var t=he();return so=Array.isArray||function(e){return"Array"===t(e)}}function Lo(){if(co)return lo;co=1;var t=de(),e=yt(),n=ye(),r=Qr(),o=we(),i=Hn(),a=function(){},s=o("Reflect","construct"),u=/^\s*(?:class|function)\b/,l=t(u.exec),c=!u.test(a),f=function(t){if(!n(t))return!1;try{return s(a,[],t),!0}catch(t){return!1}},d=function(t){if(!n(t))return!1;switch(r(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return c||!!l(u,i(t))}catch(t){return!0}};return d.sham=!0,lo=!s||e(function(){var t;return f(f.call)||!f(Object)||!f(function(){t=!0})||t})?d:f}function Mo(){if(ho)return fo;ho=1;var t=To(),e=Lo(),n=be(),r=cn()("species"),o=Array;return fo=function(i){var a;return t(i)&&(a=i.constructor,(e(a)&&(a===o||t(a.prototype))||n(a)&&null===(a=a[r]))&&(a=void 0)),void 0===a?o:a}}function Ro(){if(go)return po;go=1;var t=Mo();return po=function(e,n){return new(t(e))(0===n?0:n)}}function Do(){if(mo)return vo;mo=1;var t=No(),e=de(),n=pe(),r=sn(),o=br(),i=Ro(),a=e([].push),s=function(e){var s=1===e,u=2===e,l=3===e,c=4===e,f=6===e,d=7===e,h=5===e||f;return function(p,g,v,m){for(var y,b,w=r(p),x=n(w),S=o(x),O=t(g,v),E=0,C=m||i,k=s?C(p,S):u||d?C(p,0):void 0;S>E;E++)if((h||E in x)&&(b=O(y=x[E],E,w),e))if(s)k[E]=b;else if(b)switch(e){case 3:return!0;case 5:return y;case 6:return E;case 2:a(k,y)}else switch(e){case 4:return!1;case 7:a(k,y)}return f?-1:l||c?c:k}};return vo={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6),filterReject:s(7)}}function Po(){if(bo)return yo;bo=1;var t=yt();return yo=function(e,n){var r=[][e];return!!r&&t(function(){r.call(null,n||function(){return 1},1)})}}!function(){if(So)return Oo;So=1;var t=ut(),e=Eo(),n=Co(),r=function(){if(xo)return wo;xo=1;var t=Do().forEach,e=Po()("forEach");return wo=e?[].forEach:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)},wo}(),o=Nn(),i=function(t){if(t&&t.forEach!==r)try{o(t,"forEach",r)}catch(e){t.forEach=r}};for(var a in e)e[a]&&i(t[a]&&t[a].prototype);i(n)}();var Ao,jo,Io,$o,Fo,Bo,_o,Wo={isHistory:t=>o(t)&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(0===t.redos.length||n.isOperationList(t.redos[0].operations))&&(0===t.undos.length||n.isOperationList(t.undos[0].operations))},zo=new WeakMap,Uo=new WeakMap,Vo=new WeakMap,Ho={isHistoryEditor:t=>Wo.isHistory(t.history)&&e.isEditor(t),isMerging:t=>Uo.get(t),isSplittingOnce:t=>Vo.get(t),setSplittingOnce(t,e){Vo.set(t,e)},isSaving:t=>zo.get(t),redo(t){t.redo()},undo(t){t.undo()},withMerging(t,e){var n=Ho.isMerging(t);Uo.set(t,!0),e(),Uo.set(t,n)},withNewBatch(t,e){var n=Ho.isMerging(t);Uo.set(t,!0),Vo.set(t,!0),e(),Uo.set(t,n),Vo.delete(t)},withoutMerging(t,e){var n=Ho.isMerging(t);Uo.set(t,!1),e(),Uo.set(t,n)},withoutSaving(t,e){var n=Ho.isSaving(t);zo.set(t,!1);try{e()}finally{zo.set(t,n)}}},Ko=r=>{var o=r,{apply:i}=o;return o.history={undos:[],redos:[]},o.redo=()=>{var{history:n}=o,{redos:r}=n;if(r.length>0){var i=r[r.length-1];i.selectionBefore&&t.setSelection(o,i.selectionBefore),Ho.withoutSaving(o,()=>{e.withoutNormalizing(o,()=>{for(var t of i.operations)o.apply(t)})}),n.redos.pop(),o.writeHistory("undos",i)}},o.undo=()=>{var{history:r}=o,{undos:i}=r;if(i.length>0){var a=i[i.length-1];Ho.withoutSaving(o,()=>{e.withoutNormalizing(o,()=>{var e=a.operations.map(n.inverse).reverse();for(var r of e)o.apply(r);a.selectionBefore&&t.setSelection(o,a.selectionBefore)})}),o.writeHistory("redos",a),r.undos.pop()}},o.apply=t=>{var{operations:e,history:n}=o,{undos:r}=n,a=r[r.length-1],s=a&&a.operations[a.operations.length-1],u=Ho.isSaving(o),l=Ho.isMerging(o);if(null==u&&(u=Jo(t)),u){if(null==l&&(l=null!=a&&(!!e.includes(s)||qo(t,s))),Ho.isSplittingOnce(o)&&(l=!1,Ho.setSplittingOnce(o,void 0)),a&&l)a.operations.push(t);else{var c={operations:[t],selectionBefore:o.selection};o.writeHistory("undos",c)}for(;r.length>100;)r.shift();n.redos=[]}i(t)},o.writeHistory=(t,e)=>{o.history[t].push(e)},o},qo=(t,e)=>!(!e||"insert_text"!==t.type||"insert_text"!==e.type||t.offset!==e.offset+e.text.length||!r.equals(t.path,e.path))||!(!e||"remove_text"!==t.type||"remove_text"!==e.type||t.offset+t.text.length!==e.offset||!r.equals(t.path,e.path)),Jo=(t,e)=>"set_selection"!==t.type,Go={};function Yo(){if(jo)return Ao;jo=1;var t=TypeError;return Ao=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}}function Xo(){if($o)return Io;$o=1;var t=bt(),e=kn(),n=fe();return Io=function(r,o,i){t?e.f(r,o,n(0,i)):r[o]=i}}function Qo(){if(Bo)return Fo;Bo=1;var t=yt(),e=cn(),n=Oe(),r=e("species");return Fo=function(e){return n>=51||!t(function(){var t=[];return(t.constructor={})[r]=function(){return{foo:1}},1!==t[e](Boolean).foo})}}!function(){if(_o)return Go;_o=1;var t=Wr(),e=yt(),n=To(),r=be(),o=sn(),i=br(),a=Yo(),s=Xo(),u=Ro(),l=Qo(),c=cn(),f=Oe(),d=c("isConcatSpreadable"),h=f>=51||!e(function(){var t=[];return t[d]=!1,t.concat()[0]!==t}),p=function(t){if(!r(t))return!1;var e=t[d];return void 0!==e?!!e:n(t)};t({target:"Array",proto:!0,arity:1,forced:!h||!l("concat")},{concat:function(t){var e,n,r,l,c,f=o(this),d=u(f,0),h=0;for(e=-1,r=arguments.length;e<r;e++)if(p(c=-1===e?f:arguments[e]))for(l=i(c),a(h+l),n=0;n<l;n++,h++)n in c&&s(d,h,c[n]);else a(h+1),s(d,h++,c);return d.length=h,d}})}();var Zo=function(t,e){return Zo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Zo(t,e)};function ti(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Zo(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var ei=function(){return ei=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},ei.apply(this,arguments)};function ni(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ri(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function oi(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var ii,ai={};!function(){if(ii)return ai;ii=1;var t=Wr(),e=Do().filter;t({target:"Array",proto:!0,forced:!Qo()("filter")},{filter:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)}})}();var si,ui,li,ci,fi,di,hi,pi,gi,vi,mi,yi,bi,wi,xi,Si,Oi,Ei={};function Ci(){if(ui)return si;ui=1;var t=xt(),e=Cn(),n=Le();return si=function(r,o,i){var a,s;e(r);try{if(!(a=n(r,"return"))){if("throw"===o)throw i;return i}a=t(a,r)}catch(t){s=!0,a=t}if("throw"===o)throw i;if(s)throw a;return e(a),i}}function ki(){if(ci)return li;ci=1;var t=Cn(),e=Ci();return li=function(n,r,o,i){try{return i?r(t(o)[0],o[1]):r(o)}catch(t){e(n,"throw",t)}}}function Ni(){return di?fi:(di=1,fi={})}function Ti(){if(pi)return hi;pi=1;var t=cn(),e=Ni(),n=t("iterator"),r=Array.prototype;return hi=function(t){return void 0!==t&&(e.Array===t||r[n]===t)}}function Li(){if(vi)return gi;vi=1;var t=Qr(),e=Le(),n=ge(),r=Ni(),o=cn()("iterator");return gi=function(i){if(!n(i))return e(i,o)||e(i,"@@iterator")||r[t(i)]}}function Mi(){if(yi)return mi;yi=1;var t=xt(),e=Te(),n=Cn(),r=Ne(),o=Li(),i=TypeError;return mi=function(a,s){var u=arguments.length<2?o(a):s;if(e(u))return n(t(u,a));throw new i(r(a)+" is not iterable")},mi}function Ri(){if(Si)return xi;Si=1;var t=cn()("iterator"),e=!1;try{var n=0,r={next:function(){return{done:!!n++}},return:function(){e=!0}};r[t]=function(){return this},Array.from(r,function(){throw 2})}catch(t){}return xi=function(n,r){try{if(!r&&!e)return!1}catch(t){return!1}var o=!1;try{var i={};i[t]=function(){return{next:function(){return{done:o=!0}}}},n(i)}catch(t){}return o}}!function(){if(Oi)return Ei;Oi=1;var t=Wr(),e=function(){if(wi)return bi;wi=1;var t=No(),e=xt(),n=sn(),r=ki(),o=Ti(),i=Lo(),a=br(),s=Xo(),u=Mi(),l=Li(),c=Array;return bi=function(f){var d=n(f),h=i(this),p=arguments.length,g=p>1?arguments[1]:void 0,v=void 0!==g;v&&(g=t(g,p>2?arguments[2]:void 0));var m,y,b,w,x,S,O=l(d),E=0;if(!O||this===c&&o(O))for(m=a(d),y=h?new this(m):c(m);m>E;E++)S=v?g(d[E],E):d[E],s(y,E,S);else for(y=h?new this:[],x=(w=u(d,O)).next;!(b=e(x,w)).done;E++)S=v?r(w,g,[b.value,E],!0):b.value,s(y,E,S);return y.length=E,y},bi}();t({target:"Array",stat:!0,forced:!Ri()(function(t){Array.from(t)})},{from:e})}();var Di,Pi,Ai,ji,Ii,$i,Fi,Bi,_i,Wi,zi,Ui,Vi,Hi,Ki,qi,Ji,Gi,Yi,Xi,Qi,Zi,ta,ea,na,ra,oa,ia,aa,sa,ua,la={};function ca(){if(Ai)return Pi;Ai=1;var t=we();return Pi=t("document","documentElement")}function fa(){if(Ii)return ji;Ii=1;var t,e=Cn(),n=function(){if(Di)return la;Di=1;var t=bt(),e=En(),n=kn(),r=Cn(),o=me(),i=zr();return la.f=t&&!e?Object.defineProperties:function(t,e){r(t);for(var a,s=o(e),u=i(e),l=u.length,c=0;l>c;)n.f(t,a=u[c++],s[a]);return t},la}(),r=Sr(),o=Jn(),i=ca(),a=hn(),s=qn(),u="prototype",l="script",c=s("IE_PROTO"),f=function(){},d=function(t){return"<"+l+">"+t+"</"+l+">"},h=function(t){t.write(d("")),t.close();var e=t.parentWindow.Object;return t=null,e},p=function(){try{t=new ActiveXObject("htmlfile")}catch(t){}var e,n,o;p="undefined"!=typeof document?document.domain&&t?h(t):(n=a("iframe"),o="java"+l+":",n.style.display="none",i.appendChild(n),n.src=String(o),(e=n.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F):h(t);for(var s=r.length;s--;)delete p[u][r[s]];return p()};return o[c]=!0,ji=Object.create||function(t,r){var o;return null!==t?(f[u]=e(t),o=new f,f[u]=null,o[c]=t):o=p(),void 0===r?o:n.f(o,r)}}function da(){if(Fi)return $i;Fi=1;var t=cn(),e=fa(),n=kn().f,r=t("unscopables"),o=Array.prototype;return void 0===o[r]&&n(o,r,{configurable:!0,value:e(null)}),$i=function(t){o[r][t]=!0}}function ha(){if(zi)return Wi;zi=1;var t=un(),e=ye(),n=sn(),r=qn(),o=function(){if(_i)return Bi;_i=1;var t=yt();return Bi=!t(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})}(),i=r("IE_PROTO"),a=Object,s=a.prototype;return Wi=o?a.getPrototypeOf:function(r){var o=n(r);if(t(o,i))return o[i];var u=o.constructor;return e(u)&&o instanceof u?u.prototype:o instanceof a?s:null}}function pa(){if(Vi)return Ui;Vi=1;var t,e,n,r=yt(),o=ye(),i=be(),a=fa(),s=ha(),u=Xn(),l=cn(),c=nn(),f=l("iterator"),d=!1;return[].keys&&("next"in(n=[].keys())?(e=s(s(n)))!==Object.prototype&&(t=e):d=!0),!i(t)||r(function(){var e={};return t[f].call(e)!==e})?t={}:c&&(t=a(t)),o(t[f])||u(t,f,function(){return this}),Ui={IteratorPrototype:t,BUGGY_SAFARI_ITERATORS:d}}function ga(){if(Ki)return Hi;Ki=1;var t=kn().f,e=un(),n=cn()("toStringTag");return Hi=function(r,o,i){r&&!i&&(r=r.prototype),r&&!e(r,n)&&t(r,n,{configurable:!0,value:o})}}function va(){if(Qi)return Xi;Qi=1;var t=be();return Xi=function(e){return t(e)||null===e}}function ma(){if(ta)return Zi;ta=1;var t=va(),e=String,n=TypeError;return Zi=function(r){if(t(r))return r;throw new n("Can't set "+e(r)+" as a prototype")}}function ya(){if(na)return ea;na=1;var t=function(){if(Yi)return Gi;Yi=1;var t=de(),e=Te();return Gi=function(n,r,o){try{return t(e(Object.getOwnPropertyDescriptor(n,r)[o]))}catch(t){}}}(),e=be(),n=ve(),r=ma();return ea=Object.setPrototypeOf||("__proto__"in{}?function(){var o,i=!1,a={};try{(o=t(Object.prototype,"__proto__","set"))(a,[]),i=a instanceof Array}catch(t){}return function(t,a){return n(t),r(a),e(t)?(i?o(t,a):t.__proto__=a,t):t}}():void 0)}function ba(){if(oa)return ra;oa=1;var t=Wr(),e=xt(),n=nn(),r=Vn(),o=ye(),i=function(){if(Ji)return qi;Ji=1;var t=pa().IteratorPrototype,e=fa(),n=fe(),r=ga(),o=Ni(),i=function(){return this};return qi=function(a,s,u,l){var c=s+" Iterator";return a.prototype=e(t,{next:n(+!l,u)}),r(a,c,!1,!0),o[c]=i,a}}(),a=ha(),s=ya(),u=ga(),l=Nn(),c=Xn(),f=cn(),d=Ni(),h=pa(),p=r.PROPER,g=r.CONFIGURABLE,v=h.IteratorPrototype,m=h.BUGGY_SAFARI_ITERATORS,y=f("iterator"),b="keys",w="values",x="entries",S=function(){return this};return ra=function(r,f,h,O,E,C,k){i(h,f,O);var N,T,L,M=function(t){if(t===E&&j)return j;if(!m&&t&&t in P)return P[t];switch(t){case b:case w:case x:return function(){return new h(this,t)}}return function(){return new h(this)}},R=f+" Iterator",D=!1,P=r.prototype,A=P[y]||P["@@iterator"]||E&&P[E],j=!m&&A||M(E),I="Array"===f&&P.entries||A;if(I&&(N=a(I.call(new r)))!==Object.prototype&&N.next&&(n||a(N)===v||(s?s(N,v):o(N[y])||c(N,y,S)),u(N,R,!0,!0),n&&(d[R]=S)),p&&E===w&&A&&A.name!==w&&(!n&&g?l(P,"name",w):(D=!0,j=function(){return e(A,this)})),E)if(T={values:M(w),keys:C?j:M(b),entries:M(x)},k)for(L in T)(m||D||!(L in P))&&c(P,L,T[L]);else t({target:f,proto:!0,forced:m||D},T);return n&&!k||P[y]===j||c(P,y,j,{name:E}),d[f]=j,T}}function wa(){return aa?ia:(aa=1,ia=function(t,e){return{value:t,done:e}})}function xa(){if(ua)return sa;ua=1;var t=me(),e=da(),n=Ni(),r=Gn(),o=kn().f,i=ba(),a=wa(),s=nn(),u=bt(),l="Array Iterator",c=r.set,f=r.getterFor(l);sa=i(Array,"Array",function(e,n){c(this,{type:l,target:t(e),index:0,kind:n})},function(){var t=f(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=null,a(void 0,!0);switch(t.kind){case"keys":return a(n,!1);case"values":return a(e[n],!1)}return a([n,e[n]],!1)},"values");var d=n.Arguments=n.Array;if(e("keys"),e("values"),e("entries"),!s&&u&&"values"!==d.name)try{o(d,"name",{value:"values"})}catch(t){}return sa}xa();var Sa,Oa={};!function(){if(Sa)return Oa;Sa=1;var t=Wr(),e=de(),n=pe(),r=me(),o=Po(),i=e([].join);t({target:"Array",proto:!0,forced:n!==Object||!o("join",",")},{join:function(t){return i(r(this),void 0===t?",":t)}})}();var Ea,Ca,ka,Na={};function Ta(){if(Ca)return Ea;Ca=1;var t=Yn(),e=kn();return Ea=function(n,r,o){return o.get&&t(o.get,r,{getter:!0}),o.set&&t(o.set,r,{setter:!0}),e.f(n,r,o)}}!function(){if(ka)return Na;ka=1;var t=bt(),e=Vn().EXISTS,n=de(),r=Ta(),o=Function.prototype,i=n(o.toString),a=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,s=n(a.exec);t&&!e&&r(o,"name",{configurable:!0,get:function(){try{return s(a,i(this))[1]}catch(t){return""}}})}();var La,Ma,Ra,Da,Pa,Aa,ja,Ia,$a,Fa,Ba,_a,Wa,za,Ua,Va,Ha,Ka,qa,Ja,Ga,Ya,Xa,Qa,Za,ts,es={exports:{}},ns={};function rs(){if(Ma)return La;Ma=1;var t=de();return La=t([].slice)}function os(){if(Ra)return ns;Ra=1;var t=he(),e=me(),n=Or().f,r=rs(),o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];return ns.f=function(i){return o&&"Window"===t(i)?function(t){try{return n(t)}catch(t){return r(o)}}(i):n(e(i))},ns}function is(){if(ja)return Aa;ja=1;var t=yt(),e=be(),n=he(),r=function(){if(Pa)return Da;Pa=1;var t=yt();return Da=t(function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})}(),o=Object.isExtensible,i=t(function(){});return Aa=i||r?function(t){return!!e(t)&&((!r||"ArrayBuffer"!==n(t))&&(!o||o(t)))}:o}function as(){if($a)return Ia;$a=1;var t=yt();return Ia=!t(function(){return Object.isExtensible(Object.preventExtensions({}))})}function ss(){if(Fa)return es.exports;Fa=1;var t=Wr(),e=de(),n=Jn(),r=be(),o=un(),i=kn().f,a=Or(),s=os(),u=is(),l=ln(),c=as(),f=!1,d=l("meta"),h=0,p=function(t){i(t,d,{value:{objectID:"O"+h++,weakData:{}}})},g=es.exports={enable:function(){g.enable=function(){},f=!0;var n=a.f,r=e([].splice),o={};o[d]=1,n(o).length&&(a.f=function(t){for(var e=n(t),o=0,i=e.length;o<i;o++)if(e[o]===d){r(e,o,1);break}return e},t({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:s.f}))},fastKey:function(t,e){if(!r(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,d)){if(!u(t))return"F";if(!e)return"E";p(t)}return t[d].objectID},getWeakData:function(t,e){if(!o(t,d)){if(!u(t))return!0;if(!e)return!1;p(t)}return t[d].weakData},onFreeze:function(t){return c&&f&&u(t)&&!o(t,d)&&p(t),t}};return n[d]=!0,es.exports}function us(){if(_a)return Ba;_a=1;var t=No(),e=xt(),n=Cn(),r=Ne(),o=Ti(),i=br(),a=xe(),s=Mi(),u=Li(),l=Ci(),c=TypeError,f=function(t,e){this.stopped=t,this.result=e},d=f.prototype;return Ba=function(h,p,g){var v,m,y,b,w,x,S,O=g&&g.that,E=!(!g||!g.AS_ENTRIES),C=!(!g||!g.IS_RECORD),k=!(!g||!g.IS_ITERATOR),N=!(!g||!g.INTERRUPTED),T=t(p,O),L=function(t){return v&&l(v,"normal"),new f(!0,t)},M=function(t){return E?(n(t),N?T(t[0],t[1],L):T(t[0],t[1])):N?T(t,L):T(t)};if(C)v=h.iterator;else if(k)v=h;else{if(!(m=u(h)))throw new c(r(h)+" is not iterable");if(o(m)){for(y=0,b=i(h);b>y;y++)if((w=M(h[y]))&&a(d,w))return w;return new f(!1)}v=s(h,m)}for(x=C?h.next:v.next;!(S=e(x,v)).done;){try{w=M(S.value)}catch(t){l(v,"throw",t)}if("object"==typeof w&&w&&a(d,w))return w}return new f(!1)}}function ls(){if(za)return Wa;za=1;var t=xe(),e=TypeError;return Wa=function(n,r){if(t(r,n))return n;throw new e("Incorrect invocation")}}function cs(){if(Va)return Ua;Va=1;var t=ye(),e=be(),n=ya();return Ua=function(r,o,i){var a,s;return n&&t(a=o.constructor)&&a!==i&&e(s=a.prototype)&&s!==i.prototype&&n(r,s),r}}function fs(){if(Ka)return Ha;Ka=1;var t=Wr(),e=ut(),n=de(),r=_r(),o=Xn(),i=ss(),a=us(),s=ls(),u=ye(),l=ge(),c=be(),f=yt(),d=Ri(),h=ga(),p=cs();return Ha=function(g,v,m){var y=-1!==g.indexOf("Map"),b=-1!==g.indexOf("Weak"),w=y?"set":"add",x=e[g],S=x&&x.prototype,O=x,E={},C=function(t){var e=n(S[t]);o(S,t,"add"===t?function(t){return e(this,0===t?0:t),this}:"delete"===t?function(t){return!(b&&!c(t))&&e(this,0===t?0:t)}:"get"===t?function(t){return b&&!c(t)?void 0:e(this,0===t?0:t)}:"has"===t?function(t){return!(b&&!c(t))&&e(this,0===t?0:t)}:function(t,n){return e(this,0===t?0:t,n),this})};if(r(g,!u(x)||!(b||S.forEach&&!f(function(){(new x).entries().next()}))))O=m.getConstructor(v,g,y,w),i.enable();else if(r(g,!0)){var k=new O,N=k[w](b?{}:-0,1)!==k,T=f(function(){k.has(1)}),L=d(function(t){new x(t)}),M=!b&&f(function(){for(var t=new x,e=5;e--;)t[w](e,e);return!t.has(-0)});L||((O=v(function(t,e){s(t,S);var n=p(new x,t,O);return l(e)||a(e,n[w],{that:n,AS_ENTRIES:y}),n})).prototype=S,S.constructor=O),(T||M)&&(C("delete"),C("has"),y&&C("get")),(M||N)&&C(w),b&&S.clear&&delete S.clear}return E[g]=O,t({global:!0,constructor:!0,forced:O!==x},E),h(O,g),b||m.setStrong(O,g,y),O},Ha}function ds(){if(Ja)return qa;Ja=1;var t=Xn();return qa=function(e,n,r){for(var o in n)t(e,o,n[o],r);return e}}function hs(){if(Ya)return Ga;Ya=1;var t=we(),e=Ta(),n=cn(),r=bt(),o=n("species");return Ga=function(n){var i=t(n);r&&i&&!i[o]&&e(i,o,{configurable:!0,get:function(){return this}})}}ts||(ts=1,Za||(Za=1,fs()("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},function(){if(Qa)return Xa;Qa=1;var t=fa(),e=Ta(),n=ds(),r=No(),o=ls(),i=ge(),a=us(),s=ba(),u=wa(),l=hs(),c=bt(),f=ss().fastKey,d=Gn(),h=d.set,p=d.getterFor;return Xa={getConstructor:function(s,u,l,d){var g=s(function(e,n){o(e,v),h(e,{type:u,index:t(null),first:null,last:null,size:0}),c||(e.size=0),i(n)||a(n,e[d],{that:e,AS_ENTRIES:l})}),v=g.prototype,m=p(u),y=function(t,e,n){var r,o,i=m(t),a=b(t,e);return a?a.value=n:(i.last=a={index:o=f(e,!0),key:e,value:n,previous:r=i.last,next:null,removed:!1},i.first||(i.first=a),r&&(r.next=a),c?i.size++:t.size++,"F"!==o&&(i.index[o]=a)),t},b=function(t,e){var n,r=m(t),o=f(e);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key===e)return n};return n(v,{clear:function(){for(var e=m(this),n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=null),n=n.next;e.first=e.last=null,e.index=t(null),c?e.size=0:this.size=0},delete:function(t){var e=this,n=m(e),r=b(e,t);if(r){var o=r.next,i=r.previous;delete n.index[r.index],r.removed=!0,i&&(i.next=o),o&&(o.previous=i),n.first===r&&(n.first=o),n.last===r&&(n.last=i),c?n.size--:e.size--}return!!r},forEach:function(t){for(var e,n=m(this),o=r(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:n.first;)for(o(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!b(this,t)}}),n(v,l?{get:function(t){var e=b(this,t);return e&&e.value},set:function(t,e){return y(this,0===t?0:t,e)}}:{add:function(t){return y(this,t=0===t?0:t,t)}}),c&&e(v,"size",{configurable:!0,get:function(){return m(this).size}}),g},setStrong:function(t,e,n){var r=e+" Iterator",o=p(e),i=p(r);s(t,e,function(t,e){h(this,{type:r,target:t,state:o(t),kind:e,last:null})},function(){for(var t=i(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?u("keys"===e?n.key:"values"===e?n.value:[n.key,n.value],!1):(t.target=null,u(void 0,!0))},n?"entries":"values",!n,!0),l(e)}},Xa}())));var ps,gs,vs,ms,ys,bs={};function ws(){if(gs)return ps;gs=1;var t=Qr(),e=String;return ps=function(n){if("Symbol"===t(n))throw new TypeError("Cannot convert a Symbol value to a string");return e(n)}}function xs(){if(ms)return vs;ms=1;var t=de(),e=vr(),n=ws(),r=ve(),o=t("".charAt),i=t("".charCodeAt),a=t("".slice),s=function(t){return function(s,u){var l,c,f=n(r(s)),d=e(u),h=f.length;return d<0||d>=h?t?"":void 0:(l=i(f,d))<55296||l>56319||d+1===h||(c=i(f,d+1))<56320||c>57343?t?o(f,d):l:t?a(f,d,d+2):c-56320+(l-55296<<10)+65536}};return vs={codeAt:s(!1),charAt:s(!0)}}!function(){if(ys)return bs;ys=1;var t=xs().charAt,e=ws(),n=Gn(),r=ba(),o=wa(),i="String Iterator",a=n.set,s=n.getterFor(i);r(String,"String",function(t){a(this,{type:i,string:e(t),index:0})},function(){var e,n=s(this),r=n.string,i=n.index;return i>=r.length?o(void 0,!0):(e=t(r,i),n.index+=e.length,o(e,!1))})}();var Ss,Os,Es,Cs,ks,Ns,Ts,Ls={};function Ms(){if(Os)return Ss;Os=1;var t=be(),e=he(),n=cn()("match");return Ss=function(r){var o;return t(r)&&(void 0!==(o=r[n])?!!o:"RegExp"===e(r))}}function Rs(){if(Cs)return Es;Cs=1;var t=Ms(),e=TypeError;return Es=function(n){if(t(n))throw new e("The method doesn't accept regular expressions");return n}}function Ds(){if(Ns)return ks;Ns=1;var t=cn()("match");return ks=function(e){var n=/./;try{"/./"[e](n)}catch(r){try{return n[t]=!1,"/./"[e](n)}catch(t){}}return!1}}!function(){if(Ts)return Ls;Ts=1;var t,e=Wr(),n=ko(),r=gn().f,o=yr(),i=ws(),a=Rs(),s=ve(),u=Ds(),l=nn(),c=n("".slice),f=Math.min,d=u("startsWith");e({target:"String",proto:!0,forced:!!(l||d||(t=r(String.prototype,"startsWith"),!t||t.writable))&&!d},{startsWith:function(t){var e=i(s(this));a(t);var n=o(f(arguments.length>1?arguments[1]:void 0,e.length)),r=i(t);return c(e,n,n+r.length)===r}})}();var Ps,As={};!function(){if(Ps)return As;Ps=1;var t=ut(),e=Eo(),n=Co(),r=xa(),o=Nn(),i=ga(),a=cn()("iterator"),s=r.values,u=function(t,n){if(t){if(t[a]!==s)try{o(t,a,s)}catch(e){t[a]=s}if(i(t,n,!0),e[n])for(var u in r)if(t[u]!==r[u])try{o(t,u,r[u])}catch(e){t[u]=r[u]}}};for(var l in e)u(t[l]&&t[l].prototype,l);u(n,"DOMTokenList")}();var js=new Set(["base","embed","math","meta","object","script","svg","template"]),Is=new Set(["href","poster","src","xlink:href"]),$s=["java","script:"].join("");function Fs(t,e,n){var r=function(t){return Array.from(t).filter(function(t){return t>" "}).join("").toLowerCase()}(n);return!r||!r.startsWith($s)&&!r.startsWith("vbscript:")&&(!r.startsWith("data:")||"href"!==e&&"xlink:href"!==e&&(("img"===t||"poster"===e)&&r.startsWith("data:image/")))}function Bs(t){if(void 0===t&&(t=""),!t)return"";var e=(new DOMParser).parseFromString(t,"text/html");return Array.from(e.body.querySelectorAll("*")).forEach(function(t){var e=t.tagName.toLowerCase();js.has(e)?t.remove():Array.from(t.attributes).forEach(function(n){var r=n.name.toLowerCase(),o=n.value||"";("srcdoc"===r||r.startsWith("on")||Is.has(r)&&!Fs(e,r,o))&&t.removeAttribute(n.name)})}),e.body.innerHTML}var _s={};var Ws="created",zs="destroyed",Us="change",Vs="scroll",Hs="fullscreen",Ks="unFullScreen",qs="modalOrPanelShow",Js="modalOrPanelHide",Gs={};function Ys(t,e){var n=t.key,r=t.factory,o=t.config,i=ei(ei({},o),e||{});if(null!=Gs[n])throw new Error("Duplicated key '".concat(n,"' in menu items"));Gs[n]=r,function(t,e){null!=e&&(_s[t]=e)}(n,i)}var Xs,Qs,Zs,tu,eu={};function nu(){if(Qs)return Xs;Qs=1;var t=de(),e=ds(),n=ss().getWeakData,r=ls(),o=Cn(),i=ge(),a=be(),s=us(),u=Do(),l=un(),c=Gn(),f=c.set,d=c.getterFor,h=u.find,p=u.findIndex,g=t([].splice),v=0,m=function(t){return t.frozen||(t.frozen=new y)},y=function(){this.entries=[]},b=function(t,e){return h(t.entries,function(t){return t[0]===e})};return y.prototype={get:function(t){var e=b(this,t);if(e)return e[1]},has:function(t){return!!b(this,t)},set:function(t,e){var n=b(this,t);n?n[1]=e:this.entries.push([t,e])},delete:function(t){var e=p(this.entries,function(e){return e[0]===t});return~e&&g(this.entries,e,1),!!~e}},Xs={getConstructor:function(t,u,c,h){var p=t(function(t,e){r(t,g),f(t,{type:u,id:v++,frozen:null}),i(e)||s(e,t[h],{that:t,AS_ENTRIES:c})}),g=p.prototype,y=d(u),b=function(t,e,r){var i=y(t),a=n(o(e),!0);return!0===a?m(i).set(e,r):a[i.id]=r,t};return e(g,{delete:function(t){var e=y(this);if(!a(t))return!1;var r=n(t);return!0===r?m(e).delete(t):r&&l(r,e.id)&&delete r[e.id]},has:function(t){var e=y(this);if(!a(t))return!1;var r=n(t);return!0===r?m(e).has(t):r&&l(r,e.id)}}),e(g,c?{get:function(t){var e=y(this);if(a(t)){var r=n(t);if(!0===r)return m(e).get(t);if(r)return r[e.id]}},set:function(t,e){return b(this,t,e)}}:{add:function(t){return b(this,t,!0)}}),p}}}tu||(tu=1,function(){if(Zs)return eu;Zs=1;var t,e=as(),n=ut(),r=de(),o=ds(),i=ss(),a=fs(),s=nu(),u=be(),l=Gn().enforce,c=yt(),f=Kn(),d=Object,h=Array.isArray,p=d.isExtensible,g=d.isFrozen,v=d.isSealed,m=d.freeze,y=d.seal,b=!n.ActiveXObject&&"ActiveXObject"in n,w=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},x=a("WeakMap",w,s),S=x.prototype,O=r(S.set);if(f)if(b){t=s.getConstructor(w,"WeakMap",!0),i.enable();var E=r(S.delete),C=r(S.has),k=r(S.get);o(S,{delete:function(e){if(u(e)&&!p(e)){var n=l(this);return n.frozen||(n.frozen=new t),E(this,e)||n.frozen.delete(e)}return E(this,e)},has:function(e){if(u(e)&&!p(e)){var n=l(this);return n.frozen||(n.frozen=new t),C(this,e)||n.frozen.has(e)}return C(this,e)},get:function(e){if(u(e)&&!p(e)){var n=l(this);return n.frozen||(n.frozen=new t),C(this,e)?k(this,e):n.frozen.get(e)}return k(this,e)},set:function(e,n){if(u(e)&&!p(e)){var r=l(this);r.frozen||(r.frozen=new t),C(this,e)?O(this,e,n):r.frozen.set(e,n)}else O(this,e,n);return this}})}else e&&c(function(){var t=m([]);return O(new x,t,1),!g(t)})&&o(S,{set:function(t,e){var n;return h(t)&&(g(t)?n=m:v(t)&&(n=y)),O(this,t,e),n&&n(t),this}})}());var ru,ou=new WeakMap,iu=new WeakMap,au=new WeakMap,su=new WeakMap,uu=new WeakMap,lu=new WeakMap,cu=new WeakMap,fu=new WeakMap,du=new WeakMap,hu=new WeakMap,pu=new WeakMap,gu=new WeakMap,vu=new WeakMap,mu=new WeakMap,yu=new WeakMap,bu=new WeakMap,wu=new WeakMap,xu=new WeakMap,Su=new WeakMap,Ou=new WeakMap,Eu=new WeakMap,Cu=new WeakMap,ku=new WeakMap,Nu=new WeakMap,Tu=new WeakMap,Lu=new WeakMap,Mu=new WeakMap,Ru=new WeakMap,Du=new WeakMap,Pu=function(t){var e=t;return e.getAllMenuKeys=function(){var t=[];for(var e in Gs)t.push(e);return t},e.getConfig=function(){var t=hu.get(e);if(null==t)throw new Error("Can not get editor config");return t},e.getMenuConfig=function(t){var n=e.getConfig().MENU_CONF;return(void 0===n?{}:n)[t]||{}},e.alert=function(t,n){void 0===n&&(n="info");var r=e.getConfig().customAlert;r&&r(t,n)},e},Au={};!function(){if(ru)return Au;ru=1;var t=Wr(),e=wr().includes,n=yt(),r=da();t({target:"Array",proto:!0,forced:n(function(){return!Array(1).includes()})},{includes:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)}}),r("includes")}();var ju,Iu={};!function(){if(ju)return Iu;ju=1;var t=Wr(),e=Do().map;t({target:"Array",proto:!0,forced:!Qo()("map")},{map:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)}})}();var $u,Fu={};!function(){if($u)return Fu;$u=1;var t=Wr(),e=de(),n=Rs(),r=ve(),o=ws(),i=Ds(),a=e("".indexOf);t({target:"String",proto:!0,forced:!i("includes")},{includes:function(t){return!!~a(o(r(this)),o(n(t)),arguments.length>1?arguments[1]:void 0)}})}();var Bu,_u,Wu,zu,Uu,Vu,Hu,Ku={};function qu(){return _u?Bu:(_u=1,Bu="\t\n\v\f\r                 \u2028\u2029\ufeff")}!function(){if(Hu)return Ku;Hu=1;var t=Wr(),e=function(){if(zu)return Wu;zu=1;var t=de(),e=ve(),n=ws(),r=qu(),o=t("".replace),i=RegExp("^["+r+"]+"),a=RegExp("(^|[^"+r+"])["+r+"]+$"),s=function(t){return function(r){var s=n(e(r));return 1&t&&(s=o(s,i,"")),2&t&&(s=o(s,a,"$1")),s}};return Wu={start:s(1),end:s(2),trim:s(3)}}().trim,n=function(){if(Vu)return Uu;Vu=1;var t=Vn().PROPER,e=yt(),n=qu();return Uu=function(r){return e(function(){return!!n[r]()||"​…᠎"!=="​…᠎"[r]()||t&&n[r].name!==r})}}();t({target:"String",proto:!0,forced:n("trim")},{trim:function(){return e(this)}})}();var Ju,Gu,Yu,Xu,Qu,Zu={};!function(){if(Qu)return Zu;Qu=1;var t=Wr(),e=function(){if(Gu)return Ju;Gu=1;var t=de(),e=ve(),n=ws(),r=/"/g,o=t("".replace);return Ju=function(t,i,a,s){var u=n(e(t)),l="<"+i;return""!==a&&(l+=" "+a+'="'+o(n(s),r,"&quot;")+'"'),l+">"+u+"</"+i+">"}}(),n=function(){if(Xu)return Yu;Xu=1;var t=yt();return Yu=function(e){return t(function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3})}}();t({target:"String",proto:!0,forced:n("anchor")},{anchor:function(t){return e(this,"a","name",t)}})}();var tl,el,nl,rl,ol,il,al,sl,ul,ll,cl,fl=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]),dl={};function hl(){if(el)return tl;el=1;var t=Cn();return tl=function(){var e=t(this),n="";return e.hasIndices&&(n+="d"),e.global&&(n+="g"),e.ignoreCase&&(n+="i"),e.multiline&&(n+="m"),e.dotAll&&(n+="s"),e.unicode&&(n+="u"),e.unicodeSets&&(n+="v"),e.sticky&&(n+="y"),n}}function pl(){if(rl)return nl;rl=1;var t=yt(),e=ut().RegExp,n=t(function(){var t=e("a","y");return t.lastIndex=2,null!==t.exec("abcd")}),r=n||t(function(){return!e("a","y").sticky}),o=n||t(function(){var t=e("^r","gy");return t.lastIndex=2,null!==t.exec("str")});return nl={BROKEN_CARET:o,MISSED_STICKY:r,UNSUPPORTED_Y:n}}function gl(){if(il)return ol;il=1;var t=yt(),e=ut().RegExp;return ol=t(function(){var t=e(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})}function vl(){if(sl)return al;sl=1;var t=yt(),e=ut().RegExp;return al=t(function(){var t=e("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})}function ml(){if(ll)return ul;ll=1;var t,e,n=xt(),r=de(),o=ws(),i=hl(),a=pl(),s=an(),u=fa(),l=Gn().get,c=gl(),f=vl(),d=s("native-string-replace",String.prototype.replace),h=RegExp.prototype.exec,p=h,g=r("".charAt),v=r("".indexOf),m=r("".replace),y=r("".slice),b=(e=/b*/g,n(h,t=/a/,"a"),n(h,e,"a"),0!==t.lastIndex||0!==e.lastIndex),w=a.BROKEN_CARET,x=void 0!==/()??/.exec("")[1];return(b||x||w||c||f)&&(p=function(t){var e,r,a,s,c,f,S,O=this,E=l(O),C=o(t),k=E.raw;if(k)return k.lastIndex=O.lastIndex,e=n(p,k,C),O.lastIndex=k.lastIndex,e;var N=E.groups,T=w&&O.sticky,L=n(i,O),M=O.source,R=0,D=C;if(T&&(L=m(L,"y",""),-1===v(L,"g")&&(L+="g"),D=y(C,O.lastIndex),O.lastIndex>0&&(!O.multiline||O.multiline&&"\n"!==g(C,O.lastIndex-1))&&(M="(?: "+M+")",D=" "+D,R++),r=new RegExp("^(?:"+M+")",L)),x&&(r=new RegExp("^"+M+"$(?!\\s)",L)),b&&(a=O.lastIndex),s=n(h,T?r:O,D),T?s?(s.input=y(s.input,R),s[0]=y(s[0],R),s.index=O.lastIndex,O.lastIndex+=s[0].length):O.lastIndex=0:b&&s&&(O.lastIndex=O.global?s.index+s[0].length:a),x&&s&&s.length>1&&n(d,s[0],r,function(){for(c=1;c<arguments.length-2;c++)void 0===arguments[c]&&(s[c]=void 0)}),s&&N)for(s.groups=f=u(null),c=0;c<N.length;c++)f[(S=N[c])[0]]=s[S[1]];return s}),ul=p}function yl(){if(cl)return dl;cl=1;var t=Wr(),e=ml();return t({target:"RegExp",proto:!0,forced:/./.exec!==e},{exec:e}),dl}yl();var bl,wl,xl,Sl,Ol,El,Cl,kl,Nl,Tl,Ll,Ml={};function Rl(){if(wl)return bl;wl=1,yl();var t=xt(),e=Xn(),n=ml(),r=yt(),o=cn(),i=Nn(),a=o("species"),s=RegExp.prototype;return bl=function(u,l,c,f){var d=o(u),h=!r(function(){var t={};return t[d]=function(){return 7},7!==""[u](t)}),p=h&&!r(function(){var t=!1,e=/a/;if("split"===u){var n={};n[a]=function(){return e},(e={constructor:n,flags:""})[d]=/./[d]}return e.exec=function(){return t=!0,null},e[d](""),!t});if(!h||!p||c){var g=/./[d],v=l(d,""[u],function(e,r,o,i,a){var u=r.exec;return u===n||u===s.exec?h&&!a?{done:!0,value:t(g,r,o,i)}:{done:!0,value:t(e,o,r,i)}:{done:!1}});e(String.prototype,u,v[0]),e(s,d,v[1])}f&&i(s[d],"sham",!0)},bl}function Dl(){if(Sl)return xl;Sl=1;var t=Lo(),e=Ne(),n=TypeError;return xl=function(r){if(t(r))return r;throw new n(e(r)+" is not a constructor")}}function Pl(){if(El)return Ol;El=1;var t=Cn(),e=Dl(),n=ge(),r=cn()("species");return Ol=function(o,i){var a,s=t(o).constructor;return void 0===s||n(a=t(s)[r])?i:e(a)}}function Al(){if(kl)return Cl;kl=1;var t=xs().charAt;return Cl=function(e,n,r){return n+(r?t(e,n).length:1)}}function jl(){if(Tl)return Nl;Tl=1;var t=xt(),e=Cn(),n=ye(),r=he(),o=ml(),i=TypeError;return Nl=function(a,s){var u=a.exec;if(n(u)){var l=t(u,a,s);return null!==l&&e(l),l}if("RegExp"===r(a))return t(o,a,s);throw new i("RegExp#exec called on incompatible receiver")}}!function(){if(Ll)return Ml;Ll=1;var t=xt(),e=de(),n=Rl(),r=Cn(),o=be(),i=ve(),a=Pl(),s=Al(),u=yr(),l=ws(),c=Le(),f=jl(),d=pl(),h=yt(),p=d.UNSUPPORTED_Y,g=Math.min,v=e([].push),m=e("".slice),y=!h(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}),b="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;n("split",function(e,n,d){var h="0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:t(n,this,e,r)}:n;return[function(n,r){var a=i(this),s=o(n)?c(n,e):void 0;return s?t(s,n,a,r):t(h,l(a),n,r)},function(t,e){var o=r(this),i=l(t);if(!b){var c=d(h,o,i,e,h!==n);if(c.done)return c.value}var y=a(o,RegExp),w=o.unicode,x=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(p?"g":"y"),S=new y(p?"^(?:"+o.source+")":o,x),O=void 0===e?4294967295:e>>>0;if(0===O)return[];if(0===i.length)return null===f(S,i)?[i]:[];for(var E=0,C=0,k=[];C<i.length;){S.lastIndex=p?0:C;var N,T=f(S,p?m(i,C):i);if(null===T||(N=g(u(S.lastIndex+(p?C:0)),i.length))===E)C=s(i,C,w);else{if(v(k,m(i,E,C)),k.length===O)return k;for(var L=1;L<=T.length-1;L++)if(v(k,T[L]),k.length===O)return k;C=E=N}}return v(k,m(i,E)),k}]},b||!y,p)}();var Il,$l,Fl,Bl={};!function(){if(Fl)return Bl;Fl=1;var t=Wr(),e=function(){if($l)return Il;$l=1;var t=To(),e=br(),n=Yo(),r=No(),o=function(i,a,s,u,l,c,f,d){for(var h,p,g=l,v=0,m=!!f&&r(f,d);v<u;)v in s&&(h=m?m(s[v],v,a):s[v],c>0&&t(h)?(p=e(h),g=o(i,a,h,p,g,c-1)-1):(n(g+1),i[g]=h),g++),v++;return g};return Il=o}(),n=Te(),r=sn(),o=br(),i=Ro();t({target:"Array",proto:!0},{flatMap:function(t){var a,s=r(this),u=o(s);return n(t),(a=i(s,0)).length=e(a,s,s,u,0,1,t,arguments.length>1?arguments[1]:void 0),a}})}();var _l;_l||(_l=1,da()("flatMap"));var Wl,zl,Ul,Vl,Hl,Kl,ql,Jl,Gl,Yl={};function Xl(){if(zl)return Wl;zl=1;var t=wt(),e=Function.prototype,n=e.apply,r=e.call;return Wl="object"==typeof Reflect&&Reflect.apply||(t?r.bind(n):function(){return r.apply(n,arguments)}),Wl}function Ql(){if(Vl)return Ul;Vl=1;var t=de(),e=sn(),n=Math.floor,r=t("".charAt),o=t("".replace),i=t("".slice),a=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,s=/\$([$&'`]|\d{1,2})/g;return Ul=function(t,u,l,c,f,d){var h=l+t.length,p=c.length,g=s;return void 0!==f&&(f=e(f),g=a),o(d,g,function(e,o){var a;switch(r(o,0)){case"$":return"$";case"&":return t;case"`":return i(u,0,l);case"'":return i(u,h);case"<":a=f[i(o,1,-1)];break;default:var s=+o;if(0===s)return e;if(s>p){var d=n(s/10);return 0===d?e:d<=p?void 0===c[d-1]?r(o,1):c[d-1]+r(o,1):e}a=c[s-1]}return void 0===a?"":a})},Ul}function Zl(){if(Jl)return ql;Jl=1;var t=xt(),e=un(),n=xe(),r=function(){if(Kl)return Hl;Kl=1;var t=ut(),e=yt(),n=t.RegExp,r=!e(function(){var t=!0;try{n(".","d")}catch(e){t=!1}var e={},r="",o=t?"dgimsy":"gimsy",i=function(t,n){Object.defineProperty(e,t,{get:function(){return r+=n,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var s in t&&(a.hasIndices="d"),a)i(s,a[s]);return Object.getOwnPropertyDescriptor(n.prototype,"flags").get.call(e)!==o||r!==o});return Hl={correct:r}}(),o=hl(),i=RegExp.prototype;return ql=r.correct?function(t){return t.flags}:function(a){return r.correct||!n(i,a)||e(a,"flags")?a.flags:t(o,a)}}!function(){if(Gl)return Yl;Gl=1;var t=Xl(),e=xt(),n=de(),r=Rl(),o=yt(),i=Cn(),a=ye(),s=be(),u=vr(),l=yr(),c=ws(),f=ve(),d=Al(),h=Le(),p=Ql(),g=Zl(),v=jl(),m=cn()("replace"),y=Math.max,b=Math.min,w=n([].concat),x=n([].push),S=n("".indexOf),O=n("".slice),E=function(t){return void 0===t?t:String(t)},C="$0"==="a".replace(/./,"$0"),k=!!/./[m]&&""===/./[m]("a","$0");r("replace",function(n,r,o){var C=k?"$":"$0";return[function(t,n){var o=f(this),i=s(t)?h(t,m):void 0;return i?e(i,t,o,n):e(r,c(o),t,n)},function(e,n){var s=i(this),f=c(e);if("string"==typeof n&&-1===S(n,C)&&-1===S(n,"$<")){var h=o(r,s,f,n);if(h.done)return h.value}var m=a(n);m||(n=c(n));var k,N=c(g(s)),T=-1!==S(N,"g");T&&(k=-1!==S(N,"u"),s.lastIndex=0);for(var L,M=[];null!==(L=v(s,f))&&(x(M,L),T);){""===c(L[0])&&(s.lastIndex=d(f,l(s.lastIndex),k))}for(var R="",D=0,P=0;P<M.length;P++){for(var A,j=c((L=M[P])[0]),I=y(b(u(L.index),f.length),0),$=[],F=1;F<L.length;F++)x($,E(L[F]));var B=L.groups;if(m){var _=w([j],$,I,f);void 0!==B&&x(_,B),A=c(t(n,void 0,_))}else A=p(j,f,I,$,B,n);I>=D&&(R+=O(f,D,I)+A,D=I+j.length)}return R+O(f,D)}]},!!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})||!C||k)}();var tc,ec={};!function(){if(tc)return ec;tc=1;var t=Wr(),e=Do().find,n=da(),r="find",o=!0;r in[]&&Array(1)[r](function(){o=!1}),t({target:"Array",proto:!0,forced:o},{find:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)}}),n(r)}();var nc,rc,oc={};rc||(rc=1,function(){if(nc)return oc;nc=1;var t=Wr(),e=ut();t({global:!0,forced:e.globalThis!==e},{globalThis:e})}());const ic=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var ac,sc,uc,lc,cc,fc,dc,hc,pc,gc,vc,mc,yc,bc,wc,xc,Sc,Oc,Ec,Cc,kc,Nc,Tc,Lc,Mc,Rc,Dc,Pc,Ac,jc,Ic={};function $c(){if(sc)return ac;sc=1;var t=ut(),e=Se(),n=he(),r=function(t){return e.slice(0,t.length)===t};return ac=r("Bun/")?"BUN":r("Cloudflare-Workers")?"CLOUDFLARE":r("Deno/")?"DENO":r("Node.js/")?"NODE":t.Bun&&"string"==typeof Bun.version?"BUN":t.Deno&&"object"==typeof Deno.version?"DENO":"process"===n(t.process)?"NODE":t.window&&t.document?"BROWSER":"REST"}function Fc(){if(lc)return uc;lc=1;var t=$c();return uc="NODE"===t}function Bc(){if(fc)return cc;fc=1;var t=ut();return cc=t}function _c(){if(hc)return dc;hc=1;var t=TypeError;return dc=function(e,n){if(e<n)throw new t("Not enough arguments");return e}}function Wc(){if(gc)return pc;gc=1;var t=Se();return pc=/(?:ipad|iphone|ipod).*applewebkit/i.test(t)}function zc(){if(mc)return vc;mc=1;var t,e,n,r,o=ut(),i=Xl(),a=No(),s=ye(),u=un(),l=yt(),c=ca(),f=rs(),d=hn(),h=_c(),p=Wc(),g=Fc(),v=o.setImmediate,m=o.clearImmediate,y=o.process,b=o.Dispatch,w=o.Function,x=o.MessageChannel,S=o.String,O=0,E={},C="onreadystatechange";l(function(){t=o.location});var k=function(t){if(u(E,t)){var e=E[t];delete E[t],e()}},N=function(t){return function(){k(t)}},T=function(t){k(t.data)},L=function(e){o.postMessage(S(e),t.protocol+"//"+t.host)};return v&&m||(v=function(t){h(arguments.length,1);var n=s(t)?t:w(t),r=f(arguments,1);return E[++O]=function(){i(n,void 0,r)},e(O),O},m=function(t){delete E[t]},g?e=function(t){y.nextTick(N(t))}:b&&b.now?e=function(t){b.now(N(t))}:x&&!p?(r=(n=new x).port2,n.port1.onmessage=T,e=a(r.postMessage,r)):o.addEventListener&&s(o.postMessage)&&!o.importScripts&&t&&"file:"!==t.protocol&&!l(L)?(e=L,o.addEventListener("message",T,!1)):e=C in d("script")?function(t){c.appendChild(d("script"))[C]=function(){c.removeChild(this),k(t)}}:function(t){setTimeout(N(t),0)}),vc={set:v,clear:m}}function Uc(){if(bc)return yc;bc=1;var t=ut(),e=bt(),n=Object.getOwnPropertyDescriptor;return yc=function(r){if(!e)return t[r];var o=n(t,r);return o&&o.value}}function Vc(){if(xc)return wc;xc=1;var t=function(){this.head=null,this.tail=null};return t.prototype={add:function(t){var e={item:t,next:null},n=this.tail;n?n.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},wc=t}function Hc(){if(Nc)return kc;Nc=1;var t,e,n,r,o,i=ut(),a=Uc(),s=No(),u=zc().set,l=Vc(),c=Wc(),f=function(){if(Oc)return Sc;Oc=1;var t=Se();return Sc=/ipad|iphone|ipod/i.test(t)&&"undefined"!=typeof Pebble}(),d=function(){if(Cc)return Ec;Cc=1;var t=Se();return Ec=/web0s(?!.*chrome)/i.test(t)}(),h=Fc(),p=i.MutationObserver||i.WebKitMutationObserver,g=i.document,v=i.process,m=i.Promise,y=a("queueMicrotask");if(!y){var b=new l,w=function(){var e,n;for(h&&(e=v.domain)&&e.exit();n=b.get();)try{n()}catch(e){throw b.head&&t(),e}e&&e.enter()};c||h||d||!p||!g?!f&&m&&m.resolve?((r=m.resolve(void 0)).constructor=m,o=s(r.then,r),t=function(){o(w)}):h?t=function(){v.nextTick(w)}:(u=s(u,i),t=function(){u(w)}):(e=!0,n=g.createTextNode(""),new p(w).observe(n,{characterData:!0}),t=function(){n.data=e=!e}),y=function(e){b.head||t(),b.add(e)}}return kc=y}function Kc(){return Lc||(Lc=1,Tc=function(t,e){try{1===arguments.length?console.error(t):console.error(t,e)}catch(t){}}),Tc}function qc(){return Rc?Mc:(Rc=1,Mc=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}})}function Jc(){if(Pc)return Dc;Pc=1;var t=ut();return Dc=t.Promise}function Gc(){if(jc)return Ac;jc=1;var t=ut(),e=Jc(),n=ye(),r=_r(),o=Hn(),i=cn(),a=$c(),s=nn(),u=Oe(),l=e&&e.prototype,c=i("species"),f=!1,d=n(t.PromiseRejectionEvent),h=r("Promise",function(){var t=o(e),n=t!==String(e);if(!n&&66===u)return!0;if(s&&(!l.catch||!l.finally))return!0;if(!u||u<51||!/native code/.test(t)){var r=new e(function(t){t(1)}),i=function(t){t(function(){},function(){})};if((r.constructor={})[c]=i,!(f=r.then(function(){})instanceof i))return!0}return!(n||"BROWSER"!==a&&"DENO"!==a||d)});return Ac={CONSTRUCTOR:h,REJECTION_EVENT:d,SUBCLASSING:f}}var Yc,Xc,Qc={};function Zc(){if(Yc)return Qc;Yc=1;var t=Te(),e=TypeError,n=function(n){var r,o;this.promise=new n(function(t,n){if(void 0!==r||void 0!==o)throw new e("Bad Promise constructor");r=t,o=n}),this.resolve=t(r),this.reject=t(o)};return Qc.f=function(t){return new n(t)},Qc}var tf,ef,nf,rf={};function of(){if(ef)return tf;ef=1;var t=Jc(),e=Ri(),n=Gc().CONSTRUCTOR;return tf=n||!e(function(e){t.all(e).then(void 0,function(){})})}var af,sf={};var uf,lf={};var cf,ff={};var df,hf,pf,gf,vf={};function mf(){if(hf)return df;hf=1;var t=Cn(),e=be(),n=Zc();return df=function(r,o){if(t(r),e(o)&&o.constructor===r)return o;var i=n.f(r);return(0,i.resolve)(o),i.promise}}gf||(gf=1,function(){if(Xc)return Ic;Xc=1;var t,e,n,r,o=Wr(),i=nn(),a=Fc(),s=ut(),u=Bc(),l=xt(),c=Xn(),f=ya(),d=ga(),h=hs(),p=Te(),g=ye(),v=be(),m=ls(),y=Pl(),b=zc().set,w=Hc(),x=Kc(),S=qc(),O=Vc(),E=Gn(),C=Jc(),k=Gc(),N=Zc(),T="Promise",L=k.CONSTRUCTOR,M=k.REJECTION_EVENT,R=k.SUBCLASSING,D=E.getterFor(T),P=E.set,A=C&&C.prototype,j=C,I=A,$=s.TypeError,F=s.document,B=s.process,_=N.f,W=_,z=!!(F&&F.createEvent&&s.dispatchEvent),U="unhandledrejection",V=function(t){var e;return!(!v(t)||!g(e=t.then))&&e},H=function(t,e){var n,r,o,i=e.value,a=1===e.state,s=a?t.ok:t.fail,u=t.resolve,c=t.reject,f=t.domain;try{s?(a||(2===e.rejection&&Y(e),e.rejection=1),!0===s?n=i:(f&&f.enter(),n=s(i),f&&(f.exit(),o=!0)),n===t.promise?c(new $("Promise-chain cycle")):(r=V(n))?l(r,n,u,c):u(n)):c(i)}catch(t){f&&!o&&f.exit(),c(t)}},K=function(t,e){t.notified||(t.notified=!0,w(function(){for(var n,r=t.reactions;n=r.get();)H(n,t);t.notified=!1,e&&!t.rejection&&J(t)}))},q=function(t,e,n){var r,o;z?((r=F.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),s.dispatchEvent(r)):r={promise:e,reason:n},!M&&(o=s["on"+t])?o(r):t===U&&x("Unhandled promise rejection",n)},J=function(t){l(b,s,function(){var e,n=t.facade,r=t.value;if(G(t)&&(e=S(function(){a?B.emit("unhandledRejection",r,n):q(U,n,r)}),t.rejection=a||G(t)?2:1,e.error))throw e.value})},G=function(t){return 1!==t.rejection&&!t.parent},Y=function(t){l(b,s,function(){var e=t.facade;a?B.emit("rejectionHandled",e):q("rejectionhandled",e,t.value)})},X=function(t,e,n){return function(r){t(e,r,n)}},Q=function(t,e,n){t.done||(t.done=!0,n&&(t=n),t.value=e,t.state=2,K(t,!0))},Z=function(t,e,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===e)throw new $("Promise can't be resolved itself");var r=V(e);r?w(function(){var n={done:!1};try{l(r,e,X(Z,n,t),X(Q,n,t))}catch(e){Q(n,e,t)}}):(t.value=e,t.state=1,K(t,!1))}catch(e){Q({done:!1},e,t)}}};if(L&&(I=(j=function(e){m(this,I),p(e),l(t,this);var n=D(this);try{e(X(Z,n),X(Q,n))}catch(t){Q(n,t)}}).prototype,(t=function(t){P(this,{type:T,done:!1,notified:!1,parent:!1,reactions:new O,rejection:!1,state:0,value:null})}).prototype=c(I,"then",function(t,e){var n=D(this),r=_(y(this,j));return n.parent=!0,r.ok=!g(t)||t,r.fail=g(e)&&e,r.domain=a?B.domain:void 0,0===n.state?n.reactions.add(r):w(function(){H(r,n)}),r.promise}),e=function(){var e=new t,n=D(e);this.promise=e,this.resolve=X(Z,n),this.reject=X(Q,n)},N.f=_=function(t){return t===j||t===n?new e(t):W(t)},!i&&g(C)&&A!==Object.prototype)){r=A.then,R||c(A,"then",function(t,e){var n=this;return new j(function(t,e){l(r,n,t,e)}).then(t,e)},{unsafe:!0});try{delete A.constructor}catch(t){}f&&f(A,I)}o({global:!0,constructor:!0,wrap:!0,forced:L},{Promise:j}),n=u.Promise,d(j,T,!1,!0),h(T)}(),function(){if(nf)return rf;nf=1;var t=Wr(),e=xt(),n=Te(),r=Zc(),o=qc(),i=us();t({target:"Promise",stat:!0,forced:of()},{all:function(t){var a=this,s=r.f(a),u=s.resolve,l=s.reject,c=o(function(){var r=n(a.resolve),o=[],s=0,c=1;i(t,function(t){var n=s++,i=!1;c++,e(r,a,t).then(function(t){i||(i=!0,o[n]=t,--c||u(o))},l)}),--c||u(o)});return c.error&&l(c.value),s.promise}})}(),function(){if(af)return sf;af=1;var t=Wr(),e=nn(),n=Gc().CONSTRUCTOR,r=Jc(),o=we(),i=ye(),a=Xn(),s=r&&r.prototype;if(t({target:"Promise",proto:!0,forced:n,real:!0},{catch:function(t){return this.then(void 0,t)}}),!e&&i(r)){var u=o("Promise").prototype.catch;s.catch!==u&&a(s,"catch",u,{unsafe:!0})}}(),function(){if(uf)return lf;uf=1;var t=Wr(),e=xt(),n=Te(),r=Zc(),o=qc(),i=us();t({target:"Promise",stat:!0,forced:of()},{race:function(t){var a=this,s=r.f(a),u=s.reject,l=o(function(){var r=n(a.resolve);i(t,function(t){e(r,a,t).then(s.resolve,u)})});return l.error&&u(l.value),s.promise}})}(),function(){if(cf)return ff;cf=1;var t=Wr(),e=Zc();t({target:"Promise",stat:!0,forced:Gc().CONSTRUCTOR},{reject:function(t){var n=e.f(this);return(0,n.reject)(t),n.promise}})}(),function(){if(pf)return vf;pf=1;var t=Wr(),e=we(),n=nn(),r=Jc(),o=Gc().CONSTRUCTOR,i=mf(),a=e("Promise"),s=n&&!o;t({target:"Promise",stat:!0,forced:n||o},{resolve:function(t){return i(s&&this===a?r:this,t)}})}());var yf,bf={};function wf(t){Promise.resolve().then(t)}function xf(t){return t.replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&reg;/g,"®").replace(/&copy;/g,"©").replace(/&trade;/g,"™").replace(/&quot;/g,'"')}!function(){if(yf)return bf;yf=1;var t=Vn().PROPER,e=Xn(),n=Cn(),r=ws(),o=yt(),i=Zl(),a="toString",s=RegExp.prototype,u=s[a],l=o(function(){return"/a/b"!==u.call({source:"a",flags:"b"})}),c=t&&u.name!==a;(l||c)&&e(s,a,function(){var t=n(this);return"/"+r(t.source)+"/"+r(i(t))},{unsafe:!0})}();var Sf,Of=function(t){return Object.prototype.toString.call(t)},Ef=globalThis.Node,Cf=globalThis.Comment,kf=globalThis.Element,Nf=globalThis.Text,Tf=globalThis.Range,Lf=globalThis.Selection,Mf=globalThis.StaticRange;p&&(h.fn.css=p),g&&(h.fn.append=g),v&&(h.fn.addClass=v),m&&(h.fn.removeClass=m),y&&(h.fn.hasClass=y),b&&(h.fn.on=b),w&&(h.fn.focus=w),x&&(h.fn.attr=x),S&&(h.fn.removeAttr=S),O&&(h.fn.hide=O),E&&(h.fn.show=E),C&&(h.fn.offset=C),k&&(h.fn.width=k),N&&(h.fn.height=N),T&&(h.fn.parent=T),L&&(h.fn.parents=L),M&&(h.fn.is=M),R&&(h.fn.dataset=R),D&&(h.fn.val=D),P&&(h.fn.text=P),A&&(h.fn.html=A),j&&(h.fn.children=j),I&&(h.fn.remove=I),$&&(h.fn.find=$),F&&(h.fn.each=F),B&&(h.fn.empty=B),function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Sf||(Sf={}));var Rf=function(t){return"[object HTMLDocument]"===Of(t)},Df=function(t){return"[object ShadowRoot]"===Of(t)},Pf=function(t){return"[object DataTransfer]"===Of(t)},Af=/\[object HTML([A-Z][a-z]*)*Element\]/,jf=function(t){return"matches"in t&&/^[ou]l$/i.test(t.tagName)&&!t.hasAttribute("data-w-e-type")},If=function(t){return Af.test(Of(t))},$f=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||null},Ff=function(t){return null!=t&&"number"==typeof t.nodeType},Bf=function(t){return Ff(t)&&t.nodeType===Sf.COMMENT_NODE},_f=function(t){return Ff(t)&&t.nodeType===Sf.ELEMENT_NODE},Wf=function(t){return"[object Selection]"===Of(t)},zf=function(t){return Ff(t)&&t.nodeType===Sf.TEXT_NODE},Uf=function(t){return t.clipboardData&&""!==t.clipboardData.getData("text/plain")&&1===t.clipboardData.types.length},Vf=function(t){var e,n=ri(t,2),r=n[0],o=n[1];if(_f(r)&&r.childNodes.length){var i=o===r.childNodes.length,a=i?o-1:o;for(r=(e=ri(qf(r,a,i?"backward":"forward"),2))[0],i=(a=e[1])<o;_f(r)&&r.childNodes.length;){var s=i?r.childNodes.length-1:0;r=Jf(r,s,i?"backward":"forward")}o=i&&null!=r.textContent?r.textContent.length:0}return[r,o]},Hf=function(){return!(!window.document.activeElement||!window.document.activeElement.shadowRoot)},Kf=function(t){var e,n,r;return null!==(e=window&&window.document.getElementById(t))&&void 0!==e?e:window&&(null===(r=null===(n=window.document.activeElement)||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.getElementById(t))||null},qf=function(t,e,n){for(var r=t.childNodes,o=r[e],i=e,a=!1,s=!1;(Bf(o)||_f(o)&&0===o.childNodes.length||_f(o)&&"false"===o.getAttribute("contenteditable"))&&(!a||!s);)i>=r.length?(a=!0,i=e-1,n="backward"):i<0?(s=!0,i=e+1,n="forward"):(o=r[i],e=i,i+="forward"===n?1:-1);return[o,e]},Jf=function(t,e,n){return ri(qf(t,e,n),1)[0]},Gf=function(t){var e,n,r="";if(zf(t)&&t.nodeValue)return t.nodeValue;if(_f(t)){try{for(var o=ni(Array.from(t.childNodes)),i=o.next();!i.done;i=o.next()){var a=i.value;r+=Gf(a)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}var s=getComputedStyle(t).getPropertyValue("display");"block"!==s&&"list"!==s&&"table-row"!==s&&"BR"!==t.tagName||(r+="\n")}return r};function Yf(t){var e=[];e.push(t);for(var n=0;e.length>0;){var r=e.pop();if(null==r)break;if((n+=1)>1e4)break;var o=r.nodeName;if(r.nodeType===Sf.ELEMENT_NODE){var i=o.toLowerCase();if(ic.includes(i)||"iframe"===i||"video"===i)return r;var a=r.children||[],s=a.length;if(s)for(var u=s-1;u>=0;u-=1)e.push(a[u])}}return null}function Xf(t,e){if(!If(t)||"true"!==t.dataset.slateVoid)for(var n=t.childNodes,r=n.length;r-=1;){var o=n[r],i=o.nodeType;zf(o)?e(o,t):[Sf.ELEMENT_NODE,Sf.DOCUMENT_NODE,Sf.DOCUMENT_FRAGMENT_NODE].includes(i)&&Xf(o,e)}}function Qf(t){if(0===t.length)return"";var e=t[0];return e.nodeType!==Sf.ELEMENT_NODE?"":e.tagName.toLowerCase()}var Zf,td,ed,nd={};function rd(){if(td)return Zf;td=1;var t=kn().f;return Zf=function(e,n,r){r in e||t(e,r,{configurable:!0,get:function(){return n[r]},set:function(t){n[r]=t}})}}!function(){if(ed)return nd;ed=1;var t=bt(),e=ut(),n=de(),r=_r(),o=cs(),i=Nn(),a=fa(),s=Or().f,u=xe(),l=Ms(),c=ws(),f=Zl(),d=pl(),h=rd(),p=Xn(),g=yt(),v=un(),m=Gn().enforce,y=hs(),b=cn(),w=gl(),x=vl(),S=b("match"),O=e.RegExp,E=O.prototype,C=e.SyntaxError,k=n(E.exec),N=n("".charAt),T=n("".replace),L=n("".indexOf),M=n("".slice),R=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,D=/a/g,P=/a/g,A=new O(D)!==D,j=d.MISSED_STICKY,I=d.UNSUPPORTED_Y,$=t&&(!A||j||w||x||g(function(){return P[S]=!1,O(D)!==D||O(P)===P||"/a/i"!==String(O(D,"i"))}));if(r("RegExp",$)){for(var F=function(t,e){var n,r,s,d,h,p,g=u(E,this),y=l(t),b=void 0===e,S=[],P=t;if(!g&&y&&b&&t.constructor===F)return t;if((y||u(E,t))&&(t=t.source,b&&(e=f(P))),t=void 0===t?"":c(t),e=void 0===e?"":c(e),P=t,w&&"dotAll"in D&&(r=!!e&&L(e,"s")>-1)&&(e=T(e,/s/g,"")),n=e,j&&"sticky"in D&&(s=!!e&&L(e,"y")>-1)&&I&&(e=T(e,/y/g,"")),x&&(d=function(t){for(var e,n=t.length,r=0,o="",i=[],s=a(null),u=!1,l=!1,c=0,f="";r<=n;r++){if("\\"===(e=N(t,r)))e+=N(t,++r);else if("]"===e)u=!1;else if(!u)switch(!0){case"["===e:u=!0;break;case"("===e:if(o+=e,"?:"===M(t,r+1,r+3))continue;k(R,M(t,r+1))&&(r+=2,l=!0),c++;continue;case">"===e&&l:if(""===f||v(s,f))throw new C("Invalid capture group name");s[f]=!0,i[i.length]=[f,c],l=!1,f="";continue}l?f+=e:o+=e}return[o,i]}(t),t=d[0],S=d[1]),h=o(O(t,e),g?this:E,F),(r||s||S.length)&&(p=m(h),r&&(p.dotAll=!0,p.raw=F(function(t){for(var e,n=t.length,r=0,o="",i=!1;r<=n;r++)"\\"!==(e=N(t,r))?i||"."!==e?("["===e?i=!0:"]"===e&&(i=!1),o+=e):o+="[\\s\\S]":o+=e+N(t,++r);return o}(t),n)),s&&(p.sticky=!0),S.length&&(p.groups=S)),t!==P)try{i(h,"source",""===P?"(?:)":P)}catch(t){}return h},B=s(O),_=0;B.length>_;)h(F,O,B[_++]);E.constructor=F,F.prototype=E,p(e,"RegExp",F,{constructor:!0})}y("RegExp")}();var od=new RegExp(String.fromCharCode(160),"g");function id(t){return t.replace(od," ")}var ad=["span","b","strong","i","em","s","strike","u","font","sub","sup"],sd=[];function ud(t){sd.push(t)}var ld=[];function cd(t){ld.push(t)}var fd={};function dd(t){var e=t.selector,n=t.parseElemHtml;fd[e]=n}function hd(t,e){var n=t.length;if(n){var r=t[n-1];if(i.isText(r)){var o=Object.keys(r);if(1===o.length&&"text"===o[0])return r.text+=e,!0}}return!1}function pd(t,e,n){return{type:"paragraph",children:[{text:h(t).text().replace(/\s+/gm," ")}]}}function gd(t,n){var r=function(t,e){var n=[];if(null!=t.attr("data-w-e-is-void"))return n;var r=t[0].childNodes;return 1===r.length&&"BR"===r[0].nodeName?(n.push({text:""}),n):(r.forEach(function(t){if(_f(t)){if("BR"===t.nodeName)return void(hd(n,"\n")||n.push({text:"\n"}));var r=wd(h(t),e);Array.isArray(r)?r.forEach(function(t){return n.push(t)}):n.push(r)}else if(zf(t)){var o=t.textContent||"";if(""===o.trim()&&o.indexOf("\n")>=0)return;o&&(o=id(o),hd(n,o)||n.push({text:o}))}}),n)}(t,n),o=function(t){for(var e in fd)if(t[0].matches(e))return fd[e];return pd}(t),i=o(t[0],r,n);return Array.isArray(i)||(i=[i]),i.forEach(function(o){e.isVoid(n,o)||(0===r.length&&(o.children=[{text:t.text().replace(/\s+/gm," ")}]),ld.forEach(function(e){o=e(t[0],o,n)}))}),i}function vd(t,e){0===t.parents("pre").length&&(t[0].innerHTML=t[0].innerHTML.replace(/[\r\n\t]+/g,"").replace(/<br>/g,"\n"));var n=t[0].textContent||"",r={text:n=id(n=xf(n))};return ld.forEach(function(n){r=n(t[0],r,e)}),r}function md(t,e){var n={text:""};return ld.forEach(function(r){n=r(t[0],n,e)}),n}function yd(t,e){var n=e.parentElement;return null==n?t:(null==n.closest("pre")&&(t=t.replace(/[\r\n\t]+/g,"")),t=id(t=xf(t)))}function bd(t,e,n){var r=t[0];if(_f(r)){var o=wd(t,n);return delete e.text,Array.isArray(o)?o.map(function(t){return ei(ei({},e),t)}):[ei(ei({},e),o)]}if(Bf(r))return null;var i=zf(r)?{text:yd(r.textContent||"",r)}:vd(t,n);return[ei(ei({},e),i)]}function wd(t,e){sd.forEach(function(e){var n=e.selector,r=e.preParseHtml;t[0].matches(n)&&(t=h(r(t[0])))});var n=Qf(t);if("span"===n){if(t.attr("data-w-e-type"))return gd(t,e);if((o=Array.from(t[0].childNodes)).some(function(t){return!zf(t)&&!Bf(t)})){var r=md(h(t[0]),e);return o.flatMap(function(t){return bd(h(t),r,e)||[]})}return vd(t,e)}if("code"===n)return"pre"===Qf(t.parent())?gd(t,e):vd(t,e);if(ad.includes(n)){var o;if((o=Array.from(t[0].childNodes)).some(function(t){return!zf(t)&&!Bf(t)})){var i=md(h(t[0]),e);return o.flatMap(function(t){return bd(h(t),i,e)||[]})}return vd(t,e)}return gd(t,e)}function xd(t,e,n){var r=h(n);return!!r.attr(e)||(r.attr(e,"true"),t.on(zs,function(){r.removeAttr(e)}),!1)}function Sd(t,e){void 0===e&&(e="");var n=[],r=t.getConfig().sanitizeHtml;""===e&&(e="<p><br></p>"),0!==e.indexOf("<")&&(e=e.split(/\n/).map(function(t){return"<p>".concat(t,"</p>")}).join("")),e=r?r(e):e;var o=h("<div>".concat(e,"</div>"));return Array.from(o.children()).forEach(function(e){var r=wd(h(e),t);Array.isArray(r)?r.forEach(function(t){return n.push(t)}):n.push(r)}),n}function Od(t,e){return"w-e-element-".concat(t,"-").concat(e)}var Ed=[];function Cd(t){Ed.push(t)}var kd={};function Nd(t){var e=t.type,n=t.elemToHtml;kd[e||""]=n}function Td(t,e,n){var r=n.isInline(t)?"span":"div";return"<".concat(r,">").concat(e,"</").concat(r,">")}function Ld(t,n){var r=t.type,o=void 0===r?"":r,i=t.children,a=void 0===i?[]:i,s=e.isVoid(n,t),u="";s||(u=a.map(function(t){return Gd(t,n)}).join(""));var l=function(t){return kd[t]||Td}(o),c=l(t,u,n),f="";if(f="string"==typeof c?c:c.html||"",s||Ed.forEach(function(e){return f=e(t,f,n)}),"string"==typeof c)return f;var d=c.prefix,h=void 0===d?"":d,p=c.suffix,g=void 0===p?"":p;return h&&(f=h+f),g&&(f+=g),f}var Md,Rd,Dd,Pd={};function Ad(){if(Rd)return Md;Rd=1;var t=un();return Md=function(e){return void 0!==e&&(t(e,"value")||t(e,"writable"))}}!function(){if(Dd)return Pd;Dd=1;var t=Wr(),e=xt(),n=be(),r=Cn(),o=Ad(),i=gn(),a=ha();t({target:"Reflect",stat:!0},{get:function t(s,u){var l,c,f=arguments.length<3?s:arguments[2];return r(s)===f?s[u]:(l=i.f(s,u))?o(l)?l.value:void 0===l.get?void 0:e(l.get,f):n(c=a(s))?t(c,u,f):void 0}})}();var jd,Id={};!function(){if(jd)return Id;jd=1;var t,e=Wr(),n=ko(),r=gn().f,o=yr(),i=ws(),a=Rs(),s=ve(),u=Ds(),l=nn(),c=n("".slice),f=Math.min,d=u("endsWith");e({target:"String",proto:!0,forced:!!(l||d||(t=r(String.prototype,"endsWith"),!t||t.writable))&&!d},{endsWith:function(t){var e=i(s(this));a(t);var n=arguments.length>1?arguments[1]:void 0,r=e.length,u=void 0===n?r:f(o(n),r),l=i(t);return c(e,u-l.length,u)===l}})}();var $d=0,Fd=function(){this.id="".concat($d++)},Bd="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),_d="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Wd="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),zd="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Ud="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Vd="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent),Hd=!Ud&&!zd&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,Kd=function(t,e){return Boolean(t.compareDocumentPosition(e)&Ef.DOCUMENT_POSITION_PRECEDING)},qd=function(t,e){return Boolean(t.compareDocumentPosition(e)&Ef.DOCUMENT_POSITION_FOLLOWING)},Jd={getWindow:function(t){var e=ku.get(t);if(!e)throw new Error("Unable to find a host window element for this editor");return e},findKey:function(t,e){var n=Cu.get(e);return n||(n=new Fd,Cu.set(e,n)),n},setNewKey:function(t){var e=new Fd;Cu.set(t,e)},findPath:function(t,n){for(var r=[],o=n;;){var i=wu.get(o);if(null==i){if(e.isEditor(o))return r;break}var a=bu.get(o);if(null==a)break;r.unshift(a),o=i}throw new Error("Unable to find the path for Slate node: ".concat(JSON.stringify(n)))},findDocumentOrShadowRoot:function(t){if(t.isDestroyed)return window.document;var e=Jd.toDOMNode(t,t),n=e.getRootNode();return(Rf(n)||Df(n))&&null!=Reflect.get(n,"getSelection")?n:e.ownerDocument},getParentNode:function(t,e){return wu.get(e)||null},getParentsNodes:function(t,e){for(var n=[],r=e;r!==t&&null!=r;){var o=Jd.getParentNode(t,r);if(null==o)break;n.push(o),r=o}return n},getTopNode:function(t,e){var n=[Jd.findPath(t,e)[0]];return u.get(t,n)},toDOMNode:function(t,n){var r;if(e.isEditor(n))r=xu.get(t);else{var o=Jd.findKey(t,n);r=Ou.get(o)}if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(JSON.stringify(n)));return r},hasDOMNode:function(t,e,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,a=Jd.toDOMNode(t,t);try{r=_f(e)?e:e.parentElement}catch(t){if(t instanceof Error&&!t.message.includes('Permission denied to access property "nodeType"'))throw t}return!!r&&(r.closest("[data-slate-editor]")===a&&(!i||r.isContentEditable||r.closest('[contenteditable="false"]')===a||!!r.getAttribute("data-slate-zero-width"))||!!r.getAttribute("data-slate-string"))},toDOMRange:function(t,e){var n=e.anchor,r=e.focus,o=a.isBackward(e),i=Jd.toDOMPoint(t,n),s=a.isCollapsed(e)?i:Jd.toDOMPoint(t,r),u=Jd.getWindow(t).document.createRange(),l=ri(o?s:i,2),c=l[0],f=l[1],d=ri(o?i:s,2),h=d[0],p=d[1],g=!!(_f(c)?c:c.parentElement).getAttribute("data-slate-zero-width"),v=!!(_f(h)?h:h.parentElement).getAttribute("data-slate-zero-width");return u.setStart(c,g?1:f),u.setEnd(h,v?1:p),u},toDOMPoint:function(t,n){var r,o,i,a=ri(e.node(t,n.path),1)[0],s=Jd.toDOMNode(t,a);e.void(t,{at:n})&&(n={path:n.path,offset:0});var u=Array.from(s.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),l=0;try{for(var c=ni(u),f=c.next();!f.done;f=c.next()){var d=f.value,h=d.childNodes[0];if(null!=h&&null!=h.textContent){var p=h.textContent.length,g=d.getAttribute("data-slate-length"),v=l+(null==g?p:parseInt(g,10));if(n.offset<=v){i=[h,Math.min(p,Math.max(0,n.offset-l))];break}l=v}}}catch(t){r={error:t}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(JSON.stringify(n)));return i},toSlateNode:function(t,e){var n=_f(e)?e:e.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Su.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},findEventRange:function(t,n){"nativeEvent"in n&&(n=n.nativeEvent);var r=n.clientX,o=n.clientY,i=n.target;if(null==r||null==o)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(n));var a,u=Jd.toSlateNode(t,n.target),l=Jd.findPath(t,u);if(s.isElement(u)&&e.isVoid(t,u)){var c=i.getBoundingClientRect(),f=t.isInline(u)?r-c.left<c.left+c.width-r:o-c.top<c.top+c.height-o,d=e.point(t,l,{edge:f?"start":"end"}),h=f?e.before(t,d):e.after(t,d);if(h)return e.range(t,h)}var p=this.getWindow(t).document;if(p.caretRangeFromPoint)a=p.caretRangeFromPoint(r,o);else{var g=p.caretPositionFromPoint(r,o);g&&((a=p.createRange()).setStart(g.offsetNode,g.offset),a.setEnd(g.offsetNode,g.offset))}if(!a)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(n));return Jd.toSlateRange(t,a,{exactMatch:!1,suppressThrow:!1})},toSlateRange:function(t,n,r){var o,i,s,u,l,c=r.exactMatch,f=r.suppressThrow;if((Wf(n)?n.anchorNode:n.startContainer)&&(Wf(n)?(o=n.anchorNode,i=n.anchorOffset,s=n.focusNode,u=n.focusOffset,l=Vd&&Hf()?n.anchorNode===n.focusNode&&n.anchorOffset===n.focusOffset:n.isCollapsed):(o=n.startContainer,i=n.startOffset,s=n.endContainer,u=n.endOffset,l=n.collapsed)),null==o||null==s||null==i||null==u)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(n));var d=Jd.toSlatePoint(t,[o,i],{exactMatch:c,suppressThrow:f});if(!d)return null;var h=l?d:Jd.toSlatePoint(t,[s,u],{exactMatch:c,suppressThrow:f,searchDirection:Kd(o,s)||o===s&&u<i?"forward":"backward"});if(!h)return null;var p={anchor:d,focus:h};return a.isExpanded(p)&&a.isForward(p)&&_f(s)&&e.void(t,{at:p.focus,mode:"highest"})&&(p=e.unhangRange(t,p,{voids:!0})),p},toSlatePoint:function(t,e,n){var r,o,i,a=n.exactMatch,s=n.suppressThrow,u=ri(a?e:Vf(e),2),l=u[0],c=u[1],f=l.parentNode,d=n.searchDirection,h=null,p=0;if(f){var g=Jd.toDOMNode(t,t),v=f.closest('[data-slate-void="true"]'),m=v&&g.contains(v)?v:null,y=f.closest('[contenteditable="false"]'),b=y&&g.contains(y)?y:null,w=f.closest("[data-slate-leaf]"),x=null,S=Jd.getWindow(t);if(w&&S.document.createRange){h=w.closest('[data-slate-node="text"]');var O=S.document.createRange();O.setStart(h,0),O.setEnd(l,c);var E=O.cloneContents();oi(oi([],ri(_(E.querySelectorAll("[data-slate-zero-width]"))),!1),ri(_(E.querySelectorAll("[contenteditable=false]"))),!1).forEach(function(t){t.parentNode.removeChild(t)}),p=E.textContent.length,x=h}else if(m)(w=Array.from(m.querySelectorAll("[data-slate-leaf]")).find(function(e){return Jd.hasDOMNode(t,e)})||null)?(h=w.closest('[data-slate-node="text"]'),p=(x=w).textContent.length,x.querySelectorAll("[data-slate-zero-width]").forEach(function(t){p-=t.textContent.length})):p=1;else if(b){var C=function(e){return e?Array.from(e.querySelectorAll("[data-slate-leaf]")).filter(function(e){return Jd.hasDOMNode(t,e)}):[]},k=b.closest('[data-slate-node="element"]');if("backward"===d||!d)for(var N=(L=oi(oi([],ri(C(null==k?void 0:k.previousElementSibling)),!1),ri(C(k)),!1)).length-1;N>=0;N-=1){var T=L[N];if(Kd(b,T)){w=T,d="backward";break}}if(!(w||"forward"!==d&&d)){var L=oi(oi([],ri(C(k)),!1),ri(C(null==k?void 0:k.nextElementSibling)),!1);try{for(var M=ni(L),R=M.next();!R.done;R=M.next()){T=R.value;if(qd(b,T)){w=T,d="forward";break}}}catch(t){r={error:t}}finally{try{R&&!R.done&&(o=M.return)&&o.call(M)}finally{if(r)throw r.error}}}w&&(h=w.closest('[data-slate-node="text"]'),x=w,"forward"===d?p=0:(p=x.textContent.length,x.querySelectorAll("[data-slate-zero-width]").forEach(function(t){p-=t.textContent.length})))}x&&p===x.textContent.length&&(f.hasAttribute("data-slate-zero-width")||_d&&(null===(i=x.textContent)||void 0===i?void 0:i.endsWith("\n")))&&(p-=1)}if(!h){if(s)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(e))}var D,P=Jd.toSlateNode(t,h);try{D=Jd.findPath(t,P)}catch(t){if(s)return null;throw t}return{path:D,offset:p}},hasRange:function(t,n){var r=n.anchor,o=n.focus;return e.hasPath(t,r.path)&&e.hasPath(t,o.path)},getNodeType:function(t){return s.isElement(t)?t.type:""},checkNodeType:function(t,e){return this.getNodeType(t)===e},getNodesStr:function(t){return t.map(function(t){return u.string(t)}).join("")},getSelectedElems:function(t){var n,r,o=[],i=e.nodes(t,{universal:!0});try{for(var a=ni(i),u=a.next();!u.done;u=a.next()){var l=ri(u.value,1)[0];s.isElement(l)&&o.push(l)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},getSelectedNodeByType:function(t,n){var r=this,o=ri(e.nodes(t,{match:function(t){return r.checkNodeType(t,n)},universal:!0}),1),i=o[0];return null==i?null:i[0]},getSelectedTextNode:function(t){var n=ri(e.nodes(t,{match:function(t){return i.isText(t)},universal:!0}),1),r=n[0];return null==r?null:r[0]},isNodeSelected:function(t,n){var r=ri(e.nodes(t,{match:function(t){return t===n},universal:!0}),1),o=r[0];return null!=o&&ri(o,1)[0]===n},isSelectionAtLineEnd:function(t,n){var r=t.selection;return!!r&&(e.isEnd(t,r.anchor,n)||e.isEnd(t,r.focus,n))},getTextarea:function(t){var e=ou.get(t);if(null==e)throw new Error("Cannot find textarea instance by editor");return e},getToolbar:function(t){return su.get(t)||null},getHoverbar:function(t){return lu.get(t)||null},normalizeContent:function(t){t.children.forEach(function(e,n){t.normalizeNode([e,[n]])})},getLeftLengthOfMaxLength:function(t){var e=t.getConfig(),n=e.maxLength,r=e.onMaxLength;if("number"!=typeof n||n<=0)return 1/0;var o=n-t.getText().replace(/\r|\n|(\r\n)|(\n\r)/g,"").length;return o<=0&&r&&r(t),o},cleanExposedTexNodeInSelectionBlock:function(t){var n,r,o,i,a=Jd.getTextarea(t).$textArea,u=null==a?void 0:a[0].childNodes;if(u)try{for(var l=ni(Array.from(u)),c=l.next();!c.done;c=l.next()){var f=c.value;if(!zf(f))break;f.remove()}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}var d=e.nodes(t,{match:function(e){return!(!s.isElement(e)||t.isInline(e))},universal:!0});try{for(var p=ni(d),g=p.next();!g.done;g=p.next()){var v=g.value;if(null!=v){var m=v[0];Xf(Jd.toDOMNode(t,m),function(t,e){var n=h(e);n.attr("data-slate-string")||n.attr("data-slate-zero-width")||n.attr("data-w-e-reserve")||e.removeChild(t)})}}}catch(t){o={error:t}}finally{try{g&&!g.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}},isLastNode:function(t,e){var n=t.children||[];return n[n.length-1]===e},genEmptyParagraph:function(){return{type:"paragraph",children:[{text:""}]}},isSelectedVoidNode:function(t){var n,r,o=e.nodes(t,{match:function(e){return t.isVoid(e)}}),i=0;try{for(var a=ni(o),s=a.next();!s.done;s=a.next()){s.value&&(i+=1)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i>0},isSelectedEmptyParagraph:function(t){var e=t.selection;if(null==e)return!1;if(a.isExpanded(e))return!1;var n=Jd.getSelectedNodeByType(t,"paragraph");if(null===n)return!1;var r=n.children;return 1===r.length&&(""===r[0].text||void 0)},isEmptyPath:function(t,n){var r=e.node(t,n);if(null==r)return!1;var o=ri(r,1)[0].children;if(1===o.length&&""===o[0].text)return!0;return!1}};function Gd(t,e){return s.isElement(t)?Ld(t,e):function(t,e){var n=t.text;if(null==n)throw new Error("Current node is not slate Text ".concat(JSON.stringify(t)));var r=n;r=function(t){return t.replace(/ {2}/g," &nbsp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/®/g,"&reg;").replace(/©/g,"&copy;").replace(/™/g,"&trade;")}(r);var o=Jd.getParentsNodes(e,t).some(function(t){return"pre"===Jd.getNodeType(t)});if(o||(r=r.replace(/\n\r|\r\n|\r|\n/g,"<br>")),o&&(r=r.replace(/&nbsp;/g," ")),""===r){var i=Jd.getParentNode(null,t);if(!i||0!==i.children.length)return r;r="<br>"}return Ed.forEach(function(n){return r=n(t,r,e)}),r}(t,e)}var Yd=function(t,e){var n=(e.top+e.bottom)/2;return t.top<=n&&t.bottom>=n},Xd=function(t,e,n){var r=Jd.toDOMRange(t,e).getBoundingClientRect(),o=Jd.toDOMRange(t,n).getBoundingClientRect();return Yd(r,o)&&Yd(o,r)},Qd=function(t,n){var r,o,i=[];try{for(var a=ni(e.levels(t,{at:n})),s=a.next();!s.done;s=a.next()){var u=ri(s.value,2),l=u[0],c=u[1],f=Jd.findKey(t,l);i.push([c,f])}}catch(t){r={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i};function Zd(e,n){e.isInline(n)?(e.insertNode(n),"link"===n.type&&e.insertFragment([{text:""}])):t.insertNodes(e,n,{mode:"highest"})}var th,eh,nh,rh,oh,ih,ah,sh,uh,lh,ch,fh,dh,hh,ph,gh,vh,mh,yh,bh,wh,xh,Sh,Oh,Eh,Ch,kh,Nh,Th,Lh,Mh,Rh,Dh,Ph,Ah,jh,Ih,$h,Fh,Bh,_h=function(n){var o=n,c=o.onChange,f=o.insertText,d=o.apply,p=o.deleteBackward,g=o.deleteFragment;return o.insertText=function(t){o.getConfig().readOnly||f(t)},o.apply=function(t){var n,i,a,s,u,l,c,f,h=[];switch(t.type){case"insert_text":case"remove_text":case"set_node":case"split_node":h.push.apply(h,oi([],ri(Qd(o,t.path)),!1));break;case"insert_node":case"remove_node":h.push.apply(h,oi([],ri(Qd(o,r.parent(t.path))),!1));break;case"merge_node":var p=r.previous(t.path);h.push.apply(h,oi([],ri(Qd(o,p)),!1));break;case"move_node":var g=r.common(r.parent(t.path),r.parent(t.newPath));h.push.apply(h,oi([],ri(Qd(o,g)),!1));break;case"set_selection":(null===(s=null===(a=t.newProperties)||void 0===a?void 0:a.focus)||void 0===s?void 0:s.path)&&(h.push.apply(h,oi([],ri(Qd(o,null===(l=null===(u=t.newProperties)||void 0===u?void 0:u.focus)||void 0===l?void 0:l.path)),!1)),h.push.apply(h,oi([],ri(Qd(o,null===(f=null===(c=t.properties)||void 0===c?void 0:c.focus)||void 0===f?void 0:f.path)),!1)))}d(t);try{for(var v=ni(h),m=v.next();!m.done;m=v.next()){var y=ri(m.value,2),b=y[0],w=y[1],x=ri(e.node(o,b),1)[0];Cu.set(x,w),"type"in x&&(mu.has(x)&&mu.delete(x),yu.has(x)&&yu.delete(x))}}catch(t){n={error:t}}finally{try{m&&!m.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}},o.deleteBackward=function(r){if("line"!==r)return p(r);if(n.selection&&a.isCollapsed(n.selection)){var i=e.above(n,{match:function(t){return s.isElement(t)&&e.isBlock(n,t)},at:n.selection});if(i){var u=ri(i,2)[1],l=e.range(n,u,n.selection.anchor),c=function(t,n){var r=e.range(t,a.end(n)),o=Array.from(e.positions(t,{at:n})),i=0,s=o.length,u=Math.floor(s/2);if(Xd(t,e.range(t,o[i]),r))return e.range(t,o[i],r);if(o.length<2)return e.range(t,o[o.length-1],r);for(;u!==o.length&&u!==i;)Xd(t,e.range(t,o[u]),r)?s=u:i=u,u=Math.floor((i+s)/2);return e.range(t,o[s],r)}(o,l);a.isCollapsed(c)||t.delete(n,{at:c})}}},o.deleteFragment=function(n){var r=function(t){var n=t.selection;if(null==n||a.isCollapsed(n))return!1;var r=ri(a.edges(n),2),o=r[0],i=r[1],s=ri(e.edges(t,[]),2),u=s[0],c=s[1];return l.equals(o,u)&&l.equals(i,c)}(o);g(n),r&&(!function(n){var r=[{type:"paragraph",children:[{text:""}]}];e.withoutNormalizing(n,function(){for(var e=n.children.length-1;e>=0;e-=1)t.removeNodes(n,{at:[e]});t.insertNodes(n,r,{at:[0]})})}(o),o.children.length>0&&t.select(o,e.start(o,[])))},o.onChange=function(){var t=o.selection;null!=t&&Tu.set(o,t),o.emit(Us),c()},o.handleTab=function(){o.insertText(" ")},o.getHtml=function(){var t=o.children,e=void 0===t?[]:t,n=o.getConfig().skipCacheTypes,r=void 0===n?["list-item"]:n;return e.map(function(t){var e=Jd.getNodeType(t);if(r.includes(e))return Gd(t,o);var n=yu.get(t);if(n)return n;var i=Gd(t,o);return yu.set(t,i),i}).join("")},o.getText=function(){var t=o.children;return(void 0===t?[]:t).map(function(t){return u.string(t)}).join("\n")},o.getSelectionText=function(){var t=o.selection;return null==t?"":e.string(n,t)},o.getElemsByType=function(t,n){var r,i;void 0===n&&(n=!1);var a=[],u=e.nodes(o,{at:[],universal:!0});try{for(var l=ni(u),c=l.next();!c.done;c=l.next()){var f=ri(c.value,1)[0];if(s.isElement(f))if(n?f.type.indexOf(t)>=0:f.type===t){var d=Jd.findKey(o,f),h=Od(f.type,d.id);a.push(ei(ei({},f),{id:h}))}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}return a},o.getElemsByTypePrefix=function(t){return o.getElemsByType(t,!0)},o.isEmpty=function(){var t=o.children,e=void 0===t?[]:t;if(e.length>1)return!1;var n=e[0];if(null==n)return!0;if(!s.isElement(n)||"paragraph"!==n.type)return!1;var r=n.children,a=void 0===r?[]:r;if(a.length>1)return!1;var u=a[0];return null==u||i.isText(u)&&""===u.text},o.clear=function(){t.delete(o,{at:{anchor:e.start(o,[]),focus:e.end(o,[])}}),0!==o.children.length?function(n){var r=n.children[0];if(1===n.children.length&&s.isElement(r)&&("paragraph"!==r.type||""!==u.string(r))&&""===u.string(r)){var o=[{type:"paragraph",children:[{text:""}]}];e.withoutNormalizing(n,function(){t.removeNodes(n,{at:[0]}),t.insertNodes(n,o,{at:[0]})})}}(o):t.insertNodes(o,[{type:"paragraph",children:[{text:""}]}])},o.getParentNode=function(t){return Jd.getParentNode(o,t)},o.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e){var r=document.createElement("div");r.innerHTML=e;var i=Array.from(r.childNodes);if(i=i.filter(function(t){var e=t.nodeName;return!!zf(t)||!!_f(t)&&!fl.has(e.toLowerCase())}),0!==i.length){var a=o.selection;if(null!=a){var s=null;if(Jd.isSelectedEmptyParagraph(o)&&!n)s=[a.focus.path[0]];r.setAttribute("hidden","true"),document.body.appendChild(r);var u=0;i.forEach(function(t,e){var n=t.nodeName,r=t.textContent,a=void 0===r?"":r;if(zf(t)){if(!a||!a.trim())return;o.insertNode({text:a})}else if("BR"!==n){var s=t,l=!1;if(ad.includes(n.toLowerCase()))l=!0;else for(var c in fd)if(s.matches(c)){l=!0;break}if(l){var f=wd(h(s),o);return Array.isArray(f)?(f.forEach(function(t){return Zd(o,t)}),u+=1):(Zd(o,f),u+=1),void(Jd.isSelectedVoidNode(o)&&o.move(1))}var d=window.getComputedStyle(s).display;if(!Jd.isSelectedEmptyParagraph(o)&&d.indexOf("inline")<0){if(e>=1){var p=i[e-1];jf(p)&&o.insertBreak()}o.insertBreak()}o.dangerouslyInsertHtml(s.innerHTML,!0)}else o.insertText("\n")}),u&&s&&Jd.isEmptyPath(o,s)&&t.removeNodes(o,{at:s}),r.remove()}}}},o.setHtml=function(n){void 0===n&&(n="");var r=o.isDisabled(),i=o.isFocused(),s=JSON.stringify(o.selection);o.enable(),Tu.delete(o),o.focus(),o.clear();var u=Sd(o,null==n?"":n);if(t.insertFragment(o,u),i||(o.deselect(),o.blur()),r&&(o.deselect(),o.disable()),o.isFocused())try{var l=JSON.parse(s);a.isRange(l)&&Jd.hasRange(o,l)?o.select(l):o.select(e.start(o,[]))}catch(t){o.select(e.start(o,[]))}},o},Wh=1,zh=function(n){var r=n;return r.id="wangEditor-".concat(Wh),Wh+=1,r.isDestroyed=!1,r.isFullScreen=!1,r.focus=function(n){if(Jd.toDOMNode(r,r).focus({preventScroll:!0}),Nu.set(r,!0),n){var o=e.end(r,[]);t.select(r,o)}else{var i=Tu.get(r);i?t.select(r,i):t.select(r,e.start(r,[]))}},r.isFocused=function(){return!!Nu.get(r)},r.blur=function(){Jd.toDOMNode(r,r).blur(),t.deselect(r),Nu.set(r,!1)},r.updateView=function(){Jd.getTextarea(r).changeViewState();var t=Jd.getToolbar(r);t&&t.changeToolbarState();var e=Jd.getHoverbar(r);e&&e.changeHoverbarState()},r.destroy=function(){if(!r.isDestroyed){var t=Jd.getTextarea(r);t.destroy(),ou.delete(r),iu.delete(t);var e=Jd.getToolbar(r);e&&(e.destroy(),su.delete(r),au.delete(e));var n=Jd.getHoverbar(r);n&&(n.destroy(),lu.delete(r),uu.delete(n)),r.isDestroyed=!0,r.emit(zs)}},r.scrollToElem=function(t){if(!r.getConfig().scroll){var e="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return e+="\nYou has disabled editor scroll, please do this yourself",void console.warn(e)}var n=h("#".concat(t));if(0!==n.length){var o=n[0];if(!Jd.hasDOMNode(r,o)){e="Element (found by id is '".concat(t,"') is not in editor DOM");return e+="\n 通过 id '".concat(t,"' 找到的 element 不在 editor DOM 之内"),void console.error(e,o)}var i=Jd.getTextarea(r),a=i.$textAreaContainer,s=i.$scroll,u=n.offset().top,l=a.offset().top;s[0].scrollBy({top:u-l,behavior:"smooth"})}},r.showProgressBar=function(t){t<1||Jd.getTextarea(r).changeProgress(t)},r.hidePanelOrModal=function(){var t=fu.get(r);null!=t&&t.forEach(function(t){return t.hide()})},r.enable=function(){r.getConfig().readOnly=!1,r.updateView()},r.disable=function(){r.getConfig().readOnly=!0,r.updateView()},r.isDisabled=function(){return r.getConfig().readOnly},r.toDOMNode=function(t){return Jd.toDOMNode(r,t)},r.fullScreen=function(){if(!r.isFullScreen){var t=null,e=Jd.getToolbar(r);e&&(t=e.$box);var n=Jd.getTextarea(r).$box.parent();if(t&&t.parent()[0]!==n[0]){throw new Error("Can not set full screen, cause toolbar DOM parent is not equal to textarea DOM parent\n不能设置全屏,因为 toolbar DOM 父节点和 textarea DOM 父节点不一致")}n.addClass("w-e-full-screen-container");var o=n.css("z-index");n.attr("data-z-index",o.toString()),r.isFullScreen=!0,r.emit(Hs)}},r.unFullScreen=function(){if(r.isFullScreen){var t=Jd.getTextarea(r).$box.parent();setTimeout(function(){t.removeClass("w-e-full-screen-container"),r.isFullScreen=!1,r.emit(Ks)},200)}},r.getEditableContainer=function(){return Jd.getTextarea(r).$textAreaContainer[0]},r},Uh={exports:{}},Vh={exports:{}};function Hh(){if(eh)return th;eh=1;return th=function(t){return null!=t}}function Kh(){if(ih)return oh;ih=1;var t=function(){if(rh)return nh;rh=1;var t=Hh(),e={object:!0,function:!0,undefined:!0};return nh=function(n){return!!t(n)&&hasOwnProperty.call(e,typeof n)}}();return oh=function(e){if(!t(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(t){return!1}}}function qh(){if(lh)return uh;lh=1;var t=function(){if(sh)return ah;sh=1;var t=Kh();return ah=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(t){return!1}return!t(e)}}(),e=/^\s*class[\s{/}]/,n=Function.prototype.toString;return uh=function(r){return!!t(r)&&!e.test(n.call(r))}}function Jh(){if(mh)return vh;mh=1;var t=(gh?ph:(gh=1,ph=function(){}))();return vh=function(e){return e!==t&&null!==e},vh}function Gh(){return xh||(xh=1,wh=(hh?dh:(hh=1,dh=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}))()?Object.keys:function(){if(bh)return yh;bh=1;var t=Jh(),e=Object.keys;return yh=function(n){return e(t(n)?Object(n):n)}}()),wh}function Yh(){if(Ch)return Eh;Ch=1;var t=Gh(),e=function(){if(Oh)return Sh;Oh=1;var t=Jh();return Sh=function(e){if(!t(e))throw new TypeError("Cannot use null or undefined");return e}}(),n=Math.max;return Eh=function(r,o){var i,a,s,u=n(arguments.length,2);for(r=Object(e(r)),s=function(t){try{r[t]=o[t]}catch(t){i||(i=t)}},a=1;a<u;++a)t(o=arguments[a]).forEach(s);if(void 0!==i)throw i;return r},Eh}function Xh(){return Nh?kh:(Nh=1,kh=(fh||(fh=1,ch=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}),ch)()?Object.assign:Yh())}function Qh(){return jh||(jh=1,Ah=function(){if(Rh)return Mh;Rh=1;var t="razdwatrzy";return Mh=function(){return"function"==typeof t.contains&&!0===t.contains("dwa")&&!1===t.contains("foo")}}()()?String.prototype.contains:function(){if(Ph)return Dh;Ph=1;var t=String.prototype.indexOf;return Dh=function(e){return t.call(this,e,arguments[1])>-1},Dh}()),Ah}function Zh(){if(Ih)return Vh.exports;Ih=1;var t=Hh(),e=qh(),n=Xh(),r=function(){if(Lh)return Th;Lh=1;var t=Jh(),e=Array.prototype.forEach,n=Object.create;return Th=function(r){var o=n(null);return e.call(arguments,function(e){t(e)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(e),o)}),o},Th}(),o=Qh(),i=Vh.exports=function(e,i){var a,s,u,l,c;return arguments.length<2||"string"!=typeof e?(l=i,i=e,e=null):l=arguments[2],t(e)?(a=o.call(e,"c"),s=o.call(e,"e"),u=o.call(e,"w")):(a=u=!0,s=!1),c={value:i,configurable:a,enumerable:s,writable:u},l?n(r(l),c):c};return i.gs=function(i,a,s){var u,l,c,f;return"string"!=typeof i?(c=s,s=a,a=i,i=null):c=arguments[3],t(a)?e(a)?t(s)?e(s)||(c=s,s=void 0):s=void 0:(c=a,a=s=void 0):a=void 0,t(i)?(u=o.call(i,"c"),l=o.call(i,"e")):(u=!0,l=!1),f={get:a,set:s,configurable:u,enumerable:l},c?n(r(c),f):f},Vh.exports}var tp=(Bh||(Bh=1,function(t,e){var n,r,o,i,a,s,u,l=Zh(),c=Fh?$h:(Fh=1,$h=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}),f=Function.prototype.apply,d=Function.prototype.call,h=Object.create,p=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};r=function(t,e){var r,i;return c(e),i=this,n.call(this,t,r=function(){o.call(i,t,r),f.call(e,this,arguments)}),r.__eeOnceListener__=e,this},i=function(t){var e,n,r,o,i;if(v.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),e=1;e<n;++e)i[e-1]=arguments[e];for(o=o.slice(),e=0;r=o[e];++e)f.call(r,this,i)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,i=new Array(n-1),e=1;e<n;++e)i[e-1]=arguments[e];f.call(o,this,i)}},a={on:n=function(t,e){var n;return c(e),v.call(this,"__ee__")?n=this.__ee__:(n=m.value=h(null),p(this,"__ee__",m),m.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:r,off:o=function(t,e){var n,r,o,i;if(c(e),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(r=n[t]))for(i=0;o=r[i];++i)o!==e&&o.__eeOnceListener__!==e||(2===r.length?n[t]=r[i?0:1]:r.splice(i,1));else r!==e&&r.__eeOnceListener__!==e||delete n[t];return this},emit:i},s={on:l(n),once:l(r),off:l(o),emit:l(i)},u=g({},s),t.exports=e=function(t){return null==t?h(u):g(Object(t),s)},e.methods=a}(Uh,Uh.exports)),Uh.exports),ep=ot(tp);function np(t){var e=Lu.get(t);return null==e&&(e=ep(),Lu.set(t,e)),e}var rp=new WeakMap;function op(t,e){var n=rp.get(t);null==n&&(n=new Set,rp.set(t,n)),n.add(e)}var ip=function(t){var e=t;return e.on=function(t,n){var r=np(e);if(r.on(t,n),"destroyed"===t&&op(e,n),"destroyed"!==t){var o=function(){return r.off(t,n)};r.on("destroyed",o),op(e,o)}},e.once=function(t,n){np(e).once(t,n)},e.off=function(t,n){np(e).off(t,n)},e.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=np(e);if(o.emit.apply(o,oi([t],ri(n),!1)),"destroyed"===t){var i=function(t){return rp.get(t)||new Set}(e);i.forEach(function(t){return o.off("destroyed",t)}),function(t){rp.set(t,new Set)}(e)}},e};var ap,sp=function(t){var n=t;return n.setFragmentData=function(t){var r=n.selection;if(r){var o=ri(a.edges(r),2),i=o[0],s=o[1],u=e.void(n,{at:i.path}),l=e.void(n,{at:s.path});if(!a.isCollapsed(r)||u){var c=Jd.toDOMRange(n,r),f=c.cloneContents(),d=f.childNodes[0];if(f.childNodes.forEach(function(t){t.textContent&&""!==t.textContent.trim()&&(d=t)}),l){var h=ri(l,1)[0],p=c.cloneRange(),g=Jd.toDOMNode(n,h);p.setEndAfter(g),f=p.cloneContents()}if(u&&(d=f.querySelector("[data-slate-spacer]")),Array.from(f.querySelectorAll("[data-slate-zero-width]")).forEach(function(t){var e="n"===t.getAttribute("data-slate-zero-width");t.textContent=e?"\n":""}),zf(d)){var v=d.ownerDocument.createElement("span");v.style.whiteSpace="pre",v.appendChild(d),f.appendChild(v),d=v}var m=n.getFragment(),y=JSON.stringify(m),b=window.btoa(encodeURIComponent(y));d.setAttribute("data-slate-fragment",b),t.setData("application/x-slate-fragment",b);var w=f.ownerDocument.createElement("div");return w.appendChild(f),w.setAttribute("hidden","true"),f.ownerDocument.body.appendChild(w),t.setData("text/html",w.innerHTML),t.setData("text/plain",Gf(w)),f.ownerDocument.body.removeChild(w),t}}},n.insertData=function(t){var e=t.getData("application/x-slate-fragment");if(e){var r=decodeURIComponent(window.atob(e)),o=JSON.parse(r);n.insertFragment(o)}else{var i=t.getData("text/plain"),a=t.getData("text/html");if(a){var s=n.getConfig().sanitizeHtml;n.dangerouslyInsertHtml(s?s(a):a)}else if(i){if(!/[\r\n]/.test(i))return void n.insertText(i);var u=function(t){return t.replace(/\n\r|\r\n|\r/g,"\n").split("\n").map(function(t){return{type:"paragraph",children:[{text:t}]}})}(i);n.insertFragment(u)}}},n},up={};function lp(t){return t.replace(/\n\r|\r\n|\r|\n/g,"").length}function cp(t,e){var n,r;if(e<=0)return"";var o=e,i="";try{for(var a=ni(t),s=a.next();!s.done;s=a.next()){var u=s.value;if(/\r|\n/.test(u))i+=u;else{if(o<=0)break;i+=u,o-=1}}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}!function(){if(ap)return up;ap=1;var t=Wr(),e=To(),n=Lo(),r=be(),o=mr(),i=br(),a=me(),s=Xo(),u=cn(),l=Qo(),c=rs(),f=l("slice"),d=u("species"),h=Array,p=Math.max;t({target:"Array",proto:!0,forced:!f},{slice:function(t,u){var l,f,g,v=a(this),m=i(v),y=o(t,m),b=o(void 0===u?m:u,m);if(e(v)&&(l=v.constructor,(n(l)&&(l===h||e(l.prototype))||r(l)&&null===(l=l[d]))&&(l=void 0),l===h||void 0===l))return c(v,y,b);for(f=new(void 0===l?h:l)(p(b-y,0)),g=0;y<b;y++,g++)y in v&&s(f,g,v[y]);return f.length=g,f}})}();var fp=function(t){var e=t,n=e.insertText,r=e.insertNode,o=e.insertFragment,i=e.dangerouslyInsertHtml;return e.insertText=function(t){if(e.getConfig().maxLength){var r=Jd.getLeftLengthOfMaxLength(e);r<=0||(r<t.length?n(t.slice(0,r)):n(t))}else n(t)},e.insertNode=function(t){if(e.getConfig().maxLength){var n=Jd.getLeftLengthOfMaxLength(e);if(!(n<=0))n<u.string(t).length||r(t)}else r(t)},e.insertFragment=function(t){if(e.getConfig().maxLength){if(t.length>0){var n=t[0];if(Jd.getLeftLengthOfMaxLength(e)<u.string(n).length)return;o([n]);for(var r=1;r<t.length;r+=1)e.insertNode(t[r])}}else o(t)},e.dangerouslyInsertHtml=function(t,n){if(void 0===t&&(t=""),void 0===n&&(n=!1),t)if(e.getConfig().maxLength){var r=Jd.getLeftLengthOfMaxLength(e);if(!(r<=0)){var o=function(t,e){if(e<=0)return"";var n=document.createElement("div");n.innerHTML=t;var r=function(t){t.forEach(function(t){return t.remove()})},o=function(t){for(var n=Array.from(t.childNodes),i=0;i<n.length;i+=1){var a=n[i];if(zf(a)){var s=a.textContent||"",u=lp(s);if(u<=e){e-=u;continue}return a.textContent=cp(s,e),e=0,r(n.slice(i+1)),!1}if(_f(a)){if(fl.has(a.nodeName.toLowerCase())){a.remove();continue}if(!o(a))return r(n.slice(i+1)),!1}else a.remove()}return e>0};return o(n),n.innerHTML}(t,r);o&&i(o,n)}}else i(t,n)},e};function dp(t){var e=Jd.getTextarea(t).$textAreaContainer,n=e.width(),r=e.height(),o=e.offset();return{top:o.top,left:o.left,width:n,height:r}}function hp(t){var e={top:"0",left:"0"},n=t.selection;if(null==n)return e;var r=dp(t);if(null==r)return e;var o=r.top,i=r.left,a=r.width,s=r.height,u=Jd.toDOMRange(t,n).getClientRects(),l=u?u[0]:null;if(null==l)return e;var c={},f=l.top-o,d=l.left-i;if(d>a/2){var h=a-d;c.right="".concat(h+5,"px")}else c.left="".concat(d+5,"px");if(f>s/2){var p=s-f;c.bottom="".concat(p+5,"px")}else{var g=u[u.length-1],v=g.top-o+g.height;v<0&&(v=0),c.top="".concat(v+5,"px")}return c}function pp(t,e,n){void 0===n&&(n="modal");var r={top:"0",left:"0"};if(null==t.selection)return r;var o=s.isElement(e)&&t.isVoid(e),i=s.isElement(e)&&t.isInline(e),a=Eu.get(e);if(null==a)return r;var u=a.getBoundingClientRect(),l=u.top,c=u.left,f=u.height,d=u.width;if(o){var h=Yf(a);if(null!=h){var p=h.getBoundingClientRect();l=p.top,f=p.height}}var g=dp(t);if(null==g)return r;var v=g.top,m=g.left,y=g.width,b=g.height,w={},x=l-v,S=c-m;if("bar"===n)return w.left="".concat(S,"px"),x>40?w.bottom="".concat(b-x+5,"px"):w.top="".concat(x+f+5,"px"),w;if("modal"===n){if(o?i?S>(y-d)/2?w.right="".concat(y-S+5,"px"):w.left="".concat(S+d+5,"px"):w.left="20px":w.left="".concat(S,"px"),o)(O=x)<0&&(O=0),w.top="".concat(O,"px");else if(x>(b-f)/2)w.bottom="".concat(b-x+5,"px");else{var O;(O=x+f)<0&&(O=0),w.top="".concat(O+5,"px")}return w}throw new Error("type '".concat(n,"' is invalid"))}function gp(t,e){wf(function(){var n=dp(t);if(null!=n){var r,o=n.top,i=n.left,a=n.width,s=n.height,u=e.offset(),l=u.top,c=u.left,f=e.width(),d=e.height(),h=l-o,p=c-i,g=e.attr("style");if(g.indexOf("top")>=0)if((r=h+d-s)>0){var v=e.css("top"),m=parseInt(v.toString(),10)-r;m<0&&(m=0),e.css("top","".concat(m,"px"))}if(g.indexOf("bottom")>=0&&l<0){var y=e.css("bottom"),b=parseInt(y.toString(),10)-Math.abs(l);e.css("bottom","".concat(b,"px"))}if(g.indexOf("left")>=0)if((r=p+f-a)>0){var w=e.css("left"),x=parseInt(w.toString(),10)-r;x<0&&(x=0),e.css("left","".concat(x,"px"))}if(g.indexOf("right")>=0&&c<0){var S=e.css("right"),O=parseInt(S.toString(),10)-Math.abs(c);e.css("right","".concat(O,"px"))}}})}var vp,mp=function(t){var n=t,r=n.select,o=n.deselect,i=n.move;return n.select=function(t){r(t)},n.deselect=function(){var t=n.selection,e=Jd.findDocumentOrShadowRoot(n).getSelection();e&&e.rangeCount>0&&Jd.hasDOMNode(n,e.anchorNode)&&Jd.hasDOMNode(n,e.focusNode)&&e.removeAllRanges(),t&&o()},n.move=function(t,e){void 0===e&&(e=!1),"number"==typeof t?t&&(t<0||i({distance:t,unit:"character",reverse:e})):i(t)},n.moveReverse=function(t){n.move(t,!0)},n.restoreSelection=function(){var t=Tu.get(n);null!=t&&(n.focus(),r(t))},n.getSelectionPosition=function(){return hp(n)},n.getNodePosition=function(t){return pp(n,t)},n.isSelectedAll=function(){var t=n.selection;if(null==t)return!1;var r=ri(a.edges(t),2),o=r[0],i=r[1],s=ri(e.edges(n,[]),2),u=s[0],c=s[1];return!(!l.equals(o,u)||!l.equals(i,c))},n.selectAll=function(){var t=e.start(n,[]),o=e.end(n,[]);r({anchor:t,focus:o})},n},yp={};!function(){if(vp)return yp;vp=1;var t=xt(),e=de(),n=Rl(),r=Cn(),o=be(),i=yr(),a=ws(),s=ve(),u=Le(),l=Al(),c=Zl(),f=jl(),d=e("".indexOf);n("match",function(e,n,h){return[function(n){var r=s(this),i=o(n)?u(n,e):void 0;return i?t(i,n,r):new RegExp(n)[e](a(r))},function(t){var e=r(this),o=a(t),s=h(n,e,o);if(s.done)return s.value;var u=a(c(e));if(-1===d(u,"g"))return f(e,o);var p=-1!==d(u,"u");e.lastIndex=0;for(var g,v=[],m=0;null!==(g=f(e,o));){var y=a(g[0]);v[m]=y,""===y&&(e.lastIndex=l(o,i(e.lastIndex),p)),m++}return 0===m?null:v}]})}();const bp=t=>"string"==typeof t,wp=()=>{let t,e;const n=new Promise((n,r)=>{t=n,e=r});return n.resolve=t,n.reject=e,n},xp=t=>null==t?"":""+t,Sp=/###/g,Op=t=>t&&t.indexOf("###")>-1?t.replace(Sp,"."):t,Ep=t=>!t||bp(t),Cp=(t,e,n)=>{const r=bp(e)?e.split("."):e;let o=0;for(;o<r.length-1;){if(Ep(t))return{};const e=Op(r[o]);!t[e]&&n&&(t[e]=new n),t=Object.prototype.hasOwnProperty.call(t,e)?t[e]:{},++o}return Ep(t)?{}:{obj:t,k:Op(r[o])}},kp=(t,e,n)=>{const{obj:r,k:o}=Cp(t,e,Object);if(void 0!==r||1===e.length)return void(r[o]=n);let i=e[e.length-1],a=e.slice(0,e.length-1),s=Cp(t,a,Object);for(;void 0===s.obj&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),s=Cp(t,a,Object),s&&s.obj&&void 0!==s.obj[`${s.k}.${i}`]&&(s.obj=void 0);s.obj[`${s.k}.${i}`]=n},Np=(t,e)=>{const{obj:n,k:r}=Cp(t,e);if(n)return n[r]},Tp=(t,e,n)=>{for(const r in e)"__proto__"!==r&&"constructor"!==r&&(r in t?bp(t[r])||t[r]instanceof String||bp(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):Tp(t[r],e[r],n):t[r]=e[r]);return t},Lp=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Mp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Rp=t=>bp(t)?t.replace(/[&<>"'\/]/g,t=>Mp[t]):t;const Dp=[" ",",","?","!",";"],Pp=new class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const e=this.regExpMap.get(t);if(void 0!==e)return e;const n=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,n),this.regExpQueue.push(t),n}}(20),Ap=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!t)return;if(t[e])return t[e];const r=e.split(n);let o=t;for(let t=0;t<r.length;){if(!o||"object"!=typeof o)return;let e,i="";for(let a=t;a<r.length;++a)if(a!==t&&(i+=n),i+=r[a],e=o[i],void 0!==e){if(["string","number","boolean"].indexOf(typeof e)>-1&&a<r.length-1)continue;t+=a-t+1;break}o=e}return o},jp=t=>t&&t.replace("_","-"),Ip={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console&&console[t]&&console[t].apply(console,e)}};class $p{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(t,e)}init(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=e.prefix||"i18next:",this.logger=t||Ip,this.options=e,this.debug=e.debug}log(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.forward(e,"log","",!0)}warn(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.forward(e,"warn","",!0)}error(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.forward(e,"error","")}deprecate(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(t,e,n,r){return r&&!this.debug?null:(bp(t[0])&&(t[0]=`${n}${this.prefix} ${t[0]}`),this.logger[e](t))}create(t){return new $p(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new $p(this.logger,t)}}var Fp=new $p;class Bp{constructor(){this.observers={}}on(t,e){return t.split(" ").forEach(t=>{this.observers[t]||(this.observers[t]=new Map);const n=this.observers[t].get(e)||0;this.observers[t].set(e,n+1)}),this}off(t,e){this.observers[t]&&(e?this.observers[t].delete(e):delete this.observers[t])}emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(this.observers[t]){Array.from(this.observers[t].entries()).forEach(t=>{let[e,r]=t;for(let t=0;t<r;t++)e(...n)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(e=>{let[r,o]=e;for(let e=0;e<o;e++)r.apply(r,[t,...n])})}}}class _p extends Bp{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=e,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const e=this.options.ns.indexOf(t);e>-1&&this.options.ns.splice(e,1)}getResource(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,e],n&&(Array.isArray(n)?a.push(...n):bp(n)&&o?a.push(...n.split(o)):a.push(n)));const s=Np(this.data,a);return!s&&!e&&!n&&t.indexOf(".")>-1&&(t=a[0],e=a[1],n=a.slice(2).join(".")),!s&&i&&bp(n)?Ap(this.data&&this.data[t]&&this.data[t][e],n,o):s}addResource(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let a=[t,e];n&&(a=a.concat(i?n.split(i):n)),t.indexOf(".")>-1&&(a=t.split("."),r=e,e=a[1]),this.addNamespaces(e),kp(this.data,a,r),o.silent||this.emit("added",t,e,n,r)}addResources(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const r in n)(bp(n[r])||Array.isArray(n[r]))&&this.addResource(t,e,r,n[r],{silent:!0});r.silent||this.emit("added",t,e,n)}addResourceBundle(t,e,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},a=[t,e];t.indexOf(".")>-1&&(a=t.split("."),r=n,n=e,e=a[1]),this.addNamespaces(e);let s=Np(this.data,a)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Tp(s,n,o):s={...s,...n},kp(this.data,a,s),i.silent||this.emit("added",t,e,n)}removeResourceBundle(t,e){this.hasResourceBundle(t,e)&&delete this.data[t][e],this.removeNamespaces(e),this.emit("removed",t,e)}hasResourceBundle(t,e){return void 0!==this.getResource(t,e)}getResourceBundle(t,e){return e||(e=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(t,e)}:this.getResource(t,e)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const e=this.getDataByLanguage(t);return!!(e&&Object.keys(e)||[]).find(t=>e[t]&&Object.keys(e[t]).length>0)}toJSON(){return this.data}}var Wp={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,o){return t.forEach(t=>{this.processors[t]&&(e=this.processors[t].process(e,n,r,o))}),e}};const zp={};class Up extends Bp{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),((t,e,n)=>{t.forEach(t=>{e[t]&&(n[t]=e[t])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=e,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=Fp.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==t)return!1;const n=this.resolve(t,e);return n&&void 0!==n.res}extractFromKey(t,e){let n=void 0!==e.nsSeparator?e.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const r=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator;let o=e.ns||this.options.defaultNS||[];const i=n&&t.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||e.keySeparator||this.options.userDefinedNsSeparator||e.nsSeparator||((t,e,n)=>{e=e||"",n=n||"";const r=Dp.filter(t=>e.indexOf(t)<0&&n.indexOf(t)<0);if(0===r.length)return!0;const o=Pp.getRegExp(`(${r.map(t=>"?"===t?"\\?":t).join("|")})`);let i=!o.test(t);if(!i){const e=t.indexOf(n);e>0&&!o.test(t.substring(0,e))&&(i=!0)}return i})(t,n,r));if(i&&!a){const e=t.match(this.interpolator.nestingRegexp);if(e&&e.length>0)return{key:t,namespaces:bp(o)?[o]:o};const i=t.split(n);(n!==r||n===r&&this.options.ns.indexOf(i[0])>-1)&&(o=i.shift()),t=i.join(r)}return{key:t,namespaces:bp(o)?[o]:o}}translate(t,e,n){if("object"!=typeof e&&this.options.overloadTranslationOptionHandler&&(e=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof e&&(e={...e}),e||(e={}),null==t)return"";Array.isArray(t)||(t=[String(t)]);const r=void 0!==e.returnDetails?e.returnDetails:this.options.returnDetails,o=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator,{key:i,namespaces:a}=this.extractFromKey(t[t.length-1],e),s=a[a.length-1],u=e.lng||this.language,l=e.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&"cimode"===u.toLowerCase()){if(l){const t=e.nsSeparator||this.options.nsSeparator;return r?{res:`${s}${t}${i}`,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:s,usedParams:this.getUsedParamsDetails(e)}:`${s}${t}${i}`}return r?{res:i,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:s,usedParams:this.getUsedParamsDetails(e)}:i}const c=this.resolve(t,e);let f=c&&c.res;const d=c&&c.usedKey||i,h=c&&c.exactUsedKey||i,p=Object.prototype.toString.apply(f),g=void 0!==e.joinArrays?e.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!bp(f)&&"boolean"!=typeof f&&"number"!=typeof f;if(!(v&&f&&m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(p)<0)||bp(g)&&Array.isArray(f))if(v&&bp(g)&&Array.isArray(f))f=f.join(g),f&&(f=this.extendTranslation(f,t,e,n));else{let r=!1,a=!1;const l=void 0!==e.count&&!bp(e.count),d=Up.hasDefaultValue(e),h=l?this.pluralResolver.getSuffix(u,e.count,e):"",p=e.ordinal&&l?this.pluralResolver.getSuffix(u,e.count,{ordinal:!1}):"",g=l&&!e.ordinal&&0===e.count&&this.pluralResolver.shouldUseIntlApi(),v=g&&e[`defaultValue${this.options.pluralSeparator}zero`]||e[`defaultValue${h}`]||e[`defaultValue${p}`]||e.defaultValue;!this.isValidLookup(f)&&d&&(r=!0,f=v),this.isValidLookup(f)||(a=!0,f=i);const m=(e.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&a?void 0:f,y=d&&v!==f&&this.options.updateMissing;if(a||r||y){if(this.logger.log(y?"updateKey":"missingKey",u,s,i,y?v:f),o){const t=this.resolve(i,{...e,keySeparator:!1});t&&t.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let t=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,e.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let e=0;e<n.length;e++)t.push(n[e]);else"all"===this.options.saveMissingTo?t=this.languageUtils.toResolveHierarchy(e.lng||this.language):t.push(e.lng||this.language);const r=(t,n,r)=>{const o=d&&r!==f?r:m;this.options.missingKeyHandler?this.options.missingKeyHandler(t,s,n,o,y,e):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(t,s,n,o,y,e),this.emit("missingKey",t,s,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&l?t.forEach(t=>{const n=this.pluralResolver.getSuffixes(t,e);g&&e[`defaultValue${this.options.pluralSeparator}zero`]&&n.indexOf(`${this.options.pluralSeparator}zero`)<0&&n.push(`${this.options.pluralSeparator}zero`),n.forEach(n=>{r([t],i+n,e[`defaultValue${n}`]||v)})}):r(t,i,v))}f=this.extendTranslation(f,t,e,c,n),a&&f===i&&this.options.appendNamespaceToMissingKey&&(f=`${s}:${i}`),(a||r)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${i}`:i,r?f:void 0):this.options.parseMissingKeyHandler(f))}else{if(!e.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const t=this.options.returnedObjectHandler?this.options.returnedObjectHandler(d,f,{...e,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(c.res=t,c.usedParams=this.getUsedParamsDetails(e),c):t}if(o){const t=Array.isArray(f),n=t?[]:{},r=t?h:d;for(const t in f)if(Object.prototype.hasOwnProperty.call(f,t)){const i=`${r}${o}${t}`;n[t]=this.translate(i,{...e,joinArrays:!1,ns:a}),n[t]===i&&(n[t]=f[t])}f=n}}return r?(c.res=f,c.usedParams=this.getUsedParamsDetails(e),c):f}extendTranslation(t,e,n,r,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const a=bp(t)&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let s;if(a){const e=t.match(this.interpolator.nestingRegexp);s=e&&e.length}let u=n.replace&&!bp(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),t=this.interpolator.interpolate(t,u,n.lng||this.language||r.usedLng,n),a){const e=t.match(this.interpolator.nestingRegexp);s<(e&&e.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(t=this.interpolator.nest(t,function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return o&&o[0]===r[0]&&!n.context?(i.logger.warn(`It seems you are nesting recursively key: ${r[0]} in key: ${e[0]}`),null):i.translate(...r,e)},n)),n.interpolation&&this.interpolator.reset()}const a=n.postProcess||this.options.postProcess,s=bp(a)?[a]:a;return null!=t&&s&&s.length&&!1!==n.applyPostProcessor&&(t=Wp.handle(s,t,e,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),t}resolve(t){let e,n,r,o,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return bp(t)&&(t=[t]),t.forEach(t=>{if(this.isValidLookup(e))return;const s=this.extractFromKey(t,a),u=s.key;n=u;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));const c=void 0!==a.count&&!bp(a.count),f=c&&!a.ordinal&&0===a.count&&this.pluralResolver.shouldUseIntlApi(),d=void 0!==a.context&&(bp(a.context)||"number"==typeof a.context)&&""!==a.context,h=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);l.forEach(t=>{this.isValidLookup(e)||(i=t,!zp[`${h[0]}-${t}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(zp[`${h[0]}-${t}`]=!0,this.logger.warn(`key "${n}" for languages "${h.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach(n=>{if(this.isValidLookup(e))return;o=n;const i=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(i,u,n,t,a);else{let t;c&&(t=this.pluralResolver.getSuffix(n,a.count,a));const e=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(i.push(u+t),a.ordinal&&0===t.indexOf(r)&&i.push(u+t.replace(r,this.options.pluralSeparator)),f&&i.push(u+e)),d){const n=`${u}${this.options.contextSeparator}${a.context}`;i.push(n),c&&(i.push(n+t),a.ordinal&&0===t.indexOf(r)&&i.push(n+t.replace(r,this.options.pluralSeparator)),f&&i.push(n+e))}}let s;for(;s=i.pop();)this.isValidLookup(e)||(r=s,e=this.getResource(n,t,s,a))}))})}),{res:e,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}isValidLookup(t){return!(void 0===t||!this.options.returnNull&&null===t||!this.options.returnEmptyString&&""===t)}getResource(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,e,n,r):this.resourceStore.getResource(t,e,n,r)}getUsedParamsDetails(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=t.replace&&!bp(t.replace);let r=n?t.replace:t;if(n&&void 0!==t.count&&(r.count=t.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(const t of e)delete r[t]}return r}static hasDefaultValue(t){const e="defaultValue";for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e===n.substring(0,12)&&void 0!==t[n])return!0;return!1}}const Vp=t=>t.charAt(0).toUpperCase()+t.slice(1);class Hp{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Fp.create("languageUtils")}getScriptPartFromCode(t){if(!(t=jp(t))||t.indexOf("-")<0)return null;const e=t.split("-");return 2===e.length?null:(e.pop(),"x"===e[e.length-1].toLowerCase()?null:this.formatLanguageCode(e.join("-")))}getLanguagePartFromCode(t){if(!(t=jp(t))||t.indexOf("-")<0)return t;const e=t.split("-");return this.formatLanguageCode(e[0])}formatLanguageCode(t){if(bp(t)&&t.indexOf("-")>-1){if("undefined"!=typeof Intl&&void 0!==Intl.getCanonicalLocales)try{let e=Intl.getCanonicalLocales(t)[0];if(e&&this.options.lowerCaseLng&&(e=e.toLowerCase()),e)return e}catch(t){}const e=["hans","hant","latn","cyrl","cans","mong","arab"];let n=t.split("-");return this.options.lowerCaseLng?n=n.map(t=>t.toLowerCase()):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),e.indexOf(n[1].toLowerCase())>-1&&(n[1]=Vp(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),e.indexOf(n[1].toLowerCase())>-1&&(n[1]=Vp(n[1].toLowerCase())),e.indexOf(n[2].toLowerCase())>-1&&(n[2]=Vp(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let e;return t.forEach(t=>{if(e)return;const n=this.formatLanguageCode(t);this.options.supportedLngs&&!this.isSupportedCode(n)||(e=n)}),!e&&this.options.supportedLngs&&t.forEach(t=>{if(e)return;const n=this.getLanguagePartFromCode(t);if(this.isSupportedCode(n))return e=n;e=this.options.supportedLngs.find(t=>t===n?t:t.indexOf("-")<0&&n.indexOf("-")<0?void 0:t.indexOf("-")>0&&n.indexOf("-")<0&&t.substring(0,t.indexOf("-"))===n||0===t.indexOf(n)&&n.length>1?t:void 0)}),e||(e=this.getFallbackCodes(this.options.fallbackLng)[0]),e}getFallbackCodes(t,e){if(!t)return[];if("function"==typeof t&&(t=t(e)),bp(t)&&(t=[t]),Array.isArray(t))return t;if(!e)return t.default||[];let n=t[e];return n||(n=t[this.getScriptPartFromCode(e)]),n||(n=t[this.formatLanguageCode(e)]),n||(n=t[this.getLanguagePartFromCode(e)]),n||(n=t.default),n||[]}toResolveHierarchy(t,e){const n=this.getFallbackCodes(e||this.options.fallbackLng||[],t),r=[],o=t=>{t&&(this.isSupportedCode(t)?r.push(t):this.logger.warn(`rejecting language code not found in supportedLngs: ${t}`))};return bp(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(t)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(t)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(t))):bp(t)&&o(this.formatLanguageCode(t)),n.forEach(t=>{r.indexOf(t)<0&&o(this.formatLanguageCode(t))}),r}}let Kp=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],qp={1:t=>Number(t>1),2:t=>Number(1!=t),3:t=>0,4:t=>Number(t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2),5:t=>Number(0==t?0:1==t?1:2==t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5),6:t=>Number(1==t?0:t>=2&&t<=4?1:2),7:t=>Number(1==t?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2),8:t=>Number(1==t?0:2==t?1:8!=t&&11!=t?2:3),9:t=>Number(t>=2),10:t=>Number(1==t?0:2==t?1:t<7?2:t<11?3:4),11:t=>Number(1==t||11==t?0:2==t||12==t?1:t>2&&t<20?2:3),12:t=>Number(t%10!=1||t%100==11),13:t=>Number(0!==t),14:t=>Number(1==t?0:2==t?1:3==t?2:3),15:t=>Number(t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2),16:t=>Number(t%10==1&&t%100!=11?0:0!==t?1:2),17:t=>Number(1==t||t%10==1&&t%100!=11?0:1),18:t=>Number(0==t?0:1==t?1:2),19:t=>Number(1==t?0:0==t||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3),20:t=>Number(1==t?0:0==t||t%100>0&&t%100<20?1:2),21:t=>Number(t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0),22:t=>Number(1==t?0:2==t?1:(t<0||t>10)&&t%10==0?2:3)};const Jp=["v1","v2","v3"],Gp=["v4"],Yp={zero:0,one:1,two:2,few:3,many:4,other:5};class Xp{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=t,this.options=e,this.logger=Fp.create("pluralResolver"),this.options.compatibilityJSON&&!Gp.includes(this.options.compatibilityJSON)||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(()=>{const t={};return Kp.forEach(e=>{e.lngs.forEach(n=>{t[n]={numbers:e.nr,plurals:qp[e.fc]}})}),t})(),this.pluralRulesCache={}}addRule(t,e){this.rules[t]=e}clearCache(){this.pluralRulesCache={}}getRule(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi()){const n=jp("dev"===t?"en":t),r=e.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(n,{type:r})}catch(n){if(!t.match(/-|_/))return;const r=this.languageUtils.getLanguagePartFromCode(t);i=this.getRule(r,e)}return this.pluralRulesCache[o]=i,i}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(t,e);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}getPluralFormsOfKey(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(t,n).map(t=>`${e}${t}`)}getSuffixes(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(t,e);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((t,e)=>Yp[t]-Yp[e]).map(t=>`${this.options.prepend}${e.ordinal?`ordinal${this.options.prepend}`:""}${t}`):n.numbers.map(n=>this.getSuffix(t,n,e)):[]}getSuffix(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(e)}`:this.getSuffixRetroCompatible(r,e):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,e){const n=t.noAbs?t.plurals(e):t.plurals(Math.abs(e));let r=t.numbers[n];this.options.simplifyPluralSuffix&&2===t.numbers.length&&1===t.numbers[0]&&(2===r?r="plural":1===r&&(r=""));const o=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return"v1"===this.options.compatibilityJSON?1===r?"":"number"==typeof r?`_plural_${r.toString()}`:o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===t.numbers.length&&1===t.numbers[0]?o():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}shouldUseIntlApi(){return!Jp.includes(this.options.compatibilityJSON)}}const Qp=function(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=((t,e,n)=>{const r=Np(t,n);return void 0!==r?r:Np(e,n)})(t,e,n);return!i&&o&&bp(n)&&(i=Ap(t,n,r),void 0===i&&(i=Ap(e,n,r))),i},Zp=t=>t.replace(/\$/g,"$$$$");class tg{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=Fp.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(t=>t),this.init(t)}init(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:e,escapeValue:n,useRawValueToEscape:r,prefix:o,prefixEscaped:i,suffix:a,suffixEscaped:s,formatSeparator:u,unescapeSuffix:l,unescapePrefix:c,nestingPrefix:f,nestingPrefixEscaped:d,nestingSuffix:h,nestingSuffixEscaped:p,nestingOptionsSeparator:g,maxReplaces:v,alwaysFormat:m}=t.interpolation;this.escape=void 0!==e?e:Rp,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?Lp(o):i||"{{",this.suffix=a?Lp(a):s||"}}",this.formatSeparator=u||",",this.unescapePrefix=l?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=f?Lp(f):d||Lp("$t("),this.nestingSuffix=h?Lp(h):p||Lp(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=v||1e3,this.alwaysFormat=void 0!==m&&m,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(t,e)=>t&&t.source===e?(t.lastIndex=0,t):new RegExp(e,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,e,n,r){let o,i,a;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=t=>{if(t.indexOf(this.formatSeparator)<0){const o=Qp(e,s,t,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,n,{...r,...e,interpolationkey:t}):o}const o=t.split(this.formatSeparator),i=o.shift().trim(),a=o.join(this.formatSeparator).trim();return this.format(Qp(e,s,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,n,{...r,...e,interpolationkey:i})};this.resetRegExp();const l=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,c=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,f=[{regex:this.regexpUnescape,safeValue:t=>Zp(t)},{regex:this.regexp,safeValue:t=>this.escapeValue?Zp(this.escape(t)):Zp(t)}];return f.forEach(e=>{for(a=0;o=e.regex.exec(t);){const n=o[1].trim();if(i=u(n),void 0===i)if("function"==typeof l){const e=l(t,o,r);i=bp(e)?e:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))i="";else{if(c){i=o[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${t}`),i=""}else bp(i)||this.useRawValueToEscape||(i=xp(i));const s=e.safeValue(i);if(t=t.replace(o[0],s),c?(e.regex.lastIndex+=i.length,e.regex.lastIndex-=o[0].length):e.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,e){let n,r,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=(t,e)=>{const n=this.nestingOptionsSeparator;if(t.indexOf(n)<0)return t;const r=t.split(new RegExp(`${n}[ ]*{`));let i=`{${r[1]}`;t=r[0],i=this.interpolate(i,o);const a=i.match(/'/g),s=i.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),e&&(o={...e,...o})}catch(e){return this.logger.warn(`failed parsing options string in nesting for key ${t}`,e),`${t}${n}${i}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,t};for(;n=this.nestingRegexp.exec(t);){let s=[];o={...i},o=o.replace&&!bp(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){const t=n[1].split(this.formatSeparator).map(t=>t.trim());n[1]=t.shift(),s=t,u=!0}if(r=e(a.call(this,n[1].trim(),o),o),r&&n[0]===t&&!bp(r))return r;bp(r)||(r=xp(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${t}`),r=""),u&&(r=s.reduce((t,e)=>this.format(t,e,i.lng,{...i,interpolationkey:n[1].trim()}),r.trim())),t=t.replace(n[0],r),this.regexp.lastIndex=0}return t}}const eg=t=>{const e={};return(n,r,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});const a=r+JSON.stringify(i);let s=e[a];return s||(s=t(jp(r),o),e[a]=s),s(n)}};class ng{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=Fp.create("formatter"),this.options=t,this.formats={number:eg((t,e)=>{const n=new Intl.NumberFormat(t,{...e});return t=>n.format(t)}),currency:eg((t,e)=>{const n=new Intl.NumberFormat(t,{...e,style:"currency"});return t=>n.format(t)}),datetime:eg((t,e)=>{const n=new Intl.DateTimeFormat(t,{...e});return t=>n.format(t)}),relativetime:eg((t,e)=>{const n=new Intl.RelativeTimeFormat(t,{...e});return t=>n.format(t,e.range||"day")}),list:eg((t,e)=>{const n=new Intl.ListFormat(t,{...e});return t=>n.format(t)})},this.init(t)}init(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=e.interpolation.formatSeparator||","}add(t,e){this.formats[t.toLowerCase().trim()]=e}addCached(t,e){this.formats[t.toLowerCase().trim()]=eg(e)}format(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=e.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(t=>t.indexOf(")")>-1)){const t=o.findIndex(t=>t.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,t)].join(this.formatSeparator)}const i=o.reduce((t,e)=>{const{formatName:o,formatOptions:i}=(t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);"currency"===e&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===e&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(t=>{if(t){const[e,...r]=t.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),i=e.trim();n[i]||(n[i]=o),"false"===o&&(n[i]=!1),"true"===o&&(n[i]=!0),isNaN(o)||(n[i]=parseInt(o,10))}})}return{formatName:e,formatOptions:n}})(e);if(this.formats[o]){let e=t;try{const a=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},s=a.locale||a.lng||r.locale||r.lng||n;e=this.formats[o](t,s,{...i,...r,...a})}catch(t){this.logger.warn(t)}return e}return this.logger.warn(`there was no format function for ${o}`),t},t);return i}}class rg extends Bp{constructor(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=t,this.store=e,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Fp.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(n,r.backend,r)}queueLoad(t,e,n,r){const o={},i={},a={},s={};return t.forEach(t=>{let r=!0;e.forEach(e=>{const a=`${t}|${e}`;!n.reload&&this.store.hasResourceBundle(t,e)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===i[a]&&(i[a]=!0):(this.state[a]=1,r=!1,void 0===i[a]&&(i[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===s[e]&&(s[e]=!0)))}),r||(a[t]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(s)}}loaded(t,e,n){const r=t.split("|"),o=r[0],i=r[1];e&&this.emit("failedLoading",o,i,e),!e&&n&&this.store.addResourceBundle(o,i,n,void 0,void 0,{skipCopy:!0}),this.state[t]=e?-1:2,e&&n&&(this.state[t]=0);const a={};this.queue.forEach(n=>{((t,e,n)=>{const{obj:r,k:o}=Cp(t,e,Object);r[o]=r[o]||[],r[o].push(n)})(n.loaded,[o],i),((t,e)=>{void 0!==t.pending[e]&&(delete t.pending[e],t.pendingCount--)})(n,t),e&&n.errors.push(e),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(t=>{a[t]||(a[t]={});const e=n.loaded[t];e.length&&e.forEach(e=>{void 0===a[t][e]&&(a[t][e]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(t=>!t.done)}read(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!t.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:t,ns:e,fcName:n,tried:r,wait:o,callback:i});this.readingCalls++;const a=(a,s)=>{if(this.readingCalls--,this.waitingReads.length>0){const t=this.waitingReads.shift();this.read(t.lng,t.ns,t.fcName,t.tried,t.wait,t.callback)}a&&s&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,t,e,n,r+1,2*o,i)},o):i(a,s)},s=this.backend[n].bind(this.backend);if(2!==s.length)return s(t,e,a);try{const n=s(t,e);n&&"function"==typeof n.then?n.then(t=>a(null,t)).catch(a):a(null,n)}catch(t){a(t)}}prepareLoading(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();bp(t)&&(t=this.languageUtils.toResolveHierarchy(t)),bp(e)&&(e=[e]);const o=this.queueLoad(t,e,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(t=>{this.loadOne(t)})}load(t,e,n){this.prepareLoading(t,e,{},n)}reload(t,e,n){this.prepareLoading(t,e,{reload:!0},n)}loadOne(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=t.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(n,i)=>{n&&this.logger.warn(`${e}loading namespace ${o} for language ${r} failed`,n),!n&&i&&this.logger.log(`${e}loaded namespace ${o} for language ${r}`,i),this.loaded(t,n,i)})}saveMissing(t,e,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(e))this.logger.warn(`did not save key "${n}" as the namespace "${e}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){const s={...i,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let o;o=5===u.length?u(t,e,n,r,s):u(t,e,n,r),o&&"function"==typeof o.then?o.then(t=>a(null,t)).catch(a):a(null,o)}catch(t){a(t)}else u(t,e,n,r,a,s)}t&&t[0]&&this.store.addResource(t[0],e,n,r)}}}const og=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if("object"==typeof t[1]&&(e=t[1]),bp(t[1])&&(e.defaultValue=t[1]),bp(t[2])&&(e.tDescription=t[2]),"object"==typeof t[2]||"object"==typeof t[3]){const n=t[3]||t[2];Object.keys(n).forEach(t=>{e[t]=n[t]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),ig=t=>(bp(t.ns)&&(t.ns=[t.ns]),bp(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),bp(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),ag=()=>{};class sg extends Bp{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;var n;if(super(),this.options=ig(t),this.services={},this.logger=Fp,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{"function"==typeof n[t]&&(n[t]=n[t].bind(n))}),e&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,e),this;setTimeout(()=>{this.init(t,e)},0)}}init(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof e&&(n=e,e={}),!e.defaultNS&&!1!==e.defaultNS&&e.ns&&(bp(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=og();this.options={...r,...this.options,...ig(e)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);const o=t=>t?"function"==typeof t?new t:t:null;if(!this.options.isClone){let e;this.modules.logger?Fp.init(o(this.modules.logger),this.options):Fp.init(null,this.options),this.modules.formatter?e=this.modules.formatter:"undefined"!=typeof Intl&&(e=ng);const n=new Hp(this.options);this.store=new _p(this.options.resources,this.options);const i=this.services;i.logger=Fp,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new Xp(n,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!e||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(i.formatter=o(e),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new tg(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new rg(o(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];t.emit(e,...r)}),this.modules.languageDetector&&(i.languageDetector=o(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=o(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new Up(this.services,this.options),this.translator.on("*",function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];t.emit(e,...r)}),this.modules.external.forEach(t=>{t.init&&t.init(this)})}if(this.format=this.options.interpolation.format,n||(n=ag),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const t=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);t.length>0&&"dev"!==t[0]&&(this.options.lng=t[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=function(){return t.store[e](...arguments)}});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=function(){return t.store[e](...arguments),t}});const i=wp(),a=()=>{const t=(t,e)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(e),n(t,e)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return t(null,this.t.bind(this));this.changeLanguage(this.options.lng,t)};return this.options.resources||!this.options.initImmediate?a():setTimeout(a,0),i}loadResources(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ag;const n=bp(t)?t:this.language;if("function"==typeof t&&(e=t),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return e();const t=[],r=e=>{if(!e)return;if("cimode"===e)return;this.services.languageUtils.toResolveHierarchy(e).forEach(e=>{"cimode"!==e&&t.indexOf(e)<0&&t.push(e)})};if(n)r(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(t=>r(t))}this.options.preload&&this.options.preload.forEach(t=>r(t)),this.services.backendConnector.load(t,this.options.ns,t=>{t||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),e(t)})}else e(null)}reloadResources(t,e,n){const r=wp();return"function"==typeof t&&(n=t,t=void 0),"function"==typeof e&&(n=e,e=void 0),t||(t=this.languages),e||(e=this.options.ns),n||(n=ag),this.services.backendConnector.reload(t,e,t=>{r.resolve(),n(t)}),r}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===t.type&&(this.modules.backend=t),("logger"===t.type||t.log&&t.warn&&t.error)&&(this.modules.logger=t),"languageDetector"===t.type&&(this.modules.languageDetector=t),"i18nFormat"===t.type&&(this.modules.i18nFormat=t),"postProcessor"===t.type&&Wp.addPostProcessor(t),"formatter"===t.type&&(this.modules.formatter=t),"3rdParty"===t.type&&this.modules.external.push(t),this}setResolvedLanguage(t){if(t&&this.languages&&!(["cimode","dev"].indexOf(t)>-1))for(let t=0;t<this.languages.length;t++){const e=this.languages[t];if(!(["cimode","dev"].indexOf(e)>-1)&&this.store.hasLanguageSomeTranslations(e)){this.resolvedLanguage=e;break}}}changeLanguage(t,e){var n=this;this.isLanguageChangingTo=t;const r=wp();this.emit("languageChanging",t);const o=t=>{this.language=t,this.languages=this.services.languageUtils.toResolveHierarchy(t),this.resolvedLanguage=void 0,this.setResolvedLanguage(t)},i=(t,i)=>{i?(o(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,r.resolve(function(){return n.t(...arguments)}),e&&e(t,function(){return n.t(...arguments)})},a=e=>{t||e||!this.services.languageDetector||(e=[]);const n=bp(e)?e:this.services.languageUtils.getBestMatchFromCodes(e);n&&(this.language||o(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(n)),this.loadResources(n,t=>{i(t,n)})};return t||!this.services.languageDetector||this.services.languageDetector.async?!t&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t):a(this.services.languageDetector.detect()),r}getFixedT(t,e,n){var r=this;const o=function(t,e){let i;if("object"!=typeof e){for(var a=arguments.length,s=new Array(a>2?a-2:0),u=2;u<a;u++)s[u-2]=arguments[u];i=r.options.overloadTranslationOptionHandler([t,e].concat(s))}else i={...e};i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs,i.ns=i.ns||o.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||n||o.keyPrefix);const l=r.options.keySeparator||".";let c;return c=i.keyPrefix&&Array.isArray(t)?t.map(t=>`${i.keyPrefix}${l}${t}`):i.keyPrefix?`${i.keyPrefix}${l}${t}`:t,r.t(c,i)};return bp(t)?o.lng=t:o.lngs=t,o.ns=e,o.keyPrefix=n,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=e.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const i=(t,e)=>{const n=this.services.backendConnector.state[`${t}|${e}`];return-1===n||0===n||2===n};if(e.precheck){const t=e.precheck(this,i);if(void 0!==t)return t}return!!this.hasResourceBundle(n,t)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(n,t)||r&&!i(o,t)))}loadNamespaces(t,e){const n=wp();return this.options.ns?(bp(t)&&(t=[t]),t.forEach(t=>{this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}),this.loadResources(t=>{n.resolve(),e&&e(t)}),n):(e&&e(),Promise.resolve())}loadLanguages(t,e){const n=wp();bp(t)&&(t=[t]);const r=this.options.preload||[],o=t.filter(t=>r.indexOf(t)<0&&this.services.languageUtils.isSupportedCode(t));return o.length?(this.options.preload=r.concat(o),this.loadResources(t=>{n.resolve(),e&&e(t)}),n):(e&&e(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const e=this.services&&this.services.languageUtils||new Hp(og());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(e.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new sg(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ag;const n=t.forkResourceStore;n&&delete t.forkResourceStore;const r={...this.options,...t,isClone:!0},o=new sg(r);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));return["store","services","language"].forEach(t=>{o[t]=this[t]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n&&(o.store=new _p(this.store.data,r),o.services.resourceStore=o.store),o.translator=new Up(o.services,r),o.translator.on("*",function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];o.emit(t,...n)}),o.init(r,e),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ug=sg.createInstance();ug.createInstance=sg.createInstance,ug.createInstance,ug.dir,ug.init,ug.loadResources,ug.reloadResources,ug.use,ug.changeLanguage,ug.getFixedT,ug.t,ug.exists,ug.setDefaultNamespace,ug.hasLoadedNamespace,ug.loadNamespaces,ug.loadLanguages;var lg="translation";function cg(t,e){ug.addResourceBundle(t,lg,e,!0,!0)}function fg(t){ug.changeLanguage(t)}function dg(t){return ug.getResourceBundle(t,lg)}function hg(t){return ug.on("languageChanged",t),function(){return ug.off("languageChanged",t)}}ug.init({lng:"zh-CN",resources:{}});var pg=ug.t.bind(ug);function gg(t){if(t.removeAttr){t.removeAttr("width"),t.removeAttr("height"),t.removeAttr("fill"),t.removeAttr("class"),t.removeAttr("t"),t.removeAttr("p-id");var e=t.children();e.length&&gg(e)}}function vg(){return h('<svg viewBox="0 0 1024 1024"><path d="M498.7 655.8l-197.6-268c-8.1-10.9-0.3-26.4 13.3-26.4h395.2c13.6 0 21.4 15.4 13.3 26.4l-197.6 268c-6.6 9-20 9-26.6 0z"></path></svg>')}function mg(){return h('<div class="w-e-bar-divider"></div>')}function yg(t,e,n,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!1),e){if(r){var i=Bd?"cmd":"ctrl";r=r.replace("mod",i)}if(o)r&&(t.attr("data-tooltip",r),t.addClass("w-e-menu-tooltip-v5"),t.addClass("tooltip-right"));else{var a=r?"".concat(n,"\n").concat(r):n;t.attr("data-tooltip",a),t.addClass("w-e-menu-tooltip-v5")}}}var bg=function(){function t(t,e,n){void 0===n&&(n=!1);var r=this;this.$elem=h('<div class="w-e-bar-item"></div>'),this.$button=h('<button type="button"></button>'),this.disabled=!1,this.menu=e;var o=e.tag,i=e.width;if("button"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'button'"));var a=e.title,s=e.hotkey,u=void 0===s?"":s,l=e.iconSvg,c=void 0===l?"":l,f=this.$button;if(c){var d=h(c);gg(d),f.append(d)}else f.text(a);yg(f,c,a,u,n),n&&c&&f.append(h('<span class="title">'.concat(a,"</span>"))),i&&f.css("width","".concat(i,"px")),f.attr("data-menu-key",t),this.$elem.append(f),wf(function(){return r.init()})}return t.prototype.init=function(){var t=this;this.setActive(),this.setDisabled(),this.$button.on("click",function(e){e.preventDefault(),Pg(t).hidePanelOrModal(),t.disabled||(t.exec(),t.onButtonClick())})},t.prototype.exec=function(){var t=Pg(this),e=this.menu,n=e.getValue(t);e.exec(t,n),this.changeMenuState()},t.prototype.setActive=function(){var t=Pg(this),e=this.$button,n="active";this.menu.isActive(t)?e.addClass(n):e.removeClass(n)},t.prototype.setDisabled=function(){var t=Pg(this),e=this.$button,n=this.menu.isDisabled(t);(null==t.selection||t.isDisabled())&&(n=!0),this.menu.alwaysEnable&&(n=!1);var r="disabled";n?e.addClass(r):e.removeClass(r),this.disabled=n},t.prototype.setIcon=function(){var t=Pg(this),e=this.$button;if(this.menu.getIcon){var n=this.menu.getIcon(t);if(n){e.find("svg").remove();var r=h(n);gg(r),e.append(r)}}},t.prototype.setTooltip=function(){var t=Pg(this),e=this.$button;if(this.menu.getTitle){var n=this.menu.getTitle(t),r=this.menu.iconSvg;n&&r&&yg(e,r,n)}},t.prototype.changeMenuState=function(){this.setActive(),this.setDisabled(),this.setIcon(),this.setTooltip()},t}(),wg=function(t){function e(e,n,r){return void 0===r&&(r=!1),t.call(this,e,n,r)||this}return ti(e,t),e.prototype.onButtonClick=function(){},e}(bg),xg=function(){function t(t){this.isShow=!1,this.showTime=0,this.record(t)}return t.prototype.record=function(t){var e=fu.get(t);null==e&&(e=new Set,fu.set(t,e)),e.add(this),du.set(this,t)},t.prototype.renderContent=function(t){var e=this.$elem;e.empty(),e.append(t);var n=this.genSelfElem();n&&e.append(n)},t.prototype.appendTo=function(t){var e=this.$elem;t.append(e)},t.prototype.show=function(){if(!this.isShow){this.showTime=Date.now(),this.$elem.show(),this.isShow=!0;var t=du.get(this);t&&t.emit(qs,this)}},t.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var t=du.get(this);t&&t.emit(Js)}},t}(),Sg=function(t){function e(e){var n=t.call(this,e)||this;return n.type="dropPanel",n.$elem=h('<div class="w-e-drop-panel"></div>'),n}return ti(e,t),e.prototype.genSelfElem=function(){return null},e}(xg),Og=function(t){function e(e,n,r){void 0===r&&(r=!1);var o=t.call(this,e,n,r)||this;if(o.dropPanel=null,o.menu=n,n.showDropPanel){var i=vg();o.$button.append(i)}return o}return ti(e,t),e.prototype.onButtonClick=function(){this.menu.showDropPanel&&this.handleDropPanel()},e.prototype.handleDropPanel=function(){var t=this.menu;if(null!=t.getPanelContentElem){var e=Pg(this);if(null==this.dropPanel){var n=new Sg(e),r=t.getPanelContentElem(e);n.renderContent(r),n.appendTo(this.$elem),n.show(),this.dropPanel=n}else{var o=this.dropPanel;if(o.isShow)o.hide();else{r=t.getPanelContentElem(e);o.renderContent(r),o.show()}}var i=this.dropPanel;if(i.isShow){var a=this.$elem,s=a.offset().left,u=a.parents(".w-e-bar");s-u.offset().left>=u.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"})}}},e}(bg),Eg=function(t){function e(e,n){void 0===n&&(n=0);var r=t.call(this,e)||this;r.type="modal",r.$elem=h('<div class="w-e-modal"></div>'),r.width=0,n&&(r.width=n);var o=r.$elem;return o.on("click",function(t){return t.stopPropagation()}),o.on("keyup",function(t){"Escape"===t.code&&(r.hide(),e.restoreSelection())}),r}return ti(e,t),e.prototype.genSelfElem=function(){var t=this,e=h('<span class="btn-close">'.concat('<svg viewBox="0 0 1024 1024"><path d="M1024 896.1024l-128 128L512 640 128 1024 0 896 384 512 0 128 128 0 512 384 896.1024 0l128 128L640 512z"></path></svg>',"</span>")),n=du.get(this);return e.on("click",function(){t.hide(),null==n||n.restoreSelection()}),e},e.prototype.setStyle=function(t){var e=this.width,n=this.$elem;n.attr("style",""),e&&n.css("width","".concat(e,"px")),n.css(t)},e}(xg);function Cg(t,e,n){var r=h('<label class="babel-container"></label>');r.append("<span>".concat(t,"</span>"));var o=h('<input type="text" id="'.concat(e,'" placeholder="').concat(n||"",'">'));return r.append(o),[r[0],o[0]]}function kg(t,e,n){var r=h('<label class="babel-container"></label>');r.append("<span>".concat(t,"</span>"));var o=h('<textarea type="text" id="'.concat(e,'" placeholder="').concat(n||"",'"></textarea>'));return r.append(o),[r[0],o[0]]}function Ng(t,e){var n=h('<div class="button-container"></div>'),r=h('<button type="button" id="'.concat(t,'">').concat(e,"</button>"));return n.append(r),[n[0],r[0]]}var Tg=function(t){function e(e,n,r){void 0===r&&(r=!1);var o=t.call(this,e,n,r)||this;return o.$body=h("body"),o.modal=null,o.menu=n,o}return ti(e,t),e.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal()},e.prototype.getPosition=function(){var t=Pg(this),e=this.menu.getModalPositionNode(t);return s.isElement(e)?pp(t,e,"modal"):hp(t)},e.prototype.handleModal=function(){var t=Pg(this),e=this.menu;if(null==this.modal){var n=new Eg(t,e.modalWidth);this.renderAndShowModal(n,!0),this.modal=n}else{(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1)}},e.prototype.renderAndShowModal=function(t,e){void 0===e&&(e=!1);var n=Pg(this),r=this.menu;if(null!=r.getModalContentElem){var o=Jd.getTextarea(n),i=Jd.getToolbar(n),a=((null==i?void 0:i.getConfig())||{}).modalAppendToBody,s=r.getModalContentElem(n);if(t.renderContent(s),a)t.setStyle({left:"0",right:"0"});else{var u=this.getPosition();t.setStyle(u)}e&&(a?t.appendTo(this.$body):t.appendTo(o.$textAreaContainer)),t.show(),a||gp(n,t.$elem),setTimeout(function(){n.blur()})}},e}(bg);var Lg=function(t){function e(e,n){var r=t.call(this,e)||this;return r.type="selectList",r.$elem=h('<div class="w-e-select-list"></div>'),n&&r.$elem.css("width","".concat(n,"px")),r.$elem.on("click",function(t){t.stopPropagation()}),r}return ti(e,t),e.prototype.renderList=function(t){var e=this.$elem;e.empty();var n=h("<ul></ul>");t.forEach(function(t){var e=t.value,r=t.text,o=t.selected,i=t.styleForRenderMenuList,a=h('<li data-value="'.concat(e,'"></li>'));if(i&&a.css(i),o){var s=h('<svg viewBox="0 0 1446 1024"><path d="M574.116299 786.736392 1238.811249 48.517862C1272.390222 11.224635 1329.414799 7.827718 1366.75664 41.450462 1403.840015 74.840484 1406.731043 132.084741 1373.10189 169.433699L655.118888 966.834607C653.072421 969.716875 650.835807 972.514337 648.407938 975.210759 615.017957 1012.29409 558.292155 1015.652019 521.195664 982.250188L72.778218 578.493306C35.910826 545.297758 32.859041 488.584019 66.481825 451.242134 99.871807 414.158803 156.597563 410.800834 193.694055 444.202665L574.116299 786.736392Z"></path></svg>');a.append(s),a.addClass("selected")}a.append(h('<span data-value="'.concat(e,'">').concat(r,"</span>"))),a.attr("title",r),n.append(a)}),e.append(n)},e.prototype.genSelfElem=function(){return null},e}(xg);var Mg=function(){function t(t,e,n){void 0===n&&(n=!1);var r=this;this.$elem=h('<div class="w-e-bar-item"></div>'),this.$button=h('<button type="button" class="select-button"></button>'),this.disabled=!1,this.selectList=null;var o=e.tag,i=e.title,a=e.width,s=e.iconSvg,u=void 0===s?"":s,l=e.hotkey,c=void 0===l?"":l;if("select"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'select'"));var f=this.$button;a&&f.css("width","".concat(a,"px")),f.attr("data-menu-key",t),yg(f,u,i,c,n),this.$elem.append(f),this.menu=e,wf(function(){return r.init()})}return t.prototype.init=function(){var t=this;this.setSelectedValue(),this.$button.on("click",function(e){e.preventDefault(),Pg(t).hidePanelOrModal(),t.trigger()})},t.prototype.trigger=function(){var t=this,e=Pg(this);if(!e.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new Lg(e,n.selectPanelWidth);var r=this.selectList,o=n.getOptions(e);r.renderList(o),r.appendTo(this.$elem),r.show(),r.$elem.on("click","li",function(e){var n=e.target;if(null!=n){e.preventDefault();var r=h(n).attr("data-value");t.onChange(r)}})}else{if((r=this.selectList).isShow)r.hide();else{o=n.getOptions(e);r.renderList(o),r.show()}}}},t.prototype.onChange=function(t){var e=Pg(this),n=this.menu;n.exec&&n.exec(e,t)},t.prototype.setSelectedValue=function(){var t=Pg(this),e=this.menu,n=e.getValue(t),r=function(t,e){for(var n=t.length,r="",o=0;o<n;o++){var i=t[o];if(i.value===e){r=i.text;break}}return r}(e.getOptions(t),n.toString()),o=this.$button,i=vg();o.empty(),o.text(r),o.append(i)},t.prototype.setDisabled=function(){var t=Pg(this),e=this.menu.isDisabled(t),n=this.$button;(null==t.selection||t.isDisabled())&&(e=!0);var r="disabled";e?n.addClass(r):n.removeClass(r),this.disabled=e},t.prototype.changeMenuState=function(){this.setSelectedValue(),this.setDisabled()},t}(),Rg=function(){function t(t){this.$elem=h('<div class="w-e-bar-item w-e-bar-item-group"></div>'),this.$container=h('<div class="w-e-bar-item-menus-container"></div>'),this.$button=h('<button type="button"></button>');var e=t.key,n=t.iconSvg,r=t.title,o=this.$elem,i=this.$button;if(n){var a=h(n);gg(a),i.append(a)}else i.text(r);i.attr("data-menu-key",e);var s=vg();i.append(s),o.append(i);var u=this.$container;o.append(u);var l=this.createObserver();this.observe(l)}return t.prototype.appendBarItem=function(t){var e=t.$elem;this.$container.append(e)},t.prototype.observe=function(t){var e=this.$container;t.observe(e[0],{childList:!0,subtree:!0,attributes:!0})},t.prototype.createObserver=function(){var t=this,e=this.$container,n=this.$button,r=new MutationObserver(function(){var o=e.find("button"),i=o.length;if(0!==i){var a=0;o.each(function(t){h(t).hasClass("disabled")&&a++}),r.disconnect(),a===i?n.addClass("disabled"):n.removeClass("disabled"),t.observe(r)}});return r},t}(),Dg=new WeakMap;function Pg(t){var e=cu.get(t);if(null==e)throw new Error("Can not get editor instance");return e}function Ag(t,e,n){void 0===n&&(n=!1);var r=Dg.get(e);if(r)return r;var o=e.tag;if("button"===o){var i=e.showDropPanel,a=e.showModal;r=i?new Og(t,e,n):a?new Tg(t,e,n):new wg(t,e,n)}if("select"===o&&(r=new Mg(t,e,n)),null==r)throw new Error("Invalid tag in menu ".concat(JSON.stringify(e)));return Dg.set(e,r),r}function jg(t,e){var n=t.selection;return null!=n&&(!a.isCollapsed(n)&&(!Jd.getSelectedElems(t).some(function(e){if(t.isVoid(e))return!0;var n=e.type;return!!["pre","code","table"].includes(n)})&&!!i.isText(e)))}var Ig=function(){function t(){var t=this;this.$elem=h('<div class="w-e-bar w-e-bar-hidden w-e-hover-bar"></div>'),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null,this.isShow=!1,this.lngListen=function(){},this.changeHoverbarState=W(function(){var n=t.isShow,r=t.getSelectedNodeAndMenuKeys()||{},o=r.node,i=void 0===o?null:o,a=r.menuKeys,u=void 0===a?[]:a,l=t.getEditorInstance();if(null!=i&&t.changeItemsState(),i&&s.isElement(i)&&n){var c=t.isSamePath(i,t.prevSelectedNode);if(!e.isBlock(l,i)&&c)return}t.hideAndClean(),null!=i&&(t.registerItems(u),t.setPosition(i),t.show()),t.prevSelectedNode=i},200),wf(function(){var e=t.getEditorInstance(),n=t.$elem;n.on("mousedown",function(t){return t.preventDefault()},{passive:!1}),Jd.getTextarea(e).$textAreaContainer.append(n),e.on(Us,t.changeHoverbarState);var r=t.hideAndClean.bind(t);e.on(Vs,r),e.on(Hs,r),e.on(Ks,r)}),this.lngListen=hg(function(){t.menus={},t.hideAndClean(),t.getEditorInstance().deselect()})}return t.prototype.getMenus=function(){return this.menus},t.prototype.hideAndClean=function(){var t=this.$elem;t.removeClass("w-e-bar-show").addClass("w-e-bar-hidden"),this.hoverbarItems=[],t.empty(),this.isShow=!1},t.prototype.checkPositionBottom=function(){var t=this.$elem,e=!1,n="undefined"!=typeof window?window.innerHeight:null;n&&n>=360&&(n-t[0].getBoundingClientRect().bottom<360&&(e=!0));e?t.addClass("w-e-bar-bottom"):t.removeClass("w-e-bar-bottom")},t.prototype.show=function(){this.$elem.removeClass("w-e-bar-hidden").addClass("w-e-bar-show"),this.isShow=!0,this.checkPositionBottom()},t.prototype.changeItemsState=function(){var t=this;wf(function(){t.hoverbarItems.forEach(function(t){t.changeMenuState()})})},t.prototype.registerItems=function(t){var e=this,n=this.$elem;t.forEach(function(t){if("|"!==t)e.registerSingleItem(t);else{var r=mg();n.append(r)}})},t.prototype.registerSingleItem=function(t){var e=this.getEditorInstance(),n=this.menus,r=n[t];if(null==r){var o=Gs[t];if(null==o)throw new Error("Not found menu item factory by key '".concat(t,"'"));if("function"!=typeof o)throw new Error("Menu item factory (key='".concat(t,"') is not a function"));r=o(),n[t]=r}var i=e.getMenuConfig(t);i&&void 0!==i.iconSvg&&(r.iconSvg=i.iconSvg);var a=Ag(t,r);this.hoverbarItems.push(a),cu.set(a,e),this.$elem.append(a.$elem)},t.prototype.setPosition=function(t){var e=this.getEditorInstance(),n=this.$elem;if(n.attr("style",""),s.isElement(t)){var r=pp(e,t,"bar");return n.css(r),void gp(e,n)}if(i.isText(t)){r=hp(e);return n.css(r),void gp(e,n)}throw new Error("hoverbar.setPosition error, current selected node is not elem nor text")},t.prototype.getSelectedNodeAndMenuKeys=function(){var t=this.getEditorInstance();if(null==t.selection)return null;var n=this.getHoverbarKeysConf(),r=null,o=[],i=function(i){var a=n[i],s=a.match,u=a.menuKeys,l=void 0===u?[]:u,c=s||function(t,e){return Jd.checkNodeType(e,i)},f=ri(e.nodes(t,{match:function(e){return c(t,e)},universal:!0}),1),d=f[0];if(null!=d)return r=d[0],o=l,"break"};for(var a in n){if("break"===i(a))break}return null==r||0===o.length?null:{node:r,menuKeys:o}},t.prototype.getEditorInstance=function(){var t=uu.get(this);if(null==t)throw new Error("Can not get editor instance");return t},t.prototype.getHoverbarKeysConf=function(){var t=this.getEditorInstance().getConfig().hoverbarKeys,e=void 0===t?{}:t,n=e.text;return n&&null==n.match&&(n.match=jg),e},t.prototype.isSamePath=function(t,e){if(null==t||null==e)return!1;var n=Jd.findPath(null,t),o=Jd.findPath(null,e);return r.equals(n,o)},t.prototype.destroy=function(){var t;this.changeHoverbarState.cancel(),this.$elem.remove(),null===(t=this.lngListen)||void 0===t||t.call(this),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null},t}();function $g(t,e){return Ff(e)&&Jd.hasDOMNode(t,e,{editable:!0})}function Fg(t,e){return Ff(e)&&Jd.hasDOMNode(t,e)}function Bg(t,n){return $g(t,n)||function(t,n){if(t.getConfig().readOnly)return!1;var r=Fg(t,n)&&Jd.toSlateNode(t,n);return!!r&&s.isElement(r)&&e.isVoid(t,r)}(t,n)}const _g=t=>"object"==typeof t&&null!=t&&1===t.nodeType,Wg=(t,e)=>(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t,zg=(t,e)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const n=getComputedStyle(t,null);return Wg(n.overflowY,e)||Wg(n.overflowX,e)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return!1},Ug=(t,e,n,r,o,i,a,s)=>i<t&&a>e||i>t&&a<e?0:i<=t&&s<=n||a>=e&&s>=n?i-t-r:a>e&&s<n||i<t&&s>n?a-e+o:0,Vg=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},Hg=(t,e)=>{var n,r,o,i;if("undefined"==typeof document)return[];const{scrollMode:a,block:s,inline:u,boundary:l,skipOverflowHiddenElements:c}=e,f="function"==typeof l?l:t=>t!==l;if(!_g(t))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,h=[];let p=t;for(;_g(p)&&f(p);){if(p=Vg(p),p===d){h.push(p);break}null!=p&&p===document.body&&zg(p)&&!zg(document.documentElement)||null!=p&&zg(p,c)&&h.push(p)}const g=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,v=null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:innerHeight,{scrollX:m,scrollY:y}=window,{height:b,width:w,top:x,right:S,bottom:O,left:E}=t.getBoundingClientRect(),{top:C,right:k,bottom:N,left:T}=(t=>{const e=window.getComputedStyle(t);return{top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(t);let L="start"===s||"nearest"===s?x-C:"end"===s?O+N:x+b/2-C+N,M="center"===u?E+w/2-T+k:"end"===u?S+k:E-T;const R=[];for(let t=0;t<h.length;t++){const e=h[t],{height:n,width:r,top:o,right:i,bottom:l,left:c}=e.getBoundingClientRect();if("if-needed"===a&&x>=0&&E>=0&&O<=v&&S<=g&&(e===d&&!zg(e)||x>=o&&O<=l&&E>=c&&S<=i))return R;const f=getComputedStyle(e),p=parseInt(f.borderLeftWidth,10),C=parseInt(f.borderTopWidth,10),k=parseInt(f.borderRightWidth,10),N=parseInt(f.borderBottomWidth,10);let T=0,D=0;const P="offsetWidth"in e?e.offsetWidth-e.clientWidth-p-k:0,A="offsetHeight"in e?e.offsetHeight-e.clientHeight-C-N:0,j="offsetWidth"in e?0===e.offsetWidth?0:r/e.offsetWidth:0,I="offsetHeight"in e?0===e.offsetHeight?0:n/e.offsetHeight:0;if(d===e)T="start"===s?L:"end"===s?L-v:"nearest"===s?Ug(y,y+v,v,C,N,y+L,y+L+b,b):L-v/2,D="start"===u?M:"center"===u?M-g/2:"end"===u?M-g:Ug(m,m+g,g,p,k,m+M,m+M+w,w),T=Math.max(0,T+y),D=Math.max(0,D+m);else{T="start"===s?L-o-C:"end"===s?L-l+N+A:"nearest"===s?Ug(o,l,n,C,N+A,L,L+b,b):L-(o+n/2)+A/2,D="start"===u?M-c-p:"center"===u?M-(c+r/2)+P/2:"end"===u?M-i+k+P:Ug(c,i,r,p,k+P,M,M+w,w);const{scrollLeft:t,scrollTop:a}=e;T=0===I?0:Math.max(0,Math.min(a+T/I,e.scrollHeight-n/I+A)),D=0===j?0:Math.max(0,Math.min(t+D/j,e.scrollWidth-r/j+P)),L+=a-T,M+=t-D}R.push({el:e,top:T,left:D})}return R};function Kg(t,e){if(!t.isConnected||!(t=>{let e=t;for(;e&&e.parentNode;){if(e.parentNode===document)return!0;e=e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}return!1})(t))return;const n=(t=>{const e=window.getComputedStyle(t);return{top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(t);if((t=>"object"==typeof t&&"function"==typeof t.behavior)(e))return e.behavior(Hg(t,e));const r="boolean"==typeof e||null==e?void 0:e.behavior;for(const{el:o,top:i,left:a}of Hg(t,(t=>!1===t?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&0!==Object.keys(t).length)(t)?t:{block:"start",inline:"nearest"})(e))){const t=i-n.top+n.bottom,e=a-n.left+n.right;o.scroll({top:t,left:e,behavior:r})}}function qg(t){null!=t.selection&&(t.selection=null,t.onChange())}function Jg(t,e,n){void 0===n&&(n=!1);var r=e.selection,o=e.getConfig(),i=Jd.findDocumentOrShadowRoot(e).getSelection();if(i&&(!t.isComposing||n)&&e.isFocused()){var s="None"!==i.type;if(r||s){var u=xu.get(e),l=!1;if(u.contains(i.anchorNode)&&u.contains(i.focusNode)&&(l=!0),s&&l&&r){var c=Jd.toSlateRange(e,i,{exactMatch:!0,suppressThrow:!0});if(c&&a.equals(c,r)){var f=!0;if(a.isCollapsed(r)){var d=i.anchorNode,h=i.anchorOffset;if(d===u){var p=u.childNodes,g=void 0;(g=p[h])&&g.matches("table")&&(f=!1),(g=p[h-1])&&g.matches("table")&&(f=!1)}}if(f)return}}if(!r||Jd.hasRange(e,r)){t.isUpdatingSelection=!0;var v=r&&Jd.toDOMRange(e,r);if(v){a.isBackward(r)?i.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):i.setBaseAndExtent(v.startContainer,v.startOffset,v.endContainer,v.endOffset);var m=v.startContainer.parentElement;if(!m.closest("[data-slate-spacer]")&&v.getBoundingClientRect){var y=v.getBoundingClientRect.bind(v)();0===y.top&&0===y.right&&0===y.bottom&&0===y.left&&0===y.height&&0===y.width||(m.getBoundingClientRect=v.getBoundingClientRect.bind(v));var b=document.body;Kg(m,{scrollMode:"if-needed",boundary:o.scroll&&u.parentElement||b,block:"end",behavior:"smooth"}),delete m.getBoundingClientRect}}else i.removeAllRanges();setTimeout(function(){v&&_d&&u.focus(),t.isUpdatingSelection=!1})}else e.selection=Jd.toSlateRange(e,i,{exactMatch:!1,suppressThrow:!1})}}}var Gg=new WeakMap,Yg=new WeakMap;var Xg={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z",tab:"tab",selectAll:"mod+a"},Qg={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Zg={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},tv=function(t){var e=Xg[t],n=Qg[t],r=Zg[t],o=e&&U(e),i=n&&U(n),a=r&&U(r);return function(t){return!(!o||!o(t))||(!!(Bd&&i&&i(t))||!(Bd||!a||!a(t)))}},ev={isBold:tv("bold"),isCompose:tv("compose"),isMoveBackward:tv("moveBackward"),isMoveForward:tv("moveForward"),isDeleteBackward:tv("deleteBackward"),isDeleteForward:tv("deleteForward"),isDeleteLineBackward:tv("deleteLineBackward"),isDeleteLineForward:tv("deleteLineForward"),isDeleteWordBackward:tv("deleteWordBackward"),isDeleteWordForward:tv("deleteWordForward"),isExtendBackward:tv("extendBackward"),isExtendForward:tv("extendForward"),isExtendLineBackward:tv("extendLineBackward"),isExtendLineForward:tv("extendLineForward"),isItalic:tv("italic"),isMoveLineBackward:tv("moveLineBackward"),isMoveLineForward:tv("moveLineForward"),isMoveWordBackward:tv("moveWordBackward"),isMoveWordForward:tv("moveWordForward"),isRedo:tv("redo"),isSplitBlock:tv("splitBlock"),isTransposeCharacter:tv("transposeCharacter"),isUndo:tv("undo"),isTab:tv("tab"),isSelectAll:tv("selectAll")};function nv(t){t.preventDefault()}var rv,ov,iv,av={beforeinput:function(n,r,o){var i,s=n,u=o.getConfig().readOnly;if(Hd&&!u&&$g(o,s.target)){null===(i=r.flushDOMSelectionChange)||void 0===i||i.call(r);var l=o.selection,c=s.inputType,f=s.dataTransfer||s.data||void 0;if("insertCompositionText"!==c&&"deleteCompositionText"!==c){if(s.preventDefault(),!c.startsWith("delete")||c.startsWith("deleteBy")){var d=ri(s.getTargetRanges(),1)[0];if(d){var h=Jd.toSlateRange(o,d,{exactMatch:!1,suppressThrow:!1});l&&a.equals(l,h)||t.select(o,h)}}if(l&&a.isExpanded(l)){var p=Jd.getSelectedElems(o),g="table"===p[0].type,v="table-cell"!==p[p.length-1].type;if(g&&v)return;if(c.startsWith("delete")){var m=c.endsWith("Backward")?"backward":"forward";return void e.deleteFragment(o,{direction:m})}}switch(c){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":e.deleteFragment(o);break;case"deleteContent":case"deleteContentForward":e.deleteForward(o);break;case"deleteContentBackward":e.deleteBackward(o);break;case"deleteEntireSoftLine":e.deleteBackward(o,{unit:"line"}),e.deleteForward(o,{unit:"line"});break;case"deleteHardLineBackward":e.deleteBackward(o,{unit:"block"});break;case"deleteSoftLineBackward":e.deleteBackward(o,{unit:"line"});break;case"deleteHardLineForward":e.deleteForward(o,{unit:"block"});break;case"deleteSoftLineForward":e.deleteForward(o,{unit:"line"});break;case"deleteWordBackward":e.deleteBackward(o,{unit:"word"});break;case"deleteWordForward":e.deleteForward(o,{unit:"word"});break;case"insertLineBreak":case"insertParagraph":e.insertBreak(o);break;case"insertFromDrop":case"insertFromComposition":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromComposition"===c&&(r.isComposing=!1,Ru.set(o,!0)),"insertFromPaste"===c&&!Mu.get(o))break;Pf(f)?o.insertData(f):"string"==typeof f&&e.insertText(o,f)}}}},blur:function(t,e,n){var r=t,o=e.isUpdatingSelection,i=e.latestElement;if(!n.getConfig().readOnly&&!o&&$g(n,r.target)){var a=Jd.findDocumentOrShadowRoot(n);if(i!==a.activeElement){var u=r.relatedTarget;if(!(u===Jd.toDOMNode(n,n)||_f(u)&&u.hasAttribute("data-slate-spacer"))){if(null!=u&&Ff(u)&&Jd.hasDOMNode(n,u)){var l=Jd.toSlateNode(n,u);if(s.isElement(l)&&!n.isVoid(l))return}if(Wd){var c=a.getSelection();null==c||c.removeAllRanges()}Nu.delete(n)}}}},focus:function(t,e,n){var r=Jd.toDOMNode(n,n),o=Jd.findDocumentOrShadowRoot(n);e.latestElement=o.activeElement,_d&&t.target!==r?r.focus():Nu.set(n,!0)},click:function(n,o,i){if(!i.getConfig().readOnly&&Fg(i,n.target)&&Ff(n.target)){var a=Jd.toSlateNode(i,n.target),s=Jd.findPath(i,a);if(e.hasPath(i,s))if(u.get(i,s)===a){var l=e.start(i,s),c=e.end(i,s),f=e.void(i,{at:l}),d=e.void(i,{at:c});if(f&&d&&r.equals(f[1],d[1])){var h=e.range(i,l);t.select(i,h)}}}},compositionstart:function(t,n,r){if($g(r,t.target)){Du.delete(r);var o=r.selection;if(o&&a.isExpanded(o)&&(e.deleteFragment(r),Promise.resolve().then(function(){Jg(n,r,!0)})),r.selection){var i=Jd.toDOMRange(r,r.selection).startContainer,s=i.textContent||"";Gg.set(r,s),Yg.set(r,i)}n.isComposing=!0,function(t,e){var n;e.getConfig().placeholder&&e.isEmpty()&&t.showPlaceholder&&(null===(n=t.$placeholder)||void 0===n||n.hide(),t.showPlaceholder=!1)}(n,r)}},compositionend:function(t,n,r){var o=t;if($g(r,o.target)){n.isComposing=!1;var u=!0===Ru.get(r);u?(Ru.delete(r),Du.delete(r)):Du.delete(r);var l=r.selection;if(null!=l){(Vd||_d)&&Jd.cleanExposedTexNodeInSelectionBlock(r);for(var c=a.isBackward(l)?l.focus:l.anchor,f=ri(e.node(r,[c.path[0]]),1)[0],d=0;d<c.path.length;d+=1){var h=ri(e.node(r,c.path.slice(0,d+1)),1)[0];if(s.isElement(h)&&((Wd||_d)&&"link"===h.type||"code"===h.type)){Jd.setNewKey(f);break}}var p=o.data;if(p&&!u){if(r.getConfig().maxLength){var g=Jd.getLeftLengthOfMaxLength(r);if(g<p.length){var v=Jd.toDOMRange(r,l);v.startContainer.nodeType===Node.TEXT_NODE&&(v.startContainer.textContent=Gg.get(r)||""),g>0&&e.insertText(r,p.slice(0,g)),n.changeViewState()}else e.insertText(r,p)}else{var m=Jd.findDocumentOrShadowRoot(r).getSelection();m&&function(t,n){if(a.isCollapsed(n)){var r=n.anchor,o=n.focus;if([2,3].includes(r.path.length)&&[2,3].includes(o.path.length)&&(0===r.offset||0===o.offset)){var s=e.node(t,r.path),u=0===r.offset?r.path:o.path,l=[u[0],u[1]-1];if(0===u[1])return!1;var c=e.node(t,l);if(i.isText(c[0])&&i.isText(s[0]))return!0}}}(r,l)&&(r.selection=Jd.toSlateRange(r,m,{exactMatch:!1,suppressThrow:!1})),e.insertText(r,p)}Wd||setTimeout(function(){var t=r.selection;if(null!=t){var e=Yg.get(r);if(null!=e)Jd.toDOMRange(r,t).startContainer!==e&&(e.textContent=Gg.get(r)||"")}})}}}},compositionupdate:function(t,e,n){$g(n,t.target)&&(e.isComposing=!0)},keydown:function(n,r,o){var i=n,l=o.selection;if(!o.getConfig().readOnly&&!r.isComposing&&$g(o,i.target)){if(function(t,e){var n=su.get(t),r=n&&n.getMenus(),o=lu.get(t),i=o&&o.getMenus(),a=ei(ei({},r),i);for(var s in a){var u=a[s],l=u.hotkey;if(l&&V(l,e)&&!u.isDisabled(t)){var c=u.getValue(t);u.exec(t,c)}}}(o,i),ev.isTab(i))return nv(i),void o.handleTab();if(ev.isRedo(i))return nv(i),void("function"==typeof o.redo&&o.redo());if(ev.isUndo(i))return nv(i),void("function"==typeof o.undo&&o.undo());if(ev.isMoveLineBackward(i))return nv(i),void t.move(o,{unit:"line",reverse:!0});if(ev.isMoveLineForward(i))return nv(i),void t.move(o,{unit:"line"});if(ev.isExtendLineBackward(i))return nv(i),void t.move(o,{unit:"line",edge:"focus",reverse:!0});if(ev.isExtendLineForward(i))return nv(i),void t.move(o,{unit:"line",edge:"focus"});if(ev.isMoveBackward(i))return nv(i),void(l&&a.isCollapsed(l)?t.move(o,{reverse:!0}):t.collapse(o,{edge:"start"}));if(ev.isMoveForward(i))return nv(i),void(l&&a.isCollapsed(l)?t.move(o):t.collapse(o,{edge:"end"}));if(ev.isMoveWordBackward(i))return nv(i),l&&a.isExpanded(l)&&t.collapse(o,{edge:"focus"}),void t.move(o,{unit:"word",reverse:!0});if(ev.isMoveWordForward(i))return nv(i),l&&a.isExpanded(l)&&t.collapse(o,{edge:"focus"}),void t.move(o,{unit:"word"});if(ev.isSelectAll(i))return nv(i),void o.selectAll();if(Hd){if((Vd||Wd)&&l&&(ev.isDeleteBackward(i)||ev.isDeleteForward(i))&&a.isCollapsed(l)){var c=u.parent(o,l.anchor.path);if(s.isElement(c)&&e.isVoid(o,c)&&e.isInline(o,c))return i.preventDefault(),void t.delete(o,{unit:"block"})}}else{if(ev.isBold(i)||ev.isItalic(i)||ev.isTransposeCharacter(i))return void nv(i);if(ev.isSplitBlock(i))return nv(i),void e.insertBreak(o);if(ev.isDeleteBackward(i))return nv(i),void(l&&a.isExpanded(l)?e.deleteFragment(o,{direction:"backward"}):e.deleteBackward(o));if(ev.isDeleteForward(i))return nv(i),void(l&&a.isExpanded(l)?e.deleteFragment(o,{direction:"forward"}):e.deleteForward(o));if(ev.isDeleteLineBackward(i))return nv(i),void(l&&a.isExpanded(l)?e.deleteFragment(o,{direction:"backward"}):e.deleteBackward(o,{unit:"line"}));if(ev.isDeleteLineForward(i))return nv(i),void(l&&a.isExpanded(l)?e.deleteFragment(o,{direction:"forward"}):e.deleteForward(o,{unit:"line"}));if(ev.isDeleteWordBackward(i))return nv(i),void(l&&a.isExpanded(l)?e.deleteFragment(o,{direction:"backward"}):e.deleteBackward(o,{unit:"word"}));if(ev.isDeleteWordForward(i))return nv(i),void(l&&a.isExpanded(l)?e.deleteFragment(o,{direction:"forward"}):e.deleteForward(o,{unit:"word"}))}}},keypress:function(t,n,r){if(!Hd&&!r.getConfig().readOnly&&$g(r,t.target)){t.preventDefault();var o=t.key;e.insertText(r,o)}},copy:function(t,e,n){var r=t;if($g(n,r.target)){n.getConfig().readOnly||r.preventDefault();var o=r.clipboardData;if(null!=o){n.setFragmentData(o);var i=n.getConfig().customCopy;i&&i(n,r)}}},cut:function(n,r,o){var i=n,l=o.selection;if(!o.getConfig().readOnly&&(i.preventDefault(),$g(o,i.target))){var c=i.clipboardData;if(null!=c&&(o.setFragmentData(c),l))if(a.isExpanded(l))e.deleteFragment(o);else{var f=u.parent(o,l.anchor.path);s.isElement(f)&&e.isVoid(o,f)&&t.delete(o)}}},paste:function(t,e,n){Mu.set(n,!0);var r=t;if(!n.getConfig().readOnly&&$g(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return Mu.set(n,!1),void r.preventDefault();if(Wd||!Hd||Uf(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i)}}},dragover:function(t,n,r){if(Fg(r,t.target)){var o=Jd.toSlateNode(r,t.target);s.isElement(o)&&e.isVoid(r,o)&&t.preventDefault()}},dragstart:function(n,r,o){var i=n;if(Fg(o,i.target)&&!o.getConfig().readOnly){var a=Jd.toSlateNode(o,i.target),u=Jd.findPath(o,a);if(s.isElement(a)&&e.isVoid(o,a)||e.void(o,{at:u,voids:!0})){var l=e.range(o,u);t.select(o,l)}var c=i.dataTransfer;if(null!=c)Jd.getSelectedNodeByType(o,"table")||(r.isDraggingInternally=!0,o.setFragmentData(c))}},dragend:function(t,e,n){var r=t;n.getConfig().readOnly||e.isDraggingInternally&&Fg(n,r.target)&&(e.isDraggingInternally=!1)},drop:function(e,n,r){var o=e,i=o.dataTransfer;if(!r.getConfig().readOnly&&Fg(r,o.target)&&null!=i&&!(Hd&&Wd&&i.files.length>0)){o.preventDefault();var a=r.selection,s=Jd.findEventRange(r,o);t.select(r,s),n.isDraggingInternally&&(a&&t.delete(r,{at:a}),n.isDraggingInternally=!1),r.insertData(i),r.isFocused()||r.focus()}}},sv={};!function(){if(iv)return sv;iv=1;var t=Wr(),e=function(){if(ov)return rv;ov=1;var t=bt(),e=de(),n=xt(),r=yt(),o=zr(),i=$r(),a=ce(),s=sn(),u=pe(),l=Object.assign,c=Object.defineProperty,f=e([].concat);return rv=!l||r(function(){if(t&&1!==l({b:1},l(c({},"a",{enumerable:!0,get:function(){c(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},n={},r=Symbol("assign detection"),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach(function(t){n[t]=t}),7!==l({},e)[r]||o(l({},n)).join("")!==i})?function(e,r){for(var l=s(e),c=arguments.length,d=1,h=i.f,p=a.f;c>d;)for(var g,v=u(arguments[d++]),m=h?f(o(v),h(v)):o(v),y=m.length,b=0;y>b;)g=m[b++],t&&!n(p,v,g)||(l[g]=v[g]);return l}:l,rv}();t({target:"Object",stat:!0,arity:2,forced:Object.assign!==e},{assign:e})}();var uv=[];function lv(t){uv.push(t)}var cv={};function fv(t){var e=t.type,n=t.renderElem;cv[e||""]=n}function dv(t,e,n){var r=n.isInline(t)?"span":"div";return H(r,null,e)}function hv(t,n){var r,o=Jd.findKey(n,t),i=n.isInline(t),a=e.isVoid(n,t),s=Od(t.type,o.id),l={id:s,key:o.id,"data-slate-node":"element","data-slate-inline":i},c=t.type,f=t.children,d=void 0===f?[]:f,h=function(t){return cv[t]||dv}(c);r=a?null:d.map(function(e,r){return mv(e,r,t,n)});var p=h(t,r,n);if(a){l["data-slate-void"]=!0;var g=i?"span":"div",v=ri(u.texts(t),1),m=ri(v[0],1)[0],y=mv(m,0,t,n),b=H(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y);p=H(g,{style:{position:"relative"}},p,b),bu.set(m,0),wu.set(m,t)}return null==p.data&&(p.data={}),Object.assign(p.data,l),a||i||(p=function(t,e,n){var r=e;return uv.forEach(function(e){r=e(t,r,n)}),r}(t,p,n)),wf(function(){var e=Kf(s);null!=e&&(Ou.set(o,e),Eu.set(t,e),Su.set(e,t))}),p}function pv(t,e){return void 0===e&&(e=!1),H("span",{"data-slate-string":!0},e?t+"\n":t)}function gv(t,e){return void 0===t&&(t=0),void 0===e&&(e=!1),H("span",{"data-slate-zero-width":e?"n":"z","data-slate-length":t},"\ufeff",e?H("br",null):null)}function vv(t,n,o){if(null==t.text)throw new Error("Current node is not slate Text ".concat(JSON.stringify(t)));var a=Jd.findKey(o,t),s=o.getConfig().decorate;if(null==s)throw new Error("Can not get config.decorate");var l,c=Jd.findPath(o,t),f=s([t,c]),d=i.decorations(t,f),h=d.map(function(i){var a,s=i.leaf,l=i.position,c=function(t,n,o,i,a){void 0===n&&(n=!1);var s=t.text,l=Jd.findPath(a,o),c=r.parent(l);if(e.isEditor(i))throw new Error("Text node ".concat(JSON.stringify(o)," parent is Editor"));return a.isVoid(i)?gv(u.string(i).length):""!==s||i.children[i.children.length-1]!==o||a.isInline(i)||""!==e.string(a,c)?""===s?gv():n&&"\n"===s.slice(-1)?pv(s,!0):pv(s):gv(0,!0)}(s,null!==(a=null==l?void 0:l.isLast)&&void 0!==a?a:1===d.length,t,n,o);return c=function(t,e,n){var r=e;return uv.forEach(function(e){r=e(t,r,n)}),r}(s,c,o),H("span",{"data-slate-leaf":!0},c)}),p=(l=a.id,"w-e-text-".concat(l)),g=H("span",{"data-slate-node":"text",id:p,key:a.id},h);return wf(function(){var e=Kf(p);null!=e&&(Ou.set(a,e),Eu.set(t,e),Su.set(e,t))}),g}function mv(t,e,n,r){return bu.set(t,e),wu.set(t,n),s.isElement(t)?hv(t,r):vv(t,n,r)}var yv=["props","attrs","style","dataset","on","hook"];function bv(t){var e=t.data,n=void 0===e?{}:e,r=t.children,o=void 0===r?[]:r;Object.keys(n).forEach(function(e){var r,o,i=n[e];if("key"!==e){if(!yv.includes(e)){if(e.startsWith("data-")){var a=e.slice(5);return a=tt(a),function(t,e){null==t.data&&(t.data={});var n=t.data;null==n.dataset&&(n.dataset={});Object.assign(n.dataset,e)}(t,((r={})[a]=i,r)),void delete n[e]}!function(t,e){null==t.data&&(t.data={});var n=t.data;null==n.props&&(n.props={});Object.assign(n.props,e)}(t,(o={},o[e]=i,o)),delete n[e]}}else t.key=i}),o.length>0&&o.forEach(function(t){"string"!=typeof t&&bv(t)})}function wv(t,e){var n,r,o=t.$scroll,i=(n=t.id,"w-e-textarea-".concat(n)),a=e.getConfig(),u=a.readOnly,l=a.autoFocus,c=function(t,e){return void 0===e&&(e=!1),Z("div#".concat(t),{props:{contentEditable:!e}})}(i,u),f=e.children||[];c.children=f.map(function(t,n){if(mu.has(t)){var r=mu.get(t);if(r){var o=ri(r,2),i=o[0],a=o[1];if(a)return i!==n&&(bu.set(t,n),mu.set(t,[n,a])),a}}var u=mv(t,n,e,e);bv(u);var l=e.getConfig().skipCacheTypes,c=void 0===l?["list-item"]:l;return s.isElement(t)&&c.includes(t.type)||mu.set(t,[n,u]),u});var d=pu.get(t);if(null==d&&(d=!0),d){var p=function(t){return h('<div\n id="'.concat(t,'"\n data-slate-editor\n data-slate-node="value"\n suppressContentEditableWarning\n role="textarea"\n spellCheck="true"\n autoCorrect="true"\n autoCapitalize="true"\n ></div>'))}(i);o.append(p),t.$textArea=p,r=p[0],(v=K([q,J,G,Y,X,Q]))(r,c),pu.set(t,!1),gu.set(t,v)}else{var g=vu.get(t),v=gu.get(t);if(null==g||null==v)return;r=g.elm,v(g,c)}if(null!=r||null!=(r=Kf(i))){if((d?l:e.isFocused())&&r.focus({preventScroll:!0}),d){var m=$f(r);m&&ku.set(e,m)}xu.set(e,r),Eu.set(e,r),Su.set(r,e),vu.set(t,c)}}var xv=1,Sv=function(){function e(e){var n=this;this.selectionChangeRoot=null,this.destroyed=!1,this.id=xv++,this.$textArea=null,this.$progressBar=h('<div class="w-e-progress-bar"></div>'),this.$maxLengthInfo=h('<div class="w-e-max-length-info"></div>'),this.isComposing=!1,this.isUpdatingSelection=!1,this.isDraggingInternally=!1,this.latestElement=null,this.showPlaceholder=!1,this.$placeholder=null,this.latestEditorSelection=null,this.onDOMSelectionChange=z(function(e){var r=_f(null==e?void 0:e.target)?e.target:null,o=null==r?void 0:r.tagName;if("INPUT"!==o&&"TEXTAREA"!==o){var i=n.getActiveEditor();null!=i&&function(e,n){var r=e.isComposing,o=e.isUpdatingSelection,i=e.isDraggingInternally,a=n.getConfig();if(!o&&!i){var s=Jd.findDocumentOrShadowRoot(n),u=s.activeElement,l=Jd.toDOMNode(n,n),c=s.getSelection();if(u!==l)return Nu.delete(n),void qg(n);if(e.latestElement=u,Nu.set(n,!0),!c)return qg(n);var f=c.anchorNode,d=c.focusNode,h=Bg(n,f),p=Fg(n,d);if(!r)if(h&&p){var g=Jd.toSlateRange(n,c,{exactMatch:!1,suppressThrow:!0});g&&t.select(n,g)}else a.readOnly&&qg(n)}}(n,i)}},100);var r=h(e);if(0===r.length)throw new Error("Cannot find textarea DOM by selector '".concat(e,"'"));this.$box=r;var o=h('<div class="w-e-text-container"></div>');o.append(this.$progressBar),o.append(this.$maxLengthInfo),r.append(o);var i=h('<div class="w-e-scroll"></div>');o.append(i),this.$scroll=i,this.$textAreaContainer=o,wf(function(){var t=n.getActiveEditor();if(null!=t){n.bindSelectionChange(t),o.on("click",function(){return t.hidePanelOrModal()}),t.on(Us,n.changeViewState.bind(n));var e=t.getConfig(),i=e.onChange,a=e.scroll;i&&t.on(Us,function(){return i(t)}),a||(r.css("position","relative"),o.addClass("no-scroll")),n.onFocusAndOnBlur(),t.on(Us,n.changeMaxLengthInfo.bind(n)),n.bindEvent()}})}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var t=iu.get(this);if(null==t)throw new Error("Can not get editor instance");return t},enumerable:!1,configurable:!0}),e.prototype.getActiveEditor=function(){if(this.destroyed)return null;var t=iu.get(this);return null==t||t.isDestroyed?null:t},e.prototype.bindSelectionChange=function(t,e){var n=this;if(void 0===e&&(e=5),null==this.selectionChangeRoot&&!t.isDestroyed){try{var r=Jd.findDocumentOrShadowRoot(t);r.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=r}catch(r){if(e>0)return void setTimeout(function(){return n.bindSelectionChange(t,e-1)},0);window.document.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=window.document}t.on(zs,function(){var t;null===(t=n.selectionChangeRoot)||void 0===t||t.removeEventListener("selectionchange",n.onDOMSelectionChange),n.selectionChangeRoot=null})}},e.prototype.flushDOMSelectionChange=function(){this.onDOMSelectionChange.flush()},e.prototype.bindEvent=function(){var t=this,e=this.$textArea,n=this.$scroll,r=this.editorInstance;null!=e&&(d(av,function(n,o){e.on(o,function(e){n(e,t,r)})}),r.getConfig().scroll&&(n.css("overflow-y","auto"),n.on("scroll",z(function(){r.emit(Vs)},100))))},e.prototype.onFocusAndOnBlur=function(){var t=this,e=this.getActiveEditor();if(null!=e){var n=e.getConfig(),r=n.onBlur,o=n.onFocus;this.latestEditorSelection=e.selection,e.on(Us,function(){null==t.latestEditorSelection&&null!=e.selection?setTimeout(function(){t.destroyed||e.isDestroyed||o&&o(e)}):null!=t.latestEditorSelection&&null==e.selection&&setTimeout(function(){t.destroyed||e.isDestroyed||r&&r(e)}),t.latestEditorSelection=e.selection})}},e.prototype.changeMaxLengthInfo=function(){var t=this.getActiveEditor();if(null!=t){var e=t.getConfig().maxLength;if(e){var n=e-Jd.getLeftLengthOfMaxLength(t);this.$maxLengthInfo[0].innerHTML="".concat(n,"/").concat(e)}}},e.prototype.changeProgress=function(t){var e=this.$progressBar;e.css("width","".concat(t,"%")),t>=100&&setTimeout(function(){e.hide(),e.css("width","0"),e.show()},1e3)},e.prototype.changeViewState=function(){var t=this,e=this.getActiveEditor();null!=e&&(wv(this,e),function(t,e){var n,r=e.getConfig().placeholder;if(r){var o=e.isEmpty();if(o&&!t.showPlaceholder&&!t.isComposing){if(null==t.$placeholder){var i=h('<div class="w-e-text-placeholder">'.concat(r,"</div>"));t.$textAreaContainer.append(i),t.$placeholder=i}return t.$placeholder.show(),void(t.showPlaceholder=!0)}!o&&t.showPlaceholder&&(null===(n=t.$placeholder)||void 0===n||n.hide(),t.showPlaceholder=!1)}}(this,e),wf(function(){t.destroyed||e.isDestroyed||Jg(t,e)}))},e.prototype.destroy=function(){var t;this.destroyed=!0,this.onDOMSelectionChange.cancel(),null===(t=this.selectionChangeRoot)||void 0===t||t.removeEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=null,this.$textAreaContainer.remove()},e}();function Ov(t,n,r,o){if(bu.set(t,n),wu.set(t,r),s.isElement(t)){var i=t.children;if((void 0===i?[]:i).forEach(function(e,n){return Ov(e,n,t,o)}),e.isVoid(o,t)){var a=ri(u.texts(t),1),l=ri(a[0],1)[0];bu.set(l,0),wu.set(l,t)}}}function Ev(t){var e=t.selector,n=void 0===e?"":e,r=t.config,o=void 0===r?{}:r,i=t.content,a=t.html,s=t.plugins,u=void 0===s?[]:s,l=function(t){return[sp,zh,Pu,_h,mp,ip,fp,Ko].reduce(function(t,e){return e(t)},t)}(c());if(n&&function(t,e){return xd(t,"data-w-e-textarea",e)}(l,n))throw new Error("Repeated create editor by selector '".concat(n,"'"));var h=function(t){void 0===t&&(t={});var e=f(_s),n={},r=t.MENU_CONF,o=void 0===r?{}:r;return d(e,function(t,e){n[e]=ei(ei({},t),o[e]||{})}),delete t.MENU_CONF,ei({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return[]},maxLength:0,MENU_CONF:n,hoverbarKeys:{},textStyleMode:"inline",classStylePolicy:"preserve-data",sanitizeHtml:Bs,customAlert:function(t,e){window.alert("".concat(e,":\n").concat(t))}},t)}(o);hu.set(l,h);var p=h.hoverbarKeys,g=void 0===p?{}:p;if(u.forEach(function(t){l=t(l)}),function(t,e){var n=e.html,r=e.content;null!=n?t.children=Sd(t,n):r&&r.length&&(t.children=r),0===t.children.length&&(t.children=[{type:"paragraph",children:[{text:""}]}])}(l,{html:a,content:i}),n){var v=new Sv(n);ou.set(l,v),iu.set(v,l),v.changeViewState();var m=void 0;Object.keys(g).length>0&&(m=new Ig,uu.set(m,l),lu.set(l,m)),l.on(Us,function(){l.hidePanelOrModal()}),l.on(Vs,function(){l.hidePanelOrModal()})}else l.children.forEach(function(t,e){return Ov(t,e,l,l)});var y=h.onCreated,b=h.onDestroyed;return y&&l.on(Ws,function(){return y(l)}),b&&l.on(zs,function(){return b(l)}),wf(function(){return l.emit(Ws)}),l}var Cv,kv,Nv,Tv,Lv,Mv={};function Rv(){if(Tv)return Nv;Tv=1;var t=Ne(),e=TypeError;return Nv=function(n,r){if(!delete n[r])throw new e("Cannot delete property "+t(r)+" of "+t(n))}}!function(){if(Lv)return Mv;Lv=1;var t=Wr(),e=sn(),n=mr(),r=vr(),o=br(),i=function(){if(kv)return Cv;kv=1;var t=bt(),e=To(),n=TypeError,r=Object.getOwnPropertyDescriptor,o=t&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();return Cv=o?function(t,o){if(e(t)&&!r(t,"length").writable)throw new n("Cannot set read only .length");return t.length=o}:function(t,e){return t.length=e}}(),a=Yo(),s=Ro(),u=Xo(),l=Rv(),c=Qo()("splice"),f=Math.max,d=Math.min;t({target:"Array",proto:!0,forced:!c},{splice:function(t,c){var h,p,g,v,m,y,b=e(this),w=o(b),x=n(t,w),S=arguments.length;for(0===S?h=p=0:1===S?(h=0,p=w-x):(h=S-2,p=d(f(r(c),0),w-x)),a(w+h-p),g=s(b,p),v=0;v<p;v++)(m=x+v)in b&&u(g,v,b[m]);if(g.length=p,h<p){for(v=x;v<w-p;v++)y=v+h,(m=v+p)in b?b[y]=b[m]:l(b,y);for(v=w;v>w-p+h;v--)l(b,v-1)}else if(h>p)for(v=w-p;v>x;v--)y=v+h-1,(m=v+p-1)in b?b[y]=b[m]:l(b,y);for(v=0;v<h;v++)b[v+x]=arguments[v+2];return i(b,w-p+h),g}})}();var Dv=function(){function t(t,e){var n=this;this.$toolbar=h('<div class="w-e-bar w-e-bar-show w-e-toolbar"></div>'),this.menus={},this.toolbarItems=[],this.config={},this.lngListen=function(){},this.syncToolbarState=function(){n.toolbarItems.forEach(function(t){t.changeMenuState()})},this.changeToolbarState=W(function(){n.syncToolbarState()},200),this.config=e;var r=h(t);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '".concat(t,"'"));this.$box=r;var o=this.$toolbar;o.on("mousedown",function(t){return t.preventDefault()},{passive:!1}),r.append(o),wf(function(){n.initToolbar(),n.lngListen=hg(function(){return n.initToolbar()});var t=n.getEditorInstance();t.on(Us,n.changeToolbarState),t.on(Hs,n.syncToolbarState),t.on(Ks,n.syncToolbarState)})}return t.prototype.getMenus=function(){return this.menus},t.prototype.getConfig=function(){return this.config},t.prototype.initToolbar=function(){this.menus={};var t=this.$toolbar;null==t||t.empty(),this.registerItems(),this.changeToolbarState()},t.prototype.registerItems=function(){var t=this,e="",n=this.$toolbar,r=this.config,o=r.toolbarKeys,i=void 0===o?[]:o,a=r.insertKeys,s=void 0===a?{index:0,keys:[]}:a,u=r.excludeKeys,l=void 0===u?[]:u,c=f(i),d=[];d=Array.isArray(s)?s:[s];var h=0;d.forEach(function(t){var e=t.index+h;if(t.replaceFn&&c[e]){var n=t.replaceFn(c[e]);if(!n)throw new Error("This function needs to return the menu configuration:string | IMenuGroup");c[e]=n}t.keys.length>0&&("string"==typeof t.keys&&(t.keys=[t.keys]),t.keys.forEach(function(t,n){c.splice(e+n,0,t)}),h+=t.keys.length)});var p=c.filter(function(t){var e="string"==typeof t?t:t.key;return!l.includes(e)}),g=p.length;p.forEach(function(r,o){if("|"===r){if(0===o)return;if(o+1===g)return;if("|"===e)return;var i=mg();return n.append(i),void(e=r)}if("string"==typeof r)return t.registerSingleItem(r,t),void(e=r);t.registerGroup(r),e="group"})},t.prototype.registerGroup=function(t){var e=this,n=this.$toolbar,r=function(t){return new Rg(t)}(t),o=t.menuKeys,i=void 0===o?[]:o,a=this.config.excludeKeys,s=void 0===a?[]:a;i.forEach(function(t){s.includes(t)||e.registerSingleItem(t,r)}),n.append(r.$elem)},t.prototype.registerSingleItem=function(t,e){var n=this.getEditorInstance(),r=e instanceof Rg,o=this.menus,i=o[t];if(null==i){var a=Gs[t];if(null==a)throw new Error("Not found menu item factory by key '".concat(t,"'"));if("function"!=typeof a)throw new Error("Menu item factory (key='".concat(t,"') is not a function"));i=a(),o[t]=i}else console.warn("Duplicated toolbar menu key '".concat(t,"'\n重复注册了菜单栏 menu '").concat(t,"'"));var s=n.getMenuConfig(t);s&&void 0!==s.iconSvg&&(i.iconSvg=s.iconSvg);var u=Ag(t,i,r);(this.toolbarItems.push(u),cu.set(u,n),r)?e.appendBarItem(u):e.$toolbar.append(u.$elem)},t.prototype.getEditorInstance=function(){var t=au.get(this);if(null==t)throw new Error("Can not get editor instance");return t},t.prototype.destroy=function(){var t;this.$toolbar.remove(),null===(t=this.lngListen)||void 0===t||t.call(this),this.menus={},this.toolbarItems=[]},t}();function Pv(t,e){if(null==t)throw new Error("Cannot create toolbar, because editor is null");var n=e.selector,r=e.config,o=void 0===r?{}:r;if(function(t,e){return xd(t,"data-w-e-toolbar",e)}(t,n))throw new Error("Repeated create toolbar by selector '".concat(n,"'"));var i=ei({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),a=new Dv(n,i);return au.set(a,t),su.set(t,a),a}function Av(t){return t&&"class"===t.getConfig().textStyleMode?"class":"inline"}function jv(t){if(!t)return"preserve-data";var e=t.getConfig().classStylePolicy;return"fallback-inline"===e?"fallback-inline":"strict"===e?"strict":"preserve-data"}function Iv(t,e){var n=null==t?void 0:t.getConfig().onClassStyleUnsupported;n?n(e):console.warn(e.message)}function $v(t){return t||{name:""}}function Fv(t){var e=t.server,n=void 0===e?"":e,r=t.fieldName,o=void 0===r?"":r,i=t.maxFileSize,a=void 0===i?10485760:i,s=t.maxNumberOfFiles,u=void 0===s?100:s,l=t.meta,c=void 0===l?{}:l,f=t.metaWithUrl,h=void 0!==f&&f,p=t.headers,g=void 0===p?{}:p,v=t.withCredentials,m=void 0!==v&&v,y=t.timeout,b=void 0===y?1e4:y,w=t.onBeforeUpload,x=void 0===w?function(t){return t}:w,S=t.onSuccess,O=void 0===S?function(t,e){}:S,E=t.onError,C=void 0===E?function(t,e,n){console.error("".concat(t.name," upload error"),e,n)}:E,k=t.onProgress,N=void 0===k?function(t){}:k;if(!n)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!o)throw new Error("Cannot get fieldName\n没有配置 fieldName");var T=n;h&&(T=function(t,e){var n=ri(t.split("#"),2),r=n[0],o=n[1],i=[];d(e,function(t,e){i.push("".concat(e,"=").concat(t))});var a=i.join("&");return r=r.indexOf("?")>0?"".concat(r,"&").concat(a):"".concat(r,"?").concat(a),o?"".concat(r,"#").concat(o):r}(T,c));var L=new et(ei({onBeforeUpload:function(t){return x(t)},restrictions:{maxFileSize:a,maxNumberOfFiles:u},meta:c},t.uppyConfig)).use(nt,ei({endpoint:T,headers:g,formData:!0,fieldName:o,bundle:!1,withCredentials:m,timeout:b},t.xhrConfig));return L.on("upload-success",function(t,e){var n=(null!=e?e:{}).body,r=void 0===n?{}:n,o=$v(t);try{O(o,r)}catch(t){console.error("wangEditor upload file - onSuccess error",t)}}),L.on("progress",function(t){t<1||N(t)}),L.on("upload-error",function(t,e,n){var r=$v(t);try{C(r,e,n)}catch(t){console.error("wangEditor upload file - onError error",t)}}),L.on("restriction-failed",function(t,e){var n=$v(t);try{C(n,e,void 0)}catch(t){console.error("wangEditor upload file - onError error",t)}}),L}function Bv(t,e){return t.uploadAdapter?t.uploadAdapter({config:t,editor:e}):Fv(t)}export{Cf as DOMComment,kf as DOMElement,Ef as DOMNode,Tf as DOMRange,Lf as DOMSelection,Mf as DOMStaticRange,Nf as DOMText,Jd as DomEditor,kd as ELEM_TO_HTML_CONF,Sf as NodeType,fd as PARSE_ELEM_HTML_CONF,ld as PARSE_STYLE_HTML_FN_LIST,sd as PRE_PARSE_HTML_CONF_LIST,cv as RENDER_ELEM_CONF,uv as RENDER_STYLE_HANDLER_LIST,Ed as STYLE_TO_HTML_FN_LIST,ad as TEXT_TAGS,Dv as Toolbar,Ev as coreCreateEditor,Pv as coreCreateToolbar,Bv as createUploader,Fv as createUppyUploader,Ng as genModalButtonElems,Cg as genModalInputElems,kg as genModalTextareaElems,jv as getClassStylePolicy,$f as getDefaultView,Jf as getEditableChild,qf as getEditableChildAndIndex,Kf as getElementById,Yf as getFirstVoidChild,Gf as getPlainText,Qf as getTagName,Av as getTextStyleMode,Hf as hasShadowRoot,cg as i18nAddResources,fg as i18nChangeLanguage,dg as i18nGetResources,hg as i18nListenLanguage,Bf as isDOMComment,_f as isDOMElement,Ff as isDOMNode,Wf as isDOMSelection,zf as isDOMText,Pf as isDataTransfer,Rf as isDocument,If as isHTMLElememt,Uf as isPlainTextOnlyPaste,Df as isShadowRoot,jf as isUnprocessedListElement,Vf as normalizeDOMPoint,Nd as registerElemToHtmlConf,Ys as registerMenu,dd as registerParseElemHtmlConf,cd as registerParseStyleHtmlHandler,ud as registerPreParseHtmlConf,fv as registerRenderElemConf,lv as registerStyleHandler,Cd as registerStyleToHtmlHandler,Iv as reportUnsupportedClassStyle,pg as t,Xf as walkTextNodes};
1
+ import*as e from"nanoid/non-secure";import t from"lodash.throttle";import n from"lodash.foreach";import"nanoid";import{Transforms as r,Editor as o,Operation as i,Path as s,isObject as a,Text as l,Range as u,Element as c,Node as d,Point as h,createEditor as p}from"slate";import f from"lodash.clonedeep";import g,{css as v,append as m,addClass as y,removeClass as b,hasClass as w,on as x,focus as S,attr as _,removeAttr as O,hide as E,show as k,offset as C,width as P,height as N,parent as T,parents as M,is as L,dataset as R,val as $,text as F,html as D,children as A,remove as j,find as I,each as U,empty as B}from"dom7";import H from"lodash.toarray";import z from"lodash.debounce";import{isKeyHotkey as W,isHotkey as V}from"is-hotkey";import{jsx as q,init as K,classModule as J,propsModule as X,styleModule as G,datasetModule as Y,eventListenersModule as Q,attributesModule as Z,h as ee}from"snabbdom";import te from"lodash.camelcase";var ne=function(e,t){return ne=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ne(e,t)};function re(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}ne(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var oe=function(){return oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},oe.apply(this,arguments)};function ie(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function se(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function ae(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function le(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ue(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}"function"==typeof SuppressedError&&SuppressedError;var ce,de,he,pe={exports:{}},fe={};function ge(){if(he)return fe;he=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.justErrorsLogger=fe.debugLogger=void 0;const e=function(){if(de)return ce;function e(e){return e<10?`0${e}`:e.toString()}return de=1,ce=function(){const t=new Date;return`${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`}}(),t={debug:()=>{},warn:()=>{},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.error(`[Uppy] [${e()}]`,...n)}};fe.justErrorsLogger=t;const n={debug:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.debug(`[Uppy] [${e()}]`,...n)},warn:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.warn(`[Uppy] [${e()}]`,...n)},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.error(`[Uppy] [${e()}]`,...n)}};return fe.debugLogger=n,fe}var ve,me,ye,be,we,xe,Se,_e,Oe,Ee,ke,Ce,Pe,Ne,Te,Me,Le,Re,$e,Fe,De,Ae,je,Ie,Ue,Be,He,ze,We,Ve,qe,Ke=ue(e),Je={};function Xe(){return me?ve:(me=1,ve=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),n.length-1);e=Number(e/Math.pow(1024,r));var o=n[r];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+o:(t?"-":"")+e.toFixed(1)+" "+o})}function Ge(){if(be)return ye;function e(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return be=1,e.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(n=(e||"").split(this.separator),t=0;r&&t<i;t++)"*"!==o[t]&&(r=t<n.length&&o[t]===n[t]);r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var s in r={},e)this.match(s)&&(r[s]=e[s]);return r},ye=function(t,n,r){var o=new e(t,r||/[\/\.]/);return void 0!==n?o.match(n):o},ye}function Ye(){if(Se)return Je;Se=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.defaultOptions=Je.RestrictionError=Je.Restricter=void 0;const e=Xe(),t=function(){if(xe)return we;xe=1;var e=Ge(),t=/[\/\+\.]/;return we=function(n,r){function o(r){var o=e(r,n,t);return o&&o.length>=2}return r?o(r.split(";")[0]):o}}();Je.defaultOptions={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class n extends Error{constructor(){super(...arguments),this.isRestriction=!0}}Je.RestrictionError=n,"undefined"==typeof AggregateError&&(globalThis.AggregateError=class extends Error{constructor(e,t){super(t),this.errors=e}});return Je.Restricter=class{constructor(e,t){this.i18n=t,this.getOpts=()=>{const t=e();if(null!=t.restrictions.allowedFileTypes&&!Array.isArray(t.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return t}}validate(r,o){const{maxFileSize:i,minFileSize:s,maxTotalFileSize:a,maxNumberOfFiles:l,allowedFileTypes:u}=this.getOpts().restrictions;if(l){const e=o.filter(e=>!e.isGhost);if(e.length+1>l)throw new n(`${this.i18n("youCanOnlyUploadX",{smart_count:l})}`)}if(u){if(!u.some(e=>e.includes("/")?!!r.type&&t(r.type.replace(/;.*?$/,""),e):!("."!==e[0]||!r.extension)&&r.extension.toLowerCase()===e.slice(1).toLowerCase())){const e=u.join(", ");throw new n(this.i18n("youCanOnlyUploadFileTypes",{types:e}))}}if(a&&null!=r.size){const t=o.reduce((e,t)=>e+t.size,r.size);if(t>a)throw new n(this.i18n("exceedsSize",{size:e(a),file:r.name}))}if(i&&null!=r.size&&r.size>i)throw new n(this.i18n("exceedsSize",{size:e(i),file:r.name}));if(s&&null!=r.size&&r.size<s)throw new n(this.i18n("inferiorSize",{size:e(s)}))}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(Object.keys(e).length<t)throw new n(this.i18n("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new n(this.i18n("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:r}=this.getOpts().restrictions,o=Object.prototype.hasOwnProperty,i=[];for(const t of r)o.call(e.meta,t)&&""!==e.meta[t]||i.push(t);return{missingFields:i,error:t}}},Je}function Qe(){if(Oe)return _e;return Oe=1,_e=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}function Ze(){if(ke)return Ee;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}ke=1;var t=0;function n(e){return"__private_"+t+++"_"+e}const r=Qe();function o(e,t,n){const r=[];return e.forEach(e=>"string"!=typeof e?r.push(e):t[Symbol.split](e).forEach((e,t,o)=>{""!==e&&r.push(e),t<o.length-1&&r.push(n)})),r}
2
+ /**
3
+ * Takes a string with placeholder variables like `%{smart_count} file selected`
4
+ * and replaces it with values from options `{smart_count: 5}`
5
+ *
6
+ * @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
7
+ * taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
8
+ *
9
+ * @param {string} phrase that needs interpolation, with placeholders
10
+ * @param {object} options with values that will be used to replace placeholders
11
+ * @returns {any[]} interpolated
12
+ */function i(e,t){const n=/\$/g;let r=[e];if(null==t)return r;for(const e of Object.keys(t))if("_"!==e){let i=t[e];"string"==typeof i&&(i=n[Symbol.replace](i,"$$$$")),r=o(r,new RegExp(`%\\{${e}\\}`,"g"),i)}return r}var s=n("apply");function a(e){if(null==e||!e.strings)return;const t=this.locale;this.locale={...t,strings:{...t.strings,...e.strings}},this.locale.pluralize=e.pluralize||t.pluralize}return Ee=class{constructor(t){Object.defineProperty(this,s,{value:a}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(t)?t.forEach(e(this,s)[s],this):e(this,s)[s](t)}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){if(!r(this.locale.strings,e))throw new Error(`missing string: ${e}`);const n=this.locale.strings[e];if("object"==typeof n){if(t&&void 0!==t.smart_count){return i(n[this.locale.pluralize(t.smart_count)],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}return i(n,t)}},Ee}function et(){return Pe||(Pe=1,Ce=function(){var e={},t=e._fns={};return e.emit=function(e,n,r,o,i,s,a){var l=function(e){var n=t[e]?t[e]:[],r=e.indexOf(":"),o=-1===r?[e]:[e.substring(0,r),e.substring(r+1)],i=Object.keys(t),s=0,a=i.length;for(;s<a;s++){var l=i[s];if("*"===l&&(n=n.concat(t[l])),2===o.length&&o[0]===l){n=n.concat(t[l]);break}}return n}(e);l.length&&function(e,t,n){var r=0,o=t.length;for(;r<o&&t[r];r++)t[r].event=e,t[r].apply(t[r],n)}(e,l,[n,r,o,i,s,a])},e.on=function(e,n){t[e]||(t[e]=[]),t[e].push(n)},e.once=function(t,n){this.on(t,function r(){n.apply(this,arguments),e.off(t,r)})},e.off=function(e,t){var n=[];if(e&&t)for(var r=this._fns[e],o=0,i=r?r.length:0;o<i;o++)r[o]!==t&&n.push(r[o]);n.length?this._fns[e]=n:delete this._fns[e]},e}),Ce}function tt(){if(Te)return Ne;Te=1;var e=0;function t(t){return"__private_"+e+++"_"+t}var n=t("publish");class r{constructor(){Object.defineProperty(this,n,{value:o}),this.state={},this.callbacks=[]}getState(){return this.state}setState(e){const t={...this.state},r={...this.state,...e};this.state=r,function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}(this,n)[n](t,r,e)}subscribe(e){return this.callbacks.push(e),()=>{this.callbacks.splice(this.callbacks.indexOf(e),1)}}}function o(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.callbacks.forEach(e=>{e(...t)})}return r.VERSION="2.1.1",Ne=function(){return new r}}function nt(){if(Le)return Me;return Le=1,Me=function(e){const t=e.lastIndexOf(".");return-1===t||t===e.length-1?{name:e,extension:void 0}:{name:e.slice(0,t),extension:e.slice(t+1)}}}function rt(){return $e?Re:($e=1,Re={md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"})}function ot(){if(qe)return Ve;qe=1;var e=Ke,n=ge(),r=Ye();let o,i;function s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var a=0;function l(e){return"__private_"+a+++"_"+e}const u=Ze(),c=et(),d=t,h=tt(),p=function(){if(De)return Fe;De=1;const e=nt(),t=rt();return Fe=function(n){var r;if(n.type)return n.type;const o=n.name?null==(r=e(n.name).extension)?void 0:r.toLowerCase():null;return o&&o in t?t[o]:"application/octet-stream"}}(),f=nt(),g=function(){if(je)return Ae;function e(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}return je=1,Ae=function(t){let n="uppy";return"string"==typeof t.name&&(n+=`-${e(t.name.toLowerCase())}`),void 0!==t.type&&(n+=`-${t.type}`),t.meta&&"string"==typeof t.meta.relativePath&&(n+=`-${e(t.meta.relativePath.toLowerCase())}`),void 0!==t.data.size&&(n+=`-${t.data.size}`),void 0!==t.data.lastModified&&(n+=`-${t.data.lastModified}`),n}}(),v=(Ue||(Ue=1,Ie=function(e){if(null==e&&"undefined"!=typeof navigator&&(e=navigator.userAgent),!e)return!0;const t=/Edge\/(\d+\.\d+)/.exec(e);if(!t)return!0;const n=t[1];let[r,o]=n.split(".");return r=parseInt(r,10),o=parseInt(o,10),r<15||15===r&&o<15063||r>18||18===r&&o>=18218}),Ie),m=He?Be:(He=1,Be=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}),y=We?ze:(We=1,ze={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",emptyFolderAdded:"No files were added from empty folder",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"}}});var b=l("plugins"),w=l("restricter"),x=l("storeUnsubscribe"),S=l("emitter"),_=l("preProcessors"),O=l("uploaders"),E=l("postProcessors"),k=l("informAndEmit"),C=l("checkRequiredMetaFieldsOnFile"),P=l("checkRequiredMetaFields"),N=l("assertNewUploadAllowed"),T=l("checkAndCreateFileStateObject"),M=l("startIfAutoProceed"),L=l("addListeners"),R=l("updateOnlineStatus"),$=l("createUpload"),F=l("getUpload"),D=l("removeUpload"),A=l("runUpload");o=Symbol.for("uppy test: getPlugins"),i=Symbol.for("uppy test: createUpload");class j{constructor(e){Object.defineProperty(this,A,{value:X}),Object.defineProperty(this,D,{value:J}),Object.defineProperty(this,F,{value:K}),Object.defineProperty(this,$,{value:q}),Object.defineProperty(this,L,{value:V}),Object.defineProperty(this,M,{value:W}),Object.defineProperty(this,T,{value:z}),Object.defineProperty(this,N,{value:H}),Object.defineProperty(this,P,{value:B}),Object.defineProperty(this,C,{value:U}),Object.defineProperty(this,k,{value:I}),Object.defineProperty(this,b,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,w,{writable:!0,value:void 0}),Object.defineProperty(this,x,{writable:!0,value:void 0}),Object.defineProperty(this,S,{writable:!0,value:c()}),Object.defineProperty(this,_,{writable:!0,value:new Set}),Object.defineProperty(this,O,{writable:!0,value:new Set}),Object.defineProperty(this,E,{writable:!0,value:new Set}),Object.defineProperty(this,R,{writable:!0,value:this.updateOnlineStatus.bind(this)}),this.defaultLocale=y;const t={id:"uppy",autoProceed:!1,allowMultipleUploads:!0,allowMultipleUploadBatches:!0,debug:!1,restrictions:r.defaultOptions,meta:{},onBeforeFileAdded:e=>e,onBeforeUpload:e=>e,store:h(),logger:n.justErrorsLogger,infoTimeout:5e3};this.opts={...t,...e,restrictions:{...t.restrictions,...e&&e.restrictions}},e&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e&&e.debug&&(this.opts.logger=n.debugLogger),this.log(`Using Core v${this.constructor.VERSION}`),this.i18nInit(),this.calculateProgress=d(this.calculateProgress.bind(this),500,{leading:!0,trailing:!0}),this.store=this.opts.store,this.setState({plugins:{},files:{},currentUploads:{},allowNewUpload:!0,capabilities:{uploadProgress:v(),individualCancellation:!0,resumableUploads:!1},totalProgress:0,meta:{...this.opts.meta},info:[],recoveredState:null}),s(this,w)[w]=new r.Restricter(()=>this.opts,this.i18n),s(this,x)[x]=this.store.subscribe((e,t,n)=>{this.emit("state-update",e,t,n),this.updateAll(t)}),this.opts.debug&&"undefined"!=typeof window&&(window[this.opts.id]=this),s(this,L)[L]()}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];s(this,S)[S].emit(e,...n)}on(e,t){return s(this,S)[S].on(e,t),this}once(e,t){return s(this,S)[S].once(e,t),this}off(e,t){return s(this,S)[S].off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}get state(){return this.getState()}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can’t set state for ${e} (the file could have been removed)`);this.setState({files:{...this.getState().files,[e]:{...this.getState().files[e],...t}}})}i18nInit(){const e=new u([this.defaultLocale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.locale=e.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e&&e.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(e=>{e.setOptions()}),this.setState()}resetProgress(){const e={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},n={};Object.keys(t).forEach(r=>{const o={...t[r]};o.progress={...o.progress,...e},n[r]=o}),this.setState({files:n,totalProgress:0}),this.emit("reset-progress")}addPreProcessor(e){s(this,_)[_].add(e)}removePreProcessor(e){return s(this,_)[_].delete(e)}addPostProcessor(e){s(this,E)[E].add(e)}removePostProcessor(e){return s(this,E)[E].delete(e)}addUploader(e){s(this,O)[O].add(e)}removeUploader(e){return s(this,O)[O].delete(e)}setMeta(e){const t={...this.getState().meta,...e},n={...this.getState().files};Object.keys(n).forEach(t=>{n[t]={...n[t],meta:{...n[t].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:n})}setFileMeta(e,t){const n={...this.getState().files};if(!n[e])return void this.log("Was trying to set metadata for a file that has been removed: ",e);const r={...n[e].meta,...t};n[e]={...n[e],meta:r},this.setState({files:n})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:n}=this.getState(),r=Object.values(e),o=r.filter(e=>{let{progress:t}=e;return!t.uploadComplete&&t.uploadStarted}),i=r.filter(e=>!e.progress.uploadStarted),s=r.filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess),a=r.filter(e=>e.progress.uploadStarted),l=r.filter(e=>e.isPaused),u=r.filter(e=>e.progress.uploadComplete),c=r.filter(e=>e.error),d=o.filter(e=>!e.isPaused),h=r.filter(e=>e.progress.preprocess||e.progress.postprocess);return{newFiles:i,startedFiles:s,uploadStartedFiles:a,pausedFiles:l,completeFiles:u,erroredFiles:c,inProgressFiles:o,inProgressNotPausedFiles:d,processingFiles:h,isUploadStarted:a.length>0,isAllComplete:100===t&&u.length===r.length&&0===h.length,isAllErrored:!!n&&c.length===r.length,isAllPaused:0!==o.length&&l.length===o.length,isUploadInProgress:o.length>0,isSomeGhost:r.some(e=>e.isGhost)}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{return s(this,w)[w].validate(e,t),{result:!0}}catch(e){return{result:!1,reason:e.message}}}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}addFile(e){s(this,N)[N](e);const{files:t}=this.getState();let n=s(this,T)[T](t,e);return t[n.id]&&t[n.id].isGhost&&(n={...t[n.id],data:e.data,isGhost:!1},this.log(`Replaced the blob in the restored ghost file: ${n.name}, ${n.id}`)),this.setState({files:{...t,[n.id]:n}}),this.emit("file-added",n),this.emit("files-added",[n]),this.log(`Added file: ${n.name}, ${n.id}, mime type: ${n.type}`),s(this,M)[M](),n.id}addFiles(e){s(this,N)[N]();const t={...this.getState().files},n=[],r=[];for(let o=0;o<e.length;o++)try{let r=s(this,T)[T](t,e[o]);t[r.id]&&t[r.id].isGhost&&(r={...t[r.id],data:e[o].data,isGhost:!1},this.log(`Replaced blob in a ghost file: ${r.name}, ${r.id}`)),t[r.id]=r,n.push(r)}catch(e){e.isRestriction||r.push(e)}if(this.setState({files:t}),n.forEach(e=>{this.emit("file-added",e)}),this.emit("files-added",n),n.length>5?this.log(`Added batch of ${n.length} files`):Object.keys(n).forEach(e=>{this.log(`Added file: ${n[e].name}\n id: ${n[e].id}\n type: ${n[e].type}`)}),n.length>0&&s(this,M)[M](),r.length>0){let e="Multiple errors occurred while adding files:\n";if(r.forEach(t=>{e+=`\n * ${t.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:r.length}),details:e},"error",this.opts.infoTimeout),"function"==typeof AggregateError)throw new AggregateError(r,e);{const t=new Error(e);throw t.errors=r,t}}}removeFiles(e,t){const{files:n,currentUploads:r}=this.getState(),o={...n},i={...r},s=Object.create(null);function a(e){return void 0===s[e]}e.forEach(e=>{n[e]&&(s[e]=n[e],delete o[e])}),Object.keys(i).forEach(e=>{const t=r[e].fileIDs.filter(a);if(0===t.length)return void delete i[e];const{capabilities:n}=this.getState();if(t.length!==r[e].fileIDs.length&&!n.individualCancellation)throw new Error("individualCancellation is disabled");i[e]={...r[e],fileIDs:t}});const l={currentUploads:i,files:o};0===Object.keys(o).length&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.calculateTotalProgress();const u=Object.keys(s);u.forEach(e=>{this.emit("file-removed",s[e],t)}),u.length>5?this.log(`Removed ${u.length} files`):this.log(`Removed files: ${u.join(", ")}`)}removeFile(e,t){void 0===t&&(t=null),this.removeFiles([e],t)}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).uploadComplete)return;const t=!(this.getFile(e).isPaused||!1);return this.setFileState(e,{isPaused:t}),this.emit("upload-pause",e,t),t}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const n={...e[t],isPaused:!0};e[t]=n}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const n={...e[t],isPaused:!1,error:null};e[t]=n}),this.setState({files:e}),this.emit("resume-all")}retryAll(){const e={...this.getState().files},t=Object.keys(e).filter(t=>e[t].error);if(t.forEach(t=>{const n={...e[t],isPaused:!1,error:null};e[t]=n}),this.setState({files:e,error:null}),this.emit("retry-all",t),0===t.length)return Promise.resolve({successful:[],failed:[]});const n=s(this,$)[$](t,{forceAllowNewUpload:!0});return s(this,A)[A](n)}cancelAll(e){let{reason:t="user"}=void 0===e?{}:e;if(this.emit("cancel-all",{reason:t}),"user"===t){const{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t,"cancel-all"),this.setState({totalProgress:0,error:null,recoveredState:null})}}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);const t=s(this,$)[$]([e],{forceAllowNewUpload:!0});return s(this,A)[A](t)}reset(){this.cancelAll(...arguments)}logout(){this.iteratePlugins(e=>{e.provider&&e.provider.logout&&e.provider.logout()})}calculateProgress(e,t){if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const n=Number.isFinite(t.bytesTotal)&&t.bytesTotal>0;this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:n?Math.round(t.bytesUploaded/t.bytesTotal*100):0}}),this.calculateTotalProgress()}calculateTotalProgress(){const e=this.getFiles().filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess);if(0===e.length)return this.emit("progress",0),void this.setState({totalProgress:0});const t=e.filter(e=>null!=e.progress.bytesTotal),n=e.filter(e=>null==e.progress.bytesTotal);if(0===t.length){const t=100*e.length,r=n.reduce((e,t)=>e+t.progress.percentage,0),o=Math.round(r/t*100);return void this.setState({totalProgress:o})}let r=t.reduce((e,t)=>e+t.progress.bytesTotal,0);const o=r/t.length;r+=o*n.length;let i=0;t.forEach(e=>{i+=e.progress.bytesUploaded}),n.forEach(e=>{i+=o*(e.progress.percentage||0)/100});let s=0===r?0:Math.round(i/r*100);s>100&&(s=100),this.setState({totalProgress:s}),this.emit("progress",s)}updateOnlineStatus(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(e,t){if("function"!=typeof e){throw new TypeError(`Expected a plugin class, but got ${null===e?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`)}const n=new e(this,t),r=n.id;if(!r)throw new Error("Your plugin must have an id");if(!n.type)throw new Error("Your plugin must have a type");const o=this.getPlugin(r);if(o){const e=`Already found a plugin named '${o.id}'. Tried to use: '${r}'.\nUppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(e)}return e.VERSION&&this.log(`Using ${r} v${e.VERSION}`),n.type in s(this,b)[b]?s(this,b)[b][n.type].push(n):s(this,b)[b][n.type]=[n],n.install(),this}getPlugin(e){for(const t of Object.values(s(this,b)[b])){const n=t.find(t=>t.id===e);if(null!=n)return n}}[o](e){return s(this,b)[b][e]}iteratePlugins(e){Object.values(s(this,b)[b]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=s(this,b)[b][e.type],n=t.findIndex(t=>t.id===e.id);-1!==n&&t.splice(n,1);const r={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(r)}close(e){let{reason:t}=void 0===e?{}:e;this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll({reason:t}),s(this,x)[x](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",s(this,R)[R]),window.removeEventListener("offline",s(this,R)[R]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,n){void 0===t&&(t="info"),void 0===n&&(n=3e3);const r="object"==typeof e;this.setState({info:[...this.getState().info,{type:t,message:r?e.message:e,details:r?e.details:null}]}),setTimeout(()=>this.hideInfo(),n),this.emit("info-visible")}log(e,t){const{logger:n}=this.opts;switch(t){case"error":n.error(e);break;case"warning":n.warn(e);break;default:n.debug(e)}}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?s(this,A)[A](e):(s(this,D)[D](e),Promise.reject(new Error("Nonexistent upload")))}[i](){return s(this,$)[$](...arguments)}addResultData(e,t){if(!s(this,F)[F](e))return void this.log(`Not setting result for an upload that has been removed: ${e}`);const{currentUploads:n}=this.getState(),r={...n[e],result:{...n[e].result,...t}};this.setState({currentUploads:{...n,[e]:r}})}upload(){var e;null!=(e=s(this,b)[b].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const n=this.opts.onBeforeUpload(t);return!1===n?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(n&&"object"==typeof n&&(t=n,this.setState({files:t})),Promise.resolve().then(()=>s(this,w)[w].validateMinNumberOfFiles(t)).catch(e=>{throw s(this,k)[k](e),e}).then(()=>{if(!s(this,P)[P](t))throw new r.RestrictionError(this.i18n("missingRequiredMetaField"))}).catch(e=>{throw e}).then(()=>{const{currentUploads:e}=this.getState(),n=Object.values(e).flatMap(e=>e.fileIDs),r=[];Object.keys(t).forEach(e=>{const t=this.getFile(e);t.progress.uploadStarted||-1!==n.indexOf(e)||r.push(t.id)});const o=s(this,$)[$](r);return s(this,A)[A](o)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function I(e,t){const{message:n,details:r=""}=e;e.isRestriction?this.emit("restriction-failed",t,e):this.emit("error",e),this.info({message:n,details:r},"error",this.opts.infoTimeout),this.log(`${n} ${r}`.trim(),"error")}function U(e){const{missingFields:t,error:n}=s(this,w)[w].getMissingRequiredMetaFields(e);return!(t.length>0)||(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(n.message),this.emit("restriction-failed",e,n),!1)}function B(e){let t=!0;for(const n of Object.values(e))s(this,C)[C](n)||(t=!1);return t}function H(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new r.RestrictionError(this.i18n("noMoreFilesAllowed"));throw s(this,k)[k](t,e),t}}function z(e,t){const n=p(t),o=m(n,t),i=f(o).extension,a=Boolean(t.isRemote),l=g({...t,type:n});if(this.checkIfFileAlreadyExists(l)){const e=new r.RestrictionError(this.i18n("noDuplicates",{fileName:o}));throw s(this,k)[k](e,t),e}const u=t.meta||{};u.name=o,u.type=n;const c=Number.isFinite(t.data.size)?t.data.size:null;let d={source:t.source||"",id:l,name:o,extension:i||"",meta:{...this.getState().meta,...u},type:n,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:c,uploadComplete:!1,uploadStarted:null},size:c,isRemote:a,remote:t.remote||"",preview:t.preview};const h=this.opts.onBeforeFileAdded(d,e);if(!1===h){const e=new r.RestrictionError("Cannot add the file because onBeforeFileAdded returned false.");throw this.emit("restriction-failed",t,e),e}"object"==typeof h&&null!==h&&(d=h);try{const t=Object.keys(e).map(t=>e[t]);s(this,w)[w].validate(d,t)}catch(e){throw s(this,k)[k](e,d),e}return d}function W(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}function V(){const e=(e,t,n)=>{let r=e.message||"Unknown error";e.details&&(r+=` ${e.details}`),this.setState({error:r}),null!=t&&t.id in this.getState().files&&this.setFileState(t.id,{error:r,response:n})};this.on("error",e),this.on("upload-error",(t,n,r)=>{if(e(n,t,r),"object"==typeof n&&n.message){const e=new Error(n.message);e.details=n.message,n.details&&(e.details+=` ${n.details}`),e.message=this.i18n("failedToUpload",{file:null==t?void 0:t.name}),s(this,k)[k](e)}else s(this,k)[k](n)}),this.on("upload",()=>{this.setState({error:null})}),this.on("upload-started",e=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("upload-progress",this.calculateProgress),this.on("upload-success",(e,t)=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const n=this.getFile(e.id).progress;this.setFileState(e.id,{progress:{...n,postprocess:s(this,E)[E].size>0?{mode:"indeterminate"}:null,uploadComplete:!0,percentage:100,bytesUploaded:n.bytesTotal},response:t,uploadURL:t.uploadURL,isPaused:!1}),null==e.size&&this.setFileState(e.id,{size:t.bytesUploaded||n.bytesTotal}),this.calculateTotalProgress()}),this.on("preprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,preprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("preprocess-complete",e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.preprocess,this.setState({files:t})}),this.on("postprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getState().files[e.id].progress,postprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("postprocess-complete",e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.postprocess,this.setState({files:t})}),this.on("restored",()=>{this.calculateTotalProgress()}),this.on("dashboard:file-edit-complete",e=>{e&&s(this,C)[C](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",s(this,R)[R]),window.addEventListener("offline",s(this,R)[R]),setTimeout(s(this,R)[R],3e3))}function q(t,n){void 0===n&&(n={});const{forceAllowNewUpload:r=!1}=n,{allowNewUpload:o,currentUploads:i}=this.getState();if(!o&&!r)throw new Error("Cannot create a new upload: already uploading.");const s=(0,e.nanoid)();return this.emit("upload",{id:s,fileIDs:t}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploadBatches&&!1!==this.opts.allowMultipleUploads,currentUploads:{...i,[s]:{fileIDs:t,step:0,result:{}}}}),s}function K(e){const{currentUploads:t}=this.getState();return t[e]}function J(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function X(e){let{currentUploads:t}=this.getState(),n=t[e];const r=n.step||0,o=[...s(this,_)[_],...s(this,O)[O],...s(this,E)[E]];try{for(let i=r;i<o.length&&n;i++){const r=o[i],s={...n,step:i};this.setState({currentUploads:{...t,[e]:s}}),await r(s.fileIDs,e),t=this.getState().currentUploads,n=t[e]}}catch(t){throw s(this,D)[D](e),t}if(n){n.fileIDs.forEach(e=>{const t=this.getFile(e);t&&t.progress.postprocess&&this.emit("postprocess-complete",t)});const r=n.fileIDs.map(e=>this.getFile(e)),o=r.filter(e=>!e.error),i=r.filter(e=>e.error);await this.addResultData(e,{successful:o,failed:i,uploadID:e}),t=this.getState().currentUploads,n=t[e]}let i;return n&&(i=n.result,this.emit("complete",i),s(this,D)[D](e)),null==i&&this.log(`Not setting result for an upload that has been removed: ${e}`),i}return j.VERSION="2.3.4",Ve=j}var it,st,at,lt,ut,ct,dt,ht,pt,ft,gt,vt,mt,yt={},bt=[],wt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,xt=Array.isArray;function St(e,t){for(var n in t)e[n]=t[n];return e}function _t(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ot(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?it.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return Et(e,s,r,o,null)}function Et(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++at:o,__i:-1,__u:0};return null==o&&null!=st.vnode&&st.vnode(i),i}function kt(e){return e.children}function Ct(e,t){this.props=e,this.context=t}function Pt(e,t){if(null==t)return e.__?Pt(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Pt(e):null}function Nt(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return Nt(e)}}function Tt(e){(!e.__d&&(e.__d=!0)&&ut.push(e)&&!Mt.__r++||ct!=st.debounceRendering)&&((ct=st.debounceRendering)||dt)(Mt)}function Mt(){for(var e,t,n,r,o,i,s,a=1;ut.length;)ut.length>a&&ut.sort(ht),e=ut.shift(),a=ut.length,e.__d&&(n=void 0,r=void 0,o=(r=(t=e).__v).__e,i=[],s=[],t.__P&&((n=St({},r)).__v=r.__v+1,st.vnode&&st.vnode(n),It(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,i,null==o?Pt(r):o,!!(32&r.__u),s),n.__v=r.__v,n.__.__k[n.__i]=n,Bt(i,n,s),r.__e=r.__=null,n.__e!=o&&Nt(n)));Mt.__r=0}function Lt(e,t,n,r,o,i,s,a,l,u,c){var d,h,p,f,g,v,m,y=r&&r.__k||bt,b=t.length;for(l=Rt(n,t,y,l,b),d=0;d<b;d++)null!=(p=n.__k[d])&&(h=-1==p.__i?yt:y[p.__i]||yt,p.__i=d,v=It(e,p,h,o,i,s,a,l,u,c),f=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&Wt(h.ref,null,p),c.push(p.ref,p.__c||f,p)),null==g&&null!=f&&(g=f),(m=!!(4&p.__u))||h.__k===p.__k?l=$t(p,l,e,m):"function"==typeof p.type&&void 0!==v?l=v:f&&(l=f.nextSibling),p.__u&=-7);return n.__e=g,l}function Rt(e,t,n,r,o){var i,s,a,l,u,c=n.length,d=c,h=0;for(e.__k=new Array(o),i=0;i<o;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?(l=i+h,(s=e.__k[i]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?Et(null,s,null,null,null):xt(s)?Et(kt,{children:s},null,null,null):null==s.constructor&&s.__b>0?Et(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,-1!=(u=s.__i=Ft(s,n,l,d))&&(d--,(a=n[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(o>c?h--:o<c&&h++),"function"!=typeof s.type&&(s.__u|=4)):u!=l&&(u==l-1?h--:u==l+1?h++:(u>l?h--:h++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<c;i++)null!=(a=n[i])&&!(2&a.__u)&&(a.__e==r&&(r=Pt(a)),Vt(a,a));return r}function $t(e,t,n,r){var o,i;if("function"==typeof e.type){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=$t(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Pt(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Ft(e,t,n,r){var o,i,s,a=e.key,l=e.type,u=t[n],c=null!=u&&!(2&u.__u);if(null===u&&null==e.key||c&&a==u.key&&l==u.type)return n;if(r>(c?1:0))for(o=n-1,i=n+1;o>=0||i<t.length;)if(null!=(u=t[s=o>=0?o--:i++])&&!(2&u.__u)&&a==u.key&&l==u.type)return s;return-1}function Dt(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||wt.test(t)?n:n+"px"}function At(e,t,n,r,o){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Dt(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Dt(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(pt,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=ft,e.addEventListener(t,i?vt:gt,i)):e.removeEventListener(t,i?vt:gt,i);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function jt(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=ft++;else if(t.t<n.u)return;return n(st.event?st.event(t):t)}}}function It(e,t,n,r,o,i,s,a,l,u){var c,d,h,p,f,g,v,m,y,b,w,x,S,_,O,E,k,C=t.type;if(null!=t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),i=[a=t.__e=n.__e]),(c=st.__b)&&c(t);e:if("function"==typeof C)try{if(m=t.props,y="prototype"in C&&C.prototype.render,b=(c=C.contextType)&&r[c.__c],w=c?b?b.props.value:c.__:r,n.__c?v=(d=t.__c=n.__c).__=d.__E:(y?t.__c=d=new C(m,w):(t.__c=d=new Ct(m,w),d.constructor=C,d.render=qt),b&&b.sub(d),d.props=m,d.state||(d.state={}),d.context=w,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),y&&null==d.__s&&(d.__s=d.state),y&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=St({},d.__s)),St(d.__s,C.getDerivedStateFromProps(m,d.__s))),p=d.props,f=d.state,d.__v=t,h)y&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),y&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(y&&null==C.getDerivedStateFromProps&&m!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,w),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,w)||t.__v==n.__v){for(t.__v!=n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),x=0;x<d._sb.length;x++)d.__h.push(d._sb[x]);d._sb=[],d.__h.length&&s.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,w),y&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(p,f,g)})}if(d.context=w,d.props=m,d.__P=e,d.__e=!1,S=st.__r,_=0,y){for(d.state=d.__s,d.__d=!1,S&&S(t),c=d.render(d.props,d.state,d.context),O=0;O<d._sb.length;O++)d.__h.push(d._sb[O]);d._sb=[]}else do{d.__d=!1,S&&S(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++_<25);d.state=d.__s,null!=d.getChildContext&&(r=St(St({},r),d.getChildContext())),y&&!h&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(p,f)),E=c,null!=c&&c.type===kt&&null==c.key&&(E=Ht(c.props.children)),a=Lt(e,xt(E)?E:[E],t,n,r,o,i,s,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),v&&(d.__E=d.__=null)}catch(e){if(t.__v=null,l||null!=i)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,t.__e=a}else{for(k=i.length;k--;)_t(i[k]);Ut(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Ut(t);st.__e(e,t,n)}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=zt(n.__e,t,n,r,o,i,s,l,u);return(c=st.diffed)&&c(t),128&t.__u?void 0:a}function Ut(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Ut)}function Bt(e,t,n){for(var r=0;r<n.length;r++)Wt(n[r],n[++r],n[++r]);st.__c&&st.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){st.__e(e,t.__v)}})}function Ht(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:xt(e)?e.map(Ht):St({},e)}function zt(e,t,n,r,o,i,s,a,l){var u,c,d,h,p,f,g,v=n.props,m=t.props,y=t.type;if("svg"==y?o="http://www.w3.org/2000/svg":"math"==y?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=i)for(u=0;u<i.length;u++)if((p=i[u])&&"setAttribute"in p==!!y&&(y?p.localName==y:3==p.nodeType)){e=p,i[u]=null;break}if(null==e){if(null==y)return document.createTextNode(m);e=document.createElementNS(o,y,m.is&&m),a&&(st.__m&&st.__m(t,i),a=!1),i=null}if(null==y)v===m||a&&e.data==m||(e.data=m);else{if(i=i&&it.call(e.childNodes),v=n.props||yt,!a&&null!=i)for(v={},u=0;u<e.attributes.length;u++)v[(p=e.attributes[u]).name]=p.value;for(u in v)if(p=v[u],"children"==u);else if("dangerouslySetInnerHTML"==u)d=p;else if(!(u in m)){if("value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m)continue;At(e,u,null,p,o)}for(u in m)p=m[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?f=p:"checked"==u?g=p:a&&"function"!=typeof p||v[u]===p||At(e,u,p,v[u],o);if(c)a||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),Lt("template"==t.type?e.content:e,xt(h)?h:[h],t,n,r,"foreignObject"==y?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:n.__k&&Pt(n,0),a,l),null!=i)for(u=i.length;u--;)_t(i[u]);a||(u="value","progress"==y&&null==f?e.removeAttribute("value"):null!=f&&(f!==e[u]||"progress"==y&&!f||"option"==y&&f!=v[u])&&At(e,u,f,v[u],o),u="checked",null!=g&&g!=e[u]&&At(e,u,g,v[u],o))}return e}function Wt(e,t,n){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==t||(e.__u=e(t))}else e.current=t}catch(e){st.__e(e,n)}}function Vt(e,t,n){var r,o;if(st.unmount&&st.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Wt(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){st.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Vt(r[o],t,n||"function"!=typeof e.type);n||_t(e.__e),e.__c=e.__=e.__e=void 0}function qt(e,t,n){return this.constructor(e,n)}function Kt(e,t,n){var r,o,i,s;t==document&&(t=document.documentElement),st.__&&st.__(e,t),o=(r="function"==typeof n)?null:n&&n.__k||t.__k,i=[],s=[],It(t,e=(!r&&n||t).__k=Ot(kt,null,[e]),o||yt,yt,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?it.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,s),Bt(i,e,s)}it=bt.slice,st={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},at=0,lt=function(e){return null!=e&&null==e.constructor},Ct.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=St({},this.state),"function"==typeof e&&(e=e(St({},n),this.props)),e&&St(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Tt(this))},Ct.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Tt(this))},Ct.prototype.render=kt,ut=[],dt="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ht=function(e,t){return e.__v.__b-t.__v.__b},Mt.__r=0,pt=/(PointerCapture)$|Capture$/i,ft=0,gt=jt(!1),vt=jt(!0),mt=0;var Jt,Xt,Gt,Yt,Qt,Zt,en,tn,nn,rn,on,sn=Object.freeze({__proto__:null,Component:Ct,Fragment:kt,cloneElement:function(e,t,n){var r,o,i,s,a=St({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=void 0===t[i]&&null!=s?s[i]:t[i];return arguments.length>2&&(a.children=arguments.length>3?it.call(arguments,2):n),Et(e.type,a,r||e.key,o||e.ref,null)},createContext:function(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,Tt(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+mt++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createElement:Ot,createRef:function(){return{current:null}},h:Ot,hydrate:function e(t,n){Kt(t,n,e)},get isValidElement(){return lt},get options(){return st},render:Kt,toChildArray:function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(xt(t)?t.some(function(t){e(t,n)}):n.push(t)),n}}),an=ue(sn);function ln(){if(Yt)return Gt;Yt=1;const e=Xt?Jt:(Xt=1,Jt=function(e){return(null==e?void 0:e.nodeType)===Node.ELEMENT_NODE});return Gt=function(t,n){return void 0===n&&(n=document),"string"==typeof t?n.querySelector(t):e(t)?t:null}}function un(){if(tn)return en;tn=1;const e=Ze();return en=class{constructor(e,t){void 0===t&&(t={}),this.uppy=e,this.opts=t}getPluginState(){const{plugins:e}=this.uppy.getState();return e[this.id]||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(),this.i18nInit()}i18nInit(){const t=new e([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.setPluginState()}addTarget(){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}render(){throw new Error("Extend the render method to add your plugin to a DOM element")}update(){}afterUpdate(){}}}function cn(){if(rn)return nn;rn=1;var e=an;function t(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var n=0;function r(e){return"__private_"+n+++"_"+e}const o=ln(),i=Zt?Qt:(Zt=1,Qt=function(e){for(var t;e&&!e.dir;)e=e.parentNode;return null==(t=e)?void 0:t.dir}),s=un();var a=r("updateUI");class l extends s{constructor(){super(...arguments),Object.defineProperty(this,a,{writable:!0,value:void 0})}mount(n,r){const s=r.id,u=o(n);if(u){this.isTargetDOMEl=!0;const r=document.createElement("div");return r.classList.add("uppy-Root"),t(this,a)[a]=function(e){let t=null,n=null;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return n=o,t||(t=Promise.resolve().then(()=>(t=null,e(...n)))),t}}(t=>{this.uppy.getPlugin(this.id)&&((0,e.render)(this.render(t),r),this.afterUpdate())}),this.uppy.log(`Installing ${s} to a DOM element '${n}'`),this.opts.replaceTargetContent&&(u.innerHTML=""),(0,e.render)(this.render(this.uppy.getState()),r),this.el=r,u.appendChild(r),r.dir=this.opts.direction||i(r)||"ltr",this.onMount(),this.el}let c;if("object"==typeof n&&n instanceof l)c=n;else if("function"==typeof n){const e=n;this.uppy.iteratePlugins(t=>{t instanceof e&&(c=t)})}if(c)return this.uppy.log(`Installing ${s} to ${c.id}`),this.parent=c,this.el=c.addTarget(r),this.onMount(),this.el;this.uppy.log(`Not installing ${s}`);let d=`Invalid target option given to ${s}.`;throw d+="function"==typeof n?" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":"If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(d)}update(e){var n,r;null!=this.el&&(null==(n=(r=t(this,a))[a])||n.call(r,e))}unmount(){var e;this.isTargetDOMEl&&(null==(e=this.el)||e.remove());this.onUnmount()}onMount(){}onUnmount(){}}return nn=l}var dn,hn,pn,fn,gn,vn,mn,yn,bn,wn,xn=(on||(on=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Uppy=t.UIPlugin=t.BasePlugin=void 0,Object.defineProperty(t,"debugLogger",{enumerable:!0,get:function(){return n.debugLogger}});var n=ge();e.exports=ot();const r=cn();t.UIPlugin=r;const o=un();t.BasePlugin=o;const i=ot();t.Uppy=i;const s=cn(),a=un();i.Uppy=i,i.UIPlugin=s,i.BasePlugin=a,i.debugLogger=n.debugLogger}(pe,pe.exports)),pe.exports),Sn=le(xn),_n={};function On(){if(hn)return dn;hn=1;class e extends Error{constructor(e,t){void 0===t&&(t=null),super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}}return dn=e}function En(){if(wn)return bn;let e;function t(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}wn=1;var n=0;function r(e){return"__private_"+n+++"_"+e}const o=function(){if(fn)return pn;fn=1;const e=On();return pn=function(){return fetch(...arguments).catch(t=>{throw"AbortError"===t.name?t:new e(t)})},pn}(),i=function(){if(vn)return gn;vn=1;const e=Qe();class t extends Error{constructor(t,n){void 0===n&&(n={}),super(t),this.cause=n.cause,this.cause&&e(this.cause,"isNetworkError")&&(this.isNetworkError=this.cause.isNetworkError)}}return gn=t}(),s=function(){if(yn)return mn;yn=1;class e extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}return mn=e}();async function a(e){if(401===e.status)throw new s;const t=e.json();if(e.status<200||e.status>300){let n=`Failed request with status: ${e.status}. ${e.statusText}`;try{const e=await t;n=e.message?`${n} message: ${e.message}`:n,n=e.requestId?`${n} request-Id: ${e.requestId}`:n}finally{throw new Error(n)}}return t}var l=r("companionHeaders"),u=r("getPostResponseFunc"),c=r("getUrl"),d=r("errorHandler");e=Symbol.for("uppy test: getCompanionHeaders");class h{constructor(e,n){Object.defineProperty(this,d,{value:f}),Object.defineProperty(this,c,{value:p}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:e=>t=>e?t:this.onReceiveResponse(t)}),this.uppy=e,this.opts=n,this.onReceiveResponse=this.onReceiveResponse.bind(this),this.allowedHeaders=["accept","content-type","uppy-auth-token"],this.preflightDone=!1,t(this,l)[l]=null==n?void 0:n.companionHeaders}setCompanionHeaders(e){t(this,l)[l]=e}[e](){return t(this,l)[l]}get hostname(){const{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return(e&&e[t]?e[t]:t).replace(/\/$/,"")}headers(){return Promise.resolve({...h.defaultHeaders,...t(this,l)[l]})}onReceiveResponse(e){const t=this.uppy.getState().companion||{},n=this.opts.companionUrl,{headers:r}=e;return r.has("i-am")&&r.get("i-am")!==t[n]&&this.uppy.setState({companion:{...t,[n]:r.get("i-am")}}),e}preflight(e){return this.preflightDone?Promise.resolve(this.allowedHeaders.slice()):fetch(t(this,c)[c](e),{method:"OPTIONS"}).then(e=>(e.headers.has("access-control-allow-headers")&&(this.allowedHeaders=e.headers.get("access-control-allow-headers").split(",").map(e=>e.trim().toLowerCase())),this.preflightDone=!0,this.allowedHeaders.slice())).catch(e=>(this.uppy.log(`[CompanionClient] unable to make preflight request ${e}`,"warning"),this.preflightDone=!0,this.allowedHeaders.slice()))}preflightAndHeaders(e){return Promise.all([this.preflight(e),this.headers()]).then(e=>{let[t,n]=e;return Object.keys(n).forEach(e=>{t.includes(e.toLowerCase())||(this.uppy.log(`[CompanionClient] excluding disallowed header ${e}`),delete n[e])}),n})}get(e,n){return this.preflightAndHeaders(e).then(n=>o(t(this,c)[c](e),{method:"get",headers:n,credentials:this.opts.companionCookiesRule||"same-origin"})).then(t(this,u)[u](n)).then(a).catch(t(this,d)[d]("get",e))}post(e,n,r){const i="post";return this.preflightAndHeaders(e).then(r=>o(t(this,c)[c](e),{method:i,headers:r,credentials:this.opts.companionCookiesRule||"same-origin",body:JSON.stringify(n)})).then(t(this,u)[u](r)).then(a).catch(t(this,d)[d](i,e))}delete(e,n,r){const i="delete";return this.preflightAndHeaders(e).then(t=>o(`${this.hostname}/${e}`,{method:i,headers:t,credentials:this.opts.companionCookiesRule||"same-origin",body:n?JSON.stringify(n):null})).then(t(this,u)[u](r)).then(a).catch(t(this,d)[d](i,e))}}function p(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}function f(e,n){return r=>{var o;return null!=(o=r)&&o.isAuthError||(r=new i(`Could not ${e} ${t(this,c)[c](n)}`,{cause:r})),Promise.reject(r)}}return h.VERSION="2.2.2",h.defaultHeaders={Accept:"application/json","Content-Type":"application/json","Uppy-Versions":`@uppy/companion-client=${h.VERSION}`},bn=h}var kn,Cn,Pn,Nn,Tn,Mn,Ln,Rn,$n={};function Fn(){if(kn)return $n;return kn=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.getItem=function(e){return Promise.resolve(localStorage.getItem(e))},$n.removeItem=function(e){return new Promise(t=>{localStorage.removeItem(e),t()})},$n.setItem=function(e,t){return new Promise(n=>{localStorage.setItem(e,t),n()})},$n}function Dn(){if(Rn)return _n;Rn=1,Object.defineProperty(_n,"__esModule",{value:!0}),_n.Socket=_n.SearchProvider=_n.RequestClient=_n.Provider=void 0;const e=En();_n.RequestClient=e;const t=function(){if(Pn)return Cn;Pn=1;var e=Fn();const t=En();return Cn=class extends t{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||this.id.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),this.pluginId=this.opts.pluginId,this.tokenKey=`companion-${this.pluginId}-auth-token`,this.companionKeysParams=this.opts.companionKeysParams,this.preAuthToken=null}headers(){return Promise.all([super.headers(),this.getAuthToken()]).then(e=>{let[t,n]=e;const r={};return n&&(r["uppy-auth-token"]=n),this.companionKeysParams&&(r["uppy-credentials-params"]=btoa(JSON.stringify({params:this.companionKeysParams}))),{...t,...r}})}onReceiveResponse(e){e=super.onReceiveResponse(e);const t=this.uppy.getPlugin(this.pluginId),n=t.getPluginState().authenticated?401!==e.status:e.status<400;return t.setPluginState({authenticated:n}),e}setAuthToken(e){return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey,e)}getAuthToken(){return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey)}async ensurePreAuth(){if(this.companionKeysParams&&!this.preAuthToken&&(await this.fetchPreAuthToken(),!this.preAuthToken))throw new Error("Could not load authentication data required for third-party login. Please try again later.")}authUrl(e){void 0===e&&(e={});const t=new URLSearchParams(e);return this.preAuthToken&&t.set("uppyPreAuthToken",this.preAuthToken),`${this.hostname}/${this.id}/connect?${t}`}fileUrl(e){return`${this.hostname}/${this.id}/get/${e}`}async fetchPreAuthToken(){if(this.companionKeysParams)try{const e=await this.post(`${this.id}/preauth/`,{params:this.companionKeysParams});this.preAuthToken=e.token}catch(e){this.uppy.log(`[CompanionClient] unable to fetch preAuthToken ${e}`,"warning")}}list(e){return this.get(`${this.id}/list/${e||""}`)}logout(){return this.get(`${this.id}/logout`).then(e=>Promise.all([e,this.uppy.getPlugin(this.pluginId).storage.removeItem(this.tokenKey)])).then(e=>{let[t]=e;return t})}static initPlugin(t,n,r){if(t.type="acquirer",t.files=[],r&&(t.opts={...r,...n}),n.serverUrl||n.serverPattern)throw new Error("`serverUrl` and `serverPattern` have been renamed to `companionUrl` and `companionAllowedHosts` respectively in the 0.30.5 release. Please consult the docs (for example, https://uppy.io/docs/instagram/ for the Instagram plugin) and use the updated options.`");if(n.companionAllowedHosts){const e=n.companionAllowedHosts;if(!("string"==typeof e||Array.isArray(e)||e instanceof RegExp))throw new TypeError(`${t.id}: the option "companionAllowedHosts" must be one of string, Array, RegExp`);t.opts.companionAllowedHosts=e}else/^(?!https?:\/\/).*$/i.test(n.companionUrl)?t.opts.companionAllowedHosts=`https://${n.companionUrl.replace(/^\/\//,"")}`:t.opts.companionAllowedHosts=new URL(n.companionUrl).origin;t.storage=t.opts.storage||e}},Cn}();_n.Provider=t;const n=function(){if(Tn)return Nn;Tn=1;const e=En();return Nn=class extends e{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||this.id.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),this.pluginId=this.opts.pluginId}fileUrl(e){return`${this.hostname}/search/${this.id}/get/${e}`}search(e,t){return this.get(`search/${this.id}/list?q=${encodeURIComponent(e)}${t?`&${t}`:""}`)}},Nn}();_n.SearchProvider=n;const r=function(){if(Ln)return Mn;let e,t;function n(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Ln=1;var r=0;function o(e){return"__private_"+r+++"_"+e}const i=et();var s=o("queued"),a=o("emitter"),l=o("isOpen"),u=o("socket"),c=o("handleMessage");return e=Symbol.for("uppy test: getSocket"),t=Symbol.for("uppy test: getQueued"),Mn=class{constructor(e){Object.defineProperty(this,s,{writable:!0,value:[]}),Object.defineProperty(this,a,{writable:!0,value:i()}),Object.defineProperty(this,l,{writable:!0,value:!1}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:e=>{try{const t=JSON.parse(e.data);this.emit(t.action,t.payload)}catch(e){console.log(e)}}}),this.opts=e,e&&!1===e.autoOpen||this.open()}get isOpen(){return n(this,l)[l]}[e](){return n(this,u)[u]}[t](){return n(this,s)[s]}open(){n(this,u)[u]=new WebSocket(this.opts.target),n(this,u)[u].onopen=()=>{for(n(this,l)[l]=!0;n(this,s)[s].length>0&&n(this,l)[l];){const e=n(this,s)[s].shift();this.send(e.action,e.payload)}},n(this,u)[u].onclose=()=>{n(this,l)[l]=!1},n(this,u)[u].onmessage=n(this,c)[c]}close(){var e;null==(e=n(this,u)[u])||e.close()}send(e,t){n(this,l)[l]?n(this,u)[u].send(JSON.stringify({action:e,payload:t})):n(this,s)[s].push({action:e,payload:t})}on(e,t){n(this,a)[a].on(e,t)}emit(e,t){n(this,a)[a].emit(e,t)}once(e,t){n(this,a)[a].once(e,t)}},Mn}();return _n.Socket=r,_n}var An,jn,In,Un,Bn,Hn,zn,Wn,Vn,qn,Kn,Jn,Xn,Gn,Yn,Qn,Zn,er={};function tr(){if(An)return er;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}An=1,Object.defineProperty(er,"__esModule",{value:!0}),er.internalRateLimitedQueue=er.RateLimitedQueue=void 0;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("activeRequests"),o=n("queuedHandlers"),i=n("paused"),s=n("pauseTimer"),a=n("downLimit"),l=n("upperLimit"),u=n("rateLimitingTimer"),c=n("call"),d=n("queueNext"),h=n("next"),p=n("queue"),f=n("dequeue"),g=n("resume"),v=n("increaseLimit");function m(t){e(this,r)[r]+=1;let n,o=!1;try{n=t()}catch(t){throw e(this,r)[r]-=1,t}return{abort:()=>{o||(o=!0,e(this,r)[r]-=1,n(),e(this,d)[d]())},done:()=>{o||(o=!0,e(this,r)[r]-=1,e(this,d)[d]())}}}function y(){queueMicrotask(()=>e(this,h)[h]())}function b(){if(e(this,i)[i]||e(this,r)[r]>=this.limit)return;if(0===e(this,o)[o].length)return;const t=e(this,o)[o].shift(),n=e(this,c)[c](t.fn);t.abort=n.abort,t.done=n.done}function w(t,n){void 0===n&&(n={});const r={fn:t,priority:n.priority||0,abort:()=>{e(this,f)[f](r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},i=e(this,o)[o].findIndex(e=>r.priority>e.priority);return-1===i?e(this,o)[o].push(r):e(this,o)[o].splice(i,0,r),r}function x(t){const n=e(this,o)[o].indexOf(t);-1!==n&&e(this,o)[o].splice(n,1)}er.RateLimitedQueue=class{constructor(t){Object.defineProperty(this,f,{value:x}),Object.defineProperty(this,p,{value:w}),Object.defineProperty(this,h,{value:b}),Object.defineProperty(this,d,{value:y}),Object.defineProperty(this,c,{value:m}),Object.defineProperty(this,r,{writable:!0,value:0}),Object.defineProperty(this,o,{writable:!0,value:[]}),Object.defineProperty(this,i,{writable:!0,value:!1}),Object.defineProperty(this,s,{writable:!0,value:void 0}),Object.defineProperty(this,a,{writable:!0,value:1}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,g,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,v,{writable:!0,value:()=>{if(e(this,i)[i])e(this,u)[u]=setTimeout(e(this,v)[v],0);else{e(this,a)[a]=this.limit,this.limit=Math.ceil((e(this,l)[l]+e(this,a)[a])/2);for(let t=e(this,a)[a];t<=this.limit;t++)e(this,d)[d]();e(this,l)[l]-e(this,a)[a]>3?e(this,u)[u]=setTimeout(e(this,v)[v],2e3):e(this,a)[a]=Math.floor(e(this,a)[a]/2)}}}),this.limit="number"!=typeof t||0===t?1/0:t}run(t,n){return!e(this,i)[i]&&e(this,r)[r]<this.limit?e(this,c)[c](t):e(this,p)[p](t,n)}wrapPromiseFunction(e,t){var n=this;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];let s;const a=new Promise((r,i)=>{s=n.run(()=>{let t,n;try{n=Promise.resolve(e(...o))}catch(e){n=Promise.reject(e)}return n.then(e=>{t?i(t):(s.done(),r(e))},e=>{t?i(t):(s.done(),i(e))}),()=>{t=new Error("Cancelled")}},t)});return a.abort=()=>{s.abort()},a}}resume(){e(this,i)[i]=!1,clearTimeout(e(this,s)[s]);for(let t=0;t<this.limit;t++)e(this,d)[d]()}pause(t){void 0===t&&(t=null),e(this,i)[i]=!0,clearTimeout(e(this,s)[s]),null!=t&&(e(this,s)[s]=setTimeout(e(this,g)[g],t))}rateLimit(t){clearTimeout(e(this,u)[u]),this.pause(t),this.limit>1&&Number.isFinite(this.limit)&&(e(this,l)[l]=this.limit-1,this.limit=e(this,a)[a],e(this,u)[u]=setTimeout(e(this,v)[v],t))}get isPaused(){return e(this,i)[i]}};const S=Symbol("__queue");return er.internalRateLimitedQueue=S,er}function nr(){return Yn?Gn:(Yn=1,Gn={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}})}var rr=function(){if(Zn)return Qn;Zn=1;var e=Ke,n=Dn(),r=tr();const o=un(),i=In?jn:(In=1,jn=t(function(e,t,n){const{progress:r,bytesUploaded:o,bytesTotal:i}=t;r&&(e.uppy.log(`Upload progress: ${r}`),e.uppy.emit("upload-progress",n,{uploader:e,bytesUploaded:o,bytesTotal:i}))},300,{leading:!0,trailing:!0})),s=Bn?Un:(Bn=1,Un=function(e){const t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e)[1];return`${/^http:\/\//i.test(e)?"ws":"wss"}://${t}`}),a=zn?Hn:(zn=1,Hn=function(e){const t=[],n=[];function r(e){t.push(e)}function o(e){n.push(e)}return Promise.all(e.map(e=>e.then(r,o))).then(()=>({successful:t,failed:n}))}),l=function(){if(Vn)return Wn;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Vn=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("emitter"),o=n("events");return Wn=class{constructor(t){Object.defineProperty(this,r,{writable:!0,value:void 0}),Object.defineProperty(this,o,{writable:!0,value:[]}),e(this,r)[r]=t}on(t,n){return e(this,o)[o].push([t,n]),e(this,r)[r].on(t,n)}remove(){for(const[t,n]of e(this,o)[o].splice(0))e(this,r)[r].off(t,n)}}}(),u=function(){if(Kn)return qn;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Kn=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("aliveTimer"),o=n("isDone"),i=n("onTimedOut"),s=n("timeout");return qn=class{constructor(t,n){Object.defineProperty(this,r,{writable:!0,value:void 0}),Object.defineProperty(this,o,{writable:!0,value:!1}),Object.defineProperty(this,i,{writable:!0,value:void 0}),Object.defineProperty(this,s,{writable:!0,value:void 0}),e(this,s)[s]=t,e(this,i)[i]=n}progress(){e(this,o)[o]||e(this,s)[s]>0&&(clearTimeout(e(this,r)[r]),e(this,r)[r]=setTimeout(e(this,i)[i],e(this,s)[s]))}done(){e(this,o)[o]||(clearTimeout(e(this,r)[r]),e(this,r)[r]=null,e(this,o)[o]=!0)}}}(),c=On(),d=Xn?Jn:(Xn=1,Jn=function(e){return!!e&&(0!==e.readyState&&4!==e.readyState||0===e.status)}),h=nr();function p(e,t){let n=t;return n||(n=new Error("Upload error")),"string"==typeof n&&(n=new Error(n)),n instanceof Error||(n=Object.assign(new Error("Upload error"),{data:n})),d(e)?(n=new c(n,e),n):(n.request=e,n)}function f(e){return e.data.slice(0,e.data.size,e.meta.type)}class g extends o{constructor(e,t){super(e,t),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.title="XHRUpload",this.defaultLocale=h;const n={formData:!0,fieldName:t.bundle?"files[]":"file",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},timeout:3e4,limit:5,withCredentials:!1,responseType:"",getResponseData(t){let n={};try{n=JSON.parse(t)}catch(t){e.log(t)}return n},getResponseError(e,t){let n=new Error("Upload error");return d(t)&&(n=new c(n,t)),n},validateStatus:e=>e>=200&&e<300};if(this.opts={...n,...t},this.i18nInit(),this.handleUpload=this.handleUpload.bind(this),r.internalRateLimitedQueue in this.opts?this.requests=this.opts[r.internalRateLimitedQueue]:this.requests=new r.RateLimitedQueue(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");this.uploaderEvents=Object.create(null)}getOptions(e){const t=this.uppy.getState().xhrUpload,{headers:n}=this.opts,r={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return"function"==typeof n?r.headers=n(e):Object.assign(r.headers,this.opts.headers),t&&Object.assign(r.headers,t.headers),e.xhrUpload&&Object.assign(r.headers,e.xhrUpload.headers),r}addMetadata(e,t,n){(Array.isArray(n.metaFields)?n.metaFields:Object.keys(t)).forEach(n=>{e.append(n,t[n])})}createFormDataUpload(e,t){const n=new FormData;this.addMetadata(n,e.meta,t);const r=f(e);return e.name?n.append(t.fieldName,r,e.meta.name):n.append(t.fieldName,r),n}createBundledUpload(e,t){const n=new FormData,{meta:r}=this.uppy.getState();return this.addMetadata(n,r,t),e.forEach(e=>{const t=this.getOptions(e),r=f(e);e.name?n.append(t.fieldName,r,e.name):n.append(t.fieldName,r)}),n}upload(t,n,r){const o=this.getOptions(t);return this.uppy.log(`uploading ${n} of ${r}`),new Promise((n,r)=>{this.uppy.emit("upload-started",t);const i=o.formData?this.createFormDataUpload(t,o):t.data,s=new XMLHttpRequest;let a;this.uploaderEvents[t.id]=new l(this.uppy);const c=new u(o.timeout,()=>{s.abort(),a.done();const e=new Error(this.i18n("timedOut",{seconds:Math.ceil(o.timeout/1e3)}));this.uppy.emit("upload-error",t,e),r(e)}),d=(0,e.nanoid)();s.upload.addEventListener("loadstart",()=>{this.uppy.log(`[XHRUpload] ${d} started`)}),s.upload.addEventListener("progress",e=>{this.uppy.log(`[XHRUpload] ${d} progress: ${e.loaded} / ${e.total}`),c.progress(),e.lengthComputable&&this.uppy.emit("upload-progress",t,{uploader:this,bytesUploaded:e.loaded,bytesTotal:e.total})}),s.addEventListener("load",()=>{if(this.uppy.log(`[XHRUpload] ${d} finished`),c.done(),a.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null),o.validateStatus(s.status,s.responseText,s)){const e=o.getResponseData(s.responseText,s),r=e[o.responseUrlFieldName],i={status:s.status,body:e,uploadURL:r};return this.uppy.emit("upload-success",t,i),r&&this.uppy.log(`Download ${t.name} from ${r}`),n(t)}const e=o.getResponseData(s.responseText,s),i=p(s,o.getResponseError(s.responseText,s)),l={status:s.status,body:e};return this.uppy.emit("upload-error",t,i,l),r(i)}),s.addEventListener("error",()=>{this.uppy.log(`[XHRUpload] ${d} errored`),c.done(),a.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null);const e=p(s,o.getResponseError(s.responseText,s));return this.uppy.emit("upload-error",t,e),r(e)}),s.open(o.method.toUpperCase(),o.endpoint,!0),s.withCredentials=o.withCredentials,""!==o.responseType&&(s.responseType=o.responseType),a=this.requests.run(()=>{this.uppy.emit("upload-started",t);const e=this.getOptions(t);return Object.keys(e.headers).forEach(t=>{s.setRequestHeader(t,e.headers[t])}),s.send(i),()=>{c.done(),s.abort()}}),this.onFileRemove(t.id,()=>{a.abort(),r(new Error("File removed"))}),this.onCancelAll(t.id,e=>{let{reason:t}=e;"user"===t&&a.abort(),r(new Error("Upload cancelled"))})})}uploadRemote(e){const t=this.getOptions(e);return new Promise((r,o)=>{this.uppy.emit("upload-started",e);const a={};(Array.isArray(t.metaFields)?t.metaFields:Object.keys(e.meta)).forEach(t=>{a[t]=e.meta[t]});new(e.remote.providerOptions.provider?n.Provider:n.RequestClient)(this.uppy,e.remote.providerOptions).post(e.remote.url,{...e.remote.body,endpoint:t.endpoint,size:e.data.size,fieldname:t.fieldName,metadata:a,httpMethod:t.method,useFormData:t.formData,headers:t.headers}).then(a=>{const{token:u}=a,c=s(e.remote.companionUrl),d=new n.Socket({target:`${c}/api/${u}`,autoOpen:!1});let h;this.uploaderEvents[e.id]=new l(this.uppy),this.onFileRemove(e.id,()=>{d.send("cancel",{}),h.abort(),r(`upload ${e.id} was removed`)}),this.onCancelAll(e.id,function(t){let{reason:n}=void 0===t?{}:t;"user"===n&&(d.send("cancel",{}),h.abort()),r(`upload ${e.id} was canceled`)}),this.onRetry(e.id,()=>{d.send("pause",{}),d.send("resume",{})}),this.onRetryAll(e.id,()=>{d.send("pause",{}),d.send("resume",{})}),d.on("progress",t=>i(this,t,e)),d.on("success",n=>{const o=t.getResponseData(n.response.responseText,n.response),i=o[t.responseUrlFieldName],s={status:n.response.status,body:o,uploadURL:i};return this.uppy.emit("upload-success",e,s),h.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),r()}),d.on("error",n=>{const r=n.response,i=r?t.getResponseError(r.responseText,r):Object.assign(new Error(n.error.message),{cause:n.error});this.uppy.emit("upload-error",e,i),h.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),o(i)}),h=this.requests.run(()=>(d.open(),e.isPaused&&d.send("pause",{}),()=>d.close()))}).catch(t=>{this.uppy.emit("upload-error",e,t),o(t)})})}uploadBundle(e){return new Promise((t,n)=>{const{endpoint:r}=this.opts,{method:o}=this.opts,i=this.uppy.getState().xhrUpload,s=this.createBundledUpload(e,{...this.opts,...i||{}}),a=new XMLHttpRequest,l=t=>{e.forEach(e=>{this.uppy.emit("upload-error",e,t)})},c=new u(this.opts.timeout,()=>{a.abort();const e=new Error(this.i18n("timedOut",{seconds:Math.ceil(this.opts.timeout/1e3)}));l(e),n(e)});a.upload.addEventListener("loadstart",()=>{this.uppy.log("[XHRUpload] started uploading bundle"),c.progress()}),a.upload.addEventListener("progress",t=>{c.progress(),t.lengthComputable&&e.forEach(e=>{this.uppy.emit("upload-progress",e,{uploader:this,bytesUploaded:t.loaded/t.total*e.size,bytesTotal:e.size})})}),a.addEventListener("load",r=>{if(c.done(),this.opts.validateStatus(r.target.status,a.responseText,a)){const n=this.opts.getResponseData(a.responseText,a),o={status:r.target.status,body:n};return e.forEach(e=>{this.uppy.emit("upload-success",e,o)}),t()}const o=this.opts.getResponseError(a.responseText,a)||new Error("Upload error");return o.request=a,l(o),n(o)}),a.addEventListener("error",()=>{c.done();const e=this.opts.getResponseError(a.responseText,a)||new Error("Upload error");return l(e),n(e)}),this.uppy.on("cancel-all",function(e){let{reason:t}=void 0===e?{}:e;"user"===t&&(c.done(),a.abort())}),a.open(o.toUpperCase(),r,!0),a.withCredentials=this.opts.withCredentials,""!==this.opts.responseType&&(a.responseType=this.opts.responseType),Object.keys(this.opts.headers).forEach(e=>{a.setRequestHeader(e,this.opts.headers[e])}),a.send(s),e.forEach(e=>{this.uppy.emit("upload-started",e)})})}uploadFiles(e){const t=e.map((t,n)=>{const r=parseInt(n,10)+1,o=e.length;return t.error?Promise.reject(new Error(t.error)):t.isRemote?this.uploadRemote(t,r,o):this.upload(t,r,o)});return a(t)}onFileRemove(e,t){this.uploaderEvents[e].on("file-removed",n=>{e===n.id&&t(n.id)})}onRetry(e,t){this.uploaderEvents[e].on("upload-retry",n=>{e===n&&t()})}onRetryAll(e,t){this.uploaderEvents[e].on("retry-all",()=>{this.uppy.getFile(e)&&t()})}onCancelAll(e,t){var n=this;this.uploaderEvents[e].on("cancel-all",function(){n.uppy.getFile(e)&&t(...arguments)})}handleUpload(e){if(0===e.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();0!==this.opts.limit||this.opts[r.internalRateLimitedQueue]||this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");const t=e.map(e=>this.uppy.getFile(e));if(this.opts.bundle){if(t.some(e=>e.isRemote))throw new Error("Can’t upload remote files when the `bundle: true` option is set");if("function"==typeof this.opts.headers)throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");return this.uploadBundle(t)}return this.uploadFiles(t).then(()=>null)}install(){if(this.opts.bundle){const{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(this.handleUpload)}uninstall(){if(this.opts.bundle){const{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(this.handleUpload)}}return g.VERSION="2.1.3",Qn=g}(),or=le(rr);function ir(e){Promise.resolve().then(e)}function sr(e){return e.replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&reg;/g,"®").replace(/&copy;/g,"©").replace(/&trade;/g,"™").replace(/&quot;/g,'"')}var ar=function(e){return Object.prototype.toString.call(e)};function lr(e){return e||{name:""}}function ur(e){var t=e.server,r=void 0===t?"":t,o=e.fieldName,i=void 0===o?"":o,s=e.maxFileSize,a=void 0===s?10485760:s,l=e.maxNumberOfFiles,u=void 0===l?100:l,c=e.meta,d=void 0===c?{}:c,h=e.metaWithUrl,p=void 0!==h&&h,f=e.headers,g=void 0===f?{}:f,v=e.withCredentials,m=void 0!==v&&v,y=e.timeout,b=void 0===y?1e4:y,w=e.onBeforeUpload,x=void 0===w?function(e){return e}:w,S=e.onSuccess,_=void 0===S?function(e,t){}:S,O=e.onError,E=void 0===O?function(e,t,n){console.error("".concat(e.name," upload error"),t,n)}:O,k=e.onProgress,C=void 0===k?function(e){}:k;if(!r)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!i)throw new Error("Cannot get fieldName\n没有配置 fieldName");var P=r;p&&(P=function(e,t){var r=se(e.split("#"),2),o=r[0],i=r[1],s=[];n(t,function(e,t){s.push("".concat(t,"=").concat(e))});var a=s.join("&");return o=o.indexOf("?")>0?"".concat(o,"&").concat(a):"".concat(o,"?").concat(a),i?"".concat(o,"#").concat(i):o}(P,d));var N=new Sn(oe({onBeforeUpload:function(e){return x(e)},restrictions:{maxFileSize:a,maxNumberOfFiles:u},meta:d},e.uppyConfig)).use(or,oe({endpoint:P,headers:g,formData:!0,fieldName:i,bundle:!1,withCredentials:m,timeout:b},e.xhrConfig));return N.on("upload-success",function(e,t){var n=(null!=t?t:{}).body,r=void 0===n?{}:n,o=lr(e);try{_(o,r)}catch(e){console.error("wangEditor upload file - onSuccess error",e)}}),N.on("progress",function(e){e<1||C(e)}),N.on("upload-error",function(e,t,n){var r=lr(e);try{E(r,t,n)}catch(e){console.error("wangEditor upload file - onError error",e)}}),N.on("restriction-failed",function(e,t){var n=lr(e);try{E(n,t,void 0)}catch(e){console.error("wangEditor upload file - onError error",e)}}),N}var cr={isHistory:e=>a(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||i.isOperationList(e.redos[0].operations))&&(0===e.undos.length||i.isOperationList(e.undos[0].operations))},dr=new WeakMap,hr=new WeakMap,pr=new WeakMap,fr={isHistoryEditor:e=>cr.isHistory(e.history)&&o.isEditor(e),isMerging:e=>hr.get(e),isSplittingOnce:e=>pr.get(e),setSplittingOnce(e,t){pr.set(e,t)},isSaving:e=>dr.get(e),redo(e){e.redo()},undo(e){e.undo()},withMerging(e,t){var n=fr.isMerging(e);hr.set(e,!0),t(),hr.set(e,n)},withNewBatch(e,t){var n=fr.isMerging(e);hr.set(e,!0),pr.set(e,!0),t(),hr.set(e,n),pr.delete(e)},withoutMerging(e,t){var n=fr.isMerging(e);hr.set(e,!1),t(),hr.set(e,n)},withoutSaving(e,t){var n=fr.isSaving(e);dr.set(e,!1);try{t()}finally{dr.set(e,n)}}},gr=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var i=n[n.length-1];i.selectionBefore&&r.setSelection(t,i.selectionBefore),fr.withoutSaving(t,()=>{o.withoutNormalizing(t,()=>{for(var e of i.operations)t.apply(e)})}),e.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var s=n[n.length-1];fr.withoutSaving(t,()=>{o.withoutNormalizing(t,()=>{var e=s.operations.map(i.inverse).reverse();for(var n of e)t.apply(n);s.selectionBefore&&r.setSelection(t,s.selectionBefore)})}),t.writeHistory("redos",s),e.undos.pop()}},t.apply=e=>{var{operations:r,history:o}=t,{undos:i}=o,s=i[i.length-1],a=s&&s.operations[s.operations.length-1],l=fr.isSaving(t),u=fr.isMerging(t);if(null==l&&(l=mr(e)),l){if(null==u&&(u=null!=s&&(!!r.includes(a)||vr(e,a))),fr.isSplittingOnce(t)&&(u=!1,fr.setSplittingOnce(t,void 0)),s&&u)s.operations.push(e);else{var c={operations:[e],selectionBefore:t.selection};t.writeHistory("undos",c)}for(;i.length>100;)i.shift();o.redos=[]}n(e)},t.writeHistory=(e,n)=>{t.history[e].push(n)},t},vr=(e,t)=>!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!s.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!s.equals(e.path,t.path)),mr=(e,t)=>"set_selection"!==e.type,yr=new Set(["base","embed","math","meta","object","script","svg","template"]),br=new Set(["href","poster","src","xlink:href"]),wr=["java","script:"].join("");function xr(e,t,n){var r=function(e){return Array.from(e).filter(function(e){return e>" "}).join("").toLowerCase()}(n);return!r||!r.startsWith(wr)&&!r.startsWith("vbscript:")&&(!r.startsWith("data:")||"href"!==t&&"xlink:href"!==t&&(("img"===e||"poster"===t)&&r.startsWith("data:image/")))}function Sr(e){if(void 0===e&&(e=""),!e)return"";var t=(new DOMParser).parseFromString(e,"text/html");return Array.from(t.body.querySelectorAll("*")).forEach(function(e){var t=e.tagName.toLowerCase();yr.has(t)?e.remove():Array.from(e.attributes).forEach(function(n){var r=n.name.toLowerCase(),o=n.value||"";("srcdoc"===r||r.startsWith("on")||br.has(r)&&!xr(t,r,o))&&e.removeAttribute(n.name)})}),t.body.innerHTML}var _r={};var Or="created",Er="destroyed",kr="change",Cr="scroll",Pr="fullscreen",Nr="unFullScreen",Tr="modalOrPanelShow",Mr="modalOrPanelHide",Lr={};function Rr(e,t){var n=e.key,r=e.factory,o=e.config,i=oe(oe({},o),t||{});if(null!=Lr[n])throw new Error("Duplicated key '".concat(n,"' in menu items"));Lr[n]=r,function(e,t){null!=t&&(_r[e]=t)}(n,i)}var $r=new WeakMap,Fr=new WeakMap,Dr=new WeakMap,Ar=new WeakMap,jr=new WeakMap,Ir=new WeakMap,Ur=new WeakMap,Br=new WeakMap,Hr=new WeakMap,zr=new WeakMap,Wr=new WeakMap,Vr=new WeakMap,qr=new WeakMap,Kr=new WeakMap,Jr=new WeakMap,Xr=new WeakMap,Gr=new WeakMap,Yr=new WeakMap,Qr=new WeakMap,Zr=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,ro=new WeakMap,oo=new WeakMap,io=new WeakMap,so=new WeakMap,ao=new WeakMap,lo=new WeakMap,uo=function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in Lr)e.push(t);return e},t.getConfig=function(){var e=zr.get(t);if(null==e)throw new Error("Can not get editor config");return e},t.getMenuConfig=function(e){var n=t.getConfig().MENU_CONF;return(void 0===n?{}:n)[e]||{}},t.alert=function(e,n){void 0===n&&(n="info");var r=t.getConfig().customAlert;r&&r(e,n)},t},co=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]);const ho=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var po,fo=globalThis.Node,go=globalThis.Comment,vo=globalThis.Element,mo=globalThis.Text,yo=globalThis.Range,bo=globalThis.Selection,wo=globalThis.StaticRange;v&&(g.fn.css=v),m&&(g.fn.append=m),y&&(g.fn.addClass=y),b&&(g.fn.removeClass=b),w&&(g.fn.hasClass=w),x&&(g.fn.on=x),S&&(g.fn.focus=S),_&&(g.fn.attr=_),O&&(g.fn.removeAttr=O),E&&(g.fn.hide=E),k&&(g.fn.show=k),C&&(g.fn.offset=C),P&&(g.fn.width=P),N&&(g.fn.height=N),T&&(g.fn.parent=T),M&&(g.fn.parents=M),L&&(g.fn.is=L),R&&(g.fn.dataset=R),$&&(g.fn.val=$),F&&(g.fn.text=F),D&&(g.fn.html=D),A&&(g.fn.children=A),j&&(g.fn.remove=j),I&&(g.fn.find=I),U&&(g.fn.each=U),B&&(g.fn.empty=B),function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(po||(po={}));var xo=function(e){return"[object HTMLDocument]"===ar(e)},So=function(e){return"[object ShadowRoot]"===ar(e)},_o=function(e){return"[object DataTransfer]"===ar(e)},Oo=/\[object HTML([A-Z][a-z]*)*Element\]/,Eo=function(e){return"matches"in e&&/^[ou]l$/i.test(e.tagName)&&!e.hasAttribute("data-w-e-type")},ko=function(e){return Oo.test(ar(e))},Co=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},Po=function(e){return null!=e&&"number"==typeof e.nodeType},No=function(e){return Po(e)&&e.nodeType===po.COMMENT_NODE},To=function(e){return Po(e)&&e.nodeType===po.ELEMENT_NODE},Mo=function(e){return"[object Selection]"===ar(e)},Lo=function(e){return Po(e)&&e.nodeType===po.TEXT_NODE},Ro=function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length},$o=function(e){var t,n=se(e,2),r=n[0],o=n[1];if(To(r)&&r.childNodes.length){var i=o===r.childNodes.length,s=i?o-1:o;for(r=(t=se(Ao(r,s,i?"backward":"forward"),2))[0],i=(s=t[1])<o;To(r)&&r.childNodes.length;){var a=i?r.childNodes.length-1:0;r=jo(r,a,i?"backward":"forward")}o=i&&null!=r.textContent?r.textContent.length:0}return[r,o]},Fo=function(){return!(!window.document.activeElement||!window.document.activeElement.shadowRoot)},Do=function(e){var t,n,r;return null!==(t=window&&window.document.getElementById(e))&&void 0!==t?t:window&&(null===(r=null===(n=window.document.activeElement)||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.getElementById(e))||null},Ao=function(e,t,n){for(var r=e.childNodes,o=r[t],i=t,s=!1,a=!1;(No(o)||To(o)&&0===o.childNodes.length||To(o)&&"false"===o.getAttribute("contenteditable"))&&(!s||!a);)i>=r.length?(s=!0,i=t-1,n="backward"):i<0?(a=!0,i=t+1,n="forward"):(o=r[i],t=i,i+="forward"===n?1:-1);return[o,t]},jo=function(e,t,n){return se(Ao(e,t,n),1)[0]},Io=function(e){var t,n,r="";if(Lo(e)&&e.nodeValue)return e.nodeValue;if(To(e)){try{for(var o=ie(Array.from(e.childNodes)),i=o.next();!i.done;i=o.next()){var s=i.value;r+=Io(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}var a=getComputedStyle(e).getPropertyValue("display");"block"!==a&&"list"!==a&&"table-row"!==a&&"BR"!==e.tagName||(r+="\n")}return r};function Uo(e){var t=[];t.push(e);for(var n=0;t.length>0;){var r=t.pop();if(null==r)break;if((n+=1)>1e4)break;var o=r.nodeName;if(r.nodeType===po.ELEMENT_NODE){var i=o.toLowerCase();if(ho.includes(i)||"iframe"===i||"video"===i)return r;var s=r.children||[],a=s.length;if(a)for(var l=a-1;l>=0;l-=1)t.push(s[l])}}return null}function Bo(e,t){if(!ko(e)||"true"!==e.dataset.slateVoid)for(var n=e.childNodes,r=n.length;r-=1;){var o=n[r],i=o.nodeType;Lo(o)?t(o,e):[po.ELEMENT_NODE,po.DOCUMENT_NODE,po.DOCUMENT_FRAGMENT_NODE].includes(i)&&Bo(o,t)}}function Ho(e){if(0===e.length)return"";var t=e[0];return t.nodeType!==po.ELEMENT_NODE?"":t.tagName.toLowerCase()}var zo=new RegExp(String.fromCharCode(160),"g");function Wo(e){return e.replace(zo," ")}var Vo=["span","b","strong","i","em","s","strike","u","font","sub","sup"],qo=[];function Ko(e){qo.push(e)}var Jo=[];function Xo(e){Jo.push(e)}var Go={};function Yo(e){var t=e.selector,n=e.parseElemHtml;Go[t]=n}function Qo(e,t){var n=e.length;if(n){var r=e[n-1];if(l.isText(r)){var o=Object.keys(r);if(1===o.length&&"text"===o[0])return r.text+=t,!0}}return!1}function Zo(e,t,n){return{type:"paragraph",children:[{text:g(e).text().replace(/\s+/gm," ")}]}}function ei(e,t){var n=function(e,t){var n=[];if(null!=e.attr("data-w-e-is-void"))return n;var r=e[0].childNodes;return 1===r.length&&"BR"===r[0].nodeName?(n.push({text:""}),n):(r.forEach(function(e){if(To(e)){if("BR"===e.nodeName)return void(Qo(n,"\n")||n.push({text:"\n"}));var r=ii(g(e),t);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}else if(Lo(e)){var o=e.textContent||"";if(""===o.trim()&&o.indexOf("\n")>=0)return;o&&(o=Wo(o),Qo(n,o)||n.push({text:o}))}}),n)}(e,t),r=function(e){for(var t in Go)if(e[0].matches(t))return Go[t];return Zo}(e),i=r(e[0],n,t);return Array.isArray(i)||(i=[i]),i.forEach(function(r){o.isVoid(t,r)||(0===n.length&&(r.children=[{text:e.text().replace(/\s+/gm," ")}]),Jo.forEach(function(n){r=n(e[0],r,t)}))}),i}function ti(e,t){0===e.parents("pre").length&&(e[0].innerHTML=e[0].innerHTML.replace(/[\r\n\t]+/g,"").replace(/<br>/g,"\n"));var n=e[0].textContent||"",r={text:n=Wo(n=sr(n))};return Jo.forEach(function(n){r=n(e[0],r,t)}),r}function ni(e,t){var n={text:""};return Jo.forEach(function(r){n=r(e[0],n,t)}),n}function ri(e,t){var n=t.parentElement;return null==n?e:(null==n.closest("pre")&&(e=e.replace(/[\r\n\t]+/g,"")),e=Wo(e=sr(e)))}function oi(e,t,n){var r=e[0];if(To(r)){var o=ii(e,n);return delete t.text,Array.isArray(o)?o.map(function(e){return oe(oe({},t),e)}):[oe(oe({},t),o)]}if(No(r))return null;var i=Lo(r)?{text:ri(r.textContent||"",r)}:ti(e,n);return[oe(oe({},t),i)]}function ii(e,t){qo.forEach(function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=g(r(e[0])))});var n=Ho(e);if("span"===n){if(e.attr("data-w-e-type"))return ei(e,t);if((o=Array.from(e[0].childNodes)).some(function(e){return!Lo(e)&&!No(e)})){var r=ni(g(e[0]),t);return o.flatMap(function(e){return oi(g(e),r,t)||[]})}return ti(e,t)}if("code"===n)return"pre"===Ho(e.parent())?ei(e,t):ti(e,t);if(Vo.includes(n)){var o;if((o=Array.from(e[0].childNodes)).some(function(e){return!Lo(e)&&!No(e)})){var i=ni(g(e[0]),t);return o.flatMap(function(e){return oi(g(e),i,t)||[]})}return ti(e,t)}return ei(e,t)}function si(e,t,n){var r=g(n);return!!r.attr(t)||(r.attr(t,"true"),e.on(Er,function(){r.removeAttr(t)}),!1)}function ai(e,t){void 0===t&&(t="");var n=[],r=e.getConfig().sanitizeHtml;""===t&&(t="<p><br></p>"),0!==t.indexOf("<")&&(t=t.split(/\n/).map(function(e){return"<p>".concat(e,"</p>")}).join("")),t=r?r(t):t;var o=g("<div>".concat(t,"</div>"));return Array.from(o.children()).forEach(function(t){var r=ii(g(t),e);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}),n}function li(e,t){return"w-e-element-".concat(e,"-").concat(t)}var ui=[];function ci(e){ui.push(e)}var di={};function hi(e){var t=e.type,n=e.elemToHtml;di[t||""]=n}function pi(e,t,n){var r=n.isInline(e)?"span":"div";return"<".concat(r,">").concat(t,"</").concat(r,">")}function fi(e,t){var n=e.type,r=void 0===n?"":n,i=e.children,s=void 0===i?[]:i,a=o.isVoid(t,e),l="";a||(l=s.map(function(e){return Ci(e,t)}).join(""));var u=function(e){return di[e]||pi}(r),c=u(e,l,t),d="";if(d="string"==typeof c?c:c.html||"",a||ui.forEach(function(n){return d=n(e,d,t)}),"string"==typeof c)return d;var h=c.prefix,p=void 0===h?"":h,f=c.suffix,g=void 0===f?"":f;return p&&(d=p+d),g&&(d+=g),d}var gi=0,vi=function(){this.id="".concat(gi++)},mi="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),yi="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),bi="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),wi="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),xi="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Si="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent),_i=!xi&&!wi&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,Oi=function(e,t){return Boolean(e.compareDocumentPosition(t)&fo.DOCUMENT_POSITION_PRECEDING)},Ei=function(e,t){return Boolean(e.compareDocumentPosition(t)&fo.DOCUMENT_POSITION_FOLLOWING)},ki={getWindow:function(e){var t=no.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},findKey:function(e,t){var n=to.get(t);return n||(n=new vi,to.set(t,n)),n},setNewKey:function(e){var t=new vi;to.set(e,t)},findPath:function(e,t){for(var n=[],r=t;;){var i=Gr.get(r);if(null==i){if(o.isEditor(r))return n;break}var s=Xr.get(r);if(null==s)break;n.unshift(s),r=i}throw new Error("Unable to find the path for Slate node: ".concat(JSON.stringify(t)))},findDocumentOrShadowRoot:function(e){if(e.isDestroyed)return window.document;var t=ki.toDOMNode(e,e),n=t.getRootNode();return(xo(n)||So(n))&&null!=Reflect.get(n,"getSelection")?n:t.ownerDocument},getParentNode:function(e,t){return Gr.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=ki.getParentNode(e,r);if(null==o)break;n.push(o),r=o}return n},getTopNode:function(e,t){var n=[ki.findPath(e,t)[0]];return d.get(e,n)},toDOMNode:function(e,t){var n;if(o.isEditor(t))n=Yr.get(e);else{var r=ki.findKey(e,t);n=Zr.get(r)}if(!n)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(JSON.stringify(t)));return n},hasDOMNodeBySlateNode:function(e,t){if(o.isEditor(t))return!!Yr.get(e);var n=ki.findKey(e,t);return!!Zr.get(n)},canResolveDOMRange:function(e,t){try{var n=se(o.node(e,t.anchor.path),1)[0],r=se(u.isCollapsed(t)?[n]:o.node(e,t.focus.path),1)[0];return ki.hasDOMNodeBySlateNode(e,n)&&ki.hasDOMNodeBySlateNode(e,r)}catch(e){return!1}},hasDOMNode:function(e,t,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,s=ki.toDOMNode(e,e);try{r=To(t)?t:t.parentElement}catch(e){if(e instanceof Error&&!e.message.includes('Permission denied to access property "nodeType"'))throw e}return!!r&&(r.closest("[data-slate-editor]")===s&&(!i||r.isContentEditable||r.closest('[contenteditable="false"]')===s||!!r.getAttribute("data-slate-zero-width"))||!!r.getAttribute("data-slate-string"))},toDOMRange:function(e,t){var n=t.anchor,r=t.focus,o=u.isBackward(t),i=ki.toDOMPoint(e,n),s=u.isCollapsed(t)?i:ki.toDOMPoint(e,r),a=ki.getWindow(e).document.createRange(),l=se(o?s:i,2),c=l[0],d=l[1],h=se(o?i:s,2),p=h[0],f=h[1],g=!!(To(c)?c:c.parentElement).getAttribute("data-slate-zero-width"),v=!!(To(p)?p:p.parentElement).getAttribute("data-slate-zero-width");return a.setStart(c,g?1:d),a.setEnd(p,v?1:f),a},toDOMPoint:function(e,t){var n,r,i,s=se(o.node(e,t.path),1)[0],a=ki.toDOMNode(e,s);o.void(e,{at:t})&&(t={path:t.path,offset:0});var l=Array.from(a.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),u=0;try{for(var c=ie(l),d=c.next();!d.done;d=c.next()){var h=d.value,p=h.childNodes[0];if(null!=p&&null!=p.textContent){var f=p.textContent.length,g=h.getAttribute("data-slate-length"),v=u+(null==g?f:parseInt(g,10));if(t.offset<=v){i=[p,Math.min(f,Math.max(0,t.offset-u))];break}u=v}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(JSON.stringify(t)));return i},toSlateNode:function(e,t){var n=To(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Qr.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},findEventRange:function(e,t){"nativeEvent"in t&&(t=t.nativeEvent);var n=t.clientX,r=t.clientY,i=t.target;if(null==n||null==r)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var s,a=ki.toSlateNode(e,t.target),l=ki.findPath(e,a);if(c.isElement(a)&&o.isVoid(e,a)){var u=i.getBoundingClientRect(),d=e.isInline(a)?n-u.left<u.left+u.width-n:r-u.top<u.top+u.height-r,h=o.point(e,l,{edge:d?"start":"end"}),p=d?o.before(e,h):o.after(e,h);if(p)return o.range(e,p)}var f=this.getWindow(e).document;if(f.caretRangeFromPoint)s=f.caretRangeFromPoint(n,r);else{var g=f.caretPositionFromPoint(n,r);g&&((s=f.createRange()).setStart(g.offsetNode,g.offset),s.setEnd(g.offsetNode,g.offset))}if(!s)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));return ki.toSlateRange(e,s,{exactMatch:!1,suppressThrow:!1})},toSlateRange:function(e,t,n){var r,i,s,a,l,c=n.exactMatch,d=n.suppressThrow;if((Mo(t)?t.anchorNode:t.startContainer)&&(Mo(t)?(r=t.anchorNode,i=t.anchorOffset,s=t.focusNode,a=t.focusOffset,l=Si&&Fo()?t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:t.isCollapsed):(r=t.startContainer,i=t.startOffset,s=t.endContainer,a=t.endOffset,l=t.collapsed)),null==r||null==s||null==i||null==a)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));var h=ki.toSlatePoint(e,[r,i],{exactMatch:c,suppressThrow:d});if(!h)return null;var p=l?h:ki.toSlatePoint(e,[s,a],{exactMatch:c,suppressThrow:d,searchDirection:Oi(r,s)||r===s&&a<i?"forward":"backward"});if(!p)return null;var f={anchor:h,focus:p};return u.isExpanded(f)&&u.isForward(f)&&To(s)&&o.void(e,{at:f.focus,mode:"highest"})&&(f=o.unhangRange(e,f,{voids:!0})),f},toSlatePoint:function(e,t,n){var r,o,i,s=n.exactMatch,a=n.suppressThrow,l=se(s?t:$o(t),2),u=l[0],c=l[1],d=u.parentNode,h=n.searchDirection,p=null,f=0;if(d){var g=ki.toDOMNode(e,e),v=d.closest('[data-slate-void="true"]'),m=v&&g.contains(v)?v:null,y=d.closest('[contenteditable="false"]'),b=y&&g.contains(y)?y:null,w=d.closest("[data-slate-leaf]"),x=null,S=ki.getWindow(e);if(w&&S.document.createRange){p=w.closest('[data-slate-node="text"]');var _=S.document.createRange();_.setStart(p,0),_.setEnd(u,c);var O=_.cloneContents();ae(ae([],se(H(O.querySelectorAll("[data-slate-zero-width]"))),!1),se(H(O.querySelectorAll("[contenteditable=false]"))),!1).forEach(function(e){e.parentNode.removeChild(e)}),f=O.textContent.length,x=p}else if(m)(w=Array.from(m.querySelectorAll("[data-slate-leaf]")).find(function(t){return ki.hasDOMNode(e,t)})||null)?(p=w.closest('[data-slate-node="text"]'),f=(x=w).textContent.length,x.querySelectorAll("[data-slate-zero-width]").forEach(function(e){f-=e.textContent.length})):f=1;else if(b){var E=function(t){return t?Array.from(t.querySelectorAll("[data-slate-leaf]")).filter(function(t){return ki.hasDOMNode(e,t)}):[]},k=b.closest('[data-slate-node="element"]');if("backward"===h||!h)for(var C=(N=ae(ae([],se(E(null==k?void 0:k.previousElementSibling)),!1),se(E(k)),!1)).length-1;C>=0;C-=1){var P=N[C];if(Oi(b,P)){w=P,h="backward";break}}if(!(w||"forward"!==h&&h)){var N=ae(ae([],se(E(k)),!1),se(E(null==k?void 0:k.nextElementSibling)),!1);try{for(var T=ie(N),M=T.next();!M.done;M=T.next()){P=M.value;if(Ei(b,P)){w=P,h="forward";break}}}catch(e){r={error:e}}finally{try{M&&!M.done&&(o=T.return)&&o.call(T)}finally{if(r)throw r.error}}}w&&(p=w.closest('[data-slate-node="text"]'),x=w,"forward"===h?f=0:(f=x.textContent.length,x.querySelectorAll("[data-slate-zero-width]").forEach(function(e){f-=e.textContent.length})))}x&&f===x.textContent.length&&(d.hasAttribute("data-slate-zero-width")||yi&&(null===(i=x.textContent)||void 0===i?void 0:i.endsWith("\n")))&&(f-=1)}if(!p){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var L,R=ki.toSlateNode(e,p);try{L=ki.findPath(e,R)}catch(e){if(a)return null;throw e}return{path:L,offset:f}},hasRange:function(e,t){var n=t.anchor,r=t.focus;return o.hasPath(e,n.path)&&o.hasPath(e,r.path)},getNodeType:function(e){return c.isElement(e)?e.type:""},checkNodeType:function(e,t){return this.getNodeType(e)===t},getNodesStr:function(e){return e.map(function(e){return d.string(e)}).join("")},getSelectedElems:function(e){var t,n,r=[],i=o.nodes(e,{universal:!0});try{for(var s=ie(i),a=s.next();!a.done;a=s.next()){var l=se(a.value,1)[0];c.isElement(l)&&r.push(l)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return r},getSelectedNodeByType:function(e,t){var n=this,r=se(o.nodes(e,{match:function(e){return n.checkNodeType(e,t)},universal:!0}),1),i=r[0];return null==i?null:i[0]},getSelectedTextNode:function(e){var t=se(o.nodes(e,{match:function(e){return l.isText(e)},universal:!0}),1),n=t[0];return null==n?null:n[0]},isNodeSelected:function(e,t){var n=se(o.nodes(e,{match:function(e){return e===t},universal:!0}),1),r=n[0];return null!=r&&se(r,1)[0]===t},isSelectionAtLineEnd:function(e,t){var n=e.selection;return!!n&&(o.isEnd(e,n.anchor,t)||o.isEnd(e,n.focus,t))},getTextarea:function(e){var t=$r.get(e);if(null==t)throw new Error("Cannot find textarea instance by editor");return t},getToolbar:function(e){return Ar.get(e)||null},getHoverbar:function(e){return Ir.get(e)||null},normalizeContent:function(e){e.children.forEach(function(t,n){e.normalizeNode([t,[n]])})},getLeftLengthOfMaxLength:function(e){var t=e.getConfig(),n=t.maxLength,r=t.onMaxLength;if("number"!=typeof n||n<=0)return 1/0;var o=n-e.getText().replace(/\r|\n|(\r\n)|(\n\r)/g,"").length;return o<=0&&r&&r(e),o},cleanExposedTexNodeInSelectionBlock:function(e){var t,n,r,i,s=ki.getTextarea(e).$textArea,a=null==s?void 0:s[0].childNodes;if(a)try{for(var l=ie(Array.from(a)),u=l.next();!u.done;u=l.next()){var d=u.value;if(!Lo(d))break;d.remove()}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}var h=o.nodes(e,{match:function(t){return!(!c.isElement(t)||e.isInline(t))},universal:!0});try{for(var p=ie(h),f=p.next();!f.done;f=p.next()){var v=f.value;if(null!=v){var m=v[0];if(!ki.hasDOMNodeBySlateNode(e,m))continue;Bo(ki.toDOMNode(e,m),function(e,t){var n=g(t);n.attr("data-slate-string")||n.attr("data-slate-zero-width")||n.attr("data-w-e-reserve")||t.removeChild(e)})}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}},isLastNode:function(e,t){var n=e.children||[];return n[n.length-1]===t},genEmptyParagraph:function(){return{type:"paragraph",children:[{text:""}]}},isSelectedVoidNode:function(e){var t,n,r=o.nodes(e,{match:function(t){return e.isVoid(t)}}),i=0;try{for(var s=ie(r),a=s.next();!a.done;a=s.next()){a.value&&(i+=1)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i>0},isSelectedEmptyParagraph:function(e){var t=e.selection;if(null==t)return!1;if(u.isExpanded(t))return!1;var n=ki.getSelectedNodeByType(e,"paragraph");if(null===n)return!1;var r=n.children;return 1===r.length&&(""===r[0].text||void 0)},isEmptyPath:function(e,t){var n=o.node(e,t);if(null==n)return!1;var r=se(n,1)[0].children;if(1===r.length&&""===r[0].text)return!0;return!1}};function Ci(e,t){return c.isElement(e)?fi(e,t):function(e,t){var n=e.text;if(null==n)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=n;r=function(e){return e.replace(/ {2}/g," &nbsp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/®/g,"&reg;").replace(/©/g,"&copy;").replace(/™/g,"&trade;")}(r);var o=ki.getParentsNodes(t,e).some(function(e){return"pre"===ki.getNodeType(e)});if(o||(r=r.replace(/\n\r|\r\n|\r|\n/g,"<br>")),o&&(r=r.replace(/&nbsp;/g," ")),""===r){var i=ki.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="<br>"}return ui.forEach(function(n){return r=n(e,r,t)}),r}(e,t)}var Pi=function(e,t){var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ni=function(e,t,n){var r=ki.toDOMRange(e,t).getBoundingClientRect(),o=ki.toDOMRange(e,n).getBoundingClientRect();return Pi(r,o)&&Pi(o,r)},Ti=function(e,t){var n,r,i=[];try{for(var s=ie(o.levels(e,{at:t})),a=s.next();!a.done;a=s.next()){var l=se(a.value,2),u=l[0],c=l[1],d=ki.findKey(e,u);i.push([c,d])}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i};function Mi(e,t){e.isInline(t)?(e.insertNode(t),"link"===t.type&&e.insertFragment([{text:""}])):r.insertNodes(e,t,{mode:"highest"})}var Li,Ri,$i,Fi,Di,Ai,ji,Ii,Ui,Bi,Hi,zi,Wi,Vi,qi,Ki,Ji,Xi,Gi,Yi,Qi,Zi,es,ts,ns,rs,os,is,ss,as,ls,us,cs,ds,hs,ps,fs,gs,vs,ms,ys=function(e){var t=e,n=t.onChange,i=t.insertText,a=t.apply,p=t.deleteBackward,f=t.deleteFragment;return t.insertText=function(e){t.getConfig().readOnly||i(e)},t.apply=function(e){var n,r,i,l,u,c,d,h,p=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":case"split_node":p.push.apply(p,ae([],se(Ti(t,e.path)),!1));break;case"insert_node":case"remove_node":p.push.apply(p,ae([],se(Ti(t,s.parent(e.path))),!1));break;case"merge_node":var f=s.previous(e.path);p.push.apply(p,ae([],se(Ti(t,f)),!1));break;case"move_node":var g=s.common(s.parent(e.path),s.parent(e.newPath));p.push.apply(p,ae([],se(Ti(t,g)),!1));break;case"set_selection":(null===(l=null===(i=e.newProperties)||void 0===i?void 0:i.focus)||void 0===l?void 0:l.path)&&(p.push.apply(p,ae([],se(Ti(t,null===(c=null===(u=e.newProperties)||void 0===u?void 0:u.focus)||void 0===c?void 0:c.path)),!1)),p.push.apply(p,ae([],se(Ti(t,null===(h=null===(d=e.properties)||void 0===d?void 0:d.focus)||void 0===h?void 0:h.path)),!1)))}a(e);try{for(var v=ie(p),m=v.next();!m.done;m=v.next()){var y=se(m.value,2),b=y[0],w=y[1],x=se(o.node(t,b),1)[0];to.set(x,w),"type"in x&&(Kr.has(x)&&Kr.delete(x),Jr.has(x)&&Jr.delete(x))}}catch(e){n={error:e}}finally{try{m&&!m.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}},t.deleteBackward=function(n){if("line"!==n)return p(n);if(e.selection&&u.isCollapsed(e.selection)){var i=o.above(e,{match:function(t){return c.isElement(t)&&o.isBlock(e,t)},at:e.selection});if(i){var s=se(i,2)[1],a=o.range(e,s,e.selection.anchor),l=function(e,t){var n=o.range(e,u.end(t)),r=Array.from(o.positions(e,{at:t})),i=0,s=r.length,a=Math.floor(s/2);if(Ni(e,o.range(e,r[i]),n))return o.range(e,r[i],n);if(r.length<2)return o.range(e,r[r.length-1],n);for(;a!==r.length&&a!==i;)Ni(e,o.range(e,r[a]),n)?s=a:i=a,a=Math.floor((i+s)/2);return o.range(e,r[s],n)}(t,a);u.isCollapsed(l)||r.delete(e,{at:l})}}},t.deleteFragment=function(e){var n=function(e){var t=e.selection;if(null==t||u.isCollapsed(t))return!1;var n=se(u.edges(t),2),r=n[0],i=n[1],s=se(o.edges(e,[]),2),a=s[0],l=s[1];return h.equals(r,a)&&h.equals(i,l)}(t);f(e),n&&(!function(e){var t=[{type:"paragraph",children:[{text:""}]}];o.withoutNormalizing(e,function(){for(var n=e.children.length-1;n>=0;n-=1)r.removeNodes(e,{at:[n]});r.insertNodes(e,t,{at:[0]})})}(t),t.children.length>0&&r.select(t,o.start(t,[])))},t.onChange=function(){var e=t.selection;null!=e&&oo.set(t,e),t.emit(kr),n()},t.handleTab=function(){t.insertText(" ")},t.getHtml=function(){var e=t.children,n=void 0===e?[]:e,r=t.getConfig().skipCacheTypes,o=void 0===r?["list-item"]:r;return n.map(function(e){var n=ki.getNodeType(e);if(o.includes(n))return Ci(e,t);var r=Jr.get(e);if(r)return r;var i=Ci(e,t);return Jr.set(e,i),i}).join("")},t.getText=function(){var e=t.children;return(void 0===e?[]:e).map(function(e){return d.string(e)}).join("\n")},t.getSelectionText=function(){var n=t.selection;return null==n?"":o.string(e,n)},t.getElemsByType=function(e,n){var r,i;void 0===n&&(n=!1);var s=[],a=o.nodes(t,{at:[],universal:!0});try{for(var l=ie(a),u=l.next();!u.done;u=l.next()){var d=se(u.value,1)[0];if(c.isElement(d))if(n?d.type.indexOf(e)>=0:d.type===e){var h=ki.findKey(t,d),p=li(d.type,h.id);s.push(oe(oe({},d),{id:p}))}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}return s},t.getElemsByTypePrefix=function(e){return t.getElemsByType(e,!0)},t.isEmpty=function(){var e=t.children,n=void 0===e?[]:e;if(n.length>1)return!1;var r=n[0];if(null==r)return!0;if(!c.isElement(r)||"paragraph"!==r.type)return!1;var o=r.children,i=void 0===o?[]:o;if(i.length>1)return!1;var s=i[0];return null==s||l.isText(s)&&""===s.text},t.clear=function(){r.delete(t,{at:{anchor:o.start(t,[]),focus:o.end(t,[])}}),0!==t.children.length?function(e){var t=e.children[0];if(1===e.children.length&&c.isElement(t)&&("paragraph"!==t.type||""!==d.string(t))&&""===d.string(t)){var n=[{type:"paragraph",children:[{text:""}]}];o.withoutNormalizing(e,function(){r.removeNodes(e,{at:[0]}),r.insertNodes(e,n,{at:[0]})})}}(t):r.insertNodes(t,[{type:"paragraph",children:[{text:""}]}])},t.getParentNode=function(e){return ki.getParentNode(t,e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e){var o=document.createElement("div");o.innerHTML=e;var i=Array.from(o.childNodes);if(i=i.filter(function(e){var t=e.nodeName;return!!Lo(e)||!!To(e)&&!co.has(t.toLowerCase())}),0!==i.length){var s=t.selection;if(null!=s){var a=null;if(ki.isSelectedEmptyParagraph(t)&&!n)a=[s.focus.path[0]];o.setAttribute("hidden","true"),document.body.appendChild(o);var l=0;i.forEach(function(e,n){var r=e.nodeName,o=e.textContent,s=void 0===o?"":o;if(Lo(e)){if(!s||!s.trim())return;t.insertNode({text:s})}else if("BR"!==r){var a=e,u=!1;if(Vo.includes(r.toLowerCase()))u=!0;else for(var c in Go)if(a.matches(c)){u=!0;break}if(u){var d=ii(g(a),t);return Array.isArray(d)?(d.forEach(function(e){return Mi(t,e)}),l+=1):(Mi(t,d),l+=1),void(ki.isSelectedVoidNode(t)&&t.move(1))}var h=window.getComputedStyle(a).display;if(!ki.isSelectedEmptyParagraph(t)&&h.indexOf("inline")<0){if(n>=1){var p=i[n-1];Eo(p)&&t.insertBreak()}t.insertBreak()}t.dangerouslyInsertHtml(a.innerHTML,!0)}else t.insertText("\n")}),l&&a&&ki.isEmptyPath(t,a)&&r.removeNodes(t,{at:a}),o.remove()}}}},t.setHtml=function(e){void 0===e&&(e="");var n=t.isDisabled(),i=t.isFocused(),s=JSON.stringify(t.selection);t.enable(),oo.delete(t),t.focus(),t.clear();var a=ai(t,null==e?"":e);if(r.insertFragment(t,a),i||(t.deselect(),t.blur()),n&&(t.deselect(),t.disable()),t.isFocused())try{var l=JSON.parse(s);u.isRange(l)&&ki.hasRange(t,l)?t.select(l):t.select(o.start(t,[]))}catch(e){t.select(o.start(t,[]))}},t},bs=1,ws=function(e){var t=e;return t.id="wangEditor-".concat(bs),bs+=1,t.isDestroyed=!1,t.isFullScreen=!1,t.focus=function(e){if(ki.toDOMNode(t,t).focus({preventScroll:!0}),ro.set(t,!0),e){var n=o.end(t,[]);r.select(t,n)}else{var i=oo.get(t);i?r.select(t,i):r.select(t,o.start(t,[]))}},t.isFocused=function(){return!!ro.get(t)},t.blur=function(){ki.toDOMNode(t,t).blur(),r.deselect(t),ro.set(t,!1)},t.updateView=function(){ki.getTextarea(t).changeViewState();var e=ki.getToolbar(t);e&&e.changeToolbarState();var n=ki.getHoverbar(t);n&&n.changeHoverbarState()},t.destroy=function(){if(!t.isDestroyed){var e=ki.getTextarea(t);e.destroy(),$r.delete(t),Fr.delete(e);var n=ki.getToolbar(t);n&&(n.destroy(),Ar.delete(t),Dr.delete(n));var r=ki.getHoverbar(t);r&&(r.destroy(),Ir.delete(t),jr.delete(r)),t.isDestroyed=!0,t.emit(Er)}},t.scrollToElem=function(e){if(!t.getConfig().scroll){var n="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return n+="\nYou has disabled editor scroll, please do this yourself",void console.warn(n)}var r=g("#".concat(e));if(0!==r.length){var o=r[0];if(!ki.hasDOMNode(t,o)){n="Element (found by id is '".concat(e,"') is not in editor DOM");return n+="\n 通过 id '".concat(e,"' 找到的 element 不在 editor DOM 之内"),void console.error(n,o)}var i=ki.getTextarea(t),s=i.$textAreaContainer,a=i.$scroll,l=r.offset().top,u=s.offset().top;a[0].scrollBy({top:l-u,behavior:"smooth"})}},t.showProgressBar=function(e){e<1||ki.getTextarea(t).changeProgress(e)},t.hidePanelOrModal=function(){var e=Br.get(t);null!=e&&e.forEach(function(e){return e.hide()})},t.enable=function(){t.getConfig().readOnly=!1,t.updateView()},t.disable=function(){t.getConfig().readOnly=!0,t.updateView()},t.isDisabled=function(){return t.getConfig().readOnly},t.toDOMNode=function(e){return ki.toDOMNode(t,e)},t.fullScreen=function(){if(!t.isFullScreen){var e=null,n=ki.getToolbar(t);n&&(e=n.$box);var r=ki.getTextarea(t).$box.parent();if(e&&e.parent()[0]!==r[0]){throw new Error("Can not set full screen, cause toolbar DOM parent is not equal to textarea DOM parent\n不能设置全屏,因为 toolbar DOM 父节点和 textarea DOM 父节点不一致")}r.addClass("w-e-full-screen-container");var o=r.css("z-index");r.attr("data-z-index",o.toString()),t.isFullScreen=!0,t.emit(Pr)}},t.unFullScreen=function(){if(t.isFullScreen){var e=ki.getTextarea(t).$box.parent();setTimeout(function(){e.removeClass("w-e-full-screen-container"),t.isFullScreen=!1,t.emit(Nr)},200)}},t.getEditableContainer=function(){return ki.getTextarea(t).$textAreaContainer[0]},t},xs={exports:{}},Ss={exports:{}};function _s(){if(Ri)return Li;Ri=1;return Li=function(e){return null!=e}}function Os(){if(Ai)return Di;Ai=1;var e=function(){if(Fi)return $i;Fi=1;var e=_s(),t={object:!0,function:!0,undefined:!0};return $i=function(n){return!!e(n)&&hasOwnProperty.call(t,typeof n)}}();return Di=function(t){if(!e(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(e){return!1}}}function Es(){if(Bi)return Ui;Bi=1;var e=function(){if(Ii)return ji;Ii=1;var e=Os();return ji=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(e){return!1}return!e(t)}}(),t=/^\s*class[\s{/}]/,n=Function.prototype.toString;return Ui=function(r){return!!e(r)&&!t.test(n.call(r))}}function ks(){if(Xi)return Ji;Xi=1;var e=(Ki?qi:(Ki=1,qi=function(){}))();return Ji=function(t){return t!==e&&null!==t},Ji}function Cs(){return Zi||(Zi=1,Qi=(Vi?Wi:(Vi=1,Wi=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}))()?Object.keys:function(){if(Yi)return Gi;Yi=1;var e=ks(),t=Object.keys;return Gi=function(n){return t(e(n)?Object(n):n)}}()),Qi}function Ps(){if(rs)return ns;rs=1;var e=Cs(),t=function(){if(ts)return es;ts=1;var e=ks();return es=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}(),n=Math.max;return ns=function(r,o){var i,s,a,l=n(arguments.length,2);for(r=Object(t(r)),a=function(e){try{r[e]=o[e]}catch(e){i||(i=e)}},s=1;s<l;++s)e(o=arguments[s]).forEach(a);if(void 0!==i)throw i;return r},ns}function Ns(){return is?os:(is=1,os=(zi||(zi=1,Hi=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}),Hi)()?Object.assign:Ps())}function Ts(){return ps||(ps=1,hs=function(){if(us)return ls;us=1;var e="razdwatrzy";return ls=function(){return"function"==typeof e.contains&&!0===e.contains("dwa")&&!1===e.contains("foo")}}()()?String.prototype.contains:function(){if(ds)return cs;ds=1;var e=String.prototype.indexOf;return cs=function(t){return e.call(this,t,arguments[1])>-1},cs}()),hs}function Ms(){if(fs)return Ss.exports;fs=1;var e=_s(),t=Es(),n=Ns(),r=function(){if(as)return ss;as=1;var e=ks(),t=Array.prototype.forEach,n=Object.create;return ss=function(r){var o=n(null);return t.call(arguments,function(t){e(t)&&function(e,t){var n;for(n in e)t[n]=e[n]}(Object(t),o)}),o},ss}(),o=Ts(),i=Ss.exports=function(t,i){var s,a,l,u,c;return arguments.length<2||"string"!=typeof t?(u=i,i=t,t=null):u=arguments[2],e(t)?(s=o.call(t,"c"),a=o.call(t,"e"),l=o.call(t,"w")):(s=l=!0,a=!1),c={value:i,configurable:s,enumerable:a,writable:l},u?n(r(u),c):c};return i.gs=function(i,s,a){var l,u,c,d;return"string"!=typeof i?(c=a,a=s,s=i,i=null):c=arguments[3],e(s)?t(s)?e(a)?t(a)||(c=a,a=void 0):a=void 0:(c=s,s=a=void 0):s=void 0,e(i)?(l=o.call(i,"c"),u=o.call(i,"e")):(l=!0,u=!1),d={get:s,set:a,configurable:l,enumerable:u},c?n(r(c),d):d},Ss.exports}var Ls=(ms||(ms=1,function(e,t){var n,r,o,i,s,a,l,u=Ms(),c=vs?gs:(vs=1,gs=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}),d=Function.prototype.apply,h=Function.prototype.call,p=Object.create,f=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};r=function(e,t){var r,i;return c(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),d.call(t,this,arguments)}),r.__eeOnceListener__=t,this},o=function(e,t){var n,r,o,i;if(c(t),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(r=n[e]))for(i=0;o=r[i];++i)o!==t&&o.__eeOnceListener__!==t||(2===r.length?n[e]=r[i?0:1]:r.splice(i,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},i=function(e){var t,n,r,o,i;if(v.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];for(o=o.slice(),t=0;r=o[t];++t)d.call(r,this,i)}else switch(arguments.length){case 1:h.call(o,this);break;case 2:h.call(o,this,arguments[1]);break;case 3:h.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];d.call(o,this,i)}},s={on:n=function(e,t){var n;return c(t),v.call(this,"__ee__")?n=this.__ee__:(n=m.value=p(null),f(this,"__ee__",m),m.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:r,off:o,emit:i},a={on:u(n),once:u(r),off:u(o),emit:u(i)},l=g({},a),e.exports=t=function(e){return null==e?p(l):g(Object(e),a)},t.methods=s}(xs,xs.exports)),xs.exports),Rs=le(Ls);function $s(e){var t=io.get(e);return null==t&&(t=Rs(),io.set(e,t)),t}var Fs=new WeakMap;function Ds(e,t){var n=Fs.get(e);null==n&&(n=new Set,Fs.set(e,n)),n.add(t)}var As=function(e){var t=e;return t.on=function(e,n){var r=$s(t);if(r.on(e,n),"destroyed"===e&&Ds(t,n),"destroyed"!==e){var o=function(){return r.off(e,n)};r.on("destroyed",o),Ds(t,o)}},t.once=function(e,n){$s(t).once(e,n)},t.off=function(e,n){$s(t).off(e,n)},t.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=$s(t);if(o.emit.apply(o,ae([e],se(n),!1)),"destroyed"===e){var i=function(e){return Fs.get(e)||new Set}(t);i.forEach(function(e){return o.off("destroyed",e)}),function(e){Fs.set(e,new Set)}(t)}},t};var js=function(e){var t=e;return t.setFragmentData=function(e){var n=t.selection;if(n){var r=se(u.edges(n),2),i=r[0],s=r[1],a=o.void(t,{at:i.path}),l=o.void(t,{at:s.path});if(!u.isCollapsed(n)||a){var c=ki.toDOMRange(t,n),d=c.cloneContents(),h=d.childNodes[0];if(d.childNodes.forEach(function(e){e.textContent&&""!==e.textContent.trim()&&(h=e)}),l){var p=se(l,1)[0],f=c.cloneRange(),g=ki.toDOMNode(t,p);f.setEndAfter(g),d=f.cloneContents()}if(a&&(h=d.querySelector("[data-slate-spacer]")),Array.from(d.querySelectorAll("[data-slate-zero-width]")).forEach(function(e){var t="n"===e.getAttribute("data-slate-zero-width");e.textContent=t?"\n":""}),Lo(h)){var v=h.ownerDocument.createElement("span");v.style.whiteSpace="pre",v.appendChild(h),d.appendChild(v),h=v}var m=t.getFragment(),y=JSON.stringify(m),b=window.btoa(encodeURIComponent(y));h.setAttribute("data-slate-fragment",b),e.setData("application/x-slate-fragment",b);var w=d.ownerDocument.createElement("div");return w.appendChild(d),w.setAttribute("hidden","true"),d.ownerDocument.body.appendChild(w),e.setData("text/html",w.innerHTML),e.setData("text/plain",Io(w)),d.ownerDocument.body.removeChild(w),e}}},t.insertData=function(e){var n=e.getData("application/x-slate-fragment");if(n){var r=decodeURIComponent(window.atob(n)),o=JSON.parse(r);t.insertFragment(o)}else{var i=e.getData("text/plain"),s=e.getData("text/html");if(s){var a=t.getConfig().sanitizeHtml;t.dangerouslyInsertHtml(a?a(s):s)}else if(i){if(!/[\r\n]/.test(i))return void t.insertText(i);var l=function(e){return e.replace(/\n\r|\r\n|\r/g,"\n").split("\n").map(function(e){return{type:"paragraph",children:[{text:e}]}})}(i);t.insertFragment(l)}}},t};function Is(e){return e.replace(/\n\r|\r\n|\r|\n/g,"").length}function Us(e,t){var n,r;if(t<=0)return"";var o=t,i="";try{for(var s=ie(e),a=s.next();!a.done;a=s.next()){var l=a.value;if(/\r|\n/.test(l))i+=l;else{if(o<=0)break;i+=l,o-=1}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}var Bs=function(e){var t=e,n=t.insertText,r=t.insertNode,o=t.insertFragment,i=t.dangerouslyInsertHtml;return t.insertText=function(e){if(t.getConfig().maxLength){var r=ki.getLeftLengthOfMaxLength(t);r<=0||(r<e.length?n(e.slice(0,r)):n(e))}else n(e)},t.insertNode=function(e){if(t.getConfig().maxLength){var n=ki.getLeftLengthOfMaxLength(t);if(!(n<=0))n<d.string(e).length||r(e)}else r(e)},t.insertFragment=function(e){if(t.getConfig().maxLength){if(e.length>0){var n=e[0];if(ki.getLeftLengthOfMaxLength(t)<d.string(n).length)return;o([n]);for(var r=1;r<e.length;r+=1)t.insertNode(e[r])}}else o(e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e)if(t.getConfig().maxLength){var r=ki.getLeftLengthOfMaxLength(t);if(!(r<=0)){var o=function(e,t){if(t<=0)return"";var n=document.createElement("div");n.innerHTML=e;var r=function(e){e.forEach(function(e){return e.remove()})},o=function(e){for(var n=Array.from(e.childNodes),i=0;i<n.length;i+=1){var s=n[i];if(Lo(s)){var a=s.textContent||"",l=Is(a);if(l<=t){t-=l;continue}return s.textContent=Us(a,t),t=0,r(n.slice(i+1)),!1}if(To(s)){if(co.has(s.nodeName.toLowerCase())){s.remove();continue}if(!o(s))return r(n.slice(i+1)),!1}else s.remove()}return t>0};return o(n),n.innerHTML}(e,r);o&&i(o,n)}}else i(e,n)},t};function Hs(e){var t=ki.getTextarea(e).$textAreaContainer,n=t.width(),r=t.height(),o=t.offset();return{top:o.top,left:o.left,width:n,height:r}}function zs(e){var t={top:"0",left:"0"},n=e.selection;if(null==n)return t;var r=Hs(e);if(null==r)return t;var o=r.top,i=r.left,s=r.width,a=r.height,l=ki.toDOMRange(e,n).getClientRects(),u=l?l[0]:null;if(null==u)return t;var c={},d=u.top-o,h=u.left-i;if(h>s/2){var p=s-h;c.right="".concat(p+5,"px")}else c.left="".concat(h+5,"px");if(d>a/2){var f=a-d;c.bottom="".concat(f+5,"px")}else{var g=l[l.length-1],v=g.top-o+g.height;v<0&&(v=0),c.top="".concat(v+5,"px")}return c}function Ws(e,t,n){void 0===n&&(n="modal");var r={top:"0",left:"0"};if(null==e.selection)return r;var o=c.isElement(t)&&e.isVoid(t),i=c.isElement(t)&&e.isInline(t),s=eo.get(t);if(null==s)return r;var a=s.getBoundingClientRect(),l=a.top,u=a.left,d=a.height,h=a.width;if(o){var p=Uo(s);if(null!=p){var f=p.getBoundingClientRect();l=f.top,d=f.height}}var g=Hs(e);if(null==g)return r;var v=g.top,m=g.left,y=g.width,b=g.height,w={},x=l-v,S=u-m;if("bar"===n)return w.left="".concat(S,"px"),x>40?w.bottom="".concat(b-x+5,"px"):w.top="".concat(x+d+5,"px"),w;if("modal"===n){if(o?i?S>(y-h)/2?w.right="".concat(y-S+5,"px"):w.left="".concat(S+h+5,"px"):w.left="20px":w.left="".concat(S,"px"),o)(_=x)<0&&(_=0),w.top="".concat(_,"px");else if(x>(b-d)/2)w.bottom="".concat(b-x+5,"px");else{var _;(_=x+d)<0&&(_=0),w.top="".concat(_+5,"px")}return w}throw new Error("type '".concat(n,"' is invalid"))}function Vs(e,t){ir(function(){var n=Hs(e);if(null!=n){var r,o=n.top,i=n.left,s=n.width,a=n.height,l=t.offset(),u=l.top,c=l.left,d=t.width(),h=t.height(),p=u-o,f=c-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=p+h-a)>0){var v=t.css("top"),m=parseInt(v.toString(),10)-r;m<0&&(m=0),t.css("top","".concat(m,"px"))}if(g.indexOf("bottom")>=0&&u<0){var y=t.css("bottom"),b=parseInt(y.toString(),10)-Math.abs(u);t.css("bottom","".concat(b,"px"))}if(g.indexOf("left")>=0)if((r=f+d-s)>0){var w=t.css("left"),x=parseInt(w.toString(),10)-r;x<0&&(x=0),t.css("left","".concat(x,"px"))}if(g.indexOf("right")>=0&&c<0){var S=t.css("right"),_=parseInt(S.toString(),10)-Math.abs(c);t.css("right","".concat(_,"px"))}}})}var qs=function(e){var t=e,n=t.select,r=t.deselect,i=t.move;return t.select=function(e){n(e)},t.deselect=function(){var e=t.selection,n=ki.findDocumentOrShadowRoot(t).getSelection();n&&n.rangeCount>0&&ki.hasDOMNode(t,n.anchorNode)&&ki.hasDOMNode(t,n.focusNode)&&n.removeAllRanges(),e&&r()},t.move=function(e,t){void 0===t&&(t=!1),"number"==typeof e?e&&(e<0||i({distance:e,unit:"character",reverse:t})):i(e)},t.moveReverse=function(e){t.move(e,!0)},t.restoreSelection=function(){var e=oo.get(t);null!=e&&(t.focus(),n(e))},t.getSelectionPosition=function(){return zs(t)},t.getNodePosition=function(e){return Ws(t,e)},t.isSelectedAll=function(){var e=t.selection;if(null==e)return!1;var n=se(u.edges(e),2),r=n[0],i=n[1],s=se(o.edges(t,[]),2),a=s[0],l=s[1];return!(!h.equals(r,a)||!h.equals(i,l))},t.selectAll=function(){var e=o.start(t,[]),r=o.end(t,[]);n({anchor:e,focus:r})},t};const Ks=e=>"string"==typeof e,Js=()=>{let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Xs=e=>null==e?"":""+e,Gs=/###/g,Ys=e=>e&&e.indexOf("###")>-1?e.replace(Gs,"."):e,Qs=e=>!e||Ks(e),Zs=(e,t,n)=>{const r=Ks(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(Qs(e))return{};const t=Ys(r[o]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++o}return Qs(e)?{}:{obj:e,k:Ys(r[o])}},ea=(e,t,n)=>{const{obj:r,k:o}=Zs(e,t,Object);if(void 0!==r||1===t.length)return void(r[o]=n);let i=t[t.length-1],s=t.slice(0,t.length-1),a=Zs(e,s,Object);for(;void 0===a.obj&&s.length;)i=`${s[s.length-1]}.${i}`,s=s.slice(0,s.length-1),a=Zs(e,s,Object),a&&a.obj&&void 0!==a.obj[`${a.k}.${i}`]&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=n},ta=(e,t)=>{const{obj:n,k:r}=Zs(e,t);if(n)return n[r]},na=(e,t,n)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?Ks(e[r])||e[r]instanceof String||Ks(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):na(e[r],t[r],n):e[r]=t[r]);return e},ra=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var oa={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const ia=e=>Ks(e)?e.replace(/[&<>"'\/]/g,e=>oa[e]):e;const sa=[" ",",","?","!",";"],aa=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),la=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let o=e;for(let e=0;e<r.length;){if(!o||"object"!=typeof o)return;let t,i="";for(let s=e;s<r.length;++s)if(s!==e&&(i+=n),i+=r[s],t=o[i],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&s<r.length-1)continue;e+=s-e+1;break}o=t}return o},ua=e=>e&&e.replace("_","-"),ca={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class da{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||ca,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(Ks(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new da(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new da(this.logger,e)}}var ha=new da;class pa{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(e=>{let[t,r]=e;for(let e=0;e<r;e++)t(...n)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(t=>{let[r,o]=t;for(let t=0;t<o;t++)r.apply(r,[e,...n])})}}}class fa extends pa{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let s;e.indexOf(".")>-1?s=e.split("."):(s=[e,t],n&&(Array.isArray(n)?s.push(...n):Ks(n)&&o?s.push(...n.split(o)):s.push(n)));const a=ta(this.data,s);return!a&&!t&&!n&&e.indexOf(".")>-1&&(e=s[0],t=s[1],n=s.slice(2).join(".")),!a&&i&&Ks(n)?la(this.data&&this.data[e]&&this.data[e][t],n,o):a}addResource(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let s=[e,t];n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."),r=t,t=s[1]),this.addNamespaces(t),ea(this.data,s,r),o.silent||this.emit("added",e,t,n,r)}addResources(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const r in n)(Ks(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},s=[e,t];e.indexOf(".")>-1&&(s=e.split("."),r=n,n=t,t=s[1]),this.addNamespaces(t);let a=ta(this.data,s)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?na(a,n,o):a={...a,...n},ea(this.data,s,a),i.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var ga={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(e=>{this.processors[e]&&(t=this.processors[e].process(t,n,r,o))}),t}};const va={};class ma extends pa{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=ha.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const n=this.resolve(e,t);return n&&void 0!==n.res}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let o=t.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const r=sa.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(0===r.length)return!0;const o=aa.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`);let i=!o.test(e);if(!i){const t=e.indexOf(n);t>0&&!o.test(e.substring(0,t))&&(i=!0)}return i})(e,n,r));if(i&&!s){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Ks(o)?[o]:o};const i=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(i[0])>-1)&&(o=i.shift()),e=i.join(r)}return{key:e,namespaces:Ks(o)?[o]:o}}translate(e,t,n){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof t&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const r=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:i,namespaces:s}=this.extractFromKey(e[e.length-1],t),a=s[s.length-1],l=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(u){const e=t.nsSeparator||this.options.nsSeparator;return r?{res:`${a}${e}${i}`,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:`${a}${e}${i}`}return r?{res:i,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:i}const c=this.resolve(e,t);let d=c&&c.res;const h=c&&c.usedKey||i,p=c&&c.exactUsedKey||i,f=Object.prototype.toString.apply(d),g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!Ks(d)&&"boolean"!=typeof d&&"number"!=typeof d;if(!(v&&d&&m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(f)<0)||Ks(g)&&Array.isArray(d))if(v&&Ks(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,e,t,n));else{let r=!1,s=!1;const u=void 0!==t.count&&!Ks(t.count),h=ma.hasDefaultValue(t),p=u?this.pluralResolver.getSuffix(l,t.count,t):"",f=t.ordinal&&u?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",g=u&&!t.ordinal&&0===t.count&&this.pluralResolver.shouldUseIntlApi(),v=g&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${p}`]||t[`defaultValue${f}`]||t.defaultValue;!this.isValidLookup(d)&&h&&(r=!0,d=v),this.isValidLookup(d)||(s=!0,d=i);const m=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&s?void 0:d,y=h&&v!==d&&this.options.updateMissing;if(s||r||y){if(this.logger.log(y?"updateKey":"missingKey",l,a,i,y?v:d),o){const e=this.resolve(i,{...t,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(t.lng||this.language):e.push(t.lng||this.language);const r=(e,n,r)=>{const o=h&&r!==d?r:m;this.options.missingKeyHandler?this.options.missingKeyHandler(e,a,n,o,y,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(e,a,n,o,y,t),this.emit("missingKey",e,a,n,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&u?e.forEach(e=>{const n=this.pluralResolver.getSuffixes(e,t);g&&t[`defaultValue${this.options.pluralSeparator}zero`]&&n.indexOf(`${this.options.pluralSeparator}zero`)<0&&n.push(`${this.options.pluralSeparator}zero`),n.forEach(n=>{r([e],i+n,t[`defaultValue${n}`]||v)})}):r(e,i,v))}d=this.extendTranslation(d,e,t,c,n),s&&d===i&&this.options.appendNamespaceToMissingKey&&(d=`${a}:${i}`),(s||r)&&this.options.parseMissingKeyHandler&&(d="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}:${i}`:i,r?d:void 0):this.options.parseMissingKeyHandler(d))}else{if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,d,{...t,ns:s}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(c.res=e,c.usedParams=this.getUsedParamsDetails(t),c):e}if(o){const e=Array.isArray(d),n=e?[]:{},r=e?p:h;for(const e in d)if(Object.prototype.hasOwnProperty.call(d,e)){const i=`${r}${o}${e}`;n[e]=this.translate(i,{...t,joinArrays:!1,ns:s}),n[e]===i&&(n[e]=d[e])}d=n}}return r?(c.res=d,c.usedParams=this.getUsedParamsDetails(t),c):d}extendTranslation(e,t,n,r,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const s=Ks(e)&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(s){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let l=n.replace&&!Ks(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||r.usedLng,n),s){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return o&&o[0]===r[0]&&!n.context?(i.logger.warn(`It seems you are nesting recursively key: ${r[0]} in key: ${t[0]}`),null):i.translate(...r,t)},n)),n.interpolation&&this.interpolator.reset()}const s=n.postProcess||this.options.postProcess,a=Ks(s)?[s]:s;return null!=e&&a&&a.length&&!1!==n.applyPostProcessor&&(e=ga.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e){let t,n,r,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ks(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;const a=this.extractFromKey(e,s),l=a.key;n=l;let u=a.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const c=void 0!==s.count&&!Ks(s.count),d=c&&!s.ordinal&&0===s.count&&this.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&(Ks(s.context)||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);u.forEach(e=>{this.isValidLookup(t)||(i=e,!va[`${p[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(va[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${p.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(n=>{if(this.isValidLookup(t))return;o=n;const i=[l];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,n,e,s);else{let e;c&&(e=this.pluralResolver.getSuffix(n,s.count,s));const t=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(i.push(l+e),s.ordinal&&0===e.indexOf(r)&&i.push(l+e.replace(r,this.options.pluralSeparator)),d&&i.push(l+t)),h){const n=`${l}${this.options.contextSeparator}${s.context}`;i.push(n),c&&(i.push(n+e),s.ordinal&&0===e.indexOf(r)&&i.push(n+e.replace(r,this.options.pluralSeparator)),d&&i.push(n+t))}}let a;for(;a=i.pop();)this.isValidLookup(t)||(r=a,t=this.getResource(n,e,a,s))}))})}),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!Ks(e.replace);let r=n?e.replace:e;if(n&&void 0!==e.count&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(const e of t)delete r[e]}return r}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}const ya=e=>e.charAt(0).toUpperCase()+e.slice(1);class ba{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ha.create("languageUtils")}getScriptPartFromCode(e){if(!(e=ua(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=ua(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Ks(e)&&e.indexOf("-")>-1){if("undefined"!=typeof Intl&&void 0!==Intl.getCanonicalLocales)try{let t=Intl.getCanonicalLocales(e)[0];if(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)return t}catch(e){}const t=["hans","hant","latn","cyrl","cans","mong","arab"];let n=e.split("-");return this.options.lowerCaseLng?n=n.map(e=>e.toLowerCase()):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=ya(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=ya(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=ya(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Ks(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],o=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Ks(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):Ks(e)&&o(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&o(this.formatLanguageCode(e))}),r}}let wa=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],xa={1:e=>Number(e>1),2:e=>Number(1!=e),3:e=>0,4:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),5:e=>Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5),6:e=>Number(1==e?0:e>=2&&e<=4?1:2),7:e=>Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),8:e=>Number(1==e?0:2==e?1:8!=e&&11!=e?2:3),9:e=>Number(e>=2),10:e=>Number(1==e?0:2==e?1:e<7?2:e<11?3:4),11:e=>Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3),12:e=>Number(e%10!=1||e%100==11),13:e=>Number(0!==e),14:e=>Number(1==e?0:2==e?1:3==e?2:3),15:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2),16:e=>Number(e%10==1&&e%100!=11?0:0!==e?1:2),17:e=>Number(1==e||e%10==1&&e%100!=11?0:1),18:e=>Number(0==e?0:1==e?1:2),19:e=>Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3),20:e=>Number(1==e?0:0==e||e%100>0&&e%100<20?1:2),21:e=>Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0),22:e=>Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)};const Sa=["v1","v2","v3"],_a=["v4"],Oa={zero:0,one:1,two:2,few:3,many:4,other:5};class Ea{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=ha.create("pluralResolver"),this.options.compatibilityJSON&&!_a.includes(this.options.compatibilityJSON)||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(()=>{const e={};return wa.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:xa[t.fc]}})}),e})(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi()){const n=ua("dev"===e?"en":e),r=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(n,{type:r})}catch(n){if(!e.match(/-|_/))return;const r=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(r,t)}return this.pluralRulesCache[o]=i,i}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}getPluralFormsOfKey(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((e,t)=>Oa[e]-Oa[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):n.numbers.map(n=>this.getSuffix(e,n,t)):[]}getSuffix(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getRule(e,n);return r?this.shouldUseIntlApi()?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:this.getSuffixRetroCompatible(r,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let r=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===r?r="plural":1===r&&(r=""));const o=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return"v1"===this.options.compatibilityJSON?1===r?"":"number"==typeof r?`_plural_${r.toString()}`:o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}shouldUseIntlApi(){return!Sa.includes(this.options.compatibilityJSON)}}const ka=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=((e,t,n)=>{const r=ta(e,n);return void 0!==r?r:ta(t,n)})(e,t,n);return!i&&o&&Ks(n)&&(i=la(e,n,r),void 0===i&&(i=la(t,n,r))),i},Ca=e=>e.replace(/\$/g,"$$$$");class Pa{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=ha.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:o,prefixEscaped:i,suffix:s,suffixEscaped:a,formatSeparator:l,unescapeSuffix:u,unescapePrefix:c,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:p,nestingSuffixEscaped:f,nestingOptionsSeparator:g,maxReplaces:v,alwaysFormat:m}=e.interpolation;this.escape=void 0!==t?t:ia,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?ra(o):i||"{{",this.suffix=s?ra(s):a||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=d?ra(d):h||ra("$t("),this.nestingSuffix=p?ra(p):f||ra(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=v||1e3,this.alwaysFormat=void 0!==m&&m,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e&&e.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let o,i,s;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const o=ka(t,a,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,n,{...r,...t,interpolationkey:e}):o}const o=e.split(this.formatSeparator),i=o.shift().trim(),s=o.join(this.formatSeparator).trim();return this.format(ka(t,a,i,this.options.keySeparator,this.options.ignoreJSONStructure),s,n,{...r,...t,interpolationkey:i})};this.resetRegExp();const u=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,c=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,d=[{regex:this.regexpUnescape,safeValue:e=>Ca(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Ca(this.escape(e)):Ca(e)}];return d.forEach(t=>{for(s=0;o=t.regex.exec(e);){const n=o[1].trim();if(i=l(n),void 0===i)if("function"==typeof u){const t=u(e,o,r);i=Ks(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))i="";else{if(c){i=o[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),i=""}else Ks(i)||this.useRawValueToEscape||(i=Xs(i));const a=t.safeValue(i);if(e=e.replace(o[0],a),c?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,t){let n,r,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=(e,t)=>{const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const r=e.split(new RegExp(`${n}[ ]*{`));let i=`{${r[1]}`;e=r[0],i=this.interpolate(i,o);const s=i.match(/'/g),a=i.match(/"/g);(s&&s.length%2==0&&!a||a.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let a=[];o={...i},o=o.replace&&!Ks(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){const e=n[1].split(this.formatSeparator).map(e=>e.trim());n[1]=e.shift(),a=e,l=!0}if(r=t(s.call(this,n[1].trim(),o),o),r&&n[0]===e&&!Ks(r))return r;Ks(r)||(r=Xs(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),r=""),l&&(r=a.reduce((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:n[1].trim()}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}const Na=e=>{const t={};return(n,r,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});const s=r+JSON.stringify(i);let a=t[s];return a||(a=e(ua(r),o),t[s]=a),a(n)}};class Ta{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=ha.create("formatter"),this.options=e,this.formats={number:Na((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:Na((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:Na((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:Na((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:Na((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Na(t)}format(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=t.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(e=>e.indexOf(")")>-1)){const e=o.findIndex(e=>e.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}const i=o.reduce((e,t)=>{const{formatName:o,formatOptions:i}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);"currency"===t&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(e=>{if(e){const[t,...r]=e.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),i=t.trim();n[i]||(n[i]=o),"false"===o&&(n[i]=!1),"true"===o&&(n[i]=!0),isNaN(o)||(n[i]=parseInt(o,10))}})}return{formatName:t,formatOptions:n}})(t);if(this.formats[o]){let t=e;try{const s=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},a=s.locale||s.lng||r.locale||r.lng||n;t=this.formats[o](e,a,{...i,...r,...s})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${o}`),e},e);return i}}class Ma extends pa{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=ha.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(n,r.backend,r)}queueLoad(e,t,n,r){const o={},i={},s={},a={};return e.forEach(e=>{let r=!0;t.forEach(t=>{const s=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[s]=2:this.state[s]<0||(1===this.state[s]?void 0===i[s]&&(i[s]=!0):(this.state[s]=1,r=!1,void 0===i[s]&&(i[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===a[t]&&(a[t]=!0)))}),r||(s[e]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(a)}}loaded(e,t,n){const r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),!t&&n&&this.store.addResourceBundle(o,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const s={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:r,k:o}=Zs(e,t,Object);r[o]=r[o]||[],r[o].push(n)})(n.loaded,[o],i),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{s[e]||(s[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===s[e][t]&&(s[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:o,callback:i});this.readingCalls++;const s=(s,a)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}s&&a&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,r+1,2*o,i)},o):i(s,a)},a=this.backend[n].bind(this.backend);if(2!==a.length)return a(e,t,s);try{const n=a(e,t);n&&"function"==typeof n.then?n.then(e=>s(null,e)).catch(s):s(null,n)}catch(e){s(e)}}prepareLoading(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();Ks(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ks(t)&&(t=[t]);const o=this.queueLoad(e,t,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=e.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(n,i)=>{n&&this.logger.warn(`${t}loading namespace ${o} for language ${r} failed`,n),!n&&i&&this.logger.log(`${t}loaded namespace ${o} for language ${r}`,i),this.loaded(e,n,i)})}saveMissing(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){const a={...i,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let o;o=5===l.length?l(e,t,n,r,a):l(e,t,n,r),o&&"function"==typeof o.then?o.then(e=>s(null,e)).catch(s):s(null,o)}catch(e){s(e)}else l(e,t,n,r,s,a)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}const La=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Ks(e[1])&&(t.defaultValue=e[1]),Ks(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Ra=e=>(Ks(e.ns)&&(e.ns=[e.ns]),Ks(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Ks(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),$a=()=>{};class Fa extends pa{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var n;if(super(),this.options=Ra(e),this.services={},this.logger=ha,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&(Ks(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=La();this.options={...r,...this.options,...Ra(t)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?ha.init(o(this.modules.logger),this.options):ha.init(null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!=typeof Intl&&(t=Ta);const n=new ba(this.options);this.store=new fa(this.options.resources,this.options);const i=this.services;i.logger=ha,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new Ea(n,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(i.formatter=o(t),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new Pa(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Ma(o(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.languageDetector&&(i.languageDetector=o(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=o(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new ma(this.services,this.options),this.translator.on("*",function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,n||(n=$a),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(t=>{this[t]=function(){return e.store[t](...arguments)}});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(t=>{this[t]=function(){return e.store[t](...arguments),e}});const i=Js(),s=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(t),n(e,t)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initImmediate?s():setTimeout(s,0),i}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$a;const n=Ks(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],r=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(n)r(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>r(e))}this.options.preload&&this.options.preload.forEach(e=>r(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)})}else t(null)}reloadResources(e,t,n){const r=Js();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=$a),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&ga.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,t){var n=this;this.isLanguageChangingTo=e;const r=Js();this.emit("languageChanging",e);const o=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(e,i)=>{i?(o(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,r.resolve(function(){return n.t(...arguments)}),t&&t(e,function(){return n.t(...arguments)})},s=t=>{e||t||!this.services.languageDetector||(t=[]);const n=Ks(t)?t:this.services.languageUtils.getBestMatchFromCodes(t);n&&(this.language||o(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(n)),this.loadResources(n,e=>{i(e,n)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e):s(this.services.languageDetector.detect()),r}getFixedT(e,t,n){var r=this;const o=function(e,t){let i;if("object"!=typeof t){for(var s=arguments.length,a=new Array(s>2?s-2:0),l=2;l<s;l++)a[l-2]=arguments[l];i=r.options.overloadTranslationOptionHandler([e,t].concat(a))}else i={...t};i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs,i.ns=i.ns||o.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||n||o.keyPrefix);const u=r.options.keySeparator||".";let c;return c=i.keyPrefix&&Array.isArray(e)?e.map(e=>`${i.keyPrefix}${u}${e}`):i.keyPrefix?`${i.keyPrefix}${u}${e}`:e,r.t(c,i)};return Ks(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const i=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(n,e)||r&&!i(o,e)))}loadNamespaces(e,t){const n=Js();return this.options.ns?(Ks(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=Js();Ks(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services&&this.services.languageUtils||new ba(La());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new Fa(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$a;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new Fa(r);void 0===e.debug&&void 0===e.prefix||(o.logger=o.logger.clone(e));return["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n&&(o.store=new fa(this.store.data,r),o.services.resourceStore=o.store),o.translator=new ma(o.services,r),o.translator.on("*",function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit(e,...n)}),o.init(r,t),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Da=Fa.createInstance();Da.createInstance=Fa.createInstance,Da.createInstance,Da.dir,Da.init,Da.loadResources,Da.reloadResources,Da.use,Da.changeLanguage,Da.getFixedT,Da.t,Da.exists,Da.setDefaultNamespace,Da.hasLoadedNamespace,Da.loadNamespaces,Da.loadLanguages;var Aa="translation";function ja(e,t){Da.addResourceBundle(e,Aa,t,!0,!0)}function Ia(e){Da.changeLanguage(e)}function Ua(e){return Da.getResourceBundle(e,Aa)}function Ba(e){return Da.on("languageChanged",e),function(){return Da.off("languageChanged",e)}}Da.init({lng:"zh-CN",resources:{}});var Ha=Da.t.bind(Da);function za(e){if(e.removeAttr){e.removeAttr("width"),e.removeAttr("height"),e.removeAttr("fill"),e.removeAttr("class"),e.removeAttr("t"),e.removeAttr("p-id");var t=e.children();t.length&&za(t)}}function Wa(){return g('<svg viewBox="0 0 1024 1024"><path d="M498.7 655.8l-197.6-268c-8.1-10.9-0.3-26.4 13.3-26.4h395.2c13.6 0 21.4 15.4 13.3 26.4l-197.6 268c-6.6 9-20 9-26.6 0z"></path></svg>')}function Va(){return g('<div class="w-e-bar-divider"></div>')}function qa(e,t,n,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!1),t){if(r){var i=mi?"cmd":"ctrl";r=r.replace("mod",i)}if(o)r&&(e.attr("data-tooltip",r),e.addClass("w-e-menu-tooltip-v5"),e.addClass("tooltip-right"));else{var s=r?"".concat(n,"\n").concat(r):n;e.attr("data-tooltip",s),e.addClass("w-e-menu-tooltip-v5")}}}var Ka=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=g('<div class="w-e-bar-item"></div>'),this.$button=g('<button type="button"></button>'),this.disabled=!1,this.menu=t;var o=t.tag,i=t.width;if("button"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'button'"));var s=t.title,a=t.hotkey,l=void 0===a?"":a,u=t.iconSvg,c=void 0===u?"":u,d=this.$button;if(c){var h=g(c);za(h),d.append(h)}else d.text(s);qa(d,c,s,l,n),n&&c&&d.append(g('<span class="title">'.concat(s,"</span>"))),i&&d.css("width","".concat(i,"px")),d.attr("data-menu-key",e),this.$elem.append(d),ir(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",function(t){t.preventDefault(),al(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick())})},e.prototype.exec=function(){var e=al(this),t=this.menu,n=t.getValue(e);t.exec(e,n),this.changeMenuState()},e.prototype.setActive=function(){var e=al(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n)},e.prototype.setDisabled=function(){var e=al(this),t=this.$button,n=this.menu.isDisabled(e);(null==e.selection||e.isDisabled())&&(n=!0),this.menu.alwaysEnable&&(n=!1);var r="disabled";n?t.addClass(r):t.removeClass(r),this.disabled=n},e.prototype.setIcon=function(){var e=al(this),t=this.$button;if(this.menu.getIcon){var n=this.menu.getIcon(e);if(n){t.find("svg").remove();var r=g(n);za(r),t.append(r)}}},e.prototype.setTooltip=function(){var e=al(this),t=this.$button;if(this.menu.getTitle){var n=this.menu.getTitle(e),r=this.menu.iconSvg;n&&r&&qa(t,r,n)}},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled(),this.setIcon(),this.setTooltip()},e}(),Ja=function(e){function t(t,n,r){return void 0===r&&(r=!1),e.call(this,t,n,r)||this}return re(t,e),t.prototype.onButtonClick=function(){},t}(Ka),Xa=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e)}return e.prototype.record=function(e){var t=Br.get(e);null==t&&(t=new Set,Br.set(e,t)),t.add(this),Hr.set(this,e)},e.prototype.renderContent=function(e){var t=this.$elem;t.empty(),t.append(e);var n=this.genSelfElem();n&&t.append(n)},e.prototype.appendTo=function(e){var t=this.$elem;e.append(t)},e.prototype.show=function(){if(!this.isShow){this.showTime=Date.now(),this.$elem.show(),this.isShow=!0;var e=Hr.get(this);e&&e.emit(Tr,this)}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=Hr.get(this);e&&e.emit(Mr)}},e}(),Ga=function(e){function t(t){var n=e.call(this,t)||this;return n.type="dropPanel",n.$elem=g('<div class="w-e-drop-panel"></div>'),n}return re(t,e),t.prototype.genSelfElem=function(){return null},t}(Xa),Ya=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;if(o.dropPanel=null,o.menu=n,n.showDropPanel){var i=Wa();o.$button.append(i)}return o}return re(t,e),t.prototype.onButtonClick=function(){this.menu.showDropPanel&&this.handleDropPanel()},t.prototype.handleDropPanel=function(){var e=this.menu;if(null!=e.getPanelContentElem){var t=al(this);if(null==this.dropPanel){var n=new Ga(t),r=e.getPanelContentElem(t);n.renderContent(r),n.appendTo(this.$elem),n.show(),this.dropPanel=n}else{var o=this.dropPanel;if(o.isShow)o.hide();else{r=e.getPanelContentElem(t);o.renderContent(r),o.show()}}var i=this.dropPanel;if(i.isShow){var s=this.$elem,a=s.offset().left,l=s.parents(".w-e-bar");a-l.offset().left>=l.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"})}}},t}(Ka),Qa=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=g('<div class="w-e-modal"></div>'),r.width=0,n&&(r.width=n);var o=r.$elem;return o.on("click",function(e){return e.stopPropagation()}),o.on("keyup",function(e){"Escape"===e.code&&(r.hide(),t.restoreSelection())}),r}return re(t,e),t.prototype.genSelfElem=function(){var e=this,t=g('<span class="btn-close">'.concat('<svg viewBox="0 0 1024 1024"><path d="M1024 896.1024l-128 128L512 640 128 1024 0 896 384 512 0 128 128 0 512 384 896.1024 0l128 128L640 512z"></path></svg>',"</span>")),n=Hr.get(this);return t.on("click",function(){e.hide(),null==n||n.restoreSelection()}),t},t.prototype.setStyle=function(e){var t=this.width,n=this.$elem;n.attr("style",""),t&&n.css("width","".concat(t,"px")),n.css(e)},t}(Xa);function Za(e,t,n){var r=g('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=g('<input type="text" id="'.concat(t,'" placeholder="').concat(n||"",'">'));return r.append(o),[r[0],o[0]]}function el(e,t,n){var r=g('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=g('<textarea type="text" id="'.concat(t,'" placeholder="').concat(n||"",'"></textarea>'));return r.append(o),[r[0],o[0]]}function tl(e,t){var n=g('<div class="button-container"></div>'),r=g('<button type="button" id="'.concat(e,'">').concat(t,"</button>"));return n.append(r),[n[0],r[0]]}var nl=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;return o.$body=g("body"),o.modal=null,o.menu=n,o}return re(t,e),t.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal()},t.prototype.getPosition=function(){var e=al(this),t=this.menu.getModalPositionNode(e);return c.isElement(t)?Ws(e,t,"modal"):zs(e)},t.prototype.handleModal=function(){var e=al(this),t=this.menu;if(null==this.modal){var n=new Qa(e,t.modalWidth);this.renderAndShowModal(n,!0),this.modal=n}else{(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1)}},t.prototype.renderAndShowModal=function(e,t){void 0===t&&(t=!1);var n=al(this),r=this.menu;if(null!=r.getModalContentElem){var o=ki.getTextarea(n),i=ki.getToolbar(n),s=((null==i?void 0:i.getConfig())||{}).modalAppendToBody,a=r.getModalContentElem(n);if(e.renderContent(a),s)e.setStyle({left:"0",right:"0"});else{var l=this.getPosition();e.setStyle(l)}t&&(s?e.appendTo(this.$body):e.appendTo(o.$textAreaContainer)),e.show(),s||Vs(n,e.$elem),setTimeout(function(){n.blur()})}},t}(Ka);var rl=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=g('<div class="w-e-select-list"></div>'),n&&r.$elem.css("width","".concat(n,"px")),r.$elem.on("click",function(e){e.stopPropagation()}),r}return re(t,e),t.prototype.renderList=function(e){var t=this.$elem;t.empty();var n=g("<ul></ul>");e.forEach(function(e){var t=e.value,r=e.text,o=e.selected,i=e.styleForRenderMenuList,s=g('<li data-value="'.concat(t,'"></li>'));if(i&&s.css(i),o){var a=g('<svg viewBox="0 0 1446 1024"><path d="M574.116299 786.736392 1238.811249 48.517862C1272.390222 11.224635 1329.414799 7.827718 1366.75664 41.450462 1403.840015 74.840484 1406.731043 132.084741 1373.10189 169.433699L655.118888 966.834607C653.072421 969.716875 650.835807 972.514337 648.407938 975.210759 615.017957 1012.29409 558.292155 1015.652019 521.195664 982.250188L72.778218 578.493306C35.910826 545.297758 32.859041 488.584019 66.481825 451.242134 99.871807 414.158803 156.597563 410.800834 193.694055 444.202665L574.116299 786.736392Z"></path></svg>');s.append(a),s.addClass("selected")}s.append(g('<span data-value="'.concat(t,'">').concat(r,"</span>"))),s.attr("title",r),n.append(s)}),t.append(n)},t.prototype.genSelfElem=function(){return null},t}(Xa);var ol=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=g('<div class="w-e-bar-item"></div>'),this.$button=g('<button type="button" class="select-button"></button>'),this.disabled=!1,this.selectList=null;var o=t.tag,i=t.title,s=t.width,a=t.iconSvg,l=void 0===a?"":a,u=t.hotkey,c=void 0===u?"":u;if("select"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'select'"));var d=this.$button;s&&d.css("width","".concat(s,"px")),d.attr("data-menu-key",e),qa(d,l,i,c,n),this.$elem.append(d),this.menu=t,ir(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",function(t){t.preventDefault(),al(e).hidePanelOrModal(),e.trigger()})},e.prototype.trigger=function(){var e=this,t=al(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new rl(t,n.selectPanelWidth);var r=this.selectList,o=n.getOptions(t);r.renderList(o),r.appendTo(this.$elem),r.show(),r.$elem.on("click","li",function(t){var n=t.target;if(null!=n){t.preventDefault();var r=g(n).attr("data-value");e.onChange(r)}})}else{if((r=this.selectList).isShow)r.hide();else{o=n.getOptions(t);r.renderList(o),r.show()}}}},e.prototype.onChange=function(e){var t=al(this),n=this.menu;n.exec&&n.exec(t,e)},e.prototype.setSelectedValue=function(){var e=al(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o<n;o++){var i=e[o];if(i.value===t){r=i.text;break}}return r}(t.getOptions(e),n.toString()),o=this.$button,i=Wa();o.empty(),o.text(r),o.append(i)},e.prototype.setDisabled=function(){var e=al(this),t=this.menu.isDisabled(e),n=this.$button;(null==e.selection||e.isDisabled())&&(t=!0);var r="disabled";t?n.addClass(r):n.removeClass(r),this.disabled=t},e.prototype.changeMenuState=function(){this.setSelectedValue(),this.setDisabled()},e}(),il=function(){function e(e){this.$elem=g('<div class="w-e-bar-item w-e-bar-item-group"></div>'),this.$container=g('<div class="w-e-bar-item-menus-container"></div>'),this.$button=g('<button type="button"></button>');var t=e.key,n=e.iconSvg,r=e.title,o=this.$elem,i=this.$button;if(n){var s=g(n);za(s),i.append(s)}else i.text(r);i.attr("data-menu-key",t);var a=Wa();i.append(a),o.append(i);var l=this.$container;o.append(l);var u=this.createObserver();this.observe(u)}return e.prototype.appendBarItem=function(e){var t=e.$elem;this.$container.append(t)},e.prototype.observe=function(e){var t=this.$container;e.observe(t[0],{childList:!0,subtree:!0,attributes:!0})},e.prototype.createObserver=function(){var e=this,t=this.$container,n=this.$button,r=new MutationObserver(function(){var o=t.find("button"),i=o.length;if(0!==i){var s=0;o.each(function(e){g(e).hasClass("disabled")&&s++}),r.disconnect(),s===i?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r)}});return r},e}(),sl=new WeakMap;function al(e){var t=Ur.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function ll(e,t,n){void 0===n&&(n=!1);var r=sl.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,s=t.showModal;r=i?new Ya(e,t,n):s?new nl(e,t,n):new Ja(e,t,n)}if("select"===o&&(r=new ol(e,t,n)),null==r)throw new Error("Invalid tag in menu ".concat(JSON.stringify(t)));return sl.set(t,r),r}function ul(e,t){var n=e.selection;return null!=n&&(!u.isCollapsed(n)&&(!ki.getSelectedElems(e).some(function(t){if(e.isVoid(t))return!0;var n=t.type;return!!["pre","code","table"].includes(n)})&&!!l.isText(t)))}var cl=function(){function e(){var e=this;this.$elem=g('<div class="w-e-bar w-e-bar-hidden w-e-hover-bar"></div>'),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null,this.isShow=!1,this.lngListen=function(){},this.changeHoverbarState=z(function(){var t=e.isShow,n=e.getSelectedNodeAndMenuKeys()||{},r=n.node,i=void 0===r?null:r,s=n.menuKeys,a=void 0===s?[]:s,l=e.getEditorInstance();if(null!=i&&e.changeItemsState(),i&&c.isElement(i)&&t){var u=e.isSamePath(i,e.prevSelectedNode);if(!o.isBlock(l,i)&&u)return}e.hideAndClean(),null!=i&&(e.registerItems(a),e.setPosition(i),e.show()),e.prevSelectedNode=i},200),ir(function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),ki.getTextarea(t).$textAreaContainer.append(n),t.on(kr,e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on(Cr,r),t.on(Pr,r),t.on(Nr,r)}),this.lngListen=Ba(function(){e.menus={},e.hideAndClean(),e.getEditorInstance().deselect()})}return e.prototype.getMenus=function(){return this.menus},e.prototype.hideAndClean=function(){var e=this.$elem;e.removeClass("w-e-bar-show").addClass("w-e-bar-hidden"),this.hoverbarItems=[],e.empty(),this.isShow=!1},e.prototype.checkPositionBottom=function(){var e=this.$elem,t=!1,n="undefined"!=typeof window?window.innerHeight:null;n&&n>=360&&(n-e[0].getBoundingClientRect().bottom<360&&(t=!0));t?e.addClass("w-e-bar-bottom"):e.removeClass("w-e-bar-bottom")},e.prototype.show=function(){this.$elem.removeClass("w-e-bar-hidden").addClass("w-e-bar-show"),this.isShow=!0,this.checkPositionBottom()},e.prototype.changeItemsState=function(){var e=this;ir(function(){e.hoverbarItems.forEach(function(e){e.changeMenuState()})})},e.prototype.registerItems=function(e){var t=this,n=this.$elem;e.forEach(function(e){if("|"!==e)t.registerSingleItem(e);else{var r=Va();n.append(r)}})},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=Lr[e];if(null==o)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof o)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));r=o(),n[e]=r}var i=t.getMenuConfig(e);i&&void 0!==i.iconSvg&&(r.iconSvg=i.iconSvg);var s=ll(e,r);this.hoverbarItems.push(s),Ur.set(s,t),this.$elem.append(s.$elem)},e.prototype.setPosition=function(e){var t=this.getEditorInstance(),n=this.$elem;if(n.attr("style",""),c.isElement(e)){var r=Ws(t,e,"bar");return n.css(r),void Vs(t,n)}if(l.isText(e)){r=zs(t);return n.css(r),void Vs(t,n)}throw new Error("hoverbar.setPosition error, current selected node is not elem nor text")},e.prototype.getSelectedNodeAndMenuKeys=function(){var e=this.getEditorInstance();if(null==e.selection)return null;var t=this.getHoverbarKeysConf(),n=null,r=[],i=function(i){var s=t[i],a=s.match,l=s.menuKeys,u=void 0===l?[]:l,c=a||function(e,t){return ki.checkNodeType(t,i)},d=se(o.nodes(e,{match:function(t){return c(e,t)},universal:!0}),1),h=d[0];if(null!=h)return n=h[0],r=u,"break"};for(var s in t){if("break"===i(s))break}return null==n||0===r.length?null:{node:n,menuKeys:r}},e.prototype.getEditorInstance=function(){var e=jr.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.getHoverbarKeysConf=function(){var e=this.getEditorInstance().getConfig().hoverbarKeys,t=void 0===e?{}:e,n=t.text;return n&&null==n.match&&(n.match=ul),t},e.prototype.isSamePath=function(e,t){if(null==e||null==t)return!1;var n=ki.findPath(null,e),r=ki.findPath(null,t);return s.equals(n,r)},e.prototype.destroy=function(){var e;this.changeHoverbarState.cancel(),this.$elem.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null},e}();function dl(e,t){return Po(t)&&ki.hasDOMNode(e,t,{editable:!0})}function hl(e,t){return Po(t)&&ki.hasDOMNode(e,t)}function pl(e,t){return dl(e,t)||function(e,t){if(e.getConfig().readOnly)return!1;var n=hl(e,t)&&ki.toSlateNode(e,t);return!!n&&c.isElement(n)&&o.isVoid(e,n)}(e,t)}const fl=e=>"object"==typeof e&&null!=e&&1===e.nodeType,gl=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,vl=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return gl(n.overflowY,t)||gl(n.overflowX,t)||(e=>{const t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},ml=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,yl=e=>{const t=e.parentElement;return null==t?e.getRootNode().host||null:t},bl=(e,t)=>{var n,r,o,i;if("undefined"==typeof document)return[];const{scrollMode:s,block:a,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,d="function"==typeof u?u:e=>e!==u;if(!fl(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let f=e;for(;fl(f)&&d(f);){if(f=yl(f),f===h){p.push(f);break}null!=f&&f===document.body&&vl(f)&&!vl(document.documentElement)||null!=f&&vl(f,c)&&p.push(f)}const g=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,v=null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:innerHeight,{scrollX:m,scrollY:y}=window,{height:b,width:w,top:x,right:S,bottom:_,left:O}=e.getBoundingClientRect(),{top:E,right:k,bottom:C,left:P}=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);let N="start"===a||"nearest"===a?x-E:"end"===a?_+C:x+b/2-E+C,T="center"===l?O+w/2-P+k:"end"===l?S+k:O-P;const M=[];for(let e=0;e<p.length;e++){const t=p[e],{height:n,width:r,top:o,right:i,bottom:u,left:c}=t.getBoundingClientRect();if("if-needed"===s&&x>=0&&O>=0&&_<=v&&S<=g&&(t===h&&!vl(t)||x>=o&&_<=u&&O>=c&&S<=i))return M;const d=getComputedStyle(t),f=parseInt(d.borderLeftWidth,10),E=parseInt(d.borderTopWidth,10),k=parseInt(d.borderRightWidth,10),C=parseInt(d.borderBottomWidth,10);let P=0,L=0;const R="offsetWidth"in t?t.offsetWidth-t.clientWidth-f-k:0,$="offsetHeight"in t?t.offsetHeight-t.clientHeight-E-C:0,F="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,D="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(h===t)P="start"===a?N:"end"===a?N-v:"nearest"===a?ml(y,y+v,v,E,C,y+N,y+N+b,b):N-v/2,L="start"===l?T:"center"===l?T-g/2:"end"===l?T-g:ml(m,m+g,g,f,k,m+T,m+T+w,w),P=Math.max(0,P+y),L=Math.max(0,L+m);else{P="start"===a?N-o-E:"end"===a?N-u+C+$:"nearest"===a?ml(o,u,n,E,C+$,N,N+b,b):N-(o+n/2)+$/2,L="start"===l?T-c-f:"center"===l?T-(c+r/2)+R/2:"end"===l?T-i+k+R:ml(c,i,r,f,k+R,T,T+w,w);const{scrollLeft:e,scrollTop:s}=t;P=0===D?0:Math.max(0,Math.min(s+P/D,t.scrollHeight-n/D+$)),L=0===F?0:Math.max(0,Math.min(e+L/F,t.scrollWidth-r/F+R)),N+=s-P,T+=e-L}M.push({el:t,top:P,left:L})}return M};function wl(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;const n=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if((e=>"object"==typeof e&&"function"==typeof e.behavior)(t))return t.behavior(bl(e,t));const r="boolean"==typeof t||null==t?void 0:t.behavior;for(const{el:o,top:i,left:s}of bl(e,(e=>!1===e?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&0!==Object.keys(e).length)(e)?e:{block:"start",inline:"nearest"})(t))){const e=i-n.top+n.bottom,t=s-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}function xl(e){null!=e.selection&&(e.selection=null,e.onChange())}function Sl(e,t,n){void 0===n&&(n=!1);var r=t.selection,o=t.getConfig(),i=ki.findDocumentOrShadowRoot(t).getSelection();if(i&&(!e.isComposing||n)&&t.isFocused()){var s="None"!==i.type;if(r||s){var a=Yr.get(t),l=!1;if(a.contains(i.anchorNode)&&a.contains(i.focusNode)&&(l=!0),s&&l&&r){var c=ki.toSlateRange(t,i,{exactMatch:!0,suppressThrow:!0});if(c&&u.equals(c,r)){var d=!0;if(u.isCollapsed(r)){var h=i.anchorNode,p=i.anchorOffset;if(h===a){var f=a.childNodes,g=void 0;(g=f[p])&&g.matches("table")&&(d=!1),(g=f[p-1])&&g.matches("table")&&(d=!1)}}if(d)return}}if(!r||ki.hasRange(t,r)){e.isUpdatingSelection=!0;var v=null;try{v=r&&ki.toDOMRange(t,r)}catch(e){v=null}if(v){u.isBackward(r)?i.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):i.setBaseAndExtent(v.startContainer,v.startOffset,v.endContainer,v.endOffset);var m=v.startContainer.parentElement;if(!m.closest("[data-slate-spacer]")&&v.getBoundingClientRect){var y=v.getBoundingClientRect.bind(v)();0===y.top&&0===y.right&&0===y.bottom&&0===y.left&&0===y.height&&0===y.width||(m.getBoundingClientRect=v.getBoundingClientRect.bind(v));var b=document.body;wl(m,{scrollMode:"if-needed",boundary:o.scroll&&a.parentElement||b,block:"end",behavior:"smooth"}),delete m.getBoundingClientRect}}else i.removeAllRanges();setTimeout(function(){v&&yi&&a.focus(),e.isUpdatingSelection=!1})}else t.selection=ki.toSlateRange(t,i,{exactMatch:!1,suppressThrow:!0})}}}var _l=new WeakMap,Ol=new WeakMap;function El(e){var t;try{t=ki.findDocumentOrShadowRoot(e)}catch(e){return null}var n=t.getSelection();if(!n||n.rangeCount<=0)return null;try{return n.getRangeAt(0).startContainer}catch(e){return null}}var kl={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z",tab:"tab",selectAll:"mod+a"},Cl={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Pl={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Nl=function(e){var t=kl[e],n=Cl[e],r=Pl[e],o=t&&W(t),i=n&&W(n),s=r&&W(r);return function(e){return!(!o||!o(e))||(!!(mi&&i&&i(e))||!(mi||!s||!s(e)))}},Tl={isBold:Nl("bold"),isCompose:Nl("compose"),isMoveBackward:Nl("moveBackward"),isMoveForward:Nl("moveForward"),isDeleteBackward:Nl("deleteBackward"),isDeleteForward:Nl("deleteForward"),isDeleteLineBackward:Nl("deleteLineBackward"),isDeleteLineForward:Nl("deleteLineForward"),isDeleteWordBackward:Nl("deleteWordBackward"),isDeleteWordForward:Nl("deleteWordForward"),isExtendBackward:Nl("extendBackward"),isExtendForward:Nl("extendForward"),isExtendLineBackward:Nl("extendLineBackward"),isExtendLineForward:Nl("extendLineForward"),isItalic:Nl("italic"),isMoveLineBackward:Nl("moveLineBackward"),isMoveLineForward:Nl("moveLineForward"),isMoveWordBackward:Nl("moveWordBackward"),isMoveWordForward:Nl("moveWordForward"),isRedo:Nl("redo"),isSplitBlock:Nl("splitBlock"),isTransposeCharacter:Nl("transposeCharacter"),isUndo:Nl("undo"),isTab:Nl("tab"),isSelectAll:Nl("selectAll")};function Ml(e){e.preventDefault()}var Ll={beforeinput:function(e,t,n){var i,s=e,a=n.getConfig().readOnly;if(_i&&!a&&dl(n,s.target)){null===(i=t.flushDOMSelectionChange)||void 0===i||i.call(t);var l=n.selection,c=s.inputType,d=s.dataTransfer||s.data||void 0;if("insertCompositionText"!==c&&"deleteCompositionText"!==c){if(s.preventDefault(),!c.startsWith("delete")||c.startsWith("deleteBy")){var h=se(s.getTargetRanges(),1)[0];if(h){var p=ki.toSlateRange(n,h,{exactMatch:!1,suppressThrow:!1});l&&u.equals(l,p)||r.select(n,p)}}if(l&&u.isExpanded(l)){var f=ki.getSelectedElems(n),g="table"===f[0].type,v="table-cell"!==f[f.length-1].type;if(g&&v)return;if(c.startsWith("delete")){var m=c.endsWith("Backward")?"backward":"forward";return void o.deleteFragment(n,{direction:m})}}switch(c){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":o.deleteFragment(n);break;case"deleteContent":case"deleteContentForward":o.deleteForward(n);break;case"deleteContentBackward":o.deleteBackward(n);break;case"deleteEntireSoftLine":o.deleteBackward(n,{unit:"line"}),o.deleteForward(n,{unit:"line"});break;case"deleteHardLineBackward":o.deleteBackward(n,{unit:"block"});break;case"deleteSoftLineBackward":o.deleteBackward(n,{unit:"line"});break;case"deleteHardLineForward":o.deleteForward(n,{unit:"block"});break;case"deleteSoftLineForward":o.deleteForward(n,{unit:"line"});break;case"deleteWordBackward":o.deleteBackward(n,{unit:"word"});break;case"deleteWordForward":o.deleteForward(n,{unit:"word"});break;case"insertLineBreak":case"insertParagraph":o.insertBreak(n);break;case"insertFromDrop":case"insertFromComposition":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromComposition"===c&&(t.isComposing=!1,ao.set(n,!0)),"insertFromPaste"===c&&!so.get(n))break;_o(d)?n.insertData(d):"string"==typeof d&&o.insertText(n,d)}}}},blur:function(e,t,n){var r=e,o=t.isUpdatingSelection,i=t.latestElement;if(!n.getConfig().readOnly&&!o&&dl(n,r.target)){var s=ki.findDocumentOrShadowRoot(n);if(i!==s.activeElement){var a=r.relatedTarget;if(!(a===ki.toDOMNode(n,n)||To(a)&&a.hasAttribute("data-slate-spacer"))){if(null!=a&&Po(a)&&ki.hasDOMNode(n,a)){var l=ki.toSlateNode(n,a);if(c.isElement(l)&&!n.isVoid(l))return}if(bi){var u=s.getSelection();null==u||u.removeAllRanges()}ro.delete(n)}}}},focus:function(e,t,n){var r=ki.toDOMNode(n,n),o=ki.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,yi&&e.target!==r?r.focus():ro.set(n,!0)},click:function(e,t,n){if(!n.getConfig().readOnly&&hl(n,e.target)&&Po(e.target)){var i=ki.toSlateNode(n,e.target),a=ki.findPath(n,i);if(o.hasPath(n,a))if(d.get(n,a)===i){var l=o.start(n,a),u=o.end(n,a),c=o.void(n,{at:l}),h=o.void(n,{at:u});if(c&&h&&s.equals(c[1],h[1])){var p=o.range(n,l);r.select(n,p)}}}},compositionstart:function(e,t,n){if(dl(n,e.target)){lo.delete(n);var r=n.selection;if(r&&u.isCollapsed(r)){var i=El(n);if(i){var s=i.textContent||"";_l.set(n,s),Ol.set(n,i)}}r&&u.isExpanded(r)&&(o.deleteFragment(n),Promise.resolve().then(function(){Sl(t,n,!0)})),t.isComposing=!0,function(e,t){var n;t.getConfig().placeholder&&t.isEmpty()&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1)}(t,n)}},compositionend:function(e,t,n){var r=e;if(dl(n,r.target)){t.isComposing=!1;var i=!0===ao.get(n);i?(ao.delete(n),lo.delete(n)):lo.delete(n);var s=n.selection;if(null!=s){(Si||yi)&&ki.cleanExposedTexNodeInSelectionBlock(n);for(var a=u.isBackward(s)?s.focus:s.anchor,d=se(o.node(n,[a.path[0]]),1)[0],h=0;h<a.path.length;h+=1){var p=se(o.node(n,a.path.slice(0,h+1)),1)[0];if(c.isElement(p)&&((bi||yi)&&"link"===p.type||"code"===p.type)){ki.setNewKey(d);break}}var f=r.data;if(f&&!i){if(n.getConfig().maxLength){var g=ki.getLeftLengthOfMaxLength(n);if(g<f.length){var v=El(n);v&&v.nodeType===Node.TEXT_NODE&&(v.textContent=_l.get(n)||""),g>0&&o.insertText(n,f.slice(0,g)),t.changeViewState()}else o.insertText(n,f)}else{var m=ki.findDocumentOrShadowRoot(n).getSelection();if(m&&function(e,t){if(u.isCollapsed(t)){var n=t.anchor,r=t.focus;if([2,3].includes(n.path.length)&&[2,3].includes(r.path.length)&&(0===n.offset||0===r.offset)){var i=o.node(e,n.path),s=0===n.offset?n.path:r.path,a=[s[0],s[1]-1];if(0===s[1])return!1;var c=o.node(e,a);if(l.isText(c[0])&&l.isText(i[0]))return!0}}}(n,s)){var y=ki.toSlateRange(n,m,{exactMatch:!1,suppressThrow:!1});y&&(n.selection=y)}o.insertText(n,f)}bi||setTimeout(function(){if(null!=n.selection){var e=Ol.get(n);if(null!=e){var t=El(n);null!=t&&t!==e&&(e.textContent=_l.get(n)||"")}}})}}}},compositionupdate:function(e,t,n){dl(n,e.target)&&(t.isComposing=!0)},keydown:function(e,t,n){var i=e,s=n.selection;if(!n.getConfig().readOnly&&!t.isComposing&&dl(n,i.target)){if(function(e,t){var n=Ar.get(e),r=n&&n.getMenus(),o=Ir.get(e),i=o&&o.getMenus(),s=oe(oe({},r),i);for(var a in s){var l=s[a],u=l.hotkey;if(u&&V(u,t)&&!l.isDisabled(e)){var c=l.getValue(e);l.exec(e,c)}}}(n,i),Tl.isTab(i))return Ml(i),void n.handleTab();if(Tl.isRedo(i))return Ml(i),void("function"==typeof n.redo&&n.redo());if(Tl.isUndo(i))return Ml(i),void("function"==typeof n.undo&&n.undo());if(Tl.isMoveLineBackward(i))return Ml(i),void r.move(n,{unit:"line",reverse:!0});if(Tl.isMoveLineForward(i))return Ml(i),void r.move(n,{unit:"line"});if(Tl.isExtendLineBackward(i))return Ml(i),void r.move(n,{unit:"line",edge:"focus",reverse:!0});if(Tl.isExtendLineForward(i))return Ml(i),void r.move(n,{unit:"line",edge:"focus"});if(Tl.isMoveBackward(i))return Ml(i),void(s&&u.isCollapsed(s)?r.move(n,{reverse:!0}):r.collapse(n,{edge:"start"}));if(Tl.isMoveForward(i))return Ml(i),void(s&&u.isCollapsed(s)?r.move(n):r.collapse(n,{edge:"end"}));if(Tl.isMoveWordBackward(i))return Ml(i),s&&u.isExpanded(s)&&r.collapse(n,{edge:"focus"}),void r.move(n,{unit:"word",reverse:!0});if(Tl.isMoveWordForward(i))return Ml(i),s&&u.isExpanded(s)&&r.collapse(n,{edge:"focus"}),void r.move(n,{unit:"word"});if(Tl.isSelectAll(i))return Ml(i),void n.selectAll();if(_i){if((Si||bi)&&s&&(Tl.isDeleteBackward(i)||Tl.isDeleteForward(i))&&u.isCollapsed(s)){var a=d.parent(n,s.anchor.path);if(c.isElement(a)&&o.isVoid(n,a)&&o.isInline(n,a))return i.preventDefault(),void r.delete(n,{unit:"block"})}}else{if(Tl.isBold(i)||Tl.isItalic(i)||Tl.isTransposeCharacter(i))return void Ml(i);if(Tl.isSplitBlock(i))return Ml(i),void o.insertBreak(n);if(Tl.isDeleteBackward(i))return Ml(i),void(s&&u.isExpanded(s)?o.deleteFragment(n,{direction:"backward"}):o.deleteBackward(n));if(Tl.isDeleteForward(i))return Ml(i),void(s&&u.isExpanded(s)?o.deleteFragment(n,{direction:"forward"}):o.deleteForward(n));if(Tl.isDeleteLineBackward(i))return Ml(i),void(s&&u.isExpanded(s)?o.deleteFragment(n,{direction:"backward"}):o.deleteBackward(n,{unit:"line"}));if(Tl.isDeleteLineForward(i))return Ml(i),void(s&&u.isExpanded(s)?o.deleteFragment(n,{direction:"forward"}):o.deleteForward(n,{unit:"line"}));if(Tl.isDeleteWordBackward(i))return Ml(i),void(s&&u.isExpanded(s)?o.deleteFragment(n,{direction:"backward"}):o.deleteBackward(n,{unit:"word"}));if(Tl.isDeleteWordForward(i))return Ml(i),void(s&&u.isExpanded(s)?o.deleteFragment(n,{direction:"forward"}):o.deleteForward(n,{unit:"word"}))}}},keypress:function(e,t,n){if(!_i&&!n.getConfig().readOnly&&dl(n,e.target)){e.preventDefault();var r=e.key;o.insertText(n,r)}},copy:function(e,t,n){var r=e;if(dl(n,r.target)){n.getConfig().readOnly||r.preventDefault();var o=r.clipboardData;if(null!=o){n.setFragmentData(o);var i=n.getConfig().customCopy;i&&i(n,r)}}},cut:function(e,t,n){var i=e,s=n.selection;if(!n.getConfig().readOnly&&(i.preventDefault(),dl(n,i.target))){var a=i.clipboardData;if(null!=a&&(n.setFragmentData(a),s))if(u.isExpanded(s))o.deleteFragment(n);else{var l=d.parent(n,s.anchor.path);c.isElement(l)&&o.isVoid(n,l)&&r.delete(n)}}},paste:function(e,t,n){so.set(n,!0);var r=e;if(!n.getConfig().readOnly&&dl(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return so.set(n,!1),void r.preventDefault();if(bi||!_i||Ro(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i)}}},dragover:function(e,t,n){if(hl(n,e.target)){var r=ki.toSlateNode(n,e.target);c.isElement(r)&&o.isVoid(n,r)&&e.preventDefault()}},dragstart:function(e,t,n){var i=e;if(hl(n,i.target)&&!n.getConfig().readOnly){var s=ki.toSlateNode(n,i.target),a=ki.findPath(n,s);if(c.isElement(s)&&o.isVoid(n,s)||o.void(n,{at:a,voids:!0})){var l=o.range(n,a);r.select(n,l)}var u=i.dataTransfer;if(null!=u)ki.getSelectedNodeByType(n,"table")||(t.isDraggingInternally=!0,n.setFragmentData(u))}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&hl(n,r.target)&&(t.isDraggingInternally=!1)},drop:function(e,t,n){var o=e,i=o.dataTransfer;if(!n.getConfig().readOnly&&hl(n,o.target)&&null!=i&&!(_i&&bi&&i.files.length>0)){o.preventDefault();var s=n.selection,a=ki.findEventRange(n,o);r.select(n,a),t.isDraggingInternally&&(s&&r.delete(n,{at:s}),t.isDraggingInternally=!1),n.insertData(i),n.isFocused()||n.focus()}}},Rl=[];function $l(e){Rl.push(e)}var Fl={};function Dl(e){var t=e.type,n=e.renderElem;Fl[t||""]=n}function Al(e,t,n){var r=n.isInline(e)?"span":"div";return q(r,null,t)}function jl(e,t){var n,r=ki.findKey(t,e),i=t.isInline(e),s=o.isVoid(t,e),a=li(e.type,r.id),l={id:a,key:r.id,"data-slate-node":"element","data-slate-inline":i},u=e.type,c=e.children,h=void 0===c?[]:c,p=function(e){return Fl[e]||Al}(u);n=s?null:h.map(function(n,r){return Hl(n,r,e,t)});var f=p(e,n,t);if(s){l["data-slate-void"]=!0;var g=i?"span":"div",v=se(d.texts(e),1),m=se(v[0],1)[0],y=Hl(m,0,e,t),b=q(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y);f=q(g,{style:{position:"relative"}},f,b),Xr.set(m,0),Gr.set(m,e)}return null==f.data&&(f.data={}),Object.assign(f.data,l),s||i||(f=function(e,t,n){var r=t;return Rl.forEach(function(t){r=t(e,r,n)}),r}(e,f,t)),ir(function(){var t=Do(a);null!=t&&(Zr.set(r,t),eo.set(e,t),Qr.set(t,e))}),f}function Il(e,t){return void 0===t&&(t=!1),q("span",{"data-slate-string":!0},t?e+"\n":e)}function Ul(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),q("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?q("br",null):null)}function Bl(e,t,n){if(null==e.text)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=ki.findKey(n,e),i=n.getConfig().decorate;if(null==i)throw new Error("Can not get config.decorate");var a,u=ki.findPath(n,e),c=i([e,u]),h=l.decorations(e,c),p=h.map(function(r){var i,a=r.leaf,l=r.position,u=function(e,t,n,r,i){void 0===t&&(t=!1);var a=e.text,l=ki.findPath(i,n),u=s.parent(l);if(o.isEditor(r))throw new Error("Text node ".concat(JSON.stringify(n)," parent is Editor"));return i.isVoid(r)?Ul(d.string(r).length):""!==a||r.children[r.children.length-1]!==n||i.isInline(r)||""!==o.string(i,u)?""===a?Ul():t&&"\n"===a.slice(-1)?Il(a,!0):Il(a):Ul(0,!0)}(a,null!==(i=null==l?void 0:l.isLast)&&void 0!==i?i:1===h.length,e,t,n);return u=function(e,t,n){var r=t;return Rl.forEach(function(t){r=t(e,r,n)}),r}(a,u,n),q("span",{"data-slate-leaf":!0},u)}),f=(a=r.id,"w-e-text-".concat(a)),g=q("span",{"data-slate-node":"text",id:f,key:r.id},p);return ir(function(){var t=Do(f);null!=t&&(Zr.set(r,t),eo.set(e,t),Qr.set(t,e))}),g}function Hl(e,t,n,r){return Xr.set(e,t),Gr.set(e,n),c.isElement(e)?jl(e,r):Bl(e,n,r)}var zl=["props","attrs","style","dataset","on","hook"];function Wl(e){var t=e.data,n=void 0===t?{}:t,r=e.children,o=void 0===r?[]:r;Object.keys(n).forEach(function(t){var r,o,i=n[t];if("key"!==t){if(!zl.includes(t)){if(t.startsWith("data-")){var s=t.slice(5);return s=te(s),function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.dataset&&(n.dataset={});Object.assign(n.dataset,t)}(e,((r={})[s]=i,r)),void delete n[t]}!function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.props&&(n.props={});Object.assign(n.props,t)}(e,(o={},o[t]=i,o)),delete n[t]}}else e.key=i}),o.length>0&&o.forEach(function(e){"string"!=typeof e&&Wl(e)})}function Vl(e,t){var n,r,o=e.$scroll,i=(n=e.id,"w-e-textarea-".concat(n)),s=t.getConfig(),a=s.readOnly,l=s.autoFocus,u=function(e,t){return void 0===t&&(t=!1),ee("div#".concat(e),{props:{contentEditable:!t}})}(i,a),d=t.children||[];u.children=d.map(function(e,n){if(Kr.has(e)){var r=Kr.get(e);if(r){var o=se(r,2),i=o[0],s=o[1];if(s)return i!==n&&(Xr.set(e,n),Kr.set(e,[n,s])),s}}var a=Hl(e,n,t,t);Wl(a);var l=t.getConfig().skipCacheTypes,u=void 0===l?["list-item"]:l;return c.isElement(e)&&u.includes(e.type)||Kr.set(e,[n,a]),a});var h=Wr.get(e);if(null==h&&(h=!0),h){var p=function(e){return g('<div\n id="'.concat(e,'"\n data-slate-editor\n data-slate-node="value"\n suppressContentEditableWarning\n role="textarea"\n spellCheck="true"\n autoCorrect="true"\n autoCapitalize="true"\n ></div>'))}(i);o.append(p),e.$textArea=p,r=p[0],(v=K([J,X,G,Y,Q,Z]))(r,u),Wr.set(e,!1),Vr.set(e,v)}else{var f=qr.get(e),v=Vr.get(e);if(null==f||null==v)return;r=f.elm,v(f,u)}if(null!=r||null!=(r=Do(i))){if((h?l:t.isFocused())&&r.focus({preventScroll:!0}),h){var m=Co(r);m&&no.set(t,m)}Yr.set(t,r),eo.set(t,r),Qr.set(r,t),qr.set(e,u)}}var ql=1,Kl=function(){function e(e){var n=this;this.selectionChangeRoot=null,this.destroyed=!1,this.id=ql++,this.$textArea=null,this.$progressBar=g('<div class="w-e-progress-bar"></div>'),this.$maxLengthInfo=g('<div class="w-e-max-length-info"></div>'),this.isComposing=!1,this.isUpdatingSelection=!1,this.isDraggingInternally=!1,this.latestElement=null,this.showPlaceholder=!1,this.$placeholder=null,this.latestEditorSelection=null,this.onDOMSelectionChange=t(function(e){var t=To(null==e?void 0:e.target)?e.target:null,o=null==t?void 0:t.tagName;if("INPUT"!==o&&"TEXTAREA"!==o){var i=n.getActiveEditor();null!=i&&function(e,t){var n=e.isComposing,o=e.isUpdatingSelection,i=e.isDraggingInternally,s=t.getConfig();if(!o&&!i){var a=ki.findDocumentOrShadowRoot(t),l=a.activeElement,u=ki.toDOMNode(t,t),c=a.getSelection();if(l!==u)return ro.delete(t),void xl(t);if(e.latestElement=l,ro.set(t,!0),!c)return xl(t);var d=c.anchorNode,h=c.focusNode,p=pl(t,d),f=hl(t,h);if(!n)if(p&&f){var g=ki.toSlateRange(t,c,{exactMatch:!1,suppressThrow:!0});g&&r.select(t,g)}else s.readOnly&&xl(t)}}(n,i)}},100);var o=g(e);if(0===o.length)throw new Error("Cannot find textarea DOM by selector '".concat(e,"'"));this.$box=o;var i=g('<div class="w-e-text-container"></div>');i.append(this.$progressBar),i.append(this.$maxLengthInfo),o.append(i);var s=g('<div class="w-e-scroll"></div>');i.append(s),this.$scroll=s,this.$textAreaContainer=i,ir(function(){var e=n.getActiveEditor();if(null!=e){n.bindSelectionChange(e),i.on("click",function(){return e.hidePanelOrModal()}),e.on(kr,n.changeViewState.bind(n));var t=e.getConfig(),r=t.onChange,s=t.scroll;r&&e.on(kr,function(){return r(e)}),s||(o.css("position","relative"),i.addClass("no-scroll")),n.onFocusAndOnBlur(),e.on(kr,n.changeMaxLengthInfo.bind(n)),n.bindEvent()}})}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=Fr.get(this);if(null==e)throw new Error("Can not get editor instance");return e},enumerable:!1,configurable:!0}),e.prototype.getActiveEditor=function(){if(this.destroyed)return null;var e=Fr.get(this);return null==e||e.isDestroyed?null:e},e.prototype.bindSelectionChange=function(e,t){var n=this;if(void 0===t&&(t=5),null==this.selectionChangeRoot&&!e.isDestroyed){try{var r=ki.findDocumentOrShadowRoot(e);r.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=r}catch(r){if(t>0)return void setTimeout(function(){return n.bindSelectionChange(e,t-1)},0);window.document.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=window.document}e.on(Er,function(){var e;null===(e=n.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",n.onDOMSelectionChange),n.selectionChangeRoot=null})}},e.prototype.flushDOMSelectionChange=function(){this.onDOMSelectionChange.flush()},e.prototype.bindEvent=function(){var e=this,r=this.$textArea,o=this.$scroll,i=this.editorInstance;null!=r&&(n(Ll,function(t,n){r.on(n,function(n){t(n,e,i)})}),i.getConfig().scroll&&(o.css("overflow-y","auto"),o.on("scroll",t(function(){i.emit(Cr)},100))))},e.prototype.onFocusAndOnBlur=function(){var e=this,t=this.getActiveEditor();if(null!=t){var n=t.getConfig(),r=n.onBlur,o=n.onFocus;this.latestEditorSelection=t.selection,t.on(kr,function(){null==e.latestEditorSelection&&null!=t.selection?setTimeout(function(){e.destroyed||t.isDestroyed||o&&o(t)}):null!=e.latestEditorSelection&&null==t.selection&&setTimeout(function(){e.destroyed||t.isDestroyed||r&&r(t)}),e.latestEditorSelection=t.selection})}},e.prototype.changeMaxLengthInfo=function(){var e=this.getActiveEditor();if(null!=e){var t=e.getConfig().maxLength;if(t){var n=t-ki.getLeftLengthOfMaxLength(e);this.$maxLengthInfo[0].innerHTML="".concat(n,"/").concat(t)}}},e.prototype.changeProgress=function(e){var t=this.$progressBar;t.css("width","".concat(e,"%")),e>=100&&setTimeout(function(){t.hide(),t.css("width","0"),t.show()},1e3)},e.prototype.changeViewState=function(){var e=this,t=this.getActiveEditor();null!=t&&(Vl(this,t),function(e,t){var n,r=t.getConfig().placeholder;if(r){var o=t.isEmpty();if(o&&!e.showPlaceholder&&!e.isComposing){if(null==e.$placeholder){var i=g('<div class="w-e-text-placeholder">'.concat(r,"</div>"));e.$textAreaContainer.append(i),e.$placeholder=i}return e.$placeholder.show(),void(e.showPlaceholder=!0)}!o&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1)}}(this,t),ir(function(){e.destroyed||t.isDestroyed||Sl(e,t)}))},e.prototype.destroy=function(){var e;this.destroyed=!0,this.onDOMSelectionChange.cancel(),null===(e=this.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=null,this.$textAreaContainer.remove()},e}();function Jl(e,t,n,r){if(Xr.set(e,t),Gr.set(e,n),c.isElement(e)){var i=e.children;if((void 0===i?[]:i).forEach(function(t,n){return Jl(t,n,e,r)}),o.isVoid(r,e)){var s=se(d.texts(e),1),a=se(s[0],1)[0];Xr.set(a,0),Gr.set(a,e)}}}function Xl(e){var t=e.selector,r=void 0===t?"":t,o=e.config,i=void 0===o?{}:o,s=e.content,a=e.html,l=e.plugins,u=void 0===l?[]:l,c=function(e){return[js,ws,uo,ys,qs,As,Bs,gr].reduce(function(e,t){return t(e)},e)}(p());if(r&&function(e,t){return si(e,"data-w-e-textarea",t)}(c,r))throw new Error("Repeated create editor by selector '".concat(r,"'"));var d=function(e){void 0===e&&(e={});var t=f(_r),r={},o=e.MENU_CONF,i=void 0===o?{}:o;return n(t,function(e,t){r[t]=oe(oe({},e),i[t]||{})}),delete e.MENU_CONF,oe({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return[]},maxLength:0,MENU_CONF:r,hoverbarKeys:{},textStyleMode:"inline",classStylePolicy:"preserve-data",sanitizeHtml:Sr,customAlert:function(e,t){window.alert("".concat(t,":\n").concat(e))}},e)}(i);zr.set(c,d);var h=d.hoverbarKeys,g=void 0===h?{}:h;if(u.forEach(function(e){c=e(c)}),function(e,t){var n=t.html,r=t.content;null!=n?e.children=ai(e,n):r&&r.length&&(e.children=r),0===e.children.length&&(e.children=[{type:"paragraph",children:[{text:""}]}])}(c,{html:a,content:s}),r){var v=new Kl(r);$r.set(c,v),Fr.set(v,c),v.changeViewState();var m=void 0;Object.keys(g).length>0&&(m=new cl,jr.set(m,c),Ir.set(c,m)),c.on(kr,function(){c.hidePanelOrModal()}),c.on(Cr,function(){c.hidePanelOrModal()})}else c.children.forEach(function(e,t){return Jl(e,t,c,c)});var y=d.onCreated,b=d.onDestroyed;return y&&c.on(Or,function(){return y(c)}),b&&c.on(Er,function(){return b(c)}),ir(function(){return c.emit(Or)}),c}var Gl=function(){function e(e,t){var n=this;this.$toolbar=g('<div class="w-e-bar w-e-bar-show w-e-toolbar"></div>'),this.menus={},this.toolbarItems=[],this.config={},this.lngListen=function(){},this.syncToolbarState=function(){n.toolbarItems.forEach(function(e){e.changeMenuState()})},this.changeToolbarState=z(function(){n.syncToolbarState()},200),this.config=t;var r=g(e);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '".concat(e,"'"));this.$box=r;var o=this.$toolbar;o.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),r.append(o),ir(function(){n.initToolbar(),n.lngListen=Ba(function(){return n.initToolbar()});var e=n.getEditorInstance();e.on(kr,n.changeToolbarState),e.on(Pr,n.syncToolbarState),e.on(Nr,n.syncToolbarState)})}return e.prototype.getMenus=function(){return this.menus},e.prototype.getConfig=function(){return this.config},e.prototype.initToolbar=function(){this.menus={};var e=this.$toolbar;null==e||e.empty(),this.registerItems(),this.changeToolbarState()},e.prototype.registerItems=function(){var e=this,t="",n=this.$toolbar,r=this.config,o=r.toolbarKeys,i=void 0===o?[]:o,s=r.insertKeys,a=void 0===s?{index:0,keys:[]}:s,l=r.excludeKeys,u=void 0===l?[]:l,c=f(i),d=[];d=Array.isArray(a)?a:[a];var h=0;d.forEach(function(e){var t=e.index+h;if(e.replaceFn&&c[t]){var n=e.replaceFn(c[t]);if(!n)throw new Error("This function needs to return the menu configuration:string | IMenuGroup");c[t]=n}e.keys.length>0&&("string"==typeof e.keys&&(e.keys=[e.keys]),e.keys.forEach(function(e,n){c.splice(t+n,0,e)}),h+=e.keys.length)});var p=c.filter(function(e){var t="string"==typeof e?e:e.key;return!u.includes(t)}),g=p.length;p.forEach(function(r,o){if("|"===r){if(0===o)return;if(o+1===g)return;if("|"===t)return;var i=Va();return n.append(i),void(t=r)}if("string"==typeof r)return e.registerSingleItem(r,e),void(t=r);e.registerGroup(r),t="group"})},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new il(e)}(e),o=e.menuKeys,i=void 0===o?[]:o,s=this.config.excludeKeys,a=void 0===s?[]:s;i.forEach(function(e){a.includes(e)||t.registerSingleItem(e,r)}),n.append(r.$elem)},e.prototype.registerSingleItem=function(e,t){var n=this.getEditorInstance(),r=t instanceof il,o=this.menus,i=o[e];if(null==i){var s=Lr[e];if(null==s)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof s)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));i=s(),o[e]=i}else console.warn("Duplicated toolbar menu key '".concat(e,"'\n重复注册了菜单栏 menu '").concat(e,"'"));var a=n.getMenuConfig(e);a&&void 0!==a.iconSvg&&(i.iconSvg=a.iconSvg);var l=ll(e,i,r);(this.toolbarItems.push(l),Ur.set(l,n),r)?t.appendBarItem(l):t.$toolbar.append(l.$elem)},e.prototype.getEditorInstance=function(){var e=Dr.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.destroy=function(){var e;this.$toolbar.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.toolbarItems=[]},e}();function Yl(e,t){if(null==e)throw new Error("Cannot create toolbar, because editor is null");var n=t.selector,r=t.config,o=void 0===r?{}:r;if(function(e,t){return si(e,"data-w-e-toolbar",t)}(e,n))throw new Error("Repeated create toolbar by selector '".concat(n,"'"));var i=oe({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),s=new Gl(n,i);return Dr.set(s,e),Ar.set(e,s),s}function Ql(e){return e&&"class"===e.getConfig().textStyleMode?"class":"inline"}function Zl(e){if(!e)return"preserve-data";var t=e.getConfig().classStylePolicy;return"fallback-inline"===t?"fallback-inline":"strict"===t?"strict":"preserve-data"}function eu(e,t){var n=null==e?void 0:e.getConfig().onClassStyleUnsupported;n?n(t):console.warn(t.message)}var tu=!1,nu=!1;function ru(e){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("[wangeditor-next] `@wangeditor-next/core` export `".concat(e,"` is deprecated.")+" Please import it from `@wangeditor-next/core/upload`.")}var ou=function(e,t){return tu||(tu=!0,ru("createUploader")),function(e,t){return e.uploadAdapter?e.uploadAdapter({config:e,editor:t}):ur(e)}(e,t)};function iu(e){return nu||(nu=!0,ru("createUppyUploader")),ur(e)}export{go as DOMComment,vo as DOMElement,fo as DOMNode,yo as DOMRange,bo as DOMSelection,wo as DOMStaticRange,mo as DOMText,ki as DomEditor,di as ELEM_TO_HTML_CONF,po as NodeType,Go as PARSE_ELEM_HTML_CONF,Jo as PARSE_STYLE_HTML_FN_LIST,qo as PRE_PARSE_HTML_CONF_LIST,Fl as RENDER_ELEM_CONF,Rl as RENDER_STYLE_HANDLER_LIST,ui as STYLE_TO_HTML_FN_LIST,Vo as TEXT_TAGS,Gl as Toolbar,Xl as coreCreateEditor,Yl as coreCreateToolbar,ou as createUploader,iu as createUppyUploader,tl as genModalButtonElems,Za as genModalInputElems,el as genModalTextareaElems,Zl as getClassStylePolicy,Co as getDefaultView,jo as getEditableChild,Ao as getEditableChildAndIndex,Do as getElementById,Uo as getFirstVoidChild,Io as getPlainText,Ho as getTagName,Ql as getTextStyleMode,Fo as hasShadowRoot,ja as i18nAddResources,Ia as i18nChangeLanguage,Ua as i18nGetResources,Ba as i18nListenLanguage,No as isDOMComment,To as isDOMElement,Po as isDOMNode,Mo as isDOMSelection,Lo as isDOMText,_o as isDataTransfer,xo as isDocument,ko as isHTMLElememt,Ro as isPlainTextOnlyPaste,So as isShadowRoot,Eo as isUnprocessedListElement,$o as normalizeDOMPoint,hi as registerElemToHtmlConf,Rr as registerMenu,Yo as registerParseElemHtmlConf,Xo as registerParseStyleHtmlHandler,Ko as registerPreParseHtmlConf,Dl as registerRenderElemConf,$l as registerStyleHandler,ci as registerStyleToHtmlHandler,eu as reportUnsupportedClassStyle,Ha as t,Bo as walkTextNodes};
2
13
  //# sourceMappingURL=index.mjs.map