@wangeditor-next/plugin-formula 0.0.11 → 0.0.13-beta.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1,2 +1,2587 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("katex"),require("@wangeditor-next/editor"),require("snabbdom")):"function"==typeof define&&define.amd?define(["katex","@wangeditor-next/editor","snabbdom"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).WangEditorFormulaPlugin=e(t.katex,t.editor,t.snabbdom)}(this,(function(t,e,n){"use strict";var r=function(t,e){return r=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])},r(t,e)};function i(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)u.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return u}"function"==typeof SuppressedError&&SuppressedError;var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var a,f,c={};function s(){if(f)return a;f=1;var t=function(t){return t&&t.Math===Math&&t};return a=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof o&&o)||t("object"==typeof a&&a)||function(){return this}()||Function("return this")()}var l,h,p,d,v,m,g,y,b,w,E,x,S,O,A,T,L,j,M,P,I,C,N,D,_,k,F,R,W,V,H,q,B,z,$,U,G,X={exports:{}};function K(){if(d)return p;d=1;var t=s(),e=Object.defineProperty;return p=function(n,r){try{e(t,n,{value:r,configurable:!0,writable:!0})}catch(e){t[n]=r}return r}}function Y(){if(v)return X.exports;v=1;var t=h?l:(h=1,l=!1),e=s(),n=K(),r="__core-js_shared__",i=X.exports=e[r]||n(r,{});return(i.versions||(i.versions=[])).push({version:"3.38.1",mode:t?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"}),X.exports}function J(){if(g)return m;g=1;var t=Y();return m=function(e,n){return t[e]||(t[e]=n||{})}}function Q(){return b?y:(b=1,y=function(t){try{return!!t()}catch(t){return!0}})}function Z(){if(E)return w;E=1;var t=Q();return w=!t((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))}function tt(){if(S)return x;S=1;var t=Z(),e=Function.prototype,n=e.call,r=t&&e.bind.bind(n,n);return x=t?r:function(t){return function(){return n.apply(t,arguments)}},x}function et(){return A?O:(A=1,O=function(t){return null==t})}function nt(){if(L)return T;L=1;var t=et(),e=TypeError;return T=function(n){if(t(n))throw new e("Can't call method on "+n);return n}}function rt(){if(M)return j;M=1;var t=nt(),e=Object;return j=function(n){return e(t(n))}}function it(){if(I)return P;I=1;var t=tt(),e=rt(),n=t({}.hasOwnProperty);return P=Object.hasOwn||function(t,r){return n(e(t),r)}}function ot(){if(N)return C;N=1;var t=tt(),e=0,n=Math.random(),r=t(1..toString);return C=function(t){return"Symbol("+(void 0===t?"":t)+")_"+r(++e+n,36)}}function ut(){if(F)return k;F=1;var t,e,n=s(),r=function(){if(_)return D;_=1;var t=s().navigator,e=t&&t.userAgent;return D=e?String(e):""}(),i=n.process,o=n.Deno,u=i&&i.versions||o&&o.version,a=u&&u.v8;return a&&(e=(t=a.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]),k=e}function at(){if(W)return R;W=1;var t=ut(),e=Q(),n=s().String;return R=!!Object.getOwnPropertySymbols&&!e((function(){var e=Symbol("symbol detection");return!n(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&t&&t<41}))}function ft(){if(H)return V;H=1;var t=at();return V=t&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function ct(){if(B)return q;B=1;var t=s(),e=J(),n=it(),r=ot(),i=at(),o=ft(),u=t.Symbol,a=e("wks"),f=o?u.for||u:u&&u.withoutSetter||r;return q=function(t){return n(a,t)||(a[t]=i&&n(u,t)?u[t]:f("Symbol."+t)),a[t]}}function st(){if($)return z;$=1;var t={};return t[ct()("toStringTag")]="z",z="[object z]"===String(t)}function lt(){if(G)return U;G=1;var t="object"==typeof document&&document.all;return U=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(t){return"function"==typeof t}}var ht,pt,dt,vt,mt,gt,yt,bt,wt,Et,xt,St,Ot,At,Tt,Lt,jt,Mt,Pt,It,Ct,Nt,Dt,_t,kt,Ft,Rt,Wt,Vt,Ht,qt,Bt,zt,$t={};function Ut(){if(pt)return ht;pt=1;var t=Q();return ht=!t((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))}function Gt(){if(vt)return dt;vt=1;var t=lt();return dt=function(e){return"object"==typeof e?null!==e:t(e)}}function Xt(){if(gt)return mt;gt=1;var t=s(),e=Gt(),n=t.document,r=e(n)&&e(n.createElement);return mt=function(t){return r?n.createElement(t):{}}}function Kt(){if(bt)return yt;bt=1;var t=Ut(),e=Q(),n=Xt();return yt=!t&&!e((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))}function Yt(){if(Et)return wt;Et=1;var t=Ut(),e=Q();return wt=t&&e((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))}function Jt(){if(St)return xt;St=1;var t=Gt(),e=String,n=TypeError;return xt=function(r){if(t(r))return r;throw new n(e(r)+" is not an object")}}function Qt(){if(At)return Ot;At=1;var t=Z(),e=Function.prototype.call;return Ot=t?e.bind(e):function(){return e.apply(e,arguments)},Ot}function Zt(){if(Lt)return Tt;Lt=1;var t=s(),e=lt();return Tt=function(n,r){return arguments.length<2?(i=t[n],e(i)?i:void 0):t[n]&&t[n][r];var i},Tt}function te(){if(It)return Pt;It=1;var t=Zt(),e=lt(),n=function(){if(Mt)return jt;Mt=1;var t=tt();return jt=t({}.isPrototypeOf)}(),r=ft(),i=Object;return Pt=r?function(t){return"symbol"==typeof t}:function(r){var o=t("Symbol");return e(o)&&n(o.prototype,i(r))}}function ee(){if(Nt)return Ct;Nt=1;var t=String;return Ct=function(e){try{return t(e)}catch(t){return"Object"}}}function ne(){if(_t)return Dt;_t=1;var t=lt(),e=ee(),n=TypeError;return Dt=function(r){if(t(r))return r;throw new n(e(r)+" is not a function")}}function re(){if(Ft)return kt;Ft=1;var t=ne(),e=et();return kt=function(n,r){var i=n[r];return e(i)?void 0:t(i)}}function ie(){if(Wt)return Rt;Wt=1;var t=Qt(),e=lt(),n=Gt(),r=TypeError;return Rt=function(i,o){var u,a;if("string"===o&&e(u=i.toString)&&!n(a=t(u,i)))return a;if(e(u=i.valueOf)&&!n(a=t(u,i)))return a;if("string"!==o&&e(u=i.toString)&&!n(a=t(u,i)))return a;throw new r("Can't convert object to primitive value")}}function oe(){if(Ht)return Vt;Ht=1;var t=Qt(),e=Gt(),n=te(),r=re(),i=ie(),o=ct(),u=TypeError,a=o("toPrimitive");return Vt=function(o,f){if(!e(o)||n(o))return o;var c,s=r(o,a);if(s){if(void 0===f&&(f="default"),c=t(s,o,f),!e(c)||n(c))return c;throw new u("Can't convert object to primitive value")}return void 0===f&&(f="number"),i(o,f)}}function ue(){if(Bt)return qt;Bt=1;var t=oe(),e=te();return qt=function(n){var r=t(n,"string");return e(r)?r:r+""}}function ae(){if(zt)return $t;zt=1;var t=Ut(),e=Kt(),n=Yt(),r=Jt(),i=ue(),o=TypeError,u=Object.defineProperty,a=Object.getOwnPropertyDescriptor,f="enumerable",c="configurable",s="writable";return $t.f=t?n?function(t,e,n){if(r(t),e=i(e),r(n),"function"==typeof t&&"prototype"===e&&"value"in n&&s in n&&!n[s]){var o=a(t,e);o&&o[s]&&(t[e]=n.value,n={configurable:c in n?n[c]:o[c],enumerable:f in n?n[f]:o[f],writable:!1})}return u(t,e,n)}:u:function(t,n,a){if(r(t),n=i(n),r(a),e)try{return u(t,n,a)}catch(t){}if("get"in a||"set"in a)throw new o("Accessors not supported");return"value"in a&&(t[n]=a.value),t},$t}var fe,ce,se,le,he,pe,de,ve,me,ge,ye,be,we,Ee,xe,Se,Oe,Ae,Te,Le,je,Me,Pe,Ie,Ce,Ne,De={exports:{}};function _e(){if(ce)return fe;ce=1;var t=Ut(),e=it(),n=Function.prototype,r=t&&Object.getOwnPropertyDescriptor,i=e(n,"name"),o=i&&"something"===function(){}.name,u=i&&(!t||t&&r(n,"name").configurable);return fe={EXISTS:i,PROPER:o,CONFIGURABLE:u}}function ke(){if(le)return se;le=1;var t=tt(),e=lt(),n=Y(),r=t(Function.toString);return e(n.inspectSource)||(n.inspectSource=function(t){return r(t)}),se=n.inspectSource}function Fe(){return ve?de:(ve=1,de=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}})}function Re(){if(ge)return me;ge=1;var t=Ut(),e=ae(),n=Fe();return me=t?function(t,r,i){return e.f(t,r,n(1,i))}:function(t,e,n){return t[e]=n,t}}function We(){if(be)return ye;be=1;var t=J(),e=ot(),n=t("keys");return ye=function(t){return n[t]||(n[t]=e(t))}}function Ve(){return Ee?we:(Ee=1,we={})}function He(){if(Se)return xe;Se=1;var t,e,n,r=function(){if(pe)return he;pe=1;var t=s(),e=lt(),n=t.WeakMap;return he=e(n)&&/native code/.test(String(n))}(),i=s(),o=Gt(),u=Re(),a=it(),f=Y(),c=We(),l=Ve(),h="Object already initialized",p=i.TypeError,d=i.WeakMap;if(r||f.state){var v=f.state||(f.state=new d);v.get=v.get,v.has=v.has,v.set=v.set,t=function(t,e){if(v.has(t))throw new p(h);return e.facade=t,v.set(t,e),e},e=function(t){return v.get(t)||{}},n=function(t){return v.has(t)}}else{var m=c("state");l[m]=!0,t=function(t,e){if(a(t,m))throw new p(h);return e.facade=t,u(t,m,e),e},e=function(t){return a(t,m)?t[m]:{}},n=function(t){return a(t,m)}}return xe={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(!o(n)||(r=e(n)).type!==t)throw new p("Incompatible receiver, "+t+" required");return r}}}}function qe(){if(Oe)return De.exports;Oe=1;var t=tt(),e=Q(),n=lt(),r=it(),i=Ut(),o=_e().CONFIGURABLE,u=ke(),a=He(),f=a.enforce,c=a.get,s=String,l=Object.defineProperty,h=t("".slice),p=t("".replace),d=t([].join),v=i&&!e((function(){return 8!==l((function(){}),"length",{value:8}).length})),m=String(String).split("String"),g=De.exports=function(t,e,n){"Symbol("===h(s(e),0,7)&&(e="["+p(s(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!r(t,"name")||o&&t.name!==e)&&(i?l(t,"name",{value:e,configurable:!0}):t.name=e),v&&n&&r(n,"arity")&&t.length!==n.arity&&l(t,"length",{value:n.arity});try{n&&r(n,"constructor")&&n.constructor?i&&l(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var u=f(t);return r(u,"source")||(u.source=d(m,"string"==typeof e?e:"")),t};return Function.prototype.toString=g((function(){return n(this)&&c(this).source||u(this)}),"toString"),De.exports}function Be(){if(Te)return Ae;Te=1;var t=lt(),e=ae(),n=qe(),r=K();return Ae=function(i,o,u,a){a||(a={});var f=a.enumerable,c=void 0!==a.name?a.name:o;if(t(u)&&n(u,c,a),a.global)f?i[o]=u:r(o,u);else{try{a.unsafe?i[o]&&(f=!0):delete i[o]}catch(t){}f?i[o]=u:e.f(i,o,{value:u,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return i}}function ze(){if(je)return Le;je=1;var t=tt(),e=t({}.toString),n=t("".slice);return Le=function(t){return n(e(t),8,-1)}}function $e(){if(Pe)return Me;Pe=1;var t=st(),e=lt(),n=ze(),r=ct()("toStringTag"),i=Object,o="Arguments"===n(function(){return arguments}());return Me=t?n:function(t){var u,a,f;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(a=function(t,e){try{return t[e]}catch(t){}}(u=i(t),r))?a:o?n(u):"Object"===(f=n(u))&&e(u.callee)?"Arguments":f}}!function(){if(Ne)return c;Ne=1;var t=st(),e=Be(),n=function(){if(Ce)return Ie;Ce=1;var t=st(),e=$e();return Ie=t?{}.toString:function(){return"[object "+e(this)+"]"}}();t||e(Object.prototype,"toString",n,{unsafe:!0})}();var Ue,Ge,Xe,Ke,Ye,Je,Qe={},Ze={},tn={};function en(){if(Xe)return Ge;Xe=1;var t=tt(),e=Q(),n=ze(),r=Object,i=t("".split);return Ge=e((function(){return!r("z").propertyIsEnumerable(0)}))?function(t){return"String"===n(t)?i(t,""):r(t)}:r}function nn(){if(Ye)return Ke;Ye=1;var t=en(),e=nt();return Ke=function(n){return t(e(n))}}function rn(){if(Je)return Ze;Je=1;var t=Ut(),e=Qt(),n=function(){if(Ue)return tn;Ue=1;var t={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,n=e&&!t.call({1:2},1);return tn.f=n?function(t){var n=e(this,t);return!!n&&n.enumerable}:t,tn}(),r=Fe(),i=nn(),o=ue(),u=it(),a=Kt(),f=Object.getOwnPropertyDescriptor;return Ze.f=t?f:function(t,c){if(t=i(t),c=o(c),a)try{return f(t,c)}catch(t){}if(u(t,c))return r(!e(n.f,t,c),t[c])},Ze}var on,un,an,fn,cn,sn,ln,hn,pn,dn,vn,mn,gn,yn,bn,wn,En,xn={};function Sn(){if(fn)return an;fn=1;var t=function(){if(un)return on;un=1;var t=Math.ceil,e=Math.floor;return on=Math.trunc||function(n){var r=+n;return(r>0?e:t)(r)}}();return an=function(e){var n=+e;return n!=n||0===n?0:t(n)}}function On(){if(sn)return cn;sn=1;var t=Sn(),e=Math.max,n=Math.min;return cn=function(r,i){var o=t(r);return o<0?e(o+i,0):n(o,i)}}function An(){if(hn)return ln;hn=1;var t=Sn(),e=Math.min;return ln=function(n){var r=t(n);return r>0?e(r,9007199254740991):0}}function Tn(){if(dn)return pn;dn=1;var t=An();return pn=function(e){return t(e.length)}}function Ln(){if(yn)return gn;yn=1;var t=tt(),e=it(),n=nn(),r=function(){if(mn)return vn;mn=1;var t=nn(),e=On(),n=Tn(),r=function(r){return function(i,o,u){var a=t(i),f=n(a);if(0===f)return!r&&-1;var c,s=e(u,f);if(r&&o!=o){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((r||s in a)&&a[s]===o)return r||s||0;return!r&&-1}};return vn={includes:r(!0),indexOf:r(!1)}}().indexOf,i=Ve(),o=t([].push);return gn=function(t,u){var a,f=n(t),c=0,s=[];for(a in f)!e(i,a)&&e(f,a)&&o(s,a);for(;u.length>c;)e(f,a=u[c++])&&(~r(s,a)||o(s,a));return s}}function jn(){return wn?bn:(wn=1,bn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}var Mn,Pn,In,Cn,Nn,Dn,_n,kn,Fn,Rn,Wn,Vn,Hn,qn,Bn,zn,$n,Un,Gn,Xn={};function Kn(){if(In)return Pn;In=1;var t=Zt(),e=tt(),n=function(){if(En)return xn;En=1;var t=Ln(),e=jn().concat("length","prototype");return xn.f=Object.getOwnPropertyNames||function(n){return t(n,e)},xn}(),r=(Mn||(Mn=1,Xn.f=Object.getOwnPropertySymbols),Xn),i=Jt(),o=e([].concat);return Pn=t("Reflect","ownKeys")||function(t){var e=n.f(i(t)),u=r.f;return u?o(e,u(t)):e}}function Yn(){if(Nn)return Cn;Nn=1;var t=it(),e=Kn(),n=rn(),r=ae();return Cn=function(i,o,u){for(var a=e(o),f=r.f,c=n.f,s=0;s<a.length;s++){var l=a[s];t(i,l)||u&&t(u,l)||f(i,l,c(o,l))}}}function Jn(){if(Fn)return kn;Fn=1;var t=s(),e=rn().f,n=Re(),r=Be(),i=K(),o=Yn(),u=function(){if(_n)return Dn;_n=1;var t=Q(),e=lt(),n=/#|\.prototype\./,r=function(n,r){var f=o[i(n)];return f===a||f!==u&&(e(r)?t(r):!!r)},i=r.normalize=function(t){return String(t).replace(n,".").toLowerCase()},o=r.data={},u=r.NATIVE="N",a=r.POLYFILL="P";return Dn=r}();return kn=function(a,f){var c,s,l,h,p,d=a.target,v=a.global,m=a.stat;if(c=v?t:m?t[d]||i(d,{}):t[d]&&t[d].prototype)for(s in f){if(h=f[s],l=a.dontCallGetSet?(p=e(c,s))&&p.value:c[s],!u(v?s:d+(m?".":"#")+s,a.forced)&&void 0!==l){if(typeof h==typeof l)continue;o(h,l)}(a.sham||l&&l.sham)&&n(h,"sham",!0),r(c,s,h,a)}}}function Qn(){if(Hn)return Vn;Hn=1;var t=tt();return Vn=t([].slice)}function Zn(){if(Bn)return qn;Bn=1;var t=tt(),e=ne(),n=Gt(),r=it(),i=Qn(),o=Z(),u=Function,a=t([].concat),f=t([].join),c={};return qn=o?u.bind:function(t){var o=e(this),s=o.prototype,l=i(arguments,1),h=function(){var e=a(l,i(arguments));return this instanceof h?function(t,e,n){if(!r(c,e)){for(var i=[],o=0;o<e;o++)i[o]="a["+o+"]";c[e]=u("C,a","return new C("+f(i,",")+")")}return c[e](t,n)}(o,e.length,e):o.apply(t,e)};return n(s)&&(h.prototype=s),h},qn}function tr(){if($n)return zn;$n=1;var t=tt(),e=Q(),n=lt(),r=$e(),i=Zt(),o=ke(),u=function(){},a=i("Reflect","construct"),f=/^\s*(?:class|function)\b/,c=t(f.exec),s=!f.test(u),l=function(t){if(!n(t))return!1;try{return a(u,[],t),!0}catch(t){return!1}},h=function(t){if(!n(t))return!1;switch(r(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return s||!!c(f,o(t))}catch(t){return!0}};return h.sham=!0,zn=!a||e((function(){var t;return l(l.call)||!l(Object)||!l((function(){t=!0}))||t}))?h:l}function er(){if(Gn)return Un;Gn=1;var t=tr(),e=ee(),n=TypeError;return Un=function(r){if(t(r))return r;throw new n(e(r)+" is not a constructor")}}var nr,rr,ir,or,ur,ar,fr,cr,sr={};function lr(){if(rr)return nr;rr=1;var t=Ln(),e=jn();return nr=Object.keys||function(n){return t(n,e)}}function hr(){if(ur)return or;ur=1;var t=Zt();return or=t("document","documentElement")}function pr(){if(fr)return ar;fr=1;var t,e=Jt(),n=function(){if(ir)return sr;ir=1;var t=Ut(),e=Yt(),n=ae(),r=Jt(),i=nn(),o=lr();return sr.f=t&&!e?Object.defineProperties:function(t,e){r(t);for(var u,a=i(e),f=o(e),c=f.length,s=0;c>s;)n.f(t,u=f[s++],a[u]);return t},sr}(),r=jn(),i=Ve(),o=hr(),u=Xt(),a=We(),f="prototype",c="script",s=a("IE_PROTO"),l=function(){},h=function(t){return"<"+c+">"+t+"</"+c+">"},p=function(t){t.write(h("")),t.close();var e=t.parentWindow.Object;return t=null,e},d=function(){try{t=new ActiveXObject("htmlfile")}catch(t){}var e,n,i;d="undefined"!=typeof document?document.domain&&t?p(t):(n=u("iframe"),i="java"+c+":",n.style.display="none",o.appendChild(n),n.src=String(i),(e=n.contentWindow.document).open(),e.write(h("document.F=Object")),e.close(),e.F):p(t);for(var a=r.length;a--;)delete d[f][r[a]];return d()};return i[s]=!0,ar=Object.create||function(t,r){var i;return null!==t?(l[f]=e(t),i=new l,l[f]=null,i[s]=t):i=d(),void 0===r?i:n.f(i,r)}}!function(){if(cr)return Qe;cr=1;var t=Jn(),e=Zt(),n=function(){if(Wn)return Rn;Wn=1;var t=Z(),e=Function.prototype,n=e.apply,r=e.call;return Rn="object"==typeof Reflect&&Reflect.apply||(t?r.bind(n):function(){return r.apply(n,arguments)}),Rn}(),r=Zn(),i=er(),o=Jt(),u=Gt(),a=pr(),f=Q(),c=e("Reflect","construct"),s=Object.prototype,l=[].push,h=f((function(){function t(){}return!(c((function(){}),[],t)instanceof t)})),p=!f((function(){c((function(){}))})),d=h||p;t({target:"Reflect",stat:!0,forced:d,sham:d},{construct:function(t,e){i(t),o(e);var f=arguments.length<3?t:i(arguments[2]);if(p&&!h)return c(t,e,f);if(t===f){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var d=[null];return n(l,d,e),new(n(r,t,d))}var v=f.prototype,m=a(u(v)?v:s),g=n(t,m,e);return u(g)?g:m}})}(),function(){if(void 0!==window.Reflect&&void 0!==window.customElements&&!window.customElements.polyfillWrapFlushCallback){var t=HTMLElement,e=function(){return Reflect.construct(t,[],this.constructor)};window.HTMLElement=e,HTMLElement.prototype=t.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,t)}}();var dr=function(e){function n(){var t=e.call(this)||this,n=t.attachShadow({mode:"open"}),r=n.ownerDocument,i=r.createElement("link");i.rel="stylesheet",i.href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css",i.integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV",i.crossOrigin="anonymous",n.appendChild(i);var o=r.createElement("span");return o.style.display="inline-block",n.appendChild(o),t.span=o,t}return function(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}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(n,e),Object.defineProperty(n,"observedAttributes",{get:function(){return["data-value"]},enumerable:!1,configurable:!0}),n.prototype.attributeChangedCallback=function(t,e,n){if("data-value"===t){if(e===n)return;this.render(n||"")}},n.prototype.render=function(e){t.render(e,this.span,{throwOnError:!1})},n}(HTMLElement);window.customElements.get("w-e-formula-card")||window.customElements.define("w-e-formula-card",dr),e.i18nAddResources("en",{formula:{formula:"Formula",placeholder:"Use LateX syntax",insert:"Insert formula",edit:"Edit formula",ok:"OK"}}),e.i18nAddResources("zh-CN",{formula:{formula:"公式",placeholder:"使用 LateX 语法",insert:"插入公式",edit:"编辑公式",ok:"确定"}});var vr,mr,gr,yr,br,wr,Er,xr,Sr,Or,Ar,Tr,Lr,jr,Mr,Pr={type:"formula",elemToHtml:function(t,e){var n=t.value;return'<span data-w-e-type="formula" data-w-e-is-void data-w-e-is-inline data-value="'.concat(void 0===n?"":n,'"></span>')}},Ir={};function Cr(){if(yr)return gr;yr=1;var t=function(){if(mr)return vr;mr=1;var t=ze(),e=tt();return vr=function(n){if("Function"===t(n))return e(n)}}(),e=ne(),n=Z(),r=t(t.bind);return gr=function(t,i){return e(t),void 0===i?t:n?r(t,i):function(){return t.apply(i,arguments)}},gr}function Nr(){if(wr)return br;wr=1;var t=ze();return br=Array.isArray||function(e){return"Array"===t(e)}}function Dr(){if(xr)return Er;xr=1;var t=Nr(),e=tr(),n=Gt(),r=ct()("species"),i=Array;return Er=function(o){var u;return t(o)&&(u=o.constructor,(e(u)&&(u===i||t(u.prototype))||n(u)&&null===(u=u[r]))&&(u=void 0)),void 0===u?i:u}}function _r(){if(Or)return Sr;Or=1;var t=Dr();return Sr=function(e,n){return new(t(e))(0===n?0:n)}}function kr(){if(jr)return Lr;jr=1;var t=ct(),e=pr(),n=ae().f,r=t("unscopables"),i=Array.prototype;return void 0===i[r]&&n(i,r,{configurable:!0,value:e(null)}),Lr=function(t){i[r][t]=!0}}!function(){if(Mr)return Ir;Mr=1;var t=Jn(),e=function(){if(Tr)return Ar;Tr=1;var t=Cr(),e=tt(),n=en(),r=rt(),i=Tn(),o=_r(),u=e([].push),a=function(e){var a=1===e,f=2===e,c=3===e,s=4===e,l=6===e,h=7===e,p=5===e||l;return function(d,v,m,g){for(var y,b,w=r(d),E=n(w),x=i(E),S=t(v,m),O=0,A=g||o,T=a?A(d,x):f||h?A(d,0):void 0;x>O;O++)if((p||O in E)&&(b=S(y=E[O],O,w),e))if(a)T[O]=b;else if(b)switch(e){case 3:return!0;case 5:return y;case 6:return O;case 2:u(T,y)}else switch(e){case 4:return!1;case 7:u(T,y)}return l?-1:c||s?s:T}};return Ar={forEach:a(0),map:a(1),filter:a(2),some:a(3),every:a(4),find:a(5),findIndex:a(6),filterReject:a(7)}}().find,n=kr(),r="find",i=!0;r in[]&&Array(1)[r]((function(){i=!1})),t({target:"Array",proto:!0,forced:i},{find:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)}}),n(r)}();var Fr,Rr,Wr,Vr,Hr,qr,Br,zr,$r,Ur,Gr,Xr,Kr,Yr={};function Jr(){if(Rr)return Fr;Rr=1;var t=$e(),e=String;return Fr=function(n){if("Symbol"===t(n))throw new TypeError("Cannot convert a Symbol value to a string");return e(n)}}function Qr(){if(Vr)return Wr;Vr=1;var t=Jt();return Wr=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 Zr(){if(Xr)return Gr;Xr=1;var t,e,n=Qt(),r=tt(),i=Jr(),o=Qr(),u=function(){if(qr)return Hr;qr=1;var t=Q(),e=s().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})),i=n||t((function(){var t=e("^r","gy");return t.lastIndex=2,null!==t.exec("str")}));return Hr={BROKEN_CARET:i,MISSED_STICKY:r,UNSUPPORTED_Y:n}}(),a=J(),f=pr(),c=He().get,l=function(){if(zr)return Br;zr=1;var t=Q(),e=s().RegExp;return Br=t((function(){var t=e(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)}))}(),h=function(){if(Ur)return $r;Ur=1;var t=Q(),e=s().RegExp;return $r=t((function(){var t=e("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}))}(),p=a("native-string-replace",String.prototype.replace),d=RegExp.prototype.exec,v=d,m=r("".charAt),g=r("".indexOf),y=r("".replace),b=r("".slice),w=(e=/b*/g,n(d,t=/a/,"a"),n(d,e,"a"),0!==t.lastIndex||0!==e.lastIndex),E=u.BROKEN_CARET,x=void 0!==/()??/.exec("")[1];return(w||x||E||l||h)&&(v=function(t){var e,r,u,a,s,l,h,S=this,O=c(S),A=i(t),T=O.raw;if(T)return T.lastIndex=S.lastIndex,e=n(v,T,A),S.lastIndex=T.lastIndex,e;var L=O.groups,j=E&&S.sticky,M=n(o,S),P=S.source,I=0,C=A;if(j&&(M=y(M,"y",""),-1===g(M,"g")&&(M+="g"),C=b(A,S.lastIndex),S.lastIndex>0&&(!S.multiline||S.multiline&&"\n"!==m(A,S.lastIndex-1))&&(P="(?: "+P+")",C=" "+C,I++),r=new RegExp("^(?:"+P+")",M)),x&&(r=new RegExp("^"+P+"$(?!\\s)",M)),w&&(u=S.lastIndex),a=n(d,j?r:S,C),j?a?(a.input=b(a.input,I),a[0]=b(a[0],I),a.index=S.lastIndex,S.lastIndex+=a[0].length):S.lastIndex=0:w&&a&&(S.lastIndex=S.global?a.index+a[0].length:u),x&&a&&a.length>1&&n(p,a[0],r,(function(){for(s=1;s<arguments.length-2;s++)void 0===arguments[s]&&(a[s]=void 0)})),a&&L)for(a.groups=l=f(null),s=0;s<L.length;s++)l[(h=L[s])[0]]=a[h[1]];return a}),Gr=v}!function(){if(Kr)return Yr;Kr=1;var t=Jn(),e=Zr();t({target:"RegExp",proto:!0,forced:/./.exec!==e},{exec:e})}();var ti,ei,ni,ri,ii,oi,ui,ai={};function fi(){return ei?ti:(ei=1,ti="\t\n\v\f\r                 \u2028\u2029\ufeff")}!function(){if(ui)return ai;ui=1;var t=Jn(),e=function(){if(ri)return ni;ri=1;var t=tt(),e=nt(),n=Jr(),r=fi(),i=t("".replace),o=RegExp("^["+r+"]+"),u=RegExp("(^|[^"+r+"])["+r+"]+$"),a=function(t){return function(r){var a=n(e(r));return 1&t&&(a=i(a,o,"")),2&t&&(a=i(a,u,"$1")),a}};return ni={start:a(1),end:a(2),trim:a(3)}}().trim,n=function(){if(oi)return ii;oi=1;var t=_e().PROPER,e=Q(),n=fi();return ii=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 ci,si,li={};si||(si=1,function(){if(ci)return li;ci=1;var t=Jn(),e=s();t({global:!0,forced:e.globalThis!==e},{globalThis:e})}());var hi,pi,di={},vi={exports:{}};vi.exports;function mi(){return hi||(hi=1,function(t,e){!function(t){function e(t){return null!==t&&"object"==typeof t&&"constructor"in t&&t.constructor===Object}function n(t,r){void 0===t&&(t={}),void 0===r&&(r={}),Object.keys(r).forEach((function(i){void 0===t[i]?t[i]=r[i]:e(r[i])&&e(t[i])&&Object.keys(r[i]).length>0&&n(t[i],r[i])}))}var r={body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},createElementNS:function(){return{}},importNode:function(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function i(){var t="undefined"!=typeof document?document:{};return n(t,r),t}var o={document:r,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState:function(){},pushState:function(){},go:function(){},back:function(){}},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){},matchMedia:function(){return{}},requestAnimationFrame:function(t){return"undefined"==typeof setTimeout?(t(),null):setTimeout(t,0)},cancelAnimationFrame:function(t){"undefined"!=typeof setTimeout&&clearTimeout(t)}};function u(){var t="undefined"!=typeof window?window:{};return n(t,o),t}t.extend=n,t.getDocument=i,t.getWindow=u,t.ssrDocument=r,t.ssrWindow=o,Object.defineProperty(t,"__esModule",{value:!0})}(e)}(0,vi.exports)),vi.exports}function gi(){if(pi)return di;pi=1,Object.defineProperty(di,"__esModule",{value:!0});var t=mi();function e(t){return e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(t)}function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function r(t,e,i){return r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return r&&n(o,r.prototype),o},r.apply(null,arguments)}function i(t){var o="function"==typeof Map?new Map:void 0;return i=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==o){if(o.has(t))return o.get(t);o.set(t,u)}function u(){return r(t,arguments,e(this).constructor)}return u.prototype=Object.create(t.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),n(u,t)},i(t)}var o=function(t){var e,n;function r(e){var n,r,i;return n=t.call.apply(t,[this].concat(e))||this,r=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n),i=r.__proto__,Object.defineProperty(r,"__proto__",{get:function(){return i},set:function(t){i.__proto__=t}}),n}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r}(i(Array));function u(t){void 0===t&&(t=[]);var e=[];return t.forEach((function(t){Array.isArray(t)?e.push.apply(e,u(t)):e.push(t)})),e}function a(t,e){return Array.prototype.filter.call(t,e)}function f(e,n){var r=t.getWindow(),i=t.getDocument(),u=[];if(!n&&e instanceof o)return e;if(!e)return new o(u);if("string"==typeof e){var a=e.trim();if(a.indexOf("<")>=0&&a.indexOf(">")>=0){var f="div";0===a.indexOf("<li")&&(f="ul"),0===a.indexOf("<tr")&&(f="tbody"),0!==a.indexOf("<td")&&0!==a.indexOf("<th")||(f="tr"),0===a.indexOf("<tbody")&&(f="table"),0===a.indexOf("<option")&&(f="select");var c=i.createElement(f);c.innerHTML=a;for(var s=0;s<c.childNodes.length;s+=1)u.push(c.childNodes[s])}else u=function(t,e){if("string"!=typeof t)return[t];for(var n=[],r=e.querySelectorAll(t),i=0;i<r.length;i+=1)n.push(r[i]);return n}(e.trim(),n||i)}else if(e.nodeType||e===r||e===i)u.push(e);else if(Array.isArray(e)){if(e instanceof o)return e;u=e}return new o(function(t){for(var e=[],n=0;n<t.length;n+=1)-1===e.indexOf(t[n])&&e.push(t[n]);return e}(u))}f.fn=o.prototype;var c="resize scroll".split(" ");function s(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(void 0===n[0]){for(var i=0;i<this.length;i+=1)c.indexOf(t)<0&&(t in this[i]?this[i][t]():f(this[i]).trigger(t));return this}return this.on.apply(this,[t].concat(n))}}var l=s("click"),h=s("blur"),p=s("focus"),d=s("focusin"),v=s("focusout"),m=s("keyup"),g=s("keydown"),y=s("keypress"),b=s("submit"),w=s("change"),E=s("mousedown"),x=s("mousemove"),S=s("mouseup"),O=s("mouseenter"),A=s("mouseleave"),T=s("mouseout"),L=s("mouseover"),j=s("touchstart"),M=s("touchend"),P=s("touchmove"),I=s("resize"),C=s("scroll");return di.$=f,di.add=function(){for(var t,e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(t=0;t<r.length;t+=1){var o=f(r[t]);for(e=0;e<o.length;e+=1)this.push(o[e])}return this},di.addClass=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=u(e.map((function(t){return t.split(" ")})));return this.forEach((function(t){var e;(e=t.classList).add.apply(e,r)})),this},di.animate=function(e,n){var r,i=t.getWindow(),o=this,u={props:Object.assign({},e),params:Object.assign({duration:300,easing:"swing"},n),elements:o,animating:!1,que:[],easingProgress:function(t,e){return"swing"===t?.5-Math.cos(e*Math.PI)/2:"function"==typeof t?t(e):e},stop:function(){u.frameId&&i.cancelAnimationFrame(u.frameId),u.animating=!1,u.elements.each((function(t){delete t.dom7AnimateInstance})),u.que=[]},done:function(t){if(u.animating=!1,u.elements.each((function(t){delete t.dom7AnimateInstance})),t&&t(o),u.que.length>0){var e=u.que.shift();u.animate(e[0],e[1])}},animate:function(t,e){if(u.animating)return u.que.push([t,e]),u;var n=[];u.elements.each((function(e,r){var o,a,f,c,s;e.dom7AnimateInstance||(u.elements[r].dom7AnimateInstance=u),n[r]={container:e},Object.keys(t).forEach((function(u){o=i.getComputedStyle(e,null).getPropertyValue(u).replace(",","."),a=parseFloat(o),f=o.replace(a,""),c=parseFloat(t[u]),s=t[u]+f,n[r][u]={initialFullValue:o,initialValue:a,unit:f,finalValue:c,finalFullValue:s,currentValue:a}}))}));var r,a,f=null,c=0,s=0,l=!1;return u.animating=!0,u.frameId=i.requestAnimationFrame((function h(){var p,d;r=(new Date).getTime(),l||(l=!0,e.begin&&e.begin(o)),null===f&&(f=r),e.progress&&e.progress(o,Math.max(Math.min((r-f)/e.duration,1),0),f+e.duration-r<0?0:f+e.duration-r,f),n.forEach((function(i){var o=i;a||o.done||Object.keys(t).forEach((function(i){if(!a&&!o.done){p=Math.max(Math.min((r-f)/e.duration,1),0),d=u.easingProgress(e.easing,p);var l=o[i],h=l.initialValue,v=l.finalValue,m=l.unit;o[i].currentValue=h+d*(v-h);var g=o[i].currentValue;(v>h&&g>=v||v<h&&g<=v)&&(o.container.style[i]=v+m,(s+=1)===Object.keys(t).length&&(o.done=!0,c+=1),c===n.length&&(a=!0)),a?u.done(e.complete):o.container.style[i]=g+m}}))})),a||(u.frameId=i.requestAnimationFrame(h))})),u}};if(0===u.elements.length)return o;for(var a=0;a<u.elements.length;a+=1)u.elements[a].dom7AnimateInstance?r=u.elements[a].dom7AnimateInstance:u.elements[a].dom7AnimateInstance=u;return r||(r=u),"stop"===e?r.stop():r.animate(u.props,u.params),o},di.animationEnd=function(t){var e=this;return t&&e.on("animationend",(function n(r){r.target===this&&(t.call(this,r),e.off("animationend",n))})),this},di.append=function(){for(var e,n=t.getDocument(),r=0;r<arguments.length;r+=1){e=r<0||arguments.length<=r?void 0:arguments[r];for(var i=0;i<this.length;i+=1)if("string"==typeof e){var u=n.createElement("div");for(u.innerHTML=e;u.firstChild;)this[i].appendChild(u.firstChild)}else if(e instanceof o)for(var a=0;a<e.length;a+=1)this[i].appendChild(e[a]);else this[i].appendChild(e)}return this},di.appendTo=function(t){return f(t).append(this),this},di.attr=function(t,e){if(1===arguments.length&&"string"==typeof t)return this[0]?this[0].getAttribute(t):void 0;for(var n=0;n<this.length;n+=1)if(2===arguments.length)this[n].setAttribute(t,e);else for(var r in t)this[n][r]=t[r],this[n].setAttribute(r,t[r]);return this},di.blur=h,di.change=w,di.children=function(t){for(var e=[],n=0;n<this.length;n+=1)for(var r=this[n].children,i=0;i<r.length;i+=1)t&&!f(r[i]).is(t)||e.push(r[i]);return f(e)},di.click=l,di.closest=function(t){var e=this;return void 0===t?f([]):(e.is(t)||(e=e.parents(t).eq(0)),e)},di.css=function(e,n){var r,i=t.getWindow();if(1===arguments.length){if("string"!=typeof e){for(r=0;r<this.length;r+=1)for(var o in e)this[r].style[o]=e[o];return this}if(this[0])return i.getComputedStyle(this[0],null).getPropertyValue(e)}if(2===arguments.length&&"string"==typeof e){for(r=0;r<this.length;r+=1)this[r].style[e]=n;return this}return this},di.data=function(t,e){var n;if(void 0===e){if(!(n=this[0]))return;if(n.dom7ElementDataStorage&&t in n.dom7ElementDataStorage)return n.dom7ElementDataStorage[t];var r=n.getAttribute("data-"+t);return r||void 0}for(var i=0;i<this.length;i+=1)(n=this[i]).dom7ElementDataStorage||(n.dom7ElementDataStorage={}),n.dom7ElementDataStorage[t]=e;return this},di.dataset=function(){var t=this[0];if(t){var e,n={};if(t.dataset)for(var r in t.dataset)n[r]=t.dataset[r];else for(var i=0;i<t.attributes.length;i+=1){var o=t.attributes[i];o.name.indexOf("data-")>=0&&(n[(e=o.name.split("data-")[1],e.toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()})))]=o.value)}for(var u in n)"false"===n[u]?n[u]=!1:"true"===n[u]?n[u]=!0:parseFloat(n[u])===1*n[u]&&(n[u]*=1);return n}},di.default=f,di.detach=function(){return this.remove()},di.each=function(t){return t?(this.forEach((function(e,n){t.apply(e,[e,n])})),this):this},di.empty=function(){for(var t=0;t<this.length;t+=1){var e=this[t];if(1===e.nodeType){for(var n=0;n<e.childNodes.length;n+=1)e.childNodes[n].parentNode&&e.childNodes[n].parentNode.removeChild(e.childNodes[n]);e.textContent=""}}return this},di.eq=function(t){if(void 0===t)return this;var e=this.length;if(t>e-1)return f([]);if(t<0){var n=e+t;return f(n<0?[]:[this[n]])}return f([this[t]])},di.filter=function(t){return f(a(this,t))},di.find=function(t){for(var e=[],n=0;n<this.length;n+=1)for(var r=this[n].querySelectorAll(t),i=0;i<r.length;i+=1)e.push(r[i]);return f(e)},di.focus=p,di.focusin=d,di.focusout=v,di.hasClass=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=u(e.map((function(t){return t.split(" ")})));return a(this,(function(t){return r.filter((function(e){return t.classList.contains(e)})).length>0})).length>0},di.height=function(){var e=t.getWindow();return this[0]===e?e.innerHeight:this.length>0?parseFloat(this.css("height")):null},di.hide=function(){for(var t=0;t<this.length;t+=1)this[t].style.display="none";return this},di.html=function(t){if(void 0===t)return this[0]?this[0].innerHTML:null;for(var e=0;e<this.length;e+=1)this[e].innerHTML=t;return this},di.index=function(){var t,e=this[0];if(e){for(t=0;null!==(e=e.previousSibling);)1===e.nodeType&&(t+=1);return t}},di.insertAfter=function(t){for(var e=f(t),n=0;n<this.length;n+=1)if(1===e.length)e[0].parentNode.insertBefore(this[n],e[0].nextSibling);else if(e.length>1)for(var r=0;r<e.length;r+=1)e[r].parentNode.insertBefore(this[n].cloneNode(!0),e[r].nextSibling)},di.insertBefore=function(t){for(var e=f(t),n=0;n<this.length;n+=1)if(1===e.length)e[0].parentNode.insertBefore(this[n],e[0]);else if(e.length>1)for(var r=0;r<e.length;r+=1)e[r].parentNode.insertBefore(this[n].cloneNode(!0),e[r])},di.is=function(e){var n,r,i=t.getWindow(),u=t.getDocument(),a=this[0];if(!a||void 0===e)return!1;if("string"==typeof e){if(a.matches)return a.matches(e);if(a.webkitMatchesSelector)return a.webkitMatchesSelector(e);if(a.msMatchesSelector)return a.msMatchesSelector(e);for(n=f(e),r=0;r<n.length;r+=1)if(n[r]===a)return!0;return!1}if(e===u)return a===u;if(e===i)return a===i;if(e.nodeType||e instanceof o){for(n=e.nodeType?[e]:e,r=0;r<n.length;r+=1)if(n[r]===a)return!0;return!1}return!1},di.keydown=g,di.keypress=y,di.keyup=m,di.mousedown=E,di.mouseenter=O,di.mouseleave=A,di.mousemove=x,di.mouseout=T,di.mouseover=L,di.mouseup=S,di.next=function(t){return this.length>0?t?this[0].nextElementSibling&&f(this[0].nextElementSibling).is(t)?f([this[0].nextElementSibling]):f([]):this[0].nextElementSibling?f([this[0].nextElementSibling]):f([]):f([])},di.nextAll=function(t){var e=[],n=this[0];if(!n)return f([]);for(;n.nextElementSibling;){var r=n.nextElementSibling;t?f(r).is(t)&&e.push(r):e.push(r),n=r}return f(e)},di.off=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=e[2],u=e[3];"function"==typeof e[1]&&(r=e[0],o=e[1],u=e[2],i=void 0),u||(u=!1);for(var a=r.split(" "),f=0;f<a.length;f+=1)for(var c=a[f],s=0;s<this.length;s+=1){var l=this[s],h=void 0;if(!i&&l.dom7Listeners?h=l.dom7Listeners[c]:i&&l.dom7LiveListeners&&(h=l.dom7LiveListeners[c]),h&&h.length)for(var p=h.length-1;p>=0;p-=1){var d=h[p];o&&d.listener===o||o&&d.listener&&d.listener.dom7proxy&&d.listener.dom7proxy===o?(l.removeEventListener(c,d.proxyListener,u),h.splice(p,1)):o||(l.removeEventListener(c,d.proxyListener,u),h.splice(p,1))}}return this},di.offset=function(){if(this.length>0){var e=t.getWindow(),n=t.getDocument(),r=this[0],i=r.getBoundingClientRect(),o=n.body,u=r.clientTop||o.clientTop||0,a=r.clientLeft||o.clientLeft||0,f=r===e?e.scrollY:r.scrollTop,c=r===e?e.scrollX:r.scrollLeft;return{top:i.top+f-u,left:i.left+c-a}}return null},di.on=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=e[2],u=e[3];function a(t){var e=t.target;if(e){var n=t.target.dom7EventData||[];if(n.indexOf(t)<0&&n.unshift(t),f(e).is(i))o.apply(e,n);else for(var r=f(e).parents(),u=0;u<r.length;u+=1)f(r[u]).is(i)&&o.apply(r[u],n)}}function c(t){var e=t&&t.target&&t.target.dom7EventData||[];e.indexOf(t)<0&&e.unshift(t),o.apply(this,e)}"function"==typeof e[1]&&(r=e[0],o=e[1],u=e[2],i=void 0),u||(u=!1);for(var s,l=r.split(" "),h=0;h<this.length;h+=1){var p=this[h];if(i)for(s=0;s<l.length;s+=1){var d=l[s];p.dom7LiveListeners||(p.dom7LiveListeners={}),p.dom7LiveListeners[d]||(p.dom7LiveListeners[d]=[]),p.dom7LiveListeners[d].push({listener:o,proxyListener:a}),p.addEventListener(d,a,u)}else for(s=0;s<l.length;s+=1){var v=l[s];p.dom7Listeners||(p.dom7Listeners={}),p.dom7Listeners[v]||(p.dom7Listeners[v]=[]),p.dom7Listeners[v].push({listener:o,proxyListener:c}),p.addEventListener(v,c,u)}}return this},di.once=function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n[0],o=n[1],u=n[2],a=n[3];function f(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];u.apply(this,n),t.off(i,o,f,a),f.dom7proxy&&delete f.dom7proxy}return"function"==typeof n[1]&&(i=n[0],u=n[1],a=n[2],o=void 0),f.dom7proxy=u,t.on(i,o,f,a)},di.outerHeight=function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},di.outerWidth=function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},di.parent=function(t){for(var e=[],n=0;n<this.length;n+=1)null!==this[n].parentNode&&(t?f(this[n].parentNode).is(t)&&e.push(this[n].parentNode):e.push(this[n].parentNode));return f(e)},di.parents=function(t){for(var e=[],n=0;n<this.length;n+=1)for(var r=this[n].parentNode;r;)t?f(r).is(t)&&e.push(r):e.push(r),r=r.parentNode;return f(e)},di.prepend=function(e){var n,r,i=t.getDocument();for(n=0;n<this.length;n+=1)if("string"==typeof e){var u=i.createElement("div");for(u.innerHTML=e,r=u.childNodes.length-1;r>=0;r-=1)this[n].insertBefore(u.childNodes[r],this[n].childNodes[0])}else if(e instanceof o)for(r=0;r<e.length;r+=1)this[n].insertBefore(e[r],this[n].childNodes[0]);else this[n].insertBefore(e,this[n].childNodes[0]);return this},di.prependTo=function(t){return f(t).prepend(this),this},di.prev=function(t){if(this.length>0){var e=this[0];return t?e.previousElementSibling&&f(e.previousElementSibling).is(t)?f([e.previousElementSibling]):f([]):e.previousElementSibling?f([e.previousElementSibling]):f([])}return f([])},di.prevAll=function(t){var e=[],n=this[0];if(!n)return f([]);for(;n.previousElementSibling;){var r=n.previousElementSibling;t?f(r).is(t)&&e.push(r):e.push(r),n=r}return f(e)},di.prop=function(t,e){if(1!==arguments.length||"string"!=typeof t){for(var n=0;n<this.length;n+=1)if(2===arguments.length)this[n][t]=e;else for(var r in t)this[n][r]=t[r];return this}return this[0]?this[0][t]:this},di.remove=function(){for(var t=0;t<this.length;t+=1)this[t].parentNode&&this[t].parentNode.removeChild(this[t]);return this},di.removeAttr=function(t){for(var e=0;e<this.length;e+=1)this[e].removeAttribute(t);return this},di.removeClass=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=u(e.map((function(t){return t.split(" ")})));return this.forEach((function(t){var e;(e=t.classList).remove.apply(e,r)})),this},di.removeData=function(t){for(var e=0;e<this.length;e+=1){var n=this[e];n.dom7ElementDataStorage&&n.dom7ElementDataStorage[t]&&(n.dom7ElementDataStorage[t]=null,delete n.dom7ElementDataStorage[t])}},di.resize=I,di.scroll=C,di.scrollLeft=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=e[2],u=e[3];3===e.length&&"function"==typeof o&&(r=e[0],i=e[1],u=e[2],o=e[3]);var a=this;return void 0===r?a.length>0?a[0].scrollLeft:null:a.scrollTo(r,void 0,i,o,u)},di.scrollTo=function(){for(var e=t.getWindow(),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=r[0],u=r[1],a=r[2],f=r[3],c=r[4];return 4===r.length&&"function"==typeof f&&(c=f,o=r[0],u=r[1],a=r[2],c=r[3],f=r[4]),void 0===f&&(f="swing"),this.each((function(){var t,n,r,i,s,l,h,p,d=this,v=u>0||0===u,m=o>0||0===o;if(void 0===f&&(f="swing"),v&&(t=d.scrollTop,a||(d.scrollTop=u)),m&&(n=d.scrollLeft,a||(d.scrollLeft=o)),a){v&&(r=d.scrollHeight-d.offsetHeight,s=Math.max(Math.min(u,r),0)),m&&(i=d.scrollWidth-d.offsetWidth,l=Math.max(Math.min(o,i),0));var g=null;v&&s===t&&(v=!1),m&&l===n&&(m=!1),e.requestAnimationFrame((function r(i){void 0===i&&(i=(new Date).getTime()),null===g&&(g=i);var o,u=Math.max(Math.min((i-g)/a,1),0),y="linear"===f?u:.5-Math.cos(u*Math.PI)/2;v&&(h=t+y*(s-t)),m&&(p=n+y*(l-n)),v&&s>t&&h>=s&&(d.scrollTop=s,o=!0),v&&s<t&&h<=s&&(d.scrollTop=s,o=!0),m&&l>n&&p>=l&&(d.scrollLeft=l,o=!0),m&&l<n&&p<=l&&(d.scrollLeft=l,o=!0),o?c&&c():(v&&(d.scrollTop=h),m&&(d.scrollLeft=p),e.requestAnimationFrame(r))}))}}))},di.scrollTop=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=e[2],u=e[3];3===e.length&&"function"==typeof o&&(r=e[0],i=e[1],u=e[2],o=e[3]);var a=this;return void 0===r?a.length>0?a[0].scrollTop:null:a.scrollTo(void 0,r,i,o,u)},di.show=function(){for(var e=t.getWindow(),n=0;n<this.length;n+=1){var r=this[n];"none"===r.style.display&&(r.style.display=""),"none"===e.getComputedStyle(r,null).getPropertyValue("display")&&(r.style.display="block")}return this},di.siblings=function(t){return this.nextAll(t).add(this.prevAll(t))},di.stop=function(){for(var t=this,e=0;e<t.length;e+=1)t[e].dom7AnimateInstance&&t[e].dom7AnimateInstance.stop()},di.styles=function(){var e=t.getWindow();return this[0]?e.getComputedStyle(this[0],null):{}},di.submit=b,di.text=function(t){if(void 0===t)return this[0]?this[0].textContent.trim():null;for(var e=0;e<this.length;e+=1)this[e].textContent=t;return this},di.toggleClass=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=u(e.map((function(t){return t.split(" ")})));this.forEach((function(t){r.forEach((function(e){t.classList.toggle(e)}))}))},di.touchend=M,di.touchmove=P,di.touchstart=j,di.transform=function(t){for(var e=0;e<this.length;e+=1)this[e].style.transform=t;return this},di.transition=function(t){for(var e=0;e<this.length;e+=1)this[e].style.transitionDuration="string"!=typeof t?t+"ms":t;return this},di.transitionEnd=function(t){var e=this;return t&&e.on("transitionend",(function n(r){r.target===this&&(t.call(this,r),e.off("transitionend",n))})),this},di.trigger=function(){for(var e=t.getWindow(),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o=r[0].split(" "),u=r[1],a=0;a<o.length;a+=1)for(var f=o[a],c=0;c<this.length;c+=1){var s=this[c];if(e.CustomEvent){var l=new e.CustomEvent(f,{detail:u,bubbles:!0,cancelable:!0});s.dom7EventData=r.filter((function(t,e){return e>0})),s.dispatchEvent(l),s.dom7EventData=[],delete s.dom7EventData}}return this},di.val=function(t){if(void 0===t){var e=this[0];if(!e)return;if(e.multiple&&"select"===e.nodeName.toLowerCase()){for(var n=[],r=0;r<e.selectedOptions.length;r+=1)n.push(e.selectedOptions[r].value);return n}return e.value}for(var i=0;i<this.length;i+=1){var o=this[i];if(Array.isArray(t)&&o.multiple&&"select"===o.nodeName.toLowerCase())for(var u=0;u<o.options.length;u+=1)o.options[u].selected=t.indexOf(o.options[u].value)>=0;else o.value=t}return this},di.value=function(t){return this.val(t)},di.width=function(){var e=t.getWindow();return this[0]===e?e.innerWidth:this.length>0?parseFloat(this.css("width")):null},di}var yi=gi(),bi=u(yi);yi.append&&(bi.fn.append=yi.append),yi.html&&(bi.fn.html=yi.html),yi.val&&(bi.fn.val=yi.val),yi.on&&(bi.fn.on=yi.on),yi.focus&&(bi.fn.focus=yi.focus),yi.is&&(bi.fn.is=yi.is),yi.parents&&(bi.fn.parents=yi.parents),yi.find&&(bi.fn.find=yi.find);var wi,Ei,xi,Si,Oi,Ai,Ti,Li={};function ji(){if(Ei)return wi;Ei=1;var t=TypeError;return wi=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}}function Mi(){if(Si)return xi;Si=1;var t=Ut(),e=ae(),n=Fe();return xi=function(r,i,o){t?e.f(r,i,n(0,o)):r[i]=o}}function Pi(){if(Ai)return Oi;Ai=1;var t=Q(),e=ct(),n=ut(),r=e("species");return Oi=function(e){return n>=51||!t((function(){var t=[];return(t.constructor={})[r]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}}!function(){if(Ti)return Li;Ti=1;var t=Jn(),e=Q(),n=Nr(),r=Gt(),i=rt(),o=Tn(),u=ji(),a=Mi(),f=_r(),c=Pi(),s=ct(),l=ut(),h=s("isConcatSpreadable"),p=l>=51||!e((function(){var t=[];return t[h]=!1,t.concat()[0]!==t})),d=function(t){if(!r(t))return!1;var e=t[h];return void 0!==e?!!e:n(t)};t({target:"Array",proto:!0,arity:1,forced:!p||!c("concat")},{concat:function(t){var e,n,r,c,s,l=i(this),h=f(l,0),p=0;for(e=-1,r=arguments.length;e<r;e++)if(d(s=-1===e?l:arguments[e]))for(c=o(s),u(p+c),n=0;n<c;n++,p++)n in s&&a(h,p,s[n]);else u(p+1),a(h,p++,s);return h.length=p,h}})}();let Ii=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),"");function Ci(t){return"".concat(t,"-").concat(Ii())}function Ni(){return Ci("w-e-insert-formula")}var Di=function(){function t(){this.title=e.t("formula.edit"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.textareaId=Ni(),this.buttonId=Ni()}return t.prototype.getSelectedElem=function(t){var n=e.DomEditor.getSelectedNodeByType(t,"formula");return null==n?null:n},t.prototype.getValue=function(t){var e=this.getSelectedElem(t);return e&&e.value||""},t.prototype.isActive=function(t){return!1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){var n=t.selection;return null==n||(!!e.SlateRange.isExpanded(n)||null==this.getSelectedElem(t))},t.prototype.getModalPositionNode=function(t){return this.getSelectedElem(t)},t.prototype.getModalContentElem=function(t){var n=this,r=this.textareaId,o=this.buttonId,u=i(e.genModalTextareaElems(e.t("formula.formula"),r,e.t("formula.placeholder")),2),a=u[0],f=u[1],c=bi(f),s=i(e.genModalButtonElems(o,e.t("formula.ok")),1)[0];if(null==this.$content){var l=bi("<div></div>");l.on("click","#".concat(o),(function(e){e.preventDefault();var i=l.find("#".concat(r)).val().trim();n.updateFormula(t,i),t.hidePanelOrModal()})),this.$content=l}var h=this.$content;h.html(""),h.append(a),h.append(s);var p=this.getValue(t);return c.val(p),setTimeout((function(){c.focus()})),h[0]},t.prototype.updateFormula=function(t,n){if(n&&(t.restoreSelection(),!this.isDisabled(t))){var r=this.getSelectedElem(t);if(null!=r){var i=e.DomEditor.findPath(t,r),o={value:n};e.SlateTransforms.setNodes(t,o,{at:i})}}},t}();function _i(){return Ci("w-e-insert-formula")}var ki=function(){function t(){this.title=e.t("formula.insert"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M941.6 734.72L985.984 640H1024l-64 384H0v-74.24l331.552-391.2L0 227.008V0h980L1024 256h-34.368l-18.72-38.88C935.584 143.744 909.024 128 832 128H169.984l353.056 353.056L225.632 832H768c116 0 146.656-41.568 173.6-97.28z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.textareaId=_i(),this.buttonId=_i()}return t.prototype.getValue=function(t){return""},t.prototype.isActive=function(t){return!1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){var n=t.selection;if(null==n)return!0;if(e.SlateRange.isExpanded(n))return!0;var r=e.DomEditor.getSelectedElems(t);return!!r.some((function(e){return t.isVoid(e)}))||!!r.some((function(t){return"pre"===e.DomEditor.getNodeType(t)}))},t.prototype.getModalPositionNode=function(t){return null},t.prototype.getModalContentElem=function(t){var n=this,r=this.textareaId,o=this.buttonId,u=i(e.genModalTextareaElems(e.t("formula.formula"),r,e.t("formula.placeholder")),2),a=u[0],f=u[1],c=bi(f),s=i(e.genModalButtonElems(o,e.t("formula.ok")),1)[0];if(null==this.$content){var l=bi("<div></div>");l.on("click","#".concat(o),(function(e){e.preventDefault();var i=l.find("#".concat(r)).val().trim();n.insertFormula(t,i),t.hidePanelOrModal()})),this.$content=l}var h=this.$content;return h.html(""),h.append(a),h.append(s),c.val(""),setTimeout((function(){c.focus()})),h[0]},t.prototype.insertFormula=function(t,e){if(e&&(t.restoreSelection(),!this.isDisabled(t))){var n={type:"formula",value:e,children:[{text:""}]};t.insertNode(n)}},t}();return{editorPlugin:function(t){var n=t.isInline,r=t.isVoid,i=t;return i.isInline=function(t){return"formula"===e.DomEditor.getNodeType(t)||n(t)},i.isVoid=function(t){return"formula"===e.DomEditor.getNodeType(t)||r(t)},i},renderElems:[{type:"formula",renderElem:function(t,r,i){var o=e.DomEditor.isNodeSelected(i,t),u=t.value,a=void 0===u?"":u,f=n.h("w-e-formula-card",{dataset:{value:a}},null);return n.h("div",{props:{contentEditable:!1},style:{display:"inline-block",marginLeft:"3px",marginRight:"3px",border:o?"2px solid var(--w-e-textarea-selected-border-color)":"2px solid transparent",borderRadius:"3px",padding:"3px 3px"}},[f])}}],elemsToHtml:[Pr],parseElemsHtml:[{selector:'span[data-w-e-type="formula"]',parseElemHtml:function(t,e,n){return{type:"formula",value:t.getAttribute("data-value")||"",children:[{text:""}]}}}],menus:[{key:"insertFormula",factory:function(){return new ki}},{key:"editFormula",factory:function(){return new Di}}]}}));
2
- //# sourceMappingURL=index.js.map
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('katex'), require('@wangeditor-next/editor'), require('snabbdom')) :
3
+ typeof define === 'function' && define.amd ? define(['katex', '@wangeditor-next/editor', 'snabbdom'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.WangEditorFormulaPlugin = factory(global.katex, global.editor, global.snabbdom));
5
+ })(this, (function (katex, editor, snabbdom) { 'use strict';
6
+
7
+ /******************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ /* global Reflect, Promise, SuppressedError, Symbol */
22
+
23
+ var extendStatics = function(d, b) {
24
+ extendStatics = Object.setPrototypeOf ||
25
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
27
+ return extendStatics(d, b);
28
+ };
29
+
30
+ function __extends(d, b) {
31
+ if (typeof b !== "function" && b !== null)
32
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
33
+ extendStatics(d, b);
34
+ function __() { this.constructor = d; }
35
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36
+ }
37
+
38
+ function __read(o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ }
54
+
55
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
56
+ var e = new Error(message);
57
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
58
+ };
59
+
60
+ // @ts-nocheck
61
+ // 参考 https://github.com/webcomponents/custom-elements/blob/master/src/native-shim.js
62
+ /**
63
+ * @license
64
+ * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
65
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
66
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
67
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
68
+ * Code distributed by Google as part of the polymer project is also
69
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
70
+ */
71
+ /**
72
+ * This shim allows elements written in, or compiled to, ES5 to work on native
73
+ * implementations of Custom Elements v1. It sets new.target to the value of
74
+ * this.constructor so that the native HTMLElement constructor can access the
75
+ * current under-construction element's definition.
76
+ */
77
+ (function () {
78
+ if (
79
+ // No Reflect, no classes, no need for shim because native custom elements
80
+ // require ES2015 classes or Reflect.
81
+ window.Reflect === undefined
82
+ || window.customElements === undefined
83
+ // The webcomponentsjs custom elements polyfill doesn't require
84
+ // ES2015-compatible construction (`super()` or `Reflect.construct`).
85
+ || window.customElements.polyfillWrapFlushCallback) {
86
+ return;
87
+ }
88
+ var BuiltInHTMLElement = HTMLElement;
89
+ /**
90
+ * With jscompiler's RECOMMENDED_FLAGS the function name will be optimized away.
91
+ * However, if we declare the function as a property on an object literal, and
92
+ * use quotes for the property name, then closure will leave that much intact,
93
+ * which is enough for the JS VM to correctly set Function.prototype.name.
94
+ */
95
+ var wrapperForTheName = {
96
+ // eslint-disable-next-line func-names
97
+ HTMLElement: /** @this {!Object} */ function HTMLElement() {
98
+ return Reflect.construct(BuiltInHTMLElement, [], /** @type {!Function} */ this.constructor);
99
+ },
100
+ };
101
+ window.HTMLElement = wrapperForTheName.HTMLElement;
102
+ HTMLElement.prototype = BuiltInHTMLElement.prototype;
103
+ HTMLElement.prototype.constructor = HTMLElement;
104
+ Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement);
105
+ }());
106
+
107
+ /**
108
+ * @description 注册自定义 elem
109
+ * @author wangfupeng
110
+ */
111
+ var WangEditorFormulaCard = /** @class */ (function (_super) {
112
+ __extends(WangEditorFormulaCard, _super);
113
+ function WangEditorFormulaCard() {
114
+ var _this = _super.call(this) || this;
115
+ var shadow = _this.attachShadow({ mode: 'open' });
116
+ var document = shadow.ownerDocument;
117
+ var style = document.createElement('style');
118
+ shadow.appendChild(style);
119
+ var span = document.createElement('span');
120
+ span.style.display = 'inline-block';
121
+ shadow.appendChild(span);
122
+ _this.span = span;
123
+ return _this;
124
+ }
125
+ Object.defineProperty(WangEditorFormulaCard, "observedAttributes", {
126
+ // 监听的 attr
127
+ get: function () {
128
+ return ['data-value'];
129
+ },
130
+ enumerable: false,
131
+ configurable: true
132
+ });
133
+ // connectedCallback() {
134
+ // // 当 custom element首次被插入文档DOM时,被调用
135
+ // console.log('connected')
136
+ // }
137
+ // disconnectedCallback() {
138
+ // // 当 custom element从文档DOM中删除时,被调用
139
+ // console.log('disconnected')
140
+ // }
141
+ // adoptedCallback() {
142
+ // // 当 custom element被移动到新的文档时,被调用
143
+ // console.log('adopted')
144
+ // }
145
+ WangEditorFormulaCard.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
146
+ if (name === 'data-value') {
147
+ if (oldValue === newValue) {
148
+ return;
149
+ }
150
+ this.render(newValue || '');
151
+ }
152
+ };
153
+ WangEditorFormulaCard.prototype.render = function (value) {
154
+ katex.render(value, this.span, {
155
+ throwOnError: false,
156
+ });
157
+ };
158
+ return WangEditorFormulaCard;
159
+ }(HTMLElement));
160
+ if (!window.customElements.get('w-e-formula-card')) {
161
+ window.customElements.define('w-e-formula-card', WangEditorFormulaCard);
162
+ }
163
+
164
+ /**
165
+ * @description 多语言
166
+ * @author wangfupeng
167
+ */
168
+ editor.i18nAddResources('en', {
169
+ formula: {
170
+ formula: 'Formula',
171
+ placeholder: 'Use LateX syntax',
172
+ insert: 'Insert formula',
173
+ edit: 'Edit formula',
174
+ ok: 'OK',
175
+ },
176
+ });
177
+ editor.i18nAddResources('zh-CN', {
178
+ formula: {
179
+ formula: '公式',
180
+ placeholder: '使用 LateX 语法',
181
+ insert: '插入公式',
182
+ edit: '编辑公式',
183
+ ok: '确定',
184
+ },
185
+ });
186
+
187
+ /**
188
+ * @description elem to html
189
+ * @author wangfupeng
190
+ */
191
+ // 生成 html 的函数
192
+ function formulaToHtml(elem, _childrenHtml) {
193
+ var _a = elem.value, value = _a === void 0 ? '' : _a;
194
+ return "<span data-w-e-type=\"formula\" data-w-e-is-void data-w-e-is-inline data-value=\"".concat(value, "\"></span>");
195
+ }
196
+ // 配置
197
+ var conf$1 = {
198
+ type: 'formula', // 节点 type ,重要!!!
199
+ elemToHtml: formulaToHtml,
200
+ };
201
+
202
+ /**
203
+ * @description icon svg
204
+ * @author wangfupeng
205
+ */
206
+ /**
207
+ * 【注意】svg 字符串的长度 ,否则会导致代码体积过大
208
+ * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
209
+ * 找不到再从 iconfont.com 搜索
210
+ */
211
+ // 公式
212
+ var SIGMA_SVG = '<svg viewBox="0 0 1024 1024"><path d="M941.6 734.72L985.984 640H1024l-64 384H0v-74.24l331.552-391.2L0 227.008V0h980L1024 256h-34.368l-18.72-38.88C935.584 143.744 909.024 128 832 128H169.984l353.056 353.056L225.632 832H768c116 0 146.656-41.568 173.6-97.28z"></path></svg>';
213
+ // 编辑
214
+ var PENCIL_SVG = '<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>';
215
+
216
+ function getDefaultExportFromCjs (x) {
217
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
218
+ }
219
+
220
+ var dom7_cjs = {};
221
+
222
+ var ssrWindow_umd$1 = {exports: {}};
223
+
224
+ /**
225
+ * SSR Window 3.0.0
226
+ * Better handling for window object in SSR environment
227
+ * https://github.com/nolimits4web/ssr-window
228
+ *
229
+ * Copyright 2020, Vladimir Kharlampidi
230
+ *
231
+ * Licensed under MIT
232
+ *
233
+ * Released on: November 9, 2020
234
+ */
235
+ var ssrWindow_umd = ssrWindow_umd$1.exports;
236
+
237
+ var hasRequiredSsrWindow_umd;
238
+
239
+ function requireSsrWindow_umd () {
240
+ if (hasRequiredSsrWindow_umd) return ssrWindow_umd$1.exports;
241
+ hasRequiredSsrWindow_umd = 1;
242
+ (function (module, exports) {
243
+ (function (global, factory) {
244
+ factory(exports) ;
245
+ }(ssrWindow_umd, (function (exports) {
246
+ /* eslint-disable no-param-reassign */
247
+ function isObject(obj) {
248
+ return (obj !== null &&
249
+ typeof obj === 'object' &&
250
+ 'constructor' in obj &&
251
+ obj.constructor === Object);
252
+ }
253
+ function extend(target, src) {
254
+ if (target === void 0) { target = {}; }
255
+ if (src === void 0) { src = {}; }
256
+ Object.keys(src).forEach(function (key) {
257
+ if (typeof target[key] === 'undefined')
258
+ target[key] = src[key];
259
+ else if (isObject(src[key]) &&
260
+ isObject(target[key]) &&
261
+ Object.keys(src[key]).length > 0) {
262
+ extend(target[key], src[key]);
263
+ }
264
+ });
265
+ }
266
+
267
+ var ssrDocument = {
268
+ body: {},
269
+ addEventListener: function () { },
270
+ removeEventListener: function () { },
271
+ activeElement: {
272
+ blur: function () { },
273
+ nodeName: '',
274
+ },
275
+ querySelector: function () {
276
+ return null;
277
+ },
278
+ querySelectorAll: function () {
279
+ return [];
280
+ },
281
+ getElementById: function () {
282
+ return null;
283
+ },
284
+ createEvent: function () {
285
+ return {
286
+ initEvent: function () { },
287
+ };
288
+ },
289
+ createElement: function () {
290
+ return {
291
+ children: [],
292
+ childNodes: [],
293
+ style: {},
294
+ setAttribute: function () { },
295
+ getElementsByTagName: function () {
296
+ return [];
297
+ },
298
+ };
299
+ },
300
+ createElementNS: function () {
301
+ return {};
302
+ },
303
+ importNode: function () {
304
+ return null;
305
+ },
306
+ location: {
307
+ hash: '',
308
+ host: '',
309
+ hostname: '',
310
+ href: '',
311
+ origin: '',
312
+ pathname: '',
313
+ protocol: '',
314
+ search: '',
315
+ },
316
+ };
317
+ function getDocument() {
318
+ var doc = typeof document !== 'undefined' ? document : {};
319
+ extend(doc, ssrDocument);
320
+ return doc;
321
+ }
322
+
323
+ var ssrWindow = {
324
+ document: ssrDocument,
325
+ navigator: {
326
+ userAgent: '',
327
+ },
328
+ location: {
329
+ hash: '',
330
+ host: '',
331
+ hostname: '',
332
+ href: '',
333
+ origin: '',
334
+ pathname: '',
335
+ protocol: '',
336
+ search: '',
337
+ },
338
+ history: {
339
+ replaceState: function () { },
340
+ pushState: function () { },
341
+ go: function () { },
342
+ back: function () { },
343
+ },
344
+ CustomEvent: function CustomEvent() {
345
+ return this;
346
+ },
347
+ addEventListener: function () { },
348
+ removeEventListener: function () { },
349
+ getComputedStyle: function () {
350
+ return {
351
+ getPropertyValue: function () {
352
+ return '';
353
+ },
354
+ };
355
+ },
356
+ Image: function () { },
357
+ Date: function () { },
358
+ screen: {},
359
+ setTimeout: function () { },
360
+ clearTimeout: function () { },
361
+ matchMedia: function () {
362
+ return {};
363
+ },
364
+ requestAnimationFrame: function (callback) {
365
+ if (typeof setTimeout === 'undefined') {
366
+ callback();
367
+ return null;
368
+ }
369
+ return setTimeout(callback, 0);
370
+ },
371
+ cancelAnimationFrame: function (id) {
372
+ if (typeof setTimeout === 'undefined') {
373
+ return;
374
+ }
375
+ clearTimeout(id);
376
+ },
377
+ };
378
+ function getWindow() {
379
+ var win = typeof window !== 'undefined' ? window : {};
380
+ extend(win, ssrWindow);
381
+ return win;
382
+ }
383
+
384
+ exports.extend = extend;
385
+ exports.getDocument = getDocument;
386
+ exports.getWindow = getWindow;
387
+ exports.ssrDocument = ssrDocument;
388
+ exports.ssrWindow = ssrWindow;
389
+
390
+ Object.defineProperty(exports, '__esModule', { value: true });
391
+
392
+ })));
393
+
394
+ } (ssrWindow_umd$1, ssrWindow_umd$1.exports));
395
+ return ssrWindow_umd$1.exports;
396
+ }
397
+
398
+ /**
399
+ * Dom7 3.0.0
400
+ * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
401
+ * https://framework7.io/docs/dom7.html
402
+ *
403
+ * Copyright 2020, Vladimir Kharlampidi
404
+ *
405
+ * Licensed under MIT
406
+ *
407
+ * Released on: November 9, 2020
408
+ */
409
+
410
+ var hasRequiredDom7_cjs;
411
+
412
+ function requireDom7_cjs () {
413
+ if (hasRequiredDom7_cjs) return dom7_cjs;
414
+ hasRequiredDom7_cjs = 1;
415
+
416
+ Object.defineProperty(dom7_cjs, '__esModule', { value: true });
417
+
418
+ var ssrWindow = requireSsrWindow_umd();
419
+
420
+ function _inheritsLoose(subClass, superClass) {
421
+ subClass.prototype = Object.create(superClass.prototype);
422
+ subClass.prototype.constructor = subClass;
423
+ subClass.__proto__ = superClass;
424
+ }
425
+
426
+ function _getPrototypeOf(o) {
427
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
428
+ return o.__proto__ || Object.getPrototypeOf(o);
429
+ };
430
+ return _getPrototypeOf(o);
431
+ }
432
+
433
+ function _setPrototypeOf(o, p) {
434
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
435
+ o.__proto__ = p;
436
+ return o;
437
+ };
438
+
439
+ return _setPrototypeOf(o, p);
440
+ }
441
+
442
+ function _isNativeReflectConstruct() {
443
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
444
+ if (Reflect.construct.sham) return false;
445
+ if (typeof Proxy === "function") return true;
446
+
447
+ try {
448
+ Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
449
+ return true;
450
+ } catch (e) {
451
+ return false;
452
+ }
453
+ }
454
+
455
+ function _construct(Parent, args, Class) {
456
+ if (_isNativeReflectConstruct()) {
457
+ _construct = Reflect.construct;
458
+ } else {
459
+ _construct = function _construct(Parent, args, Class) {
460
+ var a = [null];
461
+ a.push.apply(a, args);
462
+ var Constructor = Function.bind.apply(Parent, a);
463
+ var instance = new Constructor();
464
+ if (Class) _setPrototypeOf(instance, Class.prototype);
465
+ return instance;
466
+ };
467
+ }
468
+
469
+ return _construct.apply(null, arguments);
470
+ }
471
+
472
+ function _isNativeFunction(fn) {
473
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
474
+ }
475
+
476
+ function _wrapNativeSuper(Class) {
477
+ var _cache = typeof Map === "function" ? new Map() : undefined;
478
+
479
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
480
+ if (Class === null || !_isNativeFunction(Class)) return Class;
481
+
482
+ if (typeof Class !== "function") {
483
+ throw new TypeError("Super expression must either be null or a function");
484
+ }
485
+
486
+ if (typeof _cache !== "undefined") {
487
+ if (_cache.has(Class)) return _cache.get(Class);
488
+
489
+ _cache.set(Class, Wrapper);
490
+ }
491
+
492
+ function Wrapper() {
493
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
494
+ }
495
+
496
+ Wrapper.prototype = Object.create(Class.prototype, {
497
+ constructor: {
498
+ value: Wrapper,
499
+ enumerable: false,
500
+ writable: true,
501
+ configurable: true
502
+ }
503
+ });
504
+ return _setPrototypeOf(Wrapper, Class);
505
+ };
506
+
507
+ return _wrapNativeSuper(Class);
508
+ }
509
+
510
+ function _assertThisInitialized(self) {
511
+ if (self === void 0) {
512
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
513
+ }
514
+
515
+ return self;
516
+ }
517
+
518
+ /* eslint-disable no-proto */
519
+ function makeReactive(obj) {
520
+ var proto = obj.__proto__;
521
+ Object.defineProperty(obj, '__proto__', {
522
+ get: function get() {
523
+ return proto;
524
+ },
525
+ set: function set(value) {
526
+ proto.__proto__ = value;
527
+ }
528
+ });
529
+ }
530
+
531
+ var Dom7 = /*#__PURE__*/function (_Array) {
532
+ _inheritsLoose(Dom7, _Array);
533
+
534
+ function Dom7(items) {
535
+ var _this;
536
+
537
+ _this = _Array.call.apply(_Array, [this].concat(items)) || this;
538
+ makeReactive(_assertThisInitialized(_this));
539
+ return _this;
540
+ }
541
+
542
+ return Dom7;
543
+ }( /*#__PURE__*/_wrapNativeSuper(Array));
544
+
545
+ function arrayFlat(arr) {
546
+ if (arr === void 0) {
547
+ arr = [];
548
+ }
549
+
550
+ var res = [];
551
+ arr.forEach(function (el) {
552
+ if (Array.isArray(el)) {
553
+ res.push.apply(res, arrayFlat(el));
554
+ } else {
555
+ res.push(el);
556
+ }
557
+ });
558
+ return res;
559
+ }
560
+ function arrayFilter(arr, callback) {
561
+ return Array.prototype.filter.call(arr, callback);
562
+ }
563
+ function arrayUnique(arr) {
564
+ var uniqueArray = [];
565
+
566
+ for (var i = 0; i < arr.length; i += 1) {
567
+ if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
568
+ }
569
+
570
+ return uniqueArray;
571
+ }
572
+ function toCamelCase(string) {
573
+ return string.toLowerCase().replace(/-(.)/g, function (match, group) {
574
+ return group.toUpperCase();
575
+ });
576
+ }
577
+
578
+ function qsa(selector, context) {
579
+ if (typeof selector !== 'string') {
580
+ return [selector];
581
+ }
582
+
583
+ var a = [];
584
+ var res = context.querySelectorAll(selector);
585
+
586
+ for (var i = 0; i < res.length; i += 1) {
587
+ a.push(res[i]);
588
+ }
589
+
590
+ return a;
591
+ }
592
+
593
+ function $(selector, context) {
594
+ var window = ssrWindow.getWindow();
595
+ var document = ssrWindow.getDocument();
596
+ var arr = [];
597
+
598
+ if (!context && selector instanceof Dom7) {
599
+ return selector;
600
+ }
601
+
602
+ if (!selector) {
603
+ return new Dom7(arr);
604
+ }
605
+
606
+ if (typeof selector === 'string') {
607
+ var html = selector.trim();
608
+
609
+ if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
610
+ var toCreate = 'div';
611
+ if (html.indexOf('<li') === 0) toCreate = 'ul';
612
+ if (html.indexOf('<tr') === 0) toCreate = 'tbody';
613
+ if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
614
+ if (html.indexOf('<tbody') === 0) toCreate = 'table';
615
+ if (html.indexOf('<option') === 0) toCreate = 'select';
616
+ var tempParent = document.createElement(toCreate);
617
+ tempParent.innerHTML = html;
618
+
619
+ for (var i = 0; i < tempParent.childNodes.length; i += 1) {
620
+ arr.push(tempParent.childNodes[i]);
621
+ }
622
+ } else {
623
+ arr = qsa(selector.trim(), context || document);
624
+ } // arr = qsa(selector, document);
625
+
626
+ } else if (selector.nodeType || selector === window || selector === document) {
627
+ arr.push(selector);
628
+ } else if (Array.isArray(selector)) {
629
+ if (selector instanceof Dom7) return selector;
630
+ arr = selector;
631
+ }
632
+
633
+ return new Dom7(arrayUnique(arr));
634
+ }
635
+
636
+ $.fn = Dom7.prototype;
637
+
638
+ function addClass() {
639
+ for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
640
+ classes[_key] = arguments[_key];
641
+ }
642
+
643
+ var classNames = arrayFlat(classes.map(function (c) {
644
+ return c.split(' ');
645
+ }));
646
+ this.forEach(function (el) {
647
+ var _el$classList;
648
+
649
+ (_el$classList = el.classList).add.apply(_el$classList, classNames);
650
+ });
651
+ return this;
652
+ }
653
+
654
+ function removeClass() {
655
+ for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
656
+ classes[_key2] = arguments[_key2];
657
+ }
658
+
659
+ var classNames = arrayFlat(classes.map(function (c) {
660
+ return c.split(' ');
661
+ }));
662
+ this.forEach(function (el) {
663
+ var _el$classList2;
664
+
665
+ (_el$classList2 = el.classList).remove.apply(_el$classList2, classNames);
666
+ });
667
+ return this;
668
+ }
669
+
670
+ function toggleClass() {
671
+ for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
672
+ classes[_key3] = arguments[_key3];
673
+ }
674
+
675
+ var classNames = arrayFlat(classes.map(function (c) {
676
+ return c.split(' ');
677
+ }));
678
+ this.forEach(function (el) {
679
+ classNames.forEach(function (className) {
680
+ el.classList.toggle(className);
681
+ });
682
+ });
683
+ }
684
+
685
+ function hasClass() {
686
+ for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
687
+ classes[_key4] = arguments[_key4];
688
+ }
689
+
690
+ var classNames = arrayFlat(classes.map(function (c) {
691
+ return c.split(' ');
692
+ }));
693
+ return arrayFilter(this, function (el) {
694
+ return classNames.filter(function (className) {
695
+ return el.classList.contains(className);
696
+ }).length > 0;
697
+ }).length > 0;
698
+ }
699
+
700
+ function attr(attrs, value) {
701
+ if (arguments.length === 1 && typeof attrs === 'string') {
702
+ // Get attr
703
+ if (this[0]) return this[0].getAttribute(attrs);
704
+ return undefined;
705
+ } // Set attrs
706
+
707
+
708
+ for (var i = 0; i < this.length; i += 1) {
709
+ if (arguments.length === 2) {
710
+ // String
711
+ this[i].setAttribute(attrs, value);
712
+ } else {
713
+ // Object
714
+ for (var attrName in attrs) {
715
+ this[i][attrName] = attrs[attrName];
716
+ this[i].setAttribute(attrName, attrs[attrName]);
717
+ }
718
+ }
719
+ }
720
+
721
+ return this;
722
+ }
723
+
724
+ function removeAttr(attr) {
725
+ for (var i = 0; i < this.length; i += 1) {
726
+ this[i].removeAttribute(attr);
727
+ }
728
+
729
+ return this;
730
+ }
731
+
732
+ function prop(props, value) {
733
+ if (arguments.length === 1 && typeof props === 'string') {
734
+ // Get prop
735
+ if (this[0]) return this[0][props];
736
+ } else {
737
+ // Set props
738
+ for (var i = 0; i < this.length; i += 1) {
739
+ if (arguments.length === 2) {
740
+ // String
741
+ this[i][props] = value;
742
+ } else {
743
+ // Object
744
+ for (var propName in props) {
745
+ this[i][propName] = props[propName];
746
+ }
747
+ }
748
+ }
749
+
750
+ return this;
751
+ }
752
+
753
+ return this;
754
+ }
755
+
756
+ function data(key, value) {
757
+ var el;
758
+
759
+ if (typeof value === 'undefined') {
760
+ el = this[0];
761
+ if (!el) return undefined; // Get value
762
+
763
+ if (el.dom7ElementDataStorage && key in el.dom7ElementDataStorage) {
764
+ return el.dom7ElementDataStorage[key];
765
+ }
766
+
767
+ var dataKey = el.getAttribute("data-" + key);
768
+
769
+ if (dataKey) {
770
+ return dataKey;
771
+ }
772
+
773
+ return undefined;
774
+ } // Set value
775
+
776
+
777
+ for (var i = 0; i < this.length; i += 1) {
778
+ el = this[i];
779
+ if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
780
+ el.dom7ElementDataStorage[key] = value;
781
+ }
782
+
783
+ return this;
784
+ }
785
+
786
+ function removeData(key) {
787
+ for (var i = 0; i < this.length; i += 1) {
788
+ var el = this[i];
789
+
790
+ if (el.dom7ElementDataStorage && el.dom7ElementDataStorage[key]) {
791
+ el.dom7ElementDataStorage[key] = null;
792
+ delete el.dom7ElementDataStorage[key];
793
+ }
794
+ }
795
+ }
796
+
797
+ function dataset() {
798
+ var el = this[0];
799
+ if (!el) return undefined;
800
+ var dataset = {}; // eslint-disable-line
801
+
802
+ if (el.dataset) {
803
+ for (var dataKey in el.dataset) {
804
+ dataset[dataKey] = el.dataset[dataKey];
805
+ }
806
+ } else {
807
+ for (var i = 0; i < el.attributes.length; i += 1) {
808
+ var _attr = el.attributes[i];
809
+
810
+ if (_attr.name.indexOf('data-') >= 0) {
811
+ dataset[toCamelCase(_attr.name.split('data-')[1])] = _attr.value;
812
+ }
813
+ }
814
+ }
815
+
816
+ for (var key in dataset) {
817
+ if (dataset[key] === 'false') dataset[key] = false;else if (dataset[key] === 'true') dataset[key] = true;else if (parseFloat(dataset[key]) === dataset[key] * 1) dataset[key] *= 1;
818
+ }
819
+
820
+ return dataset;
821
+ }
822
+
823
+ function val(value) {
824
+ if (typeof value === 'undefined') {
825
+ // get value
826
+ var el = this[0];
827
+ if (!el) return undefined;
828
+
829
+ if (el.multiple && el.nodeName.toLowerCase() === 'select') {
830
+ var values = [];
831
+
832
+ for (var i = 0; i < el.selectedOptions.length; i += 1) {
833
+ values.push(el.selectedOptions[i].value);
834
+ }
835
+
836
+ return values;
837
+ }
838
+
839
+ return el.value;
840
+ } // set value
841
+
842
+
843
+ for (var _i = 0; _i < this.length; _i += 1) {
844
+ var _el = this[_i];
845
+
846
+ if (Array.isArray(value) && _el.multiple && _el.nodeName.toLowerCase() === 'select') {
847
+ for (var j = 0; j < _el.options.length; j += 1) {
848
+ _el.options[j].selected = value.indexOf(_el.options[j].value) >= 0;
849
+ }
850
+ } else {
851
+ _el.value = value;
852
+ }
853
+ }
854
+
855
+ return this;
856
+ }
857
+
858
+ function value(value) {
859
+ return this.val(value);
860
+ }
861
+
862
+ function transform(transform) {
863
+ for (var i = 0; i < this.length; i += 1) {
864
+ this[i].style.transform = transform;
865
+ }
866
+
867
+ return this;
868
+ }
869
+
870
+ function transition(duration) {
871
+ for (var i = 0; i < this.length; i += 1) {
872
+ this[i].style.transitionDuration = typeof duration !== 'string' ? duration + "ms" : duration;
873
+ }
874
+
875
+ return this;
876
+ }
877
+
878
+ function on() {
879
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
880
+ args[_key5] = arguments[_key5];
881
+ }
882
+
883
+ var eventType = args[0],
884
+ targetSelector = args[1],
885
+ listener = args[2],
886
+ capture = args[3];
887
+
888
+ if (typeof args[1] === 'function') {
889
+ eventType = args[0];
890
+ listener = args[1];
891
+ capture = args[2];
892
+ targetSelector = undefined;
893
+ }
894
+
895
+ if (!capture) capture = false;
896
+
897
+ function handleLiveEvent(e) {
898
+ var target = e.target;
899
+ if (!target) return;
900
+ var eventData = e.target.dom7EventData || [];
901
+
902
+ if (eventData.indexOf(e) < 0) {
903
+ eventData.unshift(e);
904
+ }
905
+
906
+ if ($(target).is(targetSelector)) listener.apply(target, eventData);else {
907
+ var _parents = $(target).parents(); // eslint-disable-line
908
+
909
+
910
+ for (var k = 0; k < _parents.length; k += 1) {
911
+ if ($(_parents[k]).is(targetSelector)) listener.apply(_parents[k], eventData);
912
+ }
913
+ }
914
+ }
915
+
916
+ function handleEvent(e) {
917
+ var eventData = e && e.target ? e.target.dom7EventData || [] : [];
918
+
919
+ if (eventData.indexOf(e) < 0) {
920
+ eventData.unshift(e);
921
+ }
922
+
923
+ listener.apply(this, eventData);
924
+ }
925
+
926
+ var events = eventType.split(' ');
927
+ var j;
928
+
929
+ for (var i = 0; i < this.length; i += 1) {
930
+ var el = this[i];
931
+
932
+ if (!targetSelector) {
933
+ for (j = 0; j < events.length; j += 1) {
934
+ var event = events[j];
935
+ if (!el.dom7Listeners) el.dom7Listeners = {};
936
+ if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
937
+ el.dom7Listeners[event].push({
938
+ listener: listener,
939
+ proxyListener: handleEvent
940
+ });
941
+ el.addEventListener(event, handleEvent, capture);
942
+ }
943
+ } else {
944
+ // Live events
945
+ for (j = 0; j < events.length; j += 1) {
946
+ var _event = events[j];
947
+ if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
948
+ if (!el.dom7LiveListeners[_event]) el.dom7LiveListeners[_event] = [];
949
+
950
+ el.dom7LiveListeners[_event].push({
951
+ listener: listener,
952
+ proxyListener: handleLiveEvent
953
+ });
954
+
955
+ el.addEventListener(_event, handleLiveEvent, capture);
956
+ }
957
+ }
958
+ }
959
+
960
+ return this;
961
+ }
962
+
963
+ function off() {
964
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
965
+ args[_key6] = arguments[_key6];
966
+ }
967
+
968
+ var eventType = args[0],
969
+ targetSelector = args[1],
970
+ listener = args[2],
971
+ capture = args[3];
972
+
973
+ if (typeof args[1] === 'function') {
974
+ eventType = args[0];
975
+ listener = args[1];
976
+ capture = args[2];
977
+ targetSelector = undefined;
978
+ }
979
+
980
+ if (!capture) capture = false;
981
+ var events = eventType.split(' ');
982
+
983
+ for (var i = 0; i < events.length; i += 1) {
984
+ var event = events[i];
985
+
986
+ for (var j = 0; j < this.length; j += 1) {
987
+ var el = this[j];
988
+ var handlers = void 0;
989
+
990
+ if (!targetSelector && el.dom7Listeners) {
991
+ handlers = el.dom7Listeners[event];
992
+ } else if (targetSelector && el.dom7LiveListeners) {
993
+ handlers = el.dom7LiveListeners[event];
994
+ }
995
+
996
+ if (handlers && handlers.length) {
997
+ for (var k = handlers.length - 1; k >= 0; k -= 1) {
998
+ var handler = handlers[k];
999
+
1000
+ if (listener && handler.listener === listener) {
1001
+ el.removeEventListener(event, handler.proxyListener, capture);
1002
+ handlers.splice(k, 1);
1003
+ } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
1004
+ el.removeEventListener(event, handler.proxyListener, capture);
1005
+ handlers.splice(k, 1);
1006
+ } else if (!listener) {
1007
+ el.removeEventListener(event, handler.proxyListener, capture);
1008
+ handlers.splice(k, 1);
1009
+ }
1010
+ }
1011
+ }
1012
+ }
1013
+ }
1014
+
1015
+ return this;
1016
+ }
1017
+
1018
+ function once() {
1019
+ var dom = this;
1020
+
1021
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
1022
+ args[_key7] = arguments[_key7];
1023
+ }
1024
+
1025
+ var eventName = args[0],
1026
+ targetSelector = args[1],
1027
+ listener = args[2],
1028
+ capture = args[3];
1029
+
1030
+ if (typeof args[1] === 'function') {
1031
+ eventName = args[0];
1032
+ listener = args[1];
1033
+ capture = args[2];
1034
+ targetSelector = undefined;
1035
+ }
1036
+
1037
+ function onceHandler() {
1038
+ for (var _len8 = arguments.length, eventArgs = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
1039
+ eventArgs[_key8] = arguments[_key8];
1040
+ }
1041
+
1042
+ listener.apply(this, eventArgs);
1043
+ dom.off(eventName, targetSelector, onceHandler, capture);
1044
+
1045
+ if (onceHandler.dom7proxy) {
1046
+ delete onceHandler.dom7proxy;
1047
+ }
1048
+ }
1049
+
1050
+ onceHandler.dom7proxy = listener;
1051
+ return dom.on(eventName, targetSelector, onceHandler, capture);
1052
+ }
1053
+
1054
+ function trigger() {
1055
+ var window = ssrWindow.getWindow();
1056
+
1057
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
1058
+ args[_key9] = arguments[_key9];
1059
+ }
1060
+
1061
+ var events = args[0].split(' ');
1062
+ var eventData = args[1];
1063
+
1064
+ for (var i = 0; i < events.length; i += 1) {
1065
+ var event = events[i];
1066
+
1067
+ for (var j = 0; j < this.length; j += 1) {
1068
+ var el = this[j];
1069
+
1070
+ if (window.CustomEvent) {
1071
+ var evt = new window.CustomEvent(event, {
1072
+ detail: eventData,
1073
+ bubbles: true,
1074
+ cancelable: true
1075
+ });
1076
+ el.dom7EventData = args.filter(function (data, dataIndex) {
1077
+ return dataIndex > 0;
1078
+ });
1079
+ el.dispatchEvent(evt);
1080
+ el.dom7EventData = [];
1081
+ delete el.dom7EventData;
1082
+ }
1083
+ }
1084
+ }
1085
+
1086
+ return this;
1087
+ }
1088
+
1089
+ function transitionEnd(callback) {
1090
+ var dom = this;
1091
+
1092
+ function fireCallBack(e) {
1093
+ if (e.target !== this) return;
1094
+ callback.call(this, e);
1095
+ dom.off('transitionend', fireCallBack);
1096
+ }
1097
+
1098
+ if (callback) {
1099
+ dom.on('transitionend', fireCallBack);
1100
+ }
1101
+
1102
+ return this;
1103
+ }
1104
+
1105
+ function animationEnd(callback) {
1106
+ var dom = this;
1107
+
1108
+ function fireCallBack(e) {
1109
+ if (e.target !== this) return;
1110
+ callback.call(this, e);
1111
+ dom.off('animationend', fireCallBack);
1112
+ }
1113
+
1114
+ if (callback) {
1115
+ dom.on('animationend', fireCallBack);
1116
+ }
1117
+
1118
+ return this;
1119
+ }
1120
+
1121
+ function width() {
1122
+ var window = ssrWindow.getWindow();
1123
+
1124
+ if (this[0] === window) {
1125
+ return window.innerWidth;
1126
+ }
1127
+
1128
+ if (this.length > 0) {
1129
+ return parseFloat(this.css('width'));
1130
+ }
1131
+
1132
+ return null;
1133
+ }
1134
+
1135
+ function outerWidth(includeMargins) {
1136
+ if (this.length > 0) {
1137
+ if (includeMargins) {
1138
+ var _styles = this.styles();
1139
+
1140
+ return this[0].offsetWidth + parseFloat(_styles.getPropertyValue('margin-right')) + parseFloat(_styles.getPropertyValue('margin-left'));
1141
+ }
1142
+
1143
+ return this[0].offsetWidth;
1144
+ }
1145
+
1146
+ return null;
1147
+ }
1148
+
1149
+ function height() {
1150
+ var window = ssrWindow.getWindow();
1151
+
1152
+ if (this[0] === window) {
1153
+ return window.innerHeight;
1154
+ }
1155
+
1156
+ if (this.length > 0) {
1157
+ return parseFloat(this.css('height'));
1158
+ }
1159
+
1160
+ return null;
1161
+ }
1162
+
1163
+ function outerHeight(includeMargins) {
1164
+ if (this.length > 0) {
1165
+ if (includeMargins) {
1166
+ var _styles2 = this.styles();
1167
+
1168
+ return this[0].offsetHeight + parseFloat(_styles2.getPropertyValue('margin-top')) + parseFloat(_styles2.getPropertyValue('margin-bottom'));
1169
+ }
1170
+
1171
+ return this[0].offsetHeight;
1172
+ }
1173
+
1174
+ return null;
1175
+ }
1176
+
1177
+ function offset() {
1178
+ if (this.length > 0) {
1179
+ var window = ssrWindow.getWindow();
1180
+ var document = ssrWindow.getDocument();
1181
+ var el = this[0];
1182
+ var box = el.getBoundingClientRect();
1183
+ var body = document.body;
1184
+ var clientTop = el.clientTop || body.clientTop || 0;
1185
+ var clientLeft = el.clientLeft || body.clientLeft || 0;
1186
+ var scrollTop = el === window ? window.scrollY : el.scrollTop;
1187
+ var scrollLeft = el === window ? window.scrollX : el.scrollLeft;
1188
+ return {
1189
+ top: box.top + scrollTop - clientTop,
1190
+ left: box.left + scrollLeft - clientLeft
1191
+ };
1192
+ }
1193
+
1194
+ return null;
1195
+ }
1196
+
1197
+ function hide() {
1198
+ for (var i = 0; i < this.length; i += 1) {
1199
+ this[i].style.display = 'none';
1200
+ }
1201
+
1202
+ return this;
1203
+ }
1204
+
1205
+ function show() {
1206
+ var window = ssrWindow.getWindow();
1207
+
1208
+ for (var i = 0; i < this.length; i += 1) {
1209
+ var el = this[i];
1210
+
1211
+ if (el.style.display === 'none') {
1212
+ el.style.display = '';
1213
+ }
1214
+
1215
+ if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') {
1216
+ // Still not visible
1217
+ el.style.display = 'block';
1218
+ }
1219
+ }
1220
+
1221
+ return this;
1222
+ }
1223
+
1224
+ function styles() {
1225
+ var window = ssrWindow.getWindow();
1226
+ if (this[0]) return window.getComputedStyle(this[0], null);
1227
+ return {};
1228
+ }
1229
+
1230
+ function css(props, value) {
1231
+ var window = ssrWindow.getWindow();
1232
+ var i;
1233
+
1234
+ if (arguments.length === 1) {
1235
+ if (typeof props === 'string') {
1236
+ // .css('width')
1237
+ if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
1238
+ } else {
1239
+ // .css({ width: '100px' })
1240
+ for (i = 0; i < this.length; i += 1) {
1241
+ for (var _prop in props) {
1242
+ this[i].style[_prop] = props[_prop];
1243
+ }
1244
+ }
1245
+
1246
+ return this;
1247
+ }
1248
+ }
1249
+
1250
+ if (arguments.length === 2 && typeof props === 'string') {
1251
+ // .css('width', '100px')
1252
+ for (i = 0; i < this.length; i += 1) {
1253
+ this[i].style[props] = value;
1254
+ }
1255
+
1256
+ return this;
1257
+ }
1258
+
1259
+ return this;
1260
+ }
1261
+
1262
+ function each(callback) {
1263
+ if (!callback) return this;
1264
+ this.forEach(function (el, index) {
1265
+ callback.apply(el, [el, index]);
1266
+ });
1267
+ return this;
1268
+ }
1269
+
1270
+ function filter(callback) {
1271
+ var result = arrayFilter(this, callback);
1272
+ return $(result);
1273
+ }
1274
+
1275
+ function html(html) {
1276
+ if (typeof html === 'undefined') {
1277
+ return this[0] ? this[0].innerHTML : null;
1278
+ }
1279
+
1280
+ for (var i = 0; i < this.length; i += 1) {
1281
+ this[i].innerHTML = html;
1282
+ }
1283
+
1284
+ return this;
1285
+ }
1286
+
1287
+ function text(text) {
1288
+ if (typeof text === 'undefined') {
1289
+ return this[0] ? this[0].textContent.trim() : null;
1290
+ }
1291
+
1292
+ for (var i = 0; i < this.length; i += 1) {
1293
+ this[i].textContent = text;
1294
+ }
1295
+
1296
+ return this;
1297
+ }
1298
+
1299
+ function is(selector) {
1300
+ var window = ssrWindow.getWindow();
1301
+ var document = ssrWindow.getDocument();
1302
+ var el = this[0];
1303
+ var compareWith;
1304
+ var i;
1305
+ if (!el || typeof selector === 'undefined') return false;
1306
+
1307
+ if (typeof selector === 'string') {
1308
+ if (el.matches) return el.matches(selector);
1309
+ if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
1310
+ if (el.msMatchesSelector) return el.msMatchesSelector(selector);
1311
+ compareWith = $(selector);
1312
+
1313
+ for (i = 0; i < compareWith.length; i += 1) {
1314
+ if (compareWith[i] === el) return true;
1315
+ }
1316
+
1317
+ return false;
1318
+ }
1319
+
1320
+ if (selector === document) {
1321
+ return el === document;
1322
+ }
1323
+
1324
+ if (selector === window) {
1325
+ return el === window;
1326
+ }
1327
+
1328
+ if (selector.nodeType || selector instanceof Dom7) {
1329
+ compareWith = selector.nodeType ? [selector] : selector;
1330
+
1331
+ for (i = 0; i < compareWith.length; i += 1) {
1332
+ if (compareWith[i] === el) return true;
1333
+ }
1334
+
1335
+ return false;
1336
+ }
1337
+
1338
+ return false;
1339
+ }
1340
+
1341
+ function index() {
1342
+ var child = this[0];
1343
+ var i;
1344
+
1345
+ if (child) {
1346
+ i = 0; // eslint-disable-next-line
1347
+
1348
+ while ((child = child.previousSibling) !== null) {
1349
+ if (child.nodeType === 1) i += 1;
1350
+ }
1351
+
1352
+ return i;
1353
+ }
1354
+
1355
+ return undefined;
1356
+ }
1357
+
1358
+ function eq(index) {
1359
+ if (typeof index === 'undefined') return this;
1360
+ var length = this.length;
1361
+
1362
+ if (index > length - 1) {
1363
+ return $([]);
1364
+ }
1365
+
1366
+ if (index < 0) {
1367
+ var returnIndex = length + index;
1368
+ if (returnIndex < 0) return $([]);
1369
+ return $([this[returnIndex]]);
1370
+ }
1371
+
1372
+ return $([this[index]]);
1373
+ }
1374
+
1375
+ function append() {
1376
+ var newChild;
1377
+ var document = ssrWindow.getDocument();
1378
+
1379
+ for (var k = 0; k < arguments.length; k += 1) {
1380
+ newChild = k < 0 || arguments.length <= k ? undefined : arguments[k];
1381
+
1382
+ for (var i = 0; i < this.length; i += 1) {
1383
+ if (typeof newChild === 'string') {
1384
+ var tempDiv = document.createElement('div');
1385
+ tempDiv.innerHTML = newChild;
1386
+
1387
+ while (tempDiv.firstChild) {
1388
+ this[i].appendChild(tempDiv.firstChild);
1389
+ }
1390
+ } else if (newChild instanceof Dom7) {
1391
+ for (var j = 0; j < newChild.length; j += 1) {
1392
+ this[i].appendChild(newChild[j]);
1393
+ }
1394
+ } else {
1395
+ this[i].appendChild(newChild);
1396
+ }
1397
+ }
1398
+ }
1399
+
1400
+ return this;
1401
+ }
1402
+
1403
+ function appendTo(parent) {
1404
+ $(parent).append(this);
1405
+ return this;
1406
+ }
1407
+
1408
+ function prepend(newChild) {
1409
+ var document = ssrWindow.getDocument();
1410
+ var i;
1411
+ var j;
1412
+
1413
+ for (i = 0; i < this.length; i += 1) {
1414
+ if (typeof newChild === 'string') {
1415
+ var tempDiv = document.createElement('div');
1416
+ tempDiv.innerHTML = newChild;
1417
+
1418
+ for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
1419
+ this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
1420
+ }
1421
+ } else if (newChild instanceof Dom7) {
1422
+ for (j = 0; j < newChild.length; j += 1) {
1423
+ this[i].insertBefore(newChild[j], this[i].childNodes[0]);
1424
+ }
1425
+ } else {
1426
+ this[i].insertBefore(newChild, this[i].childNodes[0]);
1427
+ }
1428
+ }
1429
+
1430
+ return this;
1431
+ }
1432
+
1433
+ function prependTo(parent) {
1434
+ $(parent).prepend(this);
1435
+ return this;
1436
+ }
1437
+
1438
+ function insertBefore(selector) {
1439
+ var before = $(selector);
1440
+
1441
+ for (var i = 0; i < this.length; i += 1) {
1442
+ if (before.length === 1) {
1443
+ before[0].parentNode.insertBefore(this[i], before[0]);
1444
+ } else if (before.length > 1) {
1445
+ for (var j = 0; j < before.length; j += 1) {
1446
+ before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
1447
+ }
1448
+ }
1449
+ }
1450
+ }
1451
+
1452
+ function insertAfter(selector) {
1453
+ var after = $(selector);
1454
+
1455
+ for (var i = 0; i < this.length; i += 1) {
1456
+ if (after.length === 1) {
1457
+ after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
1458
+ } else if (after.length > 1) {
1459
+ for (var j = 0; j < after.length; j += 1) {
1460
+ after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
1461
+ }
1462
+ }
1463
+ }
1464
+ }
1465
+
1466
+ function next(selector) {
1467
+ if (this.length > 0) {
1468
+ if (selector) {
1469
+ if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
1470
+ return $([this[0].nextElementSibling]);
1471
+ }
1472
+
1473
+ return $([]);
1474
+ }
1475
+
1476
+ if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
1477
+ return $([]);
1478
+ }
1479
+
1480
+ return $([]);
1481
+ }
1482
+
1483
+ function nextAll(selector) {
1484
+ var nextEls = [];
1485
+ var el = this[0];
1486
+ if (!el) return $([]);
1487
+
1488
+ while (el.nextElementSibling) {
1489
+ var _next = el.nextElementSibling; // eslint-disable-line
1490
+
1491
+ if (selector) {
1492
+ if ($(_next).is(selector)) nextEls.push(_next);
1493
+ } else nextEls.push(_next);
1494
+
1495
+ el = _next;
1496
+ }
1497
+
1498
+ return $(nextEls);
1499
+ }
1500
+
1501
+ function prev(selector) {
1502
+ if (this.length > 0) {
1503
+ var el = this[0];
1504
+
1505
+ if (selector) {
1506
+ if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
1507
+ return $([el.previousElementSibling]);
1508
+ }
1509
+
1510
+ return $([]);
1511
+ }
1512
+
1513
+ if (el.previousElementSibling) return $([el.previousElementSibling]);
1514
+ return $([]);
1515
+ }
1516
+
1517
+ return $([]);
1518
+ }
1519
+
1520
+ function prevAll(selector) {
1521
+ var prevEls = [];
1522
+ var el = this[0];
1523
+ if (!el) return $([]);
1524
+
1525
+ while (el.previousElementSibling) {
1526
+ var _prev = el.previousElementSibling; // eslint-disable-line
1527
+
1528
+ if (selector) {
1529
+ if ($(_prev).is(selector)) prevEls.push(_prev);
1530
+ } else prevEls.push(_prev);
1531
+
1532
+ el = _prev;
1533
+ }
1534
+
1535
+ return $(prevEls);
1536
+ }
1537
+
1538
+ function siblings(selector) {
1539
+ return this.nextAll(selector).add(this.prevAll(selector));
1540
+ }
1541
+
1542
+ function parent(selector) {
1543
+ var parents = []; // eslint-disable-line
1544
+
1545
+ for (var i = 0; i < this.length; i += 1) {
1546
+ if (this[i].parentNode !== null) {
1547
+ if (selector) {
1548
+ if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
1549
+ } else {
1550
+ parents.push(this[i].parentNode);
1551
+ }
1552
+ }
1553
+ }
1554
+
1555
+ return $(parents);
1556
+ }
1557
+
1558
+ function parents(selector) {
1559
+ var parents = []; // eslint-disable-line
1560
+
1561
+ for (var i = 0; i < this.length; i += 1) {
1562
+ var _parent = this[i].parentNode; // eslint-disable-line
1563
+
1564
+ while (_parent) {
1565
+ if (selector) {
1566
+ if ($(_parent).is(selector)) parents.push(_parent);
1567
+ } else {
1568
+ parents.push(_parent);
1569
+ }
1570
+
1571
+ _parent = _parent.parentNode;
1572
+ }
1573
+ }
1574
+
1575
+ return $(parents);
1576
+ }
1577
+
1578
+ function closest(selector) {
1579
+ var closest = this; // eslint-disable-line
1580
+
1581
+ if (typeof selector === 'undefined') {
1582
+ return $([]);
1583
+ }
1584
+
1585
+ if (!closest.is(selector)) {
1586
+ closest = closest.parents(selector).eq(0);
1587
+ }
1588
+
1589
+ return closest;
1590
+ }
1591
+
1592
+ function find(selector) {
1593
+ var foundElements = [];
1594
+
1595
+ for (var i = 0; i < this.length; i += 1) {
1596
+ var found = this[i].querySelectorAll(selector);
1597
+
1598
+ for (var j = 0; j < found.length; j += 1) {
1599
+ foundElements.push(found[j]);
1600
+ }
1601
+ }
1602
+
1603
+ return $(foundElements);
1604
+ }
1605
+
1606
+ function children(selector) {
1607
+ var children = []; // eslint-disable-line
1608
+
1609
+ for (var i = 0; i < this.length; i += 1) {
1610
+ var childNodes = this[i].children;
1611
+
1612
+ for (var j = 0; j < childNodes.length; j += 1) {
1613
+ if (!selector || $(childNodes[j]).is(selector)) {
1614
+ children.push(childNodes[j]);
1615
+ }
1616
+ }
1617
+ }
1618
+
1619
+ return $(children);
1620
+ }
1621
+
1622
+ function remove() {
1623
+ for (var i = 0; i < this.length; i += 1) {
1624
+ if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
1625
+ }
1626
+
1627
+ return this;
1628
+ }
1629
+
1630
+ function detach() {
1631
+ return this.remove();
1632
+ }
1633
+
1634
+ function add() {
1635
+ var dom = this;
1636
+ var i;
1637
+ var j;
1638
+
1639
+ for (var _len10 = arguments.length, els = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
1640
+ els[_key10] = arguments[_key10];
1641
+ }
1642
+
1643
+ for (i = 0; i < els.length; i += 1) {
1644
+ var toAdd = $(els[i]);
1645
+
1646
+ for (j = 0; j < toAdd.length; j += 1) {
1647
+ dom.push(toAdd[j]);
1648
+ }
1649
+ }
1650
+
1651
+ return dom;
1652
+ }
1653
+
1654
+ function empty() {
1655
+ for (var i = 0; i < this.length; i += 1) {
1656
+ var el = this[i];
1657
+
1658
+ if (el.nodeType === 1) {
1659
+ for (var j = 0; j < el.childNodes.length; j += 1) {
1660
+ if (el.childNodes[j].parentNode) {
1661
+ el.childNodes[j].parentNode.removeChild(el.childNodes[j]);
1662
+ }
1663
+ }
1664
+
1665
+ el.textContent = '';
1666
+ }
1667
+ }
1668
+
1669
+ return this;
1670
+ }
1671
+
1672
+ function scrollTo() {
1673
+ var window = ssrWindow.getWindow();
1674
+
1675
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1676
+ args[_key] = arguments[_key];
1677
+ }
1678
+
1679
+ var left = args[0],
1680
+ top = args[1],
1681
+ duration = args[2],
1682
+ easing = args[3],
1683
+ callback = args[4];
1684
+
1685
+ if (args.length === 4 && typeof easing === 'function') {
1686
+ callback = easing;
1687
+ left = args[0];
1688
+ top = args[1];
1689
+ duration = args[2];
1690
+ callback = args[3];
1691
+ easing = args[4];
1692
+ }
1693
+
1694
+ if (typeof easing === 'undefined') easing = 'swing';
1695
+ return this.each(function animate() {
1696
+ var el = this;
1697
+ var currentTop;
1698
+ var currentLeft;
1699
+ var maxTop;
1700
+ var maxLeft;
1701
+ var newTop;
1702
+ var newLeft;
1703
+ var scrollTop; // eslint-disable-line
1704
+
1705
+ var scrollLeft; // eslint-disable-line
1706
+
1707
+ var animateTop = top > 0 || top === 0;
1708
+ var animateLeft = left > 0 || left === 0;
1709
+
1710
+ if (typeof easing === 'undefined') {
1711
+ easing = 'swing';
1712
+ }
1713
+
1714
+ if (animateTop) {
1715
+ currentTop = el.scrollTop;
1716
+
1717
+ if (!duration) {
1718
+ el.scrollTop = top;
1719
+ }
1720
+ }
1721
+
1722
+ if (animateLeft) {
1723
+ currentLeft = el.scrollLeft;
1724
+
1725
+ if (!duration) {
1726
+ el.scrollLeft = left;
1727
+ }
1728
+ }
1729
+
1730
+ if (!duration) return;
1731
+
1732
+ if (animateTop) {
1733
+ maxTop = el.scrollHeight - el.offsetHeight;
1734
+ newTop = Math.max(Math.min(top, maxTop), 0);
1735
+ }
1736
+
1737
+ if (animateLeft) {
1738
+ maxLeft = el.scrollWidth - el.offsetWidth;
1739
+ newLeft = Math.max(Math.min(left, maxLeft), 0);
1740
+ }
1741
+
1742
+ var startTime = null;
1743
+ if (animateTop && newTop === currentTop) animateTop = false;
1744
+ if (animateLeft && newLeft === currentLeft) animateLeft = false;
1745
+
1746
+ function render(time) {
1747
+ if (time === void 0) {
1748
+ time = new Date().getTime();
1749
+ }
1750
+
1751
+ if (startTime === null) {
1752
+ startTime = time;
1753
+ }
1754
+
1755
+ var progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
1756
+ var easeProgress = easing === 'linear' ? progress : 0.5 - Math.cos(progress * Math.PI) / 2;
1757
+ var done;
1758
+ if (animateTop) scrollTop = currentTop + easeProgress * (newTop - currentTop);
1759
+ if (animateLeft) scrollLeft = currentLeft + easeProgress * (newLeft - currentLeft);
1760
+
1761
+ if (animateTop && newTop > currentTop && scrollTop >= newTop) {
1762
+ el.scrollTop = newTop;
1763
+ done = true;
1764
+ }
1765
+
1766
+ if (animateTop && newTop < currentTop && scrollTop <= newTop) {
1767
+ el.scrollTop = newTop;
1768
+ done = true;
1769
+ }
1770
+
1771
+ if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) {
1772
+ el.scrollLeft = newLeft;
1773
+ done = true;
1774
+ }
1775
+
1776
+ if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) {
1777
+ el.scrollLeft = newLeft;
1778
+ done = true;
1779
+ }
1780
+
1781
+ if (done) {
1782
+ if (callback) callback();
1783
+ return;
1784
+ }
1785
+
1786
+ if (animateTop) el.scrollTop = scrollTop;
1787
+ if (animateLeft) el.scrollLeft = scrollLeft;
1788
+ window.requestAnimationFrame(render);
1789
+ }
1790
+
1791
+ window.requestAnimationFrame(render);
1792
+ });
1793
+ } // scrollTop(top, duration, easing, callback) {
1794
+
1795
+
1796
+ function scrollTop() {
1797
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1798
+ args[_key2] = arguments[_key2];
1799
+ }
1800
+
1801
+ var top = args[0],
1802
+ duration = args[1],
1803
+ easing = args[2],
1804
+ callback = args[3];
1805
+
1806
+ if (args.length === 3 && typeof easing === 'function') {
1807
+ top = args[0];
1808
+ duration = args[1];
1809
+ callback = args[2];
1810
+ easing = args[3];
1811
+ }
1812
+
1813
+ var dom = this;
1814
+
1815
+ if (typeof top === 'undefined') {
1816
+ if (dom.length > 0) return dom[0].scrollTop;
1817
+ return null;
1818
+ }
1819
+
1820
+ return dom.scrollTo(undefined, top, duration, easing, callback);
1821
+ }
1822
+
1823
+ function scrollLeft() {
1824
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1825
+ args[_key3] = arguments[_key3];
1826
+ }
1827
+
1828
+ var left = args[0],
1829
+ duration = args[1],
1830
+ easing = args[2],
1831
+ callback = args[3];
1832
+
1833
+ if (args.length === 3 && typeof easing === 'function') {
1834
+ left = args[0];
1835
+ duration = args[1];
1836
+ callback = args[2];
1837
+ easing = args[3];
1838
+ }
1839
+
1840
+ var dom = this;
1841
+
1842
+ if (typeof left === 'undefined') {
1843
+ if (dom.length > 0) return dom[0].scrollLeft;
1844
+ return null;
1845
+ }
1846
+
1847
+ return dom.scrollTo(left, undefined, duration, easing, callback);
1848
+ }
1849
+
1850
+ function animate(initialProps, initialParams) {
1851
+ var window = ssrWindow.getWindow();
1852
+ var els = this;
1853
+ var a = {
1854
+ props: Object.assign({}, initialProps),
1855
+ params: Object.assign({
1856
+ duration: 300,
1857
+ easing: 'swing' // or 'linear'
1858
+
1859
+ /* Callbacks
1860
+ begin(elements)
1861
+ complete(elements)
1862
+ progress(elements, complete, remaining, start, tweenValue)
1863
+ */
1864
+
1865
+ }, initialParams),
1866
+ elements: els,
1867
+ animating: false,
1868
+ que: [],
1869
+ easingProgress: function easingProgress(easing, progress) {
1870
+ if (easing === 'swing') {
1871
+ return 0.5 - Math.cos(progress * Math.PI) / 2;
1872
+ }
1873
+
1874
+ if (typeof easing === 'function') {
1875
+ return easing(progress);
1876
+ }
1877
+
1878
+ return progress;
1879
+ },
1880
+ stop: function stop() {
1881
+ if (a.frameId) {
1882
+ window.cancelAnimationFrame(a.frameId);
1883
+ }
1884
+
1885
+ a.animating = false;
1886
+ a.elements.each(function (el) {
1887
+ var element = el;
1888
+ delete element.dom7AnimateInstance;
1889
+ });
1890
+ a.que = [];
1891
+ },
1892
+ done: function done(complete) {
1893
+ a.animating = false;
1894
+ a.elements.each(function (el) {
1895
+ var element = el;
1896
+ delete element.dom7AnimateInstance;
1897
+ });
1898
+ if (complete) complete(els);
1899
+
1900
+ if (a.que.length > 0) {
1901
+ var que = a.que.shift();
1902
+ a.animate(que[0], que[1]);
1903
+ }
1904
+ },
1905
+ animate: function animate(props, params) {
1906
+ if (a.animating) {
1907
+ a.que.push([props, params]);
1908
+ return a;
1909
+ }
1910
+
1911
+ var elements = []; // Define & Cache Initials & Units
1912
+
1913
+ a.elements.each(function (el, index) {
1914
+ var initialFullValue;
1915
+ var initialValue;
1916
+ var unit;
1917
+ var finalValue;
1918
+ var finalFullValue;
1919
+ if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a;
1920
+ elements[index] = {
1921
+ container: el
1922
+ };
1923
+ Object.keys(props).forEach(function (prop) {
1924
+ initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.');
1925
+ initialValue = parseFloat(initialFullValue);
1926
+ unit = initialFullValue.replace(initialValue, '');
1927
+ finalValue = parseFloat(props[prop]);
1928
+ finalFullValue = props[prop] + unit;
1929
+ elements[index][prop] = {
1930
+ initialFullValue: initialFullValue,
1931
+ initialValue: initialValue,
1932
+ unit: unit,
1933
+ finalValue: finalValue,
1934
+ finalFullValue: finalFullValue,
1935
+ currentValue: initialValue
1936
+ };
1937
+ });
1938
+ });
1939
+ var startTime = null;
1940
+ var time;
1941
+ var elementsDone = 0;
1942
+ var propsDone = 0;
1943
+ var done;
1944
+ var began = false;
1945
+ a.animating = true;
1946
+
1947
+ function render() {
1948
+ time = new Date().getTime();
1949
+ var progress;
1950
+ var easeProgress; // let el;
1951
+
1952
+ if (!began) {
1953
+ began = true;
1954
+ if (params.begin) params.begin(els);
1955
+ }
1956
+
1957
+ if (startTime === null) {
1958
+ startTime = time;
1959
+ }
1960
+
1961
+ if (params.progress) {
1962
+ // eslint-disable-next-line
1963
+ params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), startTime + params.duration - time < 0 ? 0 : startTime + params.duration - time, startTime);
1964
+ }
1965
+
1966
+ elements.forEach(function (element) {
1967
+ var el = element;
1968
+ if (done || el.done) return;
1969
+ Object.keys(props).forEach(function (prop) {
1970
+ if (done || el.done) return;
1971
+ progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0);
1972
+ easeProgress = a.easingProgress(params.easing, progress);
1973
+ var _el$prop = el[prop],
1974
+ initialValue = _el$prop.initialValue,
1975
+ finalValue = _el$prop.finalValue,
1976
+ unit = _el$prop.unit;
1977
+ el[prop].currentValue = initialValue + easeProgress * (finalValue - initialValue);
1978
+ var currentValue = el[prop].currentValue;
1979
+
1980
+ if (finalValue > initialValue && currentValue >= finalValue || finalValue < initialValue && currentValue <= finalValue) {
1981
+ el.container.style[prop] = finalValue + unit;
1982
+ propsDone += 1;
1983
+
1984
+ if (propsDone === Object.keys(props).length) {
1985
+ el.done = true;
1986
+ elementsDone += 1;
1987
+ }
1988
+
1989
+ if (elementsDone === elements.length) {
1990
+ done = true;
1991
+ }
1992
+ }
1993
+
1994
+ if (done) {
1995
+ a.done(params.complete);
1996
+ return;
1997
+ }
1998
+
1999
+ el.container.style[prop] = currentValue + unit;
2000
+ });
2001
+ });
2002
+ if (done) return; // Then call
2003
+
2004
+ a.frameId = window.requestAnimationFrame(render);
2005
+ }
2006
+
2007
+ a.frameId = window.requestAnimationFrame(render);
2008
+ return a;
2009
+ }
2010
+ };
2011
+
2012
+ if (a.elements.length === 0) {
2013
+ return els;
2014
+ }
2015
+
2016
+ var animateInstance;
2017
+
2018
+ for (var i = 0; i < a.elements.length; i += 1) {
2019
+ if (a.elements[i].dom7AnimateInstance) {
2020
+ animateInstance = a.elements[i].dom7AnimateInstance;
2021
+ } else a.elements[i].dom7AnimateInstance = a;
2022
+ }
2023
+
2024
+ if (!animateInstance) {
2025
+ animateInstance = a;
2026
+ }
2027
+
2028
+ if (initialProps === 'stop') {
2029
+ animateInstance.stop();
2030
+ } else {
2031
+ animateInstance.animate(a.props, a.params);
2032
+ }
2033
+
2034
+ return els;
2035
+ }
2036
+
2037
+ function stop() {
2038
+ var els = this;
2039
+
2040
+ for (var i = 0; i < els.length; i += 1) {
2041
+ if (els[i].dom7AnimateInstance) {
2042
+ els[i].dom7AnimateInstance.stop();
2043
+ }
2044
+ }
2045
+ }
2046
+
2047
+ var noTrigger = 'resize scroll'.split(' ');
2048
+
2049
+ function shortcut(name) {
2050
+ function eventHandler() {
2051
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2052
+ args[_key] = arguments[_key];
2053
+ }
2054
+
2055
+ if (typeof args[0] === 'undefined') {
2056
+ for (var i = 0; i < this.length; i += 1) {
2057
+ if (noTrigger.indexOf(name) < 0) {
2058
+ if (name in this[i]) this[i][name]();else {
2059
+ $(this[i]).trigger(name);
2060
+ }
2061
+ }
2062
+ }
2063
+
2064
+ return this;
2065
+ }
2066
+
2067
+ return this.on.apply(this, [name].concat(args));
2068
+ }
2069
+
2070
+ return eventHandler;
2071
+ }
2072
+
2073
+ var click = shortcut('click');
2074
+ var blur = shortcut('blur');
2075
+ var focus = shortcut('focus');
2076
+ var focusin = shortcut('focusin');
2077
+ var focusout = shortcut('focusout');
2078
+ var keyup = shortcut('keyup');
2079
+ var keydown = shortcut('keydown');
2080
+ var keypress = shortcut('keypress');
2081
+ var submit = shortcut('submit');
2082
+ var change = shortcut('change');
2083
+ var mousedown = shortcut('mousedown');
2084
+ var mousemove = shortcut('mousemove');
2085
+ var mouseup = shortcut('mouseup');
2086
+ var mouseenter = shortcut('mouseenter');
2087
+ var mouseleave = shortcut('mouseleave');
2088
+ var mouseout = shortcut('mouseout');
2089
+ var mouseover = shortcut('mouseover');
2090
+ var touchstart = shortcut('touchstart');
2091
+ var touchend = shortcut('touchend');
2092
+ var touchmove = shortcut('touchmove');
2093
+ var resize = shortcut('resize');
2094
+ var scroll = shortcut('scroll');
2095
+
2096
+ dom7_cjs.$ = $;
2097
+ dom7_cjs.add = add;
2098
+ dom7_cjs.addClass = addClass;
2099
+ dom7_cjs.animate = animate;
2100
+ dom7_cjs.animationEnd = animationEnd;
2101
+ dom7_cjs.append = append;
2102
+ dom7_cjs.appendTo = appendTo;
2103
+ dom7_cjs.attr = attr;
2104
+ dom7_cjs.blur = blur;
2105
+ dom7_cjs.change = change;
2106
+ dom7_cjs.children = children;
2107
+ dom7_cjs.click = click;
2108
+ dom7_cjs.closest = closest;
2109
+ dom7_cjs.css = css;
2110
+ dom7_cjs.data = data;
2111
+ dom7_cjs.dataset = dataset;
2112
+ dom7_cjs.default = $;
2113
+ dom7_cjs.detach = detach;
2114
+ dom7_cjs.each = each;
2115
+ dom7_cjs.empty = empty;
2116
+ dom7_cjs.eq = eq;
2117
+ dom7_cjs.filter = filter;
2118
+ dom7_cjs.find = find;
2119
+ dom7_cjs.focus = focus;
2120
+ dom7_cjs.focusin = focusin;
2121
+ dom7_cjs.focusout = focusout;
2122
+ dom7_cjs.hasClass = hasClass;
2123
+ dom7_cjs.height = height;
2124
+ dom7_cjs.hide = hide;
2125
+ dom7_cjs.html = html;
2126
+ dom7_cjs.index = index;
2127
+ dom7_cjs.insertAfter = insertAfter;
2128
+ dom7_cjs.insertBefore = insertBefore;
2129
+ dom7_cjs.is = is;
2130
+ dom7_cjs.keydown = keydown;
2131
+ dom7_cjs.keypress = keypress;
2132
+ dom7_cjs.keyup = keyup;
2133
+ dom7_cjs.mousedown = mousedown;
2134
+ dom7_cjs.mouseenter = mouseenter;
2135
+ dom7_cjs.mouseleave = mouseleave;
2136
+ dom7_cjs.mousemove = mousemove;
2137
+ dom7_cjs.mouseout = mouseout;
2138
+ dom7_cjs.mouseover = mouseover;
2139
+ dom7_cjs.mouseup = mouseup;
2140
+ dom7_cjs.next = next;
2141
+ dom7_cjs.nextAll = nextAll;
2142
+ dom7_cjs.off = off;
2143
+ dom7_cjs.offset = offset;
2144
+ dom7_cjs.on = on;
2145
+ dom7_cjs.once = once;
2146
+ dom7_cjs.outerHeight = outerHeight;
2147
+ dom7_cjs.outerWidth = outerWidth;
2148
+ dom7_cjs.parent = parent;
2149
+ dom7_cjs.parents = parents;
2150
+ dom7_cjs.prepend = prepend;
2151
+ dom7_cjs.prependTo = prependTo;
2152
+ dom7_cjs.prev = prev;
2153
+ dom7_cjs.prevAll = prevAll;
2154
+ dom7_cjs.prop = prop;
2155
+ dom7_cjs.remove = remove;
2156
+ dom7_cjs.removeAttr = removeAttr;
2157
+ dom7_cjs.removeClass = removeClass;
2158
+ dom7_cjs.removeData = removeData;
2159
+ dom7_cjs.resize = resize;
2160
+ dom7_cjs.scroll = scroll;
2161
+ dom7_cjs.scrollLeft = scrollLeft;
2162
+ dom7_cjs.scrollTo = scrollTo;
2163
+ dom7_cjs.scrollTop = scrollTop;
2164
+ dom7_cjs.show = show;
2165
+ dom7_cjs.siblings = siblings;
2166
+ dom7_cjs.stop = stop;
2167
+ dom7_cjs.styles = styles;
2168
+ dom7_cjs.submit = submit;
2169
+ dom7_cjs.text = text;
2170
+ dom7_cjs.toggleClass = toggleClass;
2171
+ dom7_cjs.touchend = touchend;
2172
+ dom7_cjs.touchmove = touchmove;
2173
+ dom7_cjs.touchstart = touchstart;
2174
+ dom7_cjs.transform = transform;
2175
+ dom7_cjs.transition = transition;
2176
+ dom7_cjs.transitionEnd = transitionEnd;
2177
+ dom7_cjs.trigger = trigger;
2178
+ dom7_cjs.val = val;
2179
+ dom7_cjs.value = value;
2180
+ dom7_cjs.width = width;
2181
+ return dom7_cjs;
2182
+ }
2183
+
2184
+ var dom7_cjsExports = /*@__PURE__*/ requireDom7_cjs();
2185
+ var $ = /*@__PURE__*/getDefaultExportFromCjs(dom7_cjsExports);
2186
+
2187
+ /**
2188
+ * @description DOM 操作
2189
+ * @author wangfupeng
2190
+ */
2191
+ if (dom7_cjsExports.append) {
2192
+ $.fn.append = dom7_cjsExports.append;
2193
+ }
2194
+ if (dom7_cjsExports.html) {
2195
+ $.fn.html = dom7_cjsExports.html;
2196
+ }
2197
+ if (dom7_cjsExports.val) {
2198
+ $.fn.val = dom7_cjsExports.val;
2199
+ }
2200
+ if (dom7_cjsExports.on) {
2201
+ $.fn.on = dom7_cjsExports.on;
2202
+ }
2203
+ if (dom7_cjsExports.focus) {
2204
+ $.fn.focus = dom7_cjsExports.focus;
2205
+ }
2206
+ if (dom7_cjsExports.is) {
2207
+ $.fn.is = dom7_cjsExports.is;
2208
+ }
2209
+ if (dom7_cjsExports.parents) {
2210
+ $.fn.parents = dom7_cjsExports.parents;
2211
+ }
2212
+ if (dom7_cjsExports.find) {
2213
+ $.fn.find = dom7_cjsExports.find;
2214
+ }
2215
+
2216
+ let nanoid = (size = 21) =>
2217
+ crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
2218
+ byte &= 63;
2219
+ if (byte < 36) {
2220
+ id += byte.toString(36);
2221
+ } else if (byte < 62) {
2222
+ id += (byte - 26).toString(36).toUpperCase();
2223
+ } else if (byte > 62) {
2224
+ id += '-';
2225
+ } else {
2226
+ id += '_';
2227
+ }
2228
+ return id
2229
+ }, '');
2230
+
2231
+ /**
2232
+ * @description 工具函数
2233
+ * @author wangfupeng
2234
+ */
2235
+ /**
2236
+ * 获取随机数字符串
2237
+ * @param prefix 前缀
2238
+ * @returns 随机数字符串
2239
+ */
2240
+ function genRandomStr(prefix) {
2241
+ return "".concat(prefix, "-").concat(nanoid());
2242
+ }
2243
+ // export function replaceSymbols(str: string) {
2244
+ // return str.replace(/</g, '&lt;').replace(/>/g, '&gt;')
2245
+ // }
2246
+
2247
+ /**
2248
+ * @description edit formula menu
2249
+ * @author wangfupeng
2250
+ */
2251
+ /**
2252
+ * 生成唯一的 DOM ID
2253
+ */
2254
+ function genDomID$1() {
2255
+ return genRandomStr('w-e-insert-formula');
2256
+ }
2257
+ var EditFormulaMenu = /** @class */ (function () {
2258
+ function EditFormulaMenu() {
2259
+ this.title = editor.t('formula.edit');
2260
+ this.iconSvg = PENCIL_SVG;
2261
+ this.tag = 'button';
2262
+ this.showModal = true; // 点击 button 时显示 modal
2263
+ this.modalWidth = 300;
2264
+ this.$content = null;
2265
+ this.textareaId = genDomID$1();
2266
+ this.buttonId = genDomID$1();
2267
+ }
2268
+ EditFormulaMenu.prototype.getSelectedElem = function (editor$1) {
2269
+ var node = editor.DomEditor.getSelectedNodeByType(editor$1, 'formula');
2270
+ if (node == null) {
2271
+ return null;
2272
+ }
2273
+ return node;
2274
+ };
2275
+ /**
2276
+ * 获取公式 value
2277
+ * @param editor editor
2278
+ */
2279
+ EditFormulaMenu.prototype.getValue = function (editor) {
2280
+ var formulaElem = this.getSelectedElem(editor);
2281
+ if (formulaElem) {
2282
+ return formulaElem.value || '';
2283
+ }
2284
+ return '';
2285
+ };
2286
+ EditFormulaMenu.prototype.isActive = function (_editor) {
2287
+ // 无需 active
2288
+ return false;
2289
+ };
2290
+ EditFormulaMenu.prototype.exec = function (_editor, _value) {
2291
+ // 点击菜单时,弹出 modal 之前,不需要执行其他代码
2292
+ // 此处空着即可
2293
+ };
2294
+ EditFormulaMenu.prototype.isDisabled = function (editor$1) {
2295
+ var selection = editor$1.selection;
2296
+ if (selection == null) {
2297
+ return true;
2298
+ }
2299
+ if (editor.SlateRange.isExpanded(selection)) {
2300
+ return true;
2301
+ } // 选区非折叠,禁用
2302
+ // 未匹配到 formula node 则禁用
2303
+ var formulaElem = this.getSelectedElem(editor$1);
2304
+ if (formulaElem == null) {
2305
+ return true;
2306
+ }
2307
+ return false;
2308
+ };
2309
+ // modal 定位
2310
+ EditFormulaMenu.prototype.getModalPositionNode = function (editor) {
2311
+ return this.getSelectedElem(editor);
2312
+ };
2313
+ EditFormulaMenu.prototype.getModalContentElem = function (editor$1) {
2314
+ var _this = this;
2315
+ var _a = this, textareaId = _a.textareaId, buttonId = _a.buttonId;
2316
+ var _b = __read(editor.genModalTextareaElems(editor.t('formula.formula'), textareaId, editor.t('formula.placeholder')), 2), textareaContainerElem = _b[0], textareaElem = _b[1];
2317
+ var $textarea = $(textareaElem);
2318
+ var _c = __read(editor.genModalButtonElems(buttonId, editor.t('formula.ok')), 1), buttonContainerElem = _c[0];
2319
+ if (this.$content == null) {
2320
+ // 第一次渲染
2321
+ var $content_1 = $('<div></div>');
2322
+ // 绑定事件(第一次渲染时绑定,不要重复绑定)
2323
+ $content_1.on('click', "#".concat(buttonId), function (e) {
2324
+ e.preventDefault();
2325
+ var value = $content_1.find("#".concat(textareaId)).val().trim();
2326
+ _this.updateFormula(editor$1, value);
2327
+ editor$1.hidePanelOrModal(); // 隐藏 modal
2328
+ });
2329
+ // 记录属性,重要
2330
+ this.$content = $content_1;
2331
+ }
2332
+ var $content = this.$content;
2333
+ $content.html(''); // 先清空内容
2334
+ // append textarea and button
2335
+ $content.append(textareaContainerElem);
2336
+ $content.append(buttonContainerElem);
2337
+ // 设置 input val
2338
+ var value = this.getValue(editor$1);
2339
+ $textarea.val(value);
2340
+ // focus 一个 input(异步,此时 DOM 尚未渲染)
2341
+ setTimeout(function () {
2342
+ $textarea.focus();
2343
+ });
2344
+ return $content[0];
2345
+ };
2346
+ EditFormulaMenu.prototype.updateFormula = function (editor$1, value) {
2347
+ if (!value) {
2348
+ return;
2349
+ }
2350
+ // 还原选区
2351
+ editor$1.restoreSelection();
2352
+ if (this.isDisabled(editor$1)) {
2353
+ return;
2354
+ }
2355
+ var selectedElem = this.getSelectedElem(editor$1);
2356
+ if (selectedElem == null) {
2357
+ return;
2358
+ }
2359
+ var path = editor.DomEditor.findPath(editor$1, selectedElem);
2360
+ var props = { value: value };
2361
+ editor.SlateTransforms.setNodes(editor$1, props, { at: path });
2362
+ };
2363
+ return EditFormulaMenu;
2364
+ }());
2365
+
2366
+ /**
2367
+ * @description insert formula menu
2368
+ * @author wangfupeng
2369
+ */
2370
+ /**
2371
+ * 生成唯一的 DOM ID
2372
+ */
2373
+ function genDomID() {
2374
+ return genRandomStr('w-e-insert-formula');
2375
+ }
2376
+ var InsertFormulaMenu = /** @class */ (function () {
2377
+ function InsertFormulaMenu() {
2378
+ this.title = editor.t('formula.insert');
2379
+ this.iconSvg = SIGMA_SVG;
2380
+ this.tag = 'button';
2381
+ this.showModal = true; // 点击 button 时显示 modal
2382
+ this.modalWidth = 300;
2383
+ this.$content = null;
2384
+ this.textareaId = genDomID();
2385
+ this.buttonId = genDomID();
2386
+ }
2387
+ InsertFormulaMenu.prototype.getValue = function (_editor) {
2388
+ // 插入菜单,不需要 value
2389
+ return '';
2390
+ };
2391
+ InsertFormulaMenu.prototype.isActive = function (_editor) {
2392
+ // 任何时候,都不用激活 menu
2393
+ return false;
2394
+ };
2395
+ InsertFormulaMenu.prototype.exec = function (_editor, _value) {
2396
+ // 点击菜单时,弹出 modal 之前,不需要执行其他代码
2397
+ // 此处空着即可
2398
+ };
2399
+ InsertFormulaMenu.prototype.isDisabled = function (editor$1) {
2400
+ var selection = editor$1.selection;
2401
+ if (selection == null) {
2402
+ return true;
2403
+ }
2404
+ if (editor.SlateRange.isExpanded(selection)) {
2405
+ return true;
2406
+ } // 选区非折叠,禁用
2407
+ var selectedElems = editor.DomEditor.getSelectedElems(editor$1);
2408
+ var hasVoidElem = selectedElems.some(function (elem) { return editor$1.isVoid(elem); });
2409
+ if (hasVoidElem) {
2410
+ return true;
2411
+ } // 选中了 void 元素,禁用
2412
+ var hasPreElem = selectedElems.some(function (elem) { return editor.DomEditor.getNodeType(elem) === 'pre'; });
2413
+ if (hasPreElem) {
2414
+ return true;
2415
+ } // 选中了 pre 原则,禁用
2416
+ return false;
2417
+ };
2418
+ InsertFormulaMenu.prototype.getModalPositionNode = function (_editor) {
2419
+ return null; // modal 依据选区定位
2420
+ };
2421
+ InsertFormulaMenu.prototype.getModalContentElem = function (editor$1) {
2422
+ var _this = this;
2423
+ var _a = this, textareaId = _a.textareaId, buttonId = _a.buttonId;
2424
+ var _b = __read(editor.genModalTextareaElems(editor.t('formula.formula'), textareaId, editor.t('formula.placeholder')), 2), textareaContainerElem = _b[0], textareaElem = _b[1];
2425
+ var $textarea = $(textareaElem);
2426
+ var _c = __read(editor.genModalButtonElems(buttonId, editor.t('formula.ok')), 1), buttonContainerElem = _c[0];
2427
+ if (this.$content == null) {
2428
+ // 第一次渲染
2429
+ var $content_1 = $('<div></div>');
2430
+ // 绑定事件(第一次渲染时绑定,不要重复绑定)
2431
+ $content_1.on('click', "#".concat(buttonId), function (e) {
2432
+ e.preventDefault();
2433
+ var value = $content_1.find("#".concat(textareaId)).val().trim();
2434
+ _this.insertFormula(editor$1, value);
2435
+ editor$1.hidePanelOrModal(); // 隐藏 modal
2436
+ });
2437
+ // 记录属性,重要
2438
+ this.$content = $content_1;
2439
+ }
2440
+ var $content = this.$content;
2441
+ $content.html(''); // 先清空内容
2442
+ // append textarea and button
2443
+ $content.append(textareaContainerElem);
2444
+ $content.append(buttonContainerElem);
2445
+ // 设置 input val
2446
+ $textarea.val('');
2447
+ // focus 一个 input(异步,此时 DOM 尚未渲染)
2448
+ setTimeout(function () {
2449
+ $textarea.focus();
2450
+ });
2451
+ return $content[0];
2452
+ };
2453
+ InsertFormulaMenu.prototype.insertFormula = function (editor, value) {
2454
+ if (!value) {
2455
+ return;
2456
+ }
2457
+ // 还原选区
2458
+ editor.restoreSelection();
2459
+ if (this.isDisabled(editor)) {
2460
+ return;
2461
+ }
2462
+ var formulaElem = {
2463
+ type: 'formula',
2464
+ value: value,
2465
+ children: [{ text: '' }], // void node 需要有一个空 text
2466
+ };
2467
+ editor.insertNode(formulaElem);
2468
+ };
2469
+ return InsertFormulaMenu;
2470
+ }());
2471
+
2472
+ /**
2473
+ * @description formula menu entry
2474
+ * @author wangfupeng
2475
+ */
2476
+ var insertFormulaMenuConf = {
2477
+ key: 'insertFormula', // menu key ,唯一。注册之后,可配置到工具栏
2478
+ factory: function () {
2479
+ return new InsertFormulaMenu();
2480
+ },
2481
+ };
2482
+ var editFormulaMenuConf = {
2483
+ key: 'editFormula', // menu key ,唯一。注册之后,可配置到工具栏
2484
+ factory: function () {
2485
+ return new EditFormulaMenu();
2486
+ },
2487
+ };
2488
+
2489
+ /**
2490
+ * @description parse elem html
2491
+ * @author wangfupeng
2492
+ */
2493
+ function parseHtml(elem, _children, _editor) {
2494
+ var value = elem.getAttribute('data-value') || '';
2495
+ return {
2496
+ type: 'formula',
2497
+ value: value,
2498
+ children: [{ text: '' }], // void node 必须有一个空白 text
2499
+ };
2500
+ }
2501
+ var parseHtmlConf = {
2502
+ selector: 'span[data-w-e-type="formula"]',
2503
+ parseElemHtml: parseHtml,
2504
+ };
2505
+
2506
+ /**
2507
+ * @description formula plugin
2508
+ * @author wangfupeng
2509
+ */
2510
+ function withFormula(editor$1) {
2511
+ var isInline = editor$1.isInline, isVoid = editor$1.isVoid;
2512
+ var newEditor = editor$1;
2513
+ // 重写 isInline
2514
+ newEditor.isInline = function (elem) {
2515
+ var type = editor.DomEditor.getNodeType(elem);
2516
+ if (type === 'formula') {
2517
+ return true;
2518
+ }
2519
+ return isInline(elem);
2520
+ };
2521
+ // 重写 isVoid
2522
+ newEditor.isVoid = function (elem) {
2523
+ var type = editor.DomEditor.getNodeType(elem);
2524
+ if (type === 'formula') {
2525
+ return true;
2526
+ }
2527
+ return isVoid(elem);
2528
+ };
2529
+ return newEditor;
2530
+ }
2531
+
2532
+ /**
2533
+ * @description render elem
2534
+ * @author wangfupeng
2535
+ */
2536
+ function renderFormula(elem, children, editor$1) {
2537
+ // 当前节点是否选中
2538
+ var selected = editor.DomEditor.isNodeSelected(editor$1, elem);
2539
+ // 构建 formula vnode
2540
+ var _a = elem.value, value = _a === void 0 ? '' : _a;
2541
+ var formulaVnode = snabbdom.h('w-e-formula-card', {
2542
+ dataset: { value: value },
2543
+ }, null);
2544
+ // 构建容器 vnode
2545
+ var containerVnode = snabbdom.h('div', {
2546
+ props: {
2547
+ contentEditable: false, // 不可编辑
2548
+ },
2549
+ style: {
2550
+ display: 'inline-block', // inline
2551
+ marginLeft: '3px',
2552
+ marginRight: '3px',
2553
+ border: selected // 选中/不选中,样式不一样
2554
+ ? '2px solid var(--w-e-textarea-selected-border-color)' // wangEditor 提供了 css var https://www.wangeditor.com/v5/theme.html
2555
+ : '2px solid transparent',
2556
+ borderRadius: '3px',
2557
+ padding: '3px 3px',
2558
+ },
2559
+ }, [formulaVnode]);
2560
+ return containerVnode;
2561
+ }
2562
+ var conf = {
2563
+ type: 'formula', // 节点 type ,重要!!!
2564
+ renderElem: renderFormula,
2565
+ };
2566
+
2567
+ /**
2568
+ * @description formula module entry
2569
+ * @author wangfupeng
2570
+ */
2571
+ var module = {
2572
+ editorPlugin: withFormula,
2573
+ renderElems: [conf],
2574
+ elemsToHtml: [conf$1],
2575
+ parseElemsHtml: [parseHtmlConf],
2576
+ menus: [insertFormulaMenuConf, editFormulaMenuConf],
2577
+ };
2578
+
2579
+ /**
2580
+ * @description src entry
2581
+ * @author wangfupeng
2582
+ */
2583
+ // 全局注册自定义组件,用于渲染公式
2584
+
2585
+ return module;
2586
+
2587
+ }));