UNPKG

@morehook/core

Version:

关于vue的一些hooks,兼容vue2+vue3

1 lines 73.8 kB
var VueDemi=function(L,H,A){if(L.install)return L;if(!H)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),L;if(H.version.slice(0,4)==="2.7."){let V=function(it,ut){var rt,_t={},mt={config:H.config,use:H.use.bind(H),mixin:H.mixin.bind(H),component:H.component.bind(H),provide:function(q,st){return _t[q]=st,this},directive:function(q,st){return st?(H.directive(q,st),mt):H.directive(q)},mount:function(q,st){return rt||(rt=new H(Object.assign({propsData:ut},it,{provide:Object.assign(_t,it.provide)})),rt.$mount(q,st),rt)},unmount:function(){rt&&(rt.$destroy(),rt=void 0)}};return mt};var Pt=V;for(var lt in H)L[lt]=H[lt];L.isVue2=!0,L.isVue3=!1,L.install=function(){},L.Vue=H,L.Vue2=H,L.version=H.version,L.warn=H.util.warn,L.createApp=V}else if(H.version.slice(0,2)==="2.")if(A){for(var lt in A)L[lt]=A[lt];L.isVue2=!0,L.isVue3=!1,L.install=function(){},L.Vue=H,L.Vue2=H,L.version=H.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(H.version.slice(0,2)==="3."){for(var lt in H)L[lt]=H[lt];L.isVue2=!1,L.isVue3=!0,L.install=function(){},L.Vue=H,L.Vue2=void 0,L.version=H.version,L.set=function(V,it,ut){return Array.isArray(V)?(V.length=Math.max(V.length,it),V.splice(it,1,ut),ut):(V[it]=ut,ut)},L.del=function(V,it){if(Array.isArray(V)){V.splice(it,1);return}delete V[it]}}else console.error("[vue-demi] Vue version "+H.version+" is unsupported.");return L}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(L,H,A){"use strict";const lt=!1;function Pt(n){n=n||lt;const[w,[c]]=H.useToggle(n,!n);return[w,{toggle:c,setTrue:()=>c(!0),setFalse:()=>c(!1)}]}/*! js-cookie v3.0.1 | MIT */function V(n){for(var w=1;w<arguments.length;w++){var c=arguments[w];for(var m in c)n[m]=c[m]}return n}var it={read:function(n){return n[0]==='"'&&(n=n.slice(1,-1)),n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(n){return encodeURIComponent(n).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function ut(n,w){function c(g,E,C){if(typeof document!="undefined"){C=V({},w,C),typeof C.expires=="number"&&(C.expires=new Date(Date.now()+C.expires*864e5)),C.expires&&(C.expires=C.expires.toUTCString()),g=encodeURIComponent(g).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var _="";for(var b in C)!C[b]||(_+="; "+b,C[b]!==!0&&(_+="="+C[b].split(";")[0]));return document.cookie=g+"="+n.write(E,g)+_}}function m(g){if(!(typeof document=="undefined"||arguments.length&&!g)){for(var E=document.cookie?document.cookie.split("; "):[],C={},_=0;_<E.length;_++){var b=E[_].split("="),R=b.slice(1).join("=");try{var I=decodeURIComponent(b[0]);if(C[I]=n.read(R,I),g===I)break}catch{}}return g?C[g]:C}}return Object.create({set:c,get:m,remove:function(g,E){c(g,"",V({},E,{expires:-1}))},withAttributes:function(g){return ut(this.converter,V({},this.attributes,g))},withConverter:function(g){return ut(V({},this.converter,g),this.attributes)}},{attributes:{value:Object.freeze(w)},converter:{value:Object.freeze(n)}})}var rt=ut(it,{path:"/"});const _t={watch:!1,defaultValue:void 0};function mt(n,w){const{watch:c,defaultValue:m}={..._t,...w},g=A.ref(rt.get(n)||m),E=C=>{rt.set(n,C,{...w}),g.value=C};return c&&A.watch(g,C=>{if(C==null){rt.remove(n);return}E(C)},{deep:!0}),g}const q=typeof window!="undefined",st=q?window:void 0,It={onSuccess:()=>{},onError:()=>{}};function Rt(n,w){const c=A.ref(),{onSuccess:m,onError:g}={...It,...w};c.value=n||"";const E=C=>{if(!q){g("\u8BF7\u5728window\u73AF\u5883\u4E0B\u4F7F\u7528");return}C=typeof C=="object"?JSON.stringify(C):String(C),navigator.clipboard.writeText(C).then(()=>{m(C)},_=>{const b=`\u53D1\u751F\u9519\u8BEF: ${_},\u5FC5\u987B\u8981\u4FDD\u6301\u7F51\u9875\u7126\u70B9\u624D\u80FD\u590D\u5236`;console.log(b),g(b)})};return E(n),A.watch(c,C=>{E(C)}),c}var gt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Tt={exports:{}};(function(n,w){(function(c,m){n.exports=m()})(gt,function(){var c=1e3,m=6e4,g=36e5,E="millisecond",C="second",_="minute",b="hour",R="day",I="week",$="month",a="quarter",u="year",d="date",v="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(i){var r=["th","st","nd","rd"],h=i%100;return"["+i+(r[(h-20)%10]||r[h]||r[0])+"]"}},x=function(i,r,h){var p=String(i);return!p||p.length>=r?i:""+Array(r+1-p.length).join(h)+i},M={s:x,z:function(i){var r=-i.utcOffset(),h=Math.abs(r),p=Math.floor(h/60),l=h%60;return(r<=0?"+":"-")+x(p,2,"0")+":"+x(l,2,"0")},m:function i(r,h){if(r.date()<h.date())return-i(h,r);var p=12*(h.year()-r.year())+(h.month()-r.month()),l=r.clone().add(p,$),e=h-l<0,k=r.clone().add(p+(e?-1:1),$);return+(-(p+(h-l)/(e?l-k:k-l))||0)},a:function(i){return i<0?Math.ceil(i)||0:Math.floor(i)},p:function(i){return{M:$,y:u,w:I,d:R,D:d,h:b,m:_,s:C,ms:E,Q:a}[i]||String(i||"").toLowerCase().replace(/s$/,"")},u:function(i){return i===void 0}},P="en",N={};N[P]=y;var B=function(i){return i instanceof s},Z=function i(r,h,p){var l;if(!r)return P;if(typeof r=="string"){var e=r.toLowerCase();N[e]&&(l=e),h&&(N[e]=h,l=e);var k=r.split("-");if(!l&&k.length>1)return i(k[0])}else{var T=r.name;N[T]=r,l=T}return!p&&l&&(P=l),l||!p&&P},U=function(i,r){if(B(i))return i.clone();var h=typeof r=="object"?r:{};return h.date=i,h.args=arguments,new s(h)},t=M;t.l=Z,t.i=B,t.w=function(i,r){return U(i,{locale:r.$L,utc:r.$u,x:r.$x,$offset:r.$offset})};var s=function(){function i(h){this.$L=Z(h.locale,null,!0),this.parse(h)}var r=i.prototype;return r.parse=function(h){this.$d=function(p){var l=p.date,e=p.utc;if(l===null)return new Date(NaN);if(t.u(l))return new Date;if(l instanceof Date)return new Date(l);if(typeof l=="string"&&!/Z$/i.test(l)){var k=l.match(f);if(k){var T=k[2]-1||0,D=(k[7]||"0").substring(0,3);return e?new Date(Date.UTC(k[1],T,k[3]||1,k[4]||0,k[5]||0,k[6]||0,D)):new Date(k[1],T,k[3]||1,k[4]||0,k[5]||0,k[6]||0,D)}}return new Date(l)}(h),this.$x=h.x||{},this.init()},r.init=function(){var h=this.$d;this.$y=h.getFullYear(),this.$M=h.getMonth(),this.$D=h.getDate(),this.$W=h.getDay(),this.$H=h.getHours(),this.$m=h.getMinutes(),this.$s=h.getSeconds(),this.$ms=h.getMilliseconds()},r.$utils=function(){return t},r.isValid=function(){return this.$d.toString()!==v},r.isSame=function(h,p){var l=U(h);return this.startOf(p)<=l&&l<=this.endOf(p)},r.isAfter=function(h,p){return U(h)<this.startOf(p)},r.isBefore=function(h,p){return this.endOf(p)<U(h)},r.$g=function(h,p,l){return t.u(h)?this[p]:this.set(l,h)},r.unix=function(){return Math.floor(this.valueOf()/1e3)},r.valueOf=function(){return this.$d.getTime()},r.startOf=function(h,p){var l=this,e=!!t.u(p)||p,k=t.p(h),T=function(Y,Q){var et=t.w(l.$u?Date.UTC(l.$y,Q,Y):new Date(l.$y,Q,Y),l);return e?et:et.endOf(R)},D=function(Y,Q){return t.w(l.toDate()[Y].apply(l.toDate("s"),(e?[0,0,0,0]:[23,59,59,999]).slice(Q)),l)},O=this.$W,F=this.$M,j=this.$D,J="set"+(this.$u?"UTC":"");switch(k){case u:return e?T(1,0):T(31,11);case $:return e?T(1,F):T(0,F+1);case I:var K=this.$locale().weekStart||0,G=(O<K?O+7:O)-K;return T(e?j-G:j+(6-G),F);case R:case d:return D(J+"Hours",0);case b:return D(J+"Minutes",1);case _:return D(J+"Seconds",2);case C:return D(J+"Milliseconds",3);default:return this.clone()}},r.endOf=function(h){return this.startOf(h,!1)},r.$set=function(h,p){var l,e=t.p(h),k="set"+(this.$u?"UTC":""),T=(l={},l[R]=k+"Date",l[d]=k+"Date",l[$]=k+"Month",l[u]=k+"FullYear",l[b]=k+"Hours",l[_]=k+"Minutes",l[C]=k+"Seconds",l[E]=k+"Milliseconds",l)[e],D=e===R?this.$D+(p-this.$W):p;if(e===$||e===u){var O=this.clone().set(d,1);O.$d[T](D),O.init(),this.$d=O.set(d,Math.min(this.$D,O.daysInMonth())).$d}else T&&this.$d[T](D);return this.init(),this},r.set=function(h,p){return this.clone().$set(h,p)},r.get=function(h){return this[t.p(h)]()},r.add=function(h,p){var l,e=this;h=Number(h);var k=t.p(p),T=function(F){var j=U(e);return t.w(j.date(j.date()+Math.round(F*h)),e)};if(k===$)return this.set($,this.$M+h);if(k===u)return this.set(u,this.$y+h);if(k===R)return T(1);if(k===I)return T(7);var D=(l={},l[_]=m,l[b]=g,l[C]=c,l)[k]||1,O=this.$d.getTime()+h*D;return t.w(O,this)},r.subtract=function(h,p){return this.add(-1*h,p)},r.format=function(h){var p=this,l=this.$locale();if(!this.isValid())return l.invalidDate||v;var e=h||"YYYY-MM-DDTHH:mm:ssZ",k=t.z(this),T=this.$H,D=this.$m,O=this.$M,F=l.weekdays,j=l.months,J=function(Q,et,ht,z){return Q&&(Q[et]||Q(p,e))||ht[et].slice(0,z)},K=function(Q){return t.s(T%12||12,Q,"0")},G=l.meridiem||function(Q,et,ht){var z=Q<12?"AM":"PM";return ht?z.toLowerCase():z},Y={YY:String(this.$y).slice(-2),YYYY:this.$y,M:O+1,MM:t.s(O+1,2,"0"),MMM:J(l.monthsShort,O,j,3),MMMM:J(j,O),D:this.$D,DD:t.s(this.$D,2,"0"),d:String(this.$W),dd:J(l.weekdaysMin,this.$W,F,2),ddd:J(l.weekdaysShort,this.$W,F,3),dddd:F[this.$W],H:String(T),HH:t.s(T,2,"0"),h:K(1),hh:K(2),a:G(T,D,!0),A:G(T,D,!1),m:String(D),mm:t.s(D,2,"0"),s:String(this.$s),ss:t.s(this.$s,2,"0"),SSS:t.s(this.$ms,3,"0"),Z:k};return e.replace(S,function(Q,et){return et||Y[Q]||k.replace(":","")})},r.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},r.diff=function(h,p,l){var e,k=t.p(p),T=U(h),D=(T.utcOffset()-this.utcOffset())*m,O=this-T,F=t.m(this,T);return F=(e={},e[u]=F/12,e[$]=F,e[a]=F/3,e[I]=(O-D)/6048e5,e[R]=(O-D)/864e5,e[b]=O/g,e[_]=O/m,e[C]=O/c,e)[k]||O,l?F:t.a(F)},r.daysInMonth=function(){return this.endOf($).$D},r.$locale=function(){return N[this.$L]},r.locale=function(h,p){if(!h)return this.$L;var l=this.clone(),e=Z(h,p,!0);return e&&(l.$L=e),l},r.clone=function(){return t.w(this.$d,this)},r.toDate=function(){return new Date(this.valueOf())},r.toJSON=function(){return this.isValid()?this.toISOString():null},r.toISOString=function(){return this.$d.toISOString()},r.toString=function(){return this.$d.toUTCString()},i}(),o=s.prototype;return U.prototype=o,[["$ms",E],["$s",C],["$m",_],["$H",b],["$W",R],["$M",$],["$y",u],["$D",d]].forEach(function(i){o[i[1]]=function(r){return this.$g(r,i[0],i[1])}}),U.extend=function(i,r){return i.$i||(i(r,s,U),i.$i=!0),U},U.locale=Z,U.isDayjs=B,U.unix=function(i){return U(1e3*i)},U.en=N[P],U.Ls=N,U.p={},U})})(Tt);var vt=Tt.exports;const Nt={format:"YYYY-MM-DD HH:mm:ss",method:"format"};function Dt(n,w){const c=A.ref(),{format:m,method:g,methodParam:E}={...Nt,...n},C=(b=+new Date)=>{switch(g){case"format":c.value=vt(b).format(m);break;case"timestamp":c.value=+vt(b);break;case void 0:break;default:{let R=vt(b);R=R[g](E),vt.isDayjs(R)&&(R=R.format(m)),c.value=R}}};return C(w||+new Date),{data:A.readonly(c),refresh:C}}const Bt=1e3;function $t(n,w,c=!1){w=w||Bt;const m=A.ref(n.value),{run:g}=H.useDebounceFn(()=>m.value=n.value,w,c);return A.watch(n,()=>g(),{deep:!0}),m}const Ht=function(n,w,c=!1){let m=null;return(...g)=>{c&&(n.call(this,...g),c=!1),m&&clearTimeout(m),m=setTimeout(()=>{n.call(this,...g),c=!0},w)}},Ft=1e3;function qt(n,w,c=!1){return{run:Ht(n,typeof w=="number"?w:Ft,c)}}function Ut(){if(!q)return A.ref(!1);const n=A.ref(document.hidden),w=()=>{n.value=document.hidden};return document.addEventListener("visibilitychange",w),n}const Zt=(n=5)=>Number(Math.random().toString().slice(3,8)+Date.now()).toString(36).slice(0,n);function jt(n){let w=0;const c=A.ref([]),m="+"+Zt(8),g=f=>{f=f===void 0?c.value.length:f,c.value.splice(f,0,String(w++)+m)};return n.value.forEach(()=>g()),{list:n,resetList:f=>{c.value=[],A.isRef(f)?(f.value.forEach(()=>g()),n=f):(f.forEach(()=>g()),n.value=f)},insert:(f,...S)=>{if(S.length===0)return;let y=[];S.length===1&&Array.isArray(S[0])?y=S[0]:y=S,y.forEach((x,M)=>g(f+M)),n.value.splice(f,0,...y)},replace:(f,S)=>{n.value.splice(f,1,S)},remove:f=>{c.value.splice(f,1),n.value.splice(f,1)},move:(f,S)=>{f!==S&&([n.value[f],n.value[S]]=[n.value[S],n.value[f]],[c.value[f],c.value[S]]=[c.value[S],c.value[f]])},push:f=>{n.value.push(f),g()},pop:()=>{n.value.pop(),c.value.pop()},unshift:f=>{n.value.unshift(f),g(0)},shift:()=>{n.value.shift(),c.value.shift()},getKey:f=>c.value[f],getIndex:f=>c.value.indexOf(f)}}function Gt(n,w,c={}){let m=A.isRef(n)?n.value:n;const g=A.ref(null),{manual:E=!1,async:C,crossOrigin:_,referrerPolicy:b,noModule:R,defer:I,media:$="all",target:a=st?document.body:void 0}=c,u=()=>new Promise(M=>{if(!q){M(void 0);return}document.querySelector(`script[src="${m}"]`)||(y=document.createElement("script"),y.src=m,y.type="text/javascript",C&&(y.async=C),I&&(y.defer=I),R&&(y.noModule=R),_&&(y.crossOrigin=_),b&&(y.referrerPolicy=b),y=x.appendChild(y),M(y))}),d=()=>new Promise(M=>{if(!q){M(void 0);return}document.querySelector(`link[href="${m}"]`)||(y=document.createElement("link"),y.href=m,y.rel="stylesheet",y.type="text/css",y.media=$,y=x.appendChild(y),M(y))}),v=()=>new Promise(M=>{if(!q){M(void 0);return}document.querySelector(`img[src="${m}"]`)||(y=document.createElement("img"),y.src=m,a&&(x=A.isRef(a)?a.value:a,x.appendChild(y)),M(y))}),f=()=>new Promise((M,P)=>{if(!q){M(void 0);return}let N=Promise.resolve();/\.js$/.test(m)&&(N=u()),/\.css$/.test(m)&&(N=d()),/\.(gif|jpg|jpeg|png|svg|GIF|JPG|PNG|)$/.test(m)&&(N=v()),N.then(()=>{g.value=y,y.addEventListener("error",B=>P(B)),y.addEventListener("abort",B=>P(B)),y.addEventListener("load",()=>{w&&w(y)}),M(y)})}),S=()=>{g.value&&(x.removeChild(g.value),g.value=null)};if(!q)return{resources:g,load:f,unload:S};let y=document.createElement("script"),x=document.head;return A.isRef(n)&&A.watch(n,M=>{m=M,E||f()}),E||f(),{resources:g,load:f,unload:S}}const Qt={onFull:function(){},onExitFull:function(){}};function Wt(n,w){const c={setFull:()=>{!q||g.value||(_.requestFullscreen(),g.value=!0)},exitFull:()=>{!q||!g.value||(document.exitFullscreen(),g.value=!1)},toggle:()=>{!q||(g.value?c.exitFull():c.setFull())}};if(!q)return[A.ref(!1),c];const m=!!document.fullscreenElement,g=A.ref(m),{onFull:E,onExitFull:C}={...Qt,...w};let _=document.body;const b=()=>typeof n=="function"?n():A.isRef(n)?n.value:n,R=()=>{g.value=!!document.fullscreenElement,g.value?E():C()};return A.onMounted(()=>{_=b()||_,_.addEventListener("fullscreenchange",R)}),A.onUnmounted(()=>{_.removeEventListener("fullscreenchange",R)}),[g,c]}const bt={boolean:{read:n=>n!=null?n==="true":null,write:n=>String(n)},object:{read:n=>n?JSON.parse(n):null,write:n=>JSON.stringify(n)},number:{read:n=>n!=null?Number.parseFloat(n):null,write:n=>String(n)},any:{read:n=>n!=null&&n!=="null"?n:null,write:n=>String(n)},string:{read:n=>n??null,write:n=>String(n)}},kt=n=>n===null?"any":typeof n=="boolean"?"boolean":typeof n=="string"?"string":typeof n=="object"||Array.isArray(n)?"object":Number.isNaN(n)?"any":"number",Yt={watch:!0};function zt(n,w,c){const m=A.ref();if(!q)return m;const g=localStorage,{watch:E}={...Yt,...c};try{w!==void 0?m.value=A.isRef(w)?w.value:w:m.value=JSON.parse(g.getItem(n)||"{}")}catch(b){console.log(b,"useLocalStorage \u521D\u59CB\u5316\u5931\u8D25")}const C=bt[kt(m.value)],_=()=>g.setItem(n,C.write(m.value));return E&&A.watch(m,b=>{if(b==null){g.removeItem(n);return}_()},{deep:!0}),_(),m}function Xt(n){const w=A.ref(!1);return async(...c)=>{if(!w.value){w.value=!0;try{const m=await n(...c);return w.value=!1,m}catch(m){throw w.value=!1,m}}}}function Jt(n){const w=n?new Map(n):new Map,c=A.ref(w),m={set:(g,E)=>{c.value.set(g,E)},get:g=>c.value.get(g),remove:g=>{c.value.delete(g)},has:g=>c.value.has(g),clear:()=>c.value.clear(),setAll:g=>{c.value=new Map(g)},reset:()=>c.value=w};return[c,A.markRaw(m)]}function Kt(n){if(!q)return A.ref(!1);const w=window.matchMedia(n),c=A.ref(w.matches),m=g=>c.value=g.matches;return w.addEventListener("change",m),A.onUnmounted(()=>{w.removeEventListener("change",m)}),c}function Vt(n){if(!q)return A.ref("");const w=A.ref(),c=[],m=Object.entries(n);return m.forEach((g,E)=>{const C=g[0],_=g[1],b=window.matchMedia(_);b.matches&&(w.value=C);const R=I=>{I.matches?w.value=C:E!==0&&(w.value=m[E-1][0])};c.push({mql:b,handleChange:R}),b.addEventListener("change",R)}),A.onUnmounted(()=>{c.forEach(g=>{g.mql.removeEventListener("change",g.handleChange)})}),w}const te={type:"click",target:st?st.document.body:void 0,onSuccess:()=>{}};function ee(n){const{type:w,target:c,onSuccess:m}={...te,...n},g=A.ref(-1),E=A.ref(-1);if(!q||!c)return{clickX:g,clickY:E};let C=c;const _=b=>{g.value=b.pageX,E.value=b.pageY,m()};return A.onMounted(()=>{C=A.isRef(c)?c.value:c,w==="click"?C.addEventListener("click",_):C.addEventListener("mousemove",_)}),A.onBeforeUnmount(()=>{C=A.isRef(c)?c.value:c,C.removeEventListener("click",_),C.removeEventListener("mousemove",_)}),{clickX:g,clickY:E}}const wt=()=>{const n=navigator;return typeof n!="object"?null:n.connection||n.mozConnection||n.webkitConnection},Mt=()=>{const n=wt();return{rtt:n.rtt,type:n.type,saveData:n.saveData,downlink:n.downlink,downlinkMax:n.downlinkMax,effectiveType:n.effectiveType}};function ne(){if(!q)return A.reactive({});const n=A.reactive({online:navigator.onLine,since:Date.now(),...Mt()}),w=()=>{n.online=!0,n.since=Date.now()},c=()=>{n.online=!1,n.since=Date.now()},m=()=>{const g=Mt();Object.keys(g).forEach(E=>{const C=E;n[C]=g[C]})};return A.onMounted(()=>{window.addEventListener("online",w),window.addEventListener("offline",c),wt()?.addEventListener("change",m)}),A.onUnmounted(()=>{window.removeEventListener("online",w),window.removeEventListener("offline",c),wt()?.removeEventListener("change",m)}),n}var yt={exports:{}};(function(n,w){(function(){function c(a,u){var d,v=Object.keys(u);for(d=0;d<v.length;d++)a=a.replace(new RegExp("\\{"+v[d]+"\\}","gi"),u[v[d]]);return a}function m(a){var u,d,v;if(!a)throw new Error("cannot create a random attribute name for an undefined object");u="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",d="";do for(d="",v=0;v<12;v++)d+=u[Math.floor(Math.random()*u.length)];while(a[d]);return d}function g(a){var u={left:"start",right:"end",center:"middle",start:"start",end:"end"};return u[a]||u.start}function E(a){var u={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return u[a]||u.alphabetic}var C,_,b,R,I;I=function(a,u){var d,v,f,S={};for(a=a.split(","),u=u||10,d=0;d<a.length;d+=2)v="&"+a[d+1]+";",f=parseInt(a[d],u),S[v]="&#"+f+";";return S["\\xa0"]="&#160;",S}("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),C={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"},lineDash:{svgAttr:"stroke-dasharray",canvas:[],svg:null,apply:"stroke"}},b=function(a,u){this.__root=a,this.__ctx=u},b.prototype.addColorStop=function(a,u){var d,v,f=this.__ctx.__createElement("stop");f.setAttribute("offset",a),u.indexOf("rgba")!==-1?(d=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi,v=d.exec(u),f.setAttribute("stop-color",c("rgb({r},{g},{b})",{r:v[1],g:v[2],b:v[3]})),f.setAttribute("stop-opacity",v[4])):f.setAttribute("stop-color",u),this.__root.appendChild(f)},R=function(a,u){this.__root=a,this.__ctx=u},_=function(a){var u,d={width:500,height:500,enableMirroring:!1};if(arguments.length>1?(u=d,u.width=arguments[0],u.height=arguments[1]):u=a||d,!(this instanceof _))return new _(u);this.width=u.width||d.width,this.height=u.height||d.height,this.enableMirroring=u.enableMirroring!==void 0?u.enableMirroring:d.enableMirroring,this.canvas=this,this.__document=u.document||document,u.ctx?this.__ctx=u.ctx:(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d")),this.__setDefaultStyles(),this.__stack=[this.__getStyleState()],this.__groupStack=[],this.__root=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__root.setAttribute("version",1.1),this.__root.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__root.setAttribute("width",this.width),this.__root.setAttribute("height",this.height),this.__ids={},this.__defs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__root.appendChild(this.__defs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__root.appendChild(this.__currentElement)},_.prototype.__createElement=function(a,u,d){u===void 0&&(u={});var v,f,S=this.__document.createElementNS("http://www.w3.org/2000/svg",a),y=Object.keys(u);for(d&&(S.setAttribute("fill","none"),S.setAttribute("stroke","none")),v=0;v<y.length;v++)f=y[v],S.setAttribute(f,u[f]);return S},_.prototype.__setDefaultStyles=function(){var a,u,d=Object.keys(C);for(a=0;a<d.length;a++)u=d[a],this[u]=C[u].canvas},_.prototype.__applyStyleState=function(a){var u,d,v=Object.keys(a);for(u=0;u<v.length;u++)d=v[u],this[d]=a[d]},_.prototype.__getStyleState=function(){var a,u,d={},v=Object.keys(C);for(a=0;a<v.length;a++)u=v[a],d[u]=this[u];return d},_.prototype.__applyStyleToCurrentElement=function(a){var u=this.__currentElement,d=this.__currentElementsToStyle;d&&(u.setAttribute(a,""),u=d.element,d.children.forEach(function(U){U.setAttribute(a,"")}));var v,f,S,y,x,M,P=Object.keys(C);for(v=0;v<P.length;v++)if(f=C[P[v]],S=this[P[v]],f.apply){if(S instanceof R){if(S.__ctx)for(;S.__ctx.__defs.childNodes.length;)y=S.__ctx.__defs.childNodes[0].getAttribute("id"),this.__ids[y]=y,this.__defs.appendChild(S.__ctx.__defs.childNodes[0]);u.setAttribute(f.apply,c("url(#{id})",{id:S.__root.getAttribute("id")}))}else if(S instanceof b)u.setAttribute(f.apply,c("url(#{id})",{id:S.__root.getAttribute("id")}));else if(f.apply.indexOf(a)!==-1&&f.svg!==S)if(f.svgAttr!=="stroke"&&f.svgAttr!=="fill"||S.indexOf("rgba")===-1){var N=f.svgAttr;if(P[v]==="globalAlpha"&&(N=a+"-"+f.svgAttr,u.getAttribute(N)))continue;u.setAttribute(N,S)}else{x=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi,M=x.exec(S),u.setAttribute(f.svgAttr,c("rgb({r},{g},{b})",{r:M[1],g:M[2],b:M[3]}));var B=M[4],Z=this.globalAlpha;Z!=null&&(B*=Z),u.setAttribute(f.svgAttr+"-opacity",B)}}},_.prototype.__closestGroupOrSvg=function(a){return a=a||this.__currentElement,a.nodeName==="g"||a.nodeName==="svg"?a:this.__closestGroupOrSvg(a.parentNode)},_.prototype.getSerializedSvg=function(a){var u,d,v,f,S,y,x=new XMLSerializer().serializeToString(this.__root);if(y=/xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi,y.test(x)&&(x=x.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink')),a)for(u=Object.keys(I),d=0;d<u.length;d++)v=u[d],f=I[v],S=new RegExp(v,"gi"),S.test(x)&&(x=x.replace(S,f));return x},_.prototype.getSvg=function(){return this.__root},_.prototype.save=function(){var a=this.__createElement("g"),u=this.__closestGroupOrSvg();this.__groupStack.push(u),u.appendChild(a),this.__currentElement=a,this.__stack.push(this.__getStyleState())},_.prototype.restore=function(){this.__currentElement=this.__groupStack.pop(),this.__currentElementsToStyle=null,this.__currentElement||(this.__currentElement=this.__root.childNodes[1]);var a=this.__stack.pop();this.__applyStyleState(a)},_.prototype.__addTransform=function(a){var u=this.__closestGroupOrSvg();if(u.childNodes.length>0){this.__currentElement.nodeName==="path"&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:u,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());var d=this.__createElement("g");u.appendChild(d),this.__currentElement=d}var v=this.__currentElement.getAttribute("transform");v?v+=" ":v="",v+=a,this.__currentElement.setAttribute("transform",v)},_.prototype.scale=function(a,u){u===void 0&&(u=a),this.__addTransform(c("scale({x},{y})",{x:a,y:u}))},_.prototype.rotate=function(a){var u=180*a/Math.PI;this.__addTransform(c("rotate({angle},{cx},{cy})",{angle:u,cx:0,cy:0}))},_.prototype.translate=function(a,u){this.__addTransform(c("translate({x},{y})",{x:a,y:u}))},_.prototype.transform=function(a,u,d,v,f,S){this.__addTransform(c("matrix({a},{b},{c},{d},{e},{f})",{a,b:u,c:d,d:v,e:f,f:S}))},_.prototype.beginPath=function(){var a,u;this.__currentDefaultPath="",this.__currentPosition={},a=this.__createElement("path",{},!0),u=this.__closestGroupOrSvg(),u.appendChild(a),this.__currentElement=a},_.prototype.__applyCurrentDefaultPath=function(){var a=this.__currentElement;a.nodeName==="path"?a.setAttribute("d",this.__currentDefaultPath):console.error("Attempted to apply path command to node",a.nodeName)},_.prototype.__addPathCommand=function(a){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=a},_.prototype.moveTo=function(a,u){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.__currentPosition={x:a,y:u},this.__addPathCommand(c("M {x} {y}",{x:a,y:u}))},_.prototype.closePath=function(){this.__currentDefaultPath&&this.__addPathCommand("Z")},_.prototype.lineTo=function(a,u){this.__currentPosition={x:a,y:u},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(c("L {x} {y}",{x:a,y:u})):this.__addPathCommand(c("M {x} {y}",{x:a,y:u}))},_.prototype.bezierCurveTo=function(a,u,d,v,f,S){this.__currentPosition={x:f,y:S},this.__addPathCommand(c("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:a,cp1y:u,cp2x:d,cp2y:v,x:f,y:S}))},_.prototype.quadraticCurveTo=function(a,u,d,v){this.__currentPosition={x:d,y:v},this.__addPathCommand(c("Q {cpx} {cpy} {x} {y}",{cpx:a,cpy:u,x:d,y:v}))};var $=function(a){var u=Math.sqrt(a[0]*a[0]+a[1]*a[1]);return[a[0]/u,a[1]/u]};_.prototype.arcTo=function(a,u,d,v,f){var S=this.__currentPosition&&this.__currentPosition.x,y=this.__currentPosition&&this.__currentPosition.y;if(S!==void 0&&y!==void 0){if(f<0)throw new Error("IndexSizeError: The radius provided ("+f+") is negative.");if(S===a&&y===u||a===d&&u===v||f===0)return void this.lineTo(a,u);var x=$([S-a,y-u]),M=$([d-a,v-u]);if(x[0]*M[1]==x[1]*M[0])return void this.lineTo(a,u);var P=x[0]*M[0]+x[1]*M[1],N=Math.acos(Math.abs(P)),B=$([x[0]+M[0],x[1]+M[1]]),Z=f/Math.sin(N/2),U=a+Z*B[0],t=u+Z*B[1],s=[-x[1],x[0]],o=[M[1],-M[0]],i=function(p){var l=p[0];return p[1]>=0?Math.acos(l):-Math.acos(l)},r=i(s),h=i(o);this.lineTo(U+s[0]*f,t+s[1]*f),this.arc(U,t,f,r,h)}},_.prototype.stroke=function(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")},_.prototype.fill=function(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")},_.prototype.rect=function(a,u,d,v){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(a,u),this.lineTo(a+d,u),this.lineTo(a+d,u+v),this.lineTo(a,u+v),this.lineTo(a,u),this.closePath()},_.prototype.fillRect=function(a,u,d,v){var f,S;f=this.__createElement("rect",{x:a,y:u,width:d,height:v,"shape-rendering":"crispEdges"},!0),S=this.__closestGroupOrSvg(),S.appendChild(f),this.__currentElement=f,this.__applyStyleToCurrentElement("fill")},_.prototype.strokeRect=function(a,u,d,v){var f,S;f=this.__createElement("rect",{x:a,y:u,width:d,height:v},!0),S=this.__closestGroupOrSvg(),S.appendChild(f),this.__currentElement=f,this.__applyStyleToCurrentElement("stroke")},_.prototype.__clearCanvas=function(){for(var a=this.__closestGroupOrSvg(),u=a.getAttribute("transform"),d=this.__root.childNodes[1],v=d.childNodes,f=v.length-1;f>=0;f--)v[f]&&d.removeChild(v[f]);this.__currentElement=d,this.__groupStack=[],u&&this.__addTransform(u)},_.prototype.clearRect=function(a,u,d,v){if(a===0&&u===0&&d===this.width&&v===this.height)return void this.__clearCanvas();var f,S=this.__closestGroupOrSvg();f=this.__createElement("rect",{x:a,y:u,width:d,height:v,fill:"#FFFFFF"},!0),S.appendChild(f)},_.prototype.createLinearGradient=function(a,u,d,v){var f=this.__createElement("linearGradient",{id:m(this.__ids),x1:a+"px",x2:d+"px",y1:u+"px",y2:v+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(f),new b(f,this)},_.prototype.createRadialGradient=function(a,u,d,v,f,S){var y=this.__createElement("radialGradient",{id:m(this.__ids),cx:v+"px",cy:f+"px",r:S+"px",fx:a+"px",fy:u+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(y),new b(y,this)},_.prototype.__parseFont=function(){var a=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i,u=a.exec(this.font),d={style:u[1]||"normal",size:u[4]||"10px",family:u[6]||"sans-serif",weight:u[3]||"normal",decoration:u[2]||"normal",href:null};return this.__fontUnderline==="underline"&&(d.decoration="underline"),this.__fontHref&&(d.href=this.__fontHref),d},_.prototype.__wrapTextLink=function(a,u){if(a.href){var d=this.__createElement("a");return d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a.href),d.appendChild(u),d}return u},_.prototype.__applyText=function(a,u,d,v){var f=this.__parseFont(),S=this.__closestGroupOrSvg(),y=this.__createElement("text",{"font-family":f.family,"font-size":f.size,"font-style":f.style,"font-weight":f.weight,"text-decoration":f.decoration,x:u,y:d,"text-anchor":g(this.textAlign),"dominant-baseline":E(this.textBaseline)},!0);y.appendChild(this.__document.createTextNode(a)),this.__currentElement=y,this.__applyStyleToCurrentElement(v),S.appendChild(this.__wrapTextLink(f,y))},_.prototype.fillText=function(a,u,d){this.__applyText(a,u,d,"fill")},_.prototype.strokeText=function(a,u,d){this.__applyText(a,u,d,"stroke")},_.prototype.measureText=function(a){return this.__ctx.font=this.font,this.__ctx.measureText(a)},_.prototype.arc=function(a,u,d,v,f,S){if(v!==f){v%=2*Math.PI,f%=2*Math.PI,v===f&&(f=(f+2*Math.PI-.001*(S?-1:1))%(2*Math.PI));var y=a+d*Math.cos(f),x=u+d*Math.sin(f),M=a+d*Math.cos(v),P=u+d*Math.sin(v),N=S?0:1,B=0,Z=f-v;Z<0&&(Z+=2*Math.PI),B=S?Z>Math.PI?0:1:Z>Math.PI?1:0,this.lineTo(M,P),this.__addPathCommand(c("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:d,ry:d,xAxisRotation:0,largeArcFlag:B,sweepFlag:N,endX:y,endY:x})),this.__currentPosition={x:y,y:x}}},_.prototype.clip=function(){var a=this.__closestGroupOrSvg(),u=this.__createElement("clipPath"),d=m(this.__ids),v=this.__createElement("g");this.__applyCurrentDefaultPath(),a.removeChild(this.__currentElement),u.setAttribute("id",d),u.appendChild(this.__currentElement),this.__defs.appendChild(u),a.setAttribute("clip-path",c("url(#{id})",{id:d})),a.appendChild(v),this.__currentElement=v},_.prototype.drawImage=function(){var a,u,d,v,f,S,y,x,M,P,N,B,Z,U,t=Array.prototype.slice.call(arguments),s=t[0],o=0,i=0;if(t.length===3)a=t[1],u=t[2],f=s.width,S=s.height,d=f,v=S;else if(t.length===5)a=t[1],u=t[2],d=t[3],v=t[4],f=s.width,S=s.height;else{if(t.length!==9)throw new Error("Invalid number of arguments passed to drawImage: "+arguments.length);o=t[1],i=t[2],f=t[3],S=t[4],a=t[5],u=t[6],d=t[7],v=t[8]}y=this.__closestGroupOrSvg(),this.__currentElement;var r="translate("+a+", "+u+")";if(s instanceof _){if(x=s.getSvg().cloneNode(!0),x.childNodes&&x.childNodes.length>1){for(M=x.childNodes[0];M.childNodes.length;)U=M.childNodes[0].getAttribute("id"),this.__ids[U]=U,this.__defs.appendChild(M.childNodes[0]);if(P=x.childNodes[1]){var h,p=P.getAttribute("transform");h=p?p+" "+r:r,P.setAttribute("transform",h),y.appendChild(P)}}}else s.nodeName!=="CANVAS"&&s.nodeName!=="IMG"||(N=this.__createElement("image"),N.setAttribute("width",d),N.setAttribute("height",v),N.setAttribute("preserveAspectRatio","none"),N.setAttribute("opacity",this.globalAlpha),(o||i||f!==s.width||S!==s.height)&&(B=this.__document.createElement("canvas"),B.width=d,B.height=v,Z=B.getContext("2d"),Z.drawImage(s,o,i,f,S,0,0,d,v),s=B),N.setAttribute("transform",r),N.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s.nodeName==="CANVAS"?s.toDataURL():s.originalSrc),y.appendChild(N))},_.prototype.createPattern=function(a,u){var d,v=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),f=m(this.__ids);return v.setAttribute("id",f),v.setAttribute("width",a.width),v.setAttribute("height",a.height),a.nodeName==="CANVAS"||a.nodeName==="IMG"?(d=this.__document.createElementNS("http://www.w3.org/2000/svg","image"),d.setAttribute("width",a.width),d.setAttribute("height",a.height),d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a.nodeName==="CANVAS"?a.toDataURL():a.getAttribute("src")),v.appendChild(d),this.__defs.appendChild(v)):a instanceof _&&(v.appendChild(a.__root.childNodes[1]),this.__defs.appendChild(v)),new R(v,this)},_.prototype.setLineDash=function(a){a&&a.length>0?this.lineDash=a.join(","):this.lineDash=null},_.prototype.drawFocusRing=function(){},_.prototype.createImageData=function(){},_.prototype.getImageData=function(){},_.prototype.putImageData=function(){},_.prototype.globalCompositeOperation=function(){},_.prototype.setTransform=function(){},typeof window=="object"&&(window.C2S=_),n.exports=_})(),function(){function c(t,s,o){this.mode=y.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var i=0,r=this.data.length;i<r;i++){var h=[],p=this.data.charCodeAt(i);s?h[0]=p:p>65536?(h[0]=240|(1835008&p)>>>18,h[1]=128|(258048&p)>>>12,h[2]=128|(4032&p)>>>6,h[3]=128|63&p):p>2048?(h[0]=224|(61440&p)>>>12,h[1]=128|(4032&p)>>>6,h[2]=128|63&p):p>128?(h[0]=192|(1984&p)>>>6,h[1]=128|63&p):h[0]=p,this.parsedData.push(h)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),o||this.parsedData.length==this.data.length||(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function m(t,s){this.typeNumber=t,this.errorCorrectLevel=s,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function g(t,s){if(t.length==I)throw new Error(t.length+"/"+s);for(var o=0;o<t.length&&t[o]==0;)o++;this.num=new Array(t.length-o+s);for(var i=0;i<t.length-o;i++)this.num[i]=t[i+o]}function E(t,s){this.totalCount=t,this.dataCount=s}function C(){this.buffer=[],this.length=0}function _(){var t=!1,s=navigator.userAgent;if(/android/i.test(s)){t=!0;var o=s.toString().match(/android ([0-9]\.[0-9])/i);o&&o[1]&&(t=parseFloat(o[1]))}return t}function b(t,s){for(var o=s.correctLevel,i=1,r=R(t),h=0,p=Z.length;h<p;h++){var l=0;switch(o){case x.L:l=Z[h][0];break;case x.M:l=Z[h][1];break;case x.Q:l=Z[h][2];break;case x.H:l=Z[h][3]}if(r<=l)break;i++}if(i>Z.length)throw new Error("Too long data. the CorrectLevel."+["M","L","H","Q"][o]+" limit length is "+l);return s.version!=0&&(i<=s.version?(i=s.version,s.runVersion=i):(console.warn("QR Code version "+s.version+" too small, run version use "+i),s.runVersion=i)),i}function R(t){var s=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return s.length+(s.length!=t.length?3:0)}var I,$,a=typeof gt=="object"&&gt&&gt.Object===Object&&gt,u=typeof self=="object"&&self&&self.Object===Object&&self,d=a||u||Function("return this")(),v=w&&!w.nodeType&&w,f=v&&!0&&n&&!n.nodeType&&n,S=d.QRCode;c.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var s=0,o=this.parsedData.length;s<o;s++)t.put(this.parsedData[s],8)}},m.prototype={addData:function(t,s,o){var i=new c(t,s,o);this.dataList.push(i),this.dataCache=null},isDark:function(t,s){if(t<0||this.moduleCount<=t||s<0||this.moduleCount<=s)throw new Error(t+","+s);return this.modules[t][s][0]},getEye:function(t,s){if(t<0||this.moduleCount<=t||s<0||this.moduleCount<=s)throw new Error(t+","+s);var o=this.modules[t][s];if(o[1]){var i="P"+o[1]+"_"+o[2];return o[2]=="A"&&(i="A"+o[1]),{isDark:o[0],type:i}}return null},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,s){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++){this.modules[o]=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++)this.modules[o][i]=[]}this.setupPositionProbePattern(0,0,"TL"),this.setupPositionProbePattern(this.moduleCount-7,0,"BL"),this.setupPositionProbePattern(0,this.moduleCount-7,"TR"),this.setupPositionAdjustPattern("A"),this.setupTimingPattern(),this.setupTypeInfo(t,s),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=m.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,s)},setupPositionProbePattern:function(t,s,o){for(var i=-1;i<=7;i++)if(!(t+i<=-1||this.moduleCount<=t+i))for(var r=-1;r<=7;r++)s+r<=-1||this.moduleCount<=s+r||(0<=i&&i<=6&&(r==0||r==6)||0<=r&&r<=6&&(i==0||i==6)||2<=i&&i<=4&&2<=r&&r<=4?(this.modules[t+i][s+r][0]=!0,this.modules[t+i][s+r][2]=o,this.modules[t+i][s+r][1]=i==-0||r==-0||i==6||r==6?"O":"I"):this.modules[t+i][s+r][0]=!1)},getBestMaskPattern:function(){for(var t=0,s=0,o=0;o<8;o++){this.makeImpl(!0,o);var i=P.getLostPoint(this);(o==0||t>i)&&(t=i,s=o)}return s},createMovieClip:function(t,s,o){var i=t.createEmptyMovieClip(s,o);this.make();for(var r=0;r<this.modules.length;r++)for(var h=1*r,p=0;p<this.modules[r].length;p++){var l=1*p,e=this.modules[r][p][0];e&&(i.beginFill(0,100),i.moveTo(l,h),i.lineTo(l+1,h),i.lineTo(l+1,h+1),i.lineTo(l,h+1),i.endFill())}return i},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)this.modules[t][6][0]==null&&(this.modules[t][6][0]=t%2==0);for(var s=8;s<this.moduleCount-8;s++)this.modules[6][s][0]==null&&(this.modules[6][s][0]=s%2==0)},setupPositionAdjustPattern:function(t){for(var s=P.getPatternPosition(this.typeNumber),o=0;o<s.length;o++)for(var i=0;i<s.length;i++){var r=s[o],h=s[i];if(this.modules[r][h][0]==null)for(var p=-2;p<=2;p++)for(var l=-2;l<=2;l++)p==-2||p==2||l==-2||l==2||p==0&&l==0?(this.modules[r+p][h+l][0]=!0,this.modules[r+p][h+l][2]=t,this.modules[r+p][h+l][1]=p==-2||l==-2||p==2||l==2?"O":"I"):this.modules[r+p][h+l][0]=!1}},setupTypeNumber:function(t){for(var s=P.getBCHTypeNumber(this.typeNumber),o=0;o<18;o++){var i=!t&&(s>>o&1)==1;this.modules[Math.floor(o/3)][o%3+this.moduleCount-8-3][0]=i}for(var o=0;o<18;o++){var i=!t&&(s>>o&1)==1;this.modules[o%3+this.moduleCount-8-3][Math.floor(o/3)][0]=i}},setupTypeInfo:function(t,s){for(var o=this.errorCorrectLevel<<3|s,i=P.getBCHTypeInfo(o),r=0;r<15;r++){var h=!t&&(i>>r&1)==1;r<6?this.modules[r][8][0]=h:r<8?this.modules[r+1][8][0]=h:this.modules[this.moduleCount-15+r][8][0]=h}for(var r=0;r<15;r++){var h=!t&&(i>>r&1)==1;r<8?this.modules[8][this.moduleCount-r-1][0]=h:r<9?this.modules[8][15-r-1+1][0]=h:this.modules[8][15-r-1][0]=h}this.modules[this.moduleCount-8][8][0]=!t},mapData:function(t,s){for(var o=-1,i=this.moduleCount-1,r=7,h=0,p=this.moduleCount-1;p>0;p-=2)for(p==6&&p--;;){for(var l=0;l<2;l++)if(this.modules[i][p-l][0]==null){var e=!1;h<t.length&&(e=(t[h]>>>r&1)==1);var k=P.getMask(s,i,p-l);k&&(e=!e),this.modules[i][p-l][0]=e,r--,r==-1&&(h++,r=7)}if((i+=o)<0||this.moduleCount<=i){i-=o,o=-o;break}}}},m.PAD0=236,m.PAD1=17,m.createData=function(t,s,o){for(var i=E.getRSBlocks(t,s),r=new C,h=0;h<o.length;h++){var p=o[h];r.put(p.mode,4),r.put(p.getLength(),P.getLengthInBits(p.mode,t)),p.write(r)}for(var l=0,h=0;h<i.length;h++)l+=i[h].dataCount;if(r.getLengthInBits()>8*l)throw new Error("code length overflow. ("+r.getLengthInBits()+">"+8*l+")");for(r.getLengthInBits()+4<=8*l&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(!1);for(;!(r.getLengthInBits()>=8*l||(r.put(m.PAD0,8),r.getLengthInBits()>=8*l));)r.put(m.PAD1,8);return m.createBytes(r,i)},m.createBytes=function(t,s){for(var o=0,i=0,r=0,h=new Array(s.length),p=new Array(s.length),l=0;l<s.length;l++){var e=s[l].dataCount,k=s[l].totalCount-e;i=Math.max(i,e),r=Math.max(r,k),h[l]=new Array(e);for(var T=0;T<h[l].length;T++)h[l][T]=255&t.buffer[T+o];o+=e;var D=P.getErrorCorrectPolynomial(k),O=new g(h[l],D.getLength()-1),F=O.mod(D);p[l]=new Array(D.getLength()-1);for(var T=0;T<p[l].length;T++){var j=T+F.getLength()-p[l].length;p[l][T]=j>=0?F.get(j):0}}for(var J=0,T=0;T<s.length;T++)J+=s[T].totalCount;for(var K=new Array(J),G=0,T=0;T<i;T++)for(var l=0;l<s.length;l++)T<h[l].length&&(K[G++]=h[l][T]);for(var T=0;T<r;T++)for(var l=0;l<s.length;l++)T<p[l].length&&(K[G++]=p[l][T]);return K};for(var y={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},x={L:1,M:0,Q:3,H:2},M={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},P={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var s=t<<10;P.getBCHDigit(s)-P.getBCHDigit(P.G15)>=0;)s^=P.G15<<P.getBCHDigit(s)-P.getBCHDigit(P.G15);return(t<<10|s)^P.G15_MASK},getBCHTypeNumber:function(t){for(var s=t<<12;P.getBCHDigit(s)-P.getBCHDigit(P.G18)>=0;)s^=P.G18<<P.getBCHDigit(s)-P.getBCHDigit(P.G18);return t<<12|s},getBCHDigit:function(t){for(var s=0;t!=0;)s++,t>>>=1;return s},getPatternPosition:function(t){return P.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,s,o){switch(t){case M.PATTERN000:return(s+o)%2==0;case M.PATTERN001:return s%2==0;case M.PATTERN010:return o%3==0;case M.PATTERN011:return(s+o)%3==0;case M.PATTERN100:return(Math.floor(s/2)+Math.floor(o/3))%2==0;case M.PATTERN101:return s*o%2+s*o%3==0;case M.PATTERN110:return(s*o%2+s*o%3)%2==0;case M.PATTERN111:return(s*o%3+(s+o)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var s=new g([1],0),o=0;o<t;o++)s=s.multiply(new g([1,N.gexp(o)],0));return s},getLengthInBits:function(t,s){if(1<=s&&s<10)switch(t){case y.MODE_NUMBER:return 10;case y.MODE_ALPHA_NUM:return 9;case y.MODE_8BIT_BYTE:case y.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(s<27)switch(t){case y.MODE_NUMBER:return 12;case y.MODE_ALPHA_NUM:return 11;case y.MODE_8BIT_BYTE:return 16;case y.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(s<41))throw new Error("type:"+s);switch(t){case y.MODE_NUMBER:return 14;case y.MODE_ALPHA_NUM:return 13;case y.MODE_8BIT_BYTE:return 16;case y.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},getLostPoint:function(t){for(var s=t.getModuleCount(),o=0,i=0;i<s;i++)for(var r=0;r<s;r++){for(var h=0,p=t.isDark(i,r),l=-1;l<=1;l++)if(!(i+l<0||s<=i+l))for(var e=-1;e<=1;e++)r+e<0||s<=r+e||l==0&&e==0||p==t.isDark(i+l,r+e)&&h++;h>5&&(o+=3+h-5)}for(var i=0;i<s-1;i++)for(var r=0;r<s-1;r++){var k=0;t.isDark(i,r)&&k++,t.isDark(i+1,r)&&k++,t.isDark(i,r+1)&&k++,t.isDark(i+1,r+1)&&k++,k!=0&&k!=4||(o+=3)}for(var i=0;i<s;i++)for(var r=0;r<s-6;r++)t.isDark(i,r)&&!t.isDark(i,r+1)&&t.isDark(i,r+2)&&t.isDark(i,r+3)&&t.isDark(i,r+4)&&!t.isDark(i,r+5)&&t.isDark(i,r+6)&&(o+=40);for(var r=0;r<s;r++)for(var i=0;i<s-6;i++)t.isDark(i,r)&&!t.isDark(i+1,r)&&t.isDark(i+2,r)&&t.isDark(i+3,r)&&t.isDark(i+4,r)&&!t.isDark(i+5,r)&&t.isDark(i+6,r)&&(o+=40);for(var T=0,r=0;r<s;r++)for(var i=0;i<s;i++)t.isDark(i,r)&&T++;return o+=Math.abs(100*T/s/s-50)/5*10}},N={glog:function(t){if(t<1)throw new Error("glog("+t+")");return N.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return N.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},B=0;B<8;B++)N.EXP_TABLE[B]=1<<B;for(var B=8;B<256;B++)N.EXP_TABLE[B]=N.EXP_TABLE[B-4]^N.EXP_TABLE[B-5]^N.EXP_TABLE[B-6]^N.EXP_TABLE[B-8];for(var B=0;B<255;B++)N.LOG_TABLE[N.EXP_TABLE[B]]=B;g.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var s=new Array(this.getLength()+t.getLength()-1),o=0;o<this.getLength();o++)for(var i=0;i<t.getLength();i++)s[o+i]^=N.gexp(N.glog(this.get(o))+N.glog(t.get(i)));return new g(s,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var s=N.glog(this.get(0))-N.glog(t.get(0)),o=new Array(this.getLength()),i=0;i<this.getLength();i++)o[i]=this.get(i);for(var i=0;i<t.getLength();i++)o[i]^=N.gexp(N.glog(t.get(i))+s);return new g(o,0).mod(t)}},E.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[