lucky-canvas
Advanced tools
Comparing version 1.7.11 to 1.7.12
@@ -16,3 +16,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}); | ||
***************************************************************************** */ | ||
var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};function e(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function n(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function r(t,e){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function o(t,e){for(var i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}var c,h,u=function(t){return t&&t.Math==Math&&t},l=u("object"==typeof globalThis&&globalThis)||u("object"==typeof window&&window)||u("object"==typeof self&&self)||u("object"==typeof a&&a)||function(){return this}()||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},d=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=Function.prototype.call,g=p.bind?p.bind(p):function(){return p.apply(p,arguments)},v={}.propertyIsEnumerable,y=Object.getOwnPropertyDescriptor,m={f:y&&!v.call({1:2},1)?function(t){var e=y(this,t);return!!e&&e.enumerable}:v},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b=Function.prototype,S=b.bind,C=b.call,x=S&&S.bind(C),z=S?function(t){return t&&x(C,t)}:function(t){return t&&function(){return C.apply(t,arguments)}},O=z({}.toString),k=z("".slice),I=function(t){return k(O(t),8,-1)},E=l.Object,T=z("".split),A=f((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==I(t)?T(t,""):E(t)}:E,W=l.TypeError,_=function(t){if(null==t)throw W("Can't call method on "+t);return t},P=function(t){return A(_(t))},$=function(t){return"function"==typeof t},j=function(t){return"object"==typeof t?null!==t:$(t)},R=function(t){return $(t)?t:void 0},F=function(t,e){return arguments.length<2?R(l[t]):l[t]&&l[t][e]},H=z({}.isPrototypeOf),D=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(h=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!h&&D&&(!(c=D.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=D.match(/Chrome\/(\d+)/))&&(h=+c[1]);var X=h,G=!!Object.getOwnPropertySymbols&&!f((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),U=G&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=l.Object,Y=U?function(t){return"symbol"==typeof t}:function(t){var e=F("Symbol");return $(e)&&H(e.prototype,q(t))},K=l.String,V=l.TypeError,J=function(t){if($(t))return t;throw V(function(t){try{return K(t)}catch(t){return"Object"}}(t)+" is not a function")},Q=l.TypeError,Z=Object.defineProperty,tt=function(t,e){try{Z(l,t,{value:e,configurable:!0,writable:!0})}catch(i){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),it=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),nt=l.Object,rt=function(t){return nt(_(t))},ot=z({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ht=z(1..toString),ut=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ht(++st+ct,36)},lt=it("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ut,gt=function(t){if(!at(lt,t)||!G&&"string"!=typeof lt[t]){var e="Symbol."+t;G&&at(ft,t)?lt[t]=ft[t]:lt[t]=U&&dt?dt(e):pt(e)}return lt[t]},vt=l.TypeError,yt=gt("toPrimitive"),mt=function(t,e){if(!j(t)||Y(t))return t;var i,n,r=null==(i=t[yt])?void 0:J(i);if(r){if(void 0===e&&(e="default"),n=g(r,t,e),!j(n)||Y(n))return n;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var i,n;if("string"===e&&$(i=t.toString)&&!j(n=g(i,t)))return n;if($(i=t.valueOf)&&!j(n=g(i,t)))return n;if("string"!==e&&$(i=t.toString)&&!j(n=g(i,t)))return n;throw Q("Can't convert object to primitive value")}(t,e)},wt=function(t){var e=mt(t,"string");return Y(e)?e:e+""},bt=l.document,St=j(bt)&&j(bt.createElement),Ct=function(t){return St?bt.createElement(t):{}},xt=!d&&!f((function(){return 7!=Object.defineProperty(Ct("div"),"a",{get:function(){return 7}}).a})),zt=Object.getOwnPropertyDescriptor,Ot={f:d?zt:function(t,e){if(t=P(t),e=wt(e),xt)try{return zt(t,e)}catch(t){}if(at(t,e))return w(!g(m.f,t,e),t[e])}},kt=l.String,It=l.TypeError,Et=function(t){if(j(t))return t;throw It(kt(t)+" is not an object")},Tt=l.TypeError,At=Object.defineProperty,Wt={f:d?At:function(t,e,i){if(Et(t),e=wt(e),Et(i),xt)try{return At(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Tt("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},_t=d?function(t,e,i){return Wt.f(t,e,w(1,i))}:function(t,e,i){return t[e]=i,t},Pt=z(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Pt(t)});var $t,jt,Rt,Ft=et.inspectSource,Ht=l.WeakMap,Dt=$(Ht)&&/native code/.test(Ft(Ht)),Lt=it("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ut(t))},Bt={},Nt=l.TypeError,Xt=l.WeakMap;if(Dt||et.state){var Gt=et.state||(et.state=new Xt),Ut=z(Gt.get),qt=z(Gt.has),Yt=z(Gt.set);$t=function(t,e){if(qt(Gt,t))throw new Nt("Object already initialized");return e.facade=t,Yt(Gt,t,e),e},jt=function(t){return Ut(Gt,t)||{}},Rt=function(t){return qt(Gt,t)}}else{var Kt=Mt("state");Bt[Kt]=!0,$t=function(t,e){if(at(t,Kt))throw new Nt("Object already initialized");return e.facade=t,_t(t,Kt,e),e},jt=function(t){return at(t,Kt)?t[Kt]:{}},Rt=function(t){return at(t,Kt)}}var Vt,Jt={set:$t,get:jt,has:Rt,enforce:function(t){return Rt(t)?jt(t):$t(t,{})},getterFor:function(t){return function(e){var i;if(!j(e)||(i=jt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return i}}},Qt=Function.prototype,Zt=d&&Object.getOwnPropertyDescriptor,te=at(Qt,"name"),ee={EXISTS:te,PROPER:te&&"something"===function(){}.name,CONFIGURABLE:te&&(!d||d&&Zt(Qt,"name").configurable)},ie=s((function(t){var e=ee.CONFIGURABLE,i=Jt.get,n=Jt.enforce,r=String(String).split("String");(t.exports=function(t,i,o,a){var s,c=!!a&&!!a.unsafe,h=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:i;$(o)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!at(o,"name")||e&&o.name!==f)&&_t(o,"name",f),(s=n(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!u&&t[i]&&(h=!0):delete t[i],h?t[i]=o:_t(t,i,o)):h?t[i]=o:tt(i,o)})(Function.prototype,"toString",(function(){return $(this)&&i(this).source||Ft(this)}))})),ne=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ne)(e)},ae=Math.max,se=Math.min,ce=Math.min,he=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},ue=function(t){return function(e,i,n){var r,o=P(e),a=he(o),s=function(t,e){var i=oe(t);return i<0?ae(i+e,0):se(i,e)}(n,a);if(t&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===i)return t||s||0;return!t&&-1}},le={includes:ue(!0),indexOf:ue(!1)},fe=le.indexOf,de=z([].push),pe=function(t,e){var i,n=P(t),r=0,o=[];for(i in n)!at(Bt,i)&&at(n,i)&&de(o,i);for(;e.length>r;)at(n,i=e[r++])&&(~fe(o,i)||de(o,i));return o},ge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ve=ge.concat("length","prototype"),ye={f:Object.getOwnPropertyNames||function(t){return pe(t,ve)}},me={f:Object.getOwnPropertySymbols},we=z([].concat),be=F("Reflect","ownKeys")||function(t){var e=ye.f(Et(t)),i=me.f;return i?we(e,i(t)):e},Se=function(t,e){for(var i=be(e),n=Wt.f,r=Ot.f,o=0;o<i.length;o++){var a=i[o];at(t,a)||n(t,a,r(e,a))}},Ce=/#|\.prototype\./,xe=function(t,e){var i=Oe[ze(t)];return i==Ie||i!=ke&&($(e)?f(e):!!e)},ze=xe.normalize=function(t){return String(t).replace(Ce,".").toLowerCase()},Oe=xe.data={},ke=xe.NATIVE="N",Ie=xe.POLYFILL="P",Ee=xe,Te=Ot.f,Ae=function(t,e){var i,n,r,o,a,s=t.target,c=t.global,h=t.stat;if(i=c?l:h?l[s]||tt(s,{}):(l[s]||{}).prototype)for(n in e){if(o=e[n],r=t.noTargetGet?(a=Te(i,n))&&a.value:i[n],!Ee(c?n:s+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ie(i,n,o,t)}},We=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var i,n=P(e),r=We(e),o=r.length,a=0;o>a;)Wt.f(t,i=r[a++],n[i]);return t},Pe=F("document","documentElement"),$e=Mt("IE_PROTO"),je=function(){},Re=function(t){return"<script>"+t+"<\/script>"},Fe=function(t){t.write(Re("")),t.close();var e=t.parentWindow.Object;return t=null,e},He=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;He="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",Pe.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Re("document.F=Object")),t.close(),t.F):Fe(Vt);for(var i=ge.length;i--;)delete He.prototype[ge[i]];return He()};Bt[$e]=!0;var De=Object.create||function(t,e){var i;return null!==t?(je.prototype=Et(t),i=new je,je.prototype=null,i[$e]=t):i=He(),void 0===e?i:_e(i,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&Wt.f(Me,Le,{configurable:!0,value:De(null)});var Be=function(t){Me[Le][t]=!0},Ne=le.includes;Ae({target:"Array",proto:!0},{includes:function(t){return Ne(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("includes"),Ae({target:"Object",stat:!0,forced:!d,sham:!d},{defineProperty:Wt.f});var Xe=gt("match"),Ge=l.TypeError,Ue=function(t){if(function(t){var e;return j(t)&&(void 0!==(e=t[Xe])?!!e:"RegExp"==I(t))}(t))throw Ge("The method doesn't accept regular expressions");return t},qe={};qe[gt("toStringTag")]="z";var Ye="[object z]"===String(qe),Ke=gt("toStringTag"),Ve=l.Object,Je="Arguments"==I(function(){return arguments}()),Qe=Ye?I:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?i:Je?I(e):"Object"==(n=I(e))&&$(e.callee)?"Arguments":n},Ze=l.String,ti=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},ei=gt("match"),ii=z("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[ei]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~ii(ti(_(this)),ti(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var ni,ri,oi=le.indexOf,ai=z([].indexOf),si=!!ai&&1/ai([1],1,-0)<0,ci=!!(ri=[]["indexOf"])&&f((function(){ri.call(null,ni||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:si||!ci},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return si?ai(this,t,e)||0:oi(this,t,e)}});var hi=z(z.bind),ui=Array.isArray||function(t){return"Array"==I(t)},li=function(){},fi=[],di=F("Reflect","construct"),pi=/^\s*(?:class|function)\b/,gi=z(pi.exec),vi=!pi.exec(li),yi=function(t){if(!$(t))return!1;try{return di(li,fi,t),!0}catch(t){return!1}},mi=!di||f((function(){var t;return yi(yi.call)||!yi(Object)||!yi((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return vi||!!gi(pi,Ft(t))}:yi,wi=gt("species"),bi=l.Array,Si=function(t,e){return new(function(t){var e;return ui(t)&&(e=t.constructor,(mi(e)&&(e===bi||ui(e.prototype))||j(e)&&null===(e=e[wi]))&&(e=void 0)),void 0===e?bi:e}(t))(0===e?0:e)},Ci=z([].push),xi=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,h,u,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hi?hi(t,e):function(){return t.apply(e,arguments)}}(h,u),y=he(g),m=0,w=l||Si,b=e?w(c,y):i||a?w(c,0):void 0;y>m;m++)if((s||m in g)&&(d=v(f=g[m],m,p),t))if(e)b[m]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:Ci(b,f)}else switch(t){case 4:return!1;case 7:Ci(b,f)}return o?-1:n||r?r:b}},zi={forEach:xi(0),map:xi(1),filter:xi(2),some:xi(3),every:xi(4),find:xi(5),findIndex:xi(6),filterReject:xi(7)}.find,Oi=!0;"find"in[]&&Array(1).find((function(){Oi=!1})),Ae({target:"Array",proto:!0,forced:Oi},{find:function(t){return zi(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find"),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var i=Object(this),n=i.length>>>0;if(0===n)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:n-Math.abs(a),0);for(;s<n;){if((r=i[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r<i;){var o=e[r];if(t.call(n,o,r,e))return o;r++}}});var ki=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Ii=function(t,e){for(var i=0,n=e.split(".");i<n.length;i++){var r=t[n[i]];if(!ki(r,"object","array"))return r;t=r}return t},Ei=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Ti=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},Ai=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(i=e)?0:"object"==typeof i?NaN:"number"==typeof i?i:"string"==typeof i?"%"===i[i.length-1]?Number(i.slice(0,-1))/100:Number(i):NaN))return!1}var i;return!0},Wi=function(t){var e,i=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],n=0,r=0,o=0,a=0;switch(i.length){case 1:n=r=o=a=i[0];break;case 2:n=r=i[0],o=a=i[1];break;case 3:n=i[0],o=a=i[1],r=i[2];break;default:n=i[0],r=i[1],o=i[2],a=i[3]}var s={paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&ki(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[n,r,o,a]},_i=function(t){var e=[],i=t.map((function(t){return Number(t)})).reduce((function(t,i){if(i>0){var n=t+i;return e.push(n),n}return e.push(NaN),t}),0),n=Math.random()*i;return e.findIndex((function(t){return n<=t}))},Pi=function(t,e,i,n){void 0===n&&(n=1/0),n<=0&&(n=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,h=i(o);if(n===o.length+1&&(c+=a),h<0)return o;if(c>h&&(o.push(r.slice(0,-1)),r=e[s]),n===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},$i=function(t){return Math.PI/180*t},ji=function(t,e,i,n,r,o){t.beginPath();var a,s,c=$i(90/Math.PI/i*o),h=n+c,u=r-c;t.arc(0,0,i,h,u,!1),t.lineTo.apply(t,(a=(n+r)/2,s=o/2/Math.abs(Math.sin((n-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Ri=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),h=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(n+s,r),t.lineTo(n+s,r),t.lineTo(n+o-s,r),t.arc(n+o-s,r+s,s,-h/2,0),t.lineTo(n+o,r+a-s),t.arc(n+o-s,r+a-s,s,0,h/2),t.lineTo(n+s,r+a),t.arc(n+s,r+a-s,s,h/2,h),t.lineTo(n,r+s),t.arc(n+s,r+s,s,h,-h/2),t.closePath()},Fi=function(t,e,i,n,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,h=t.height;a.width=c,a.height=h;var u=c/n;return Ri(s,e*u,i*u,n*u,r*u,o*u),s.clip(),s.drawImage(t,0,0,c,h),a},Hi=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;i.width=r,i.height=o,n.drawImage(t,0,0,r,o);var a=n.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var i=Math.ceil(t),n=e*e,r=2*n,o=1/(2*Math.PI*n),a=[],s=0,c=-i;c<=i;c++)for(var h=-i;h<=i;h++){var u=o*Math.exp(-(c*c+h*h)/r);a.push(u),s+=u}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),n.putImageData(a,0,0),i},Di=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Li="__proto__"in{};function Mi(t,e,i,n){Object.defineProperty(t,e,{value:i,enumerable:!!n,writable:!0,configurable:!0})}var Bi=Array.prototype,Ni=Object.create(Bi);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Ni[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=Bi[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),n}}));var Xi=function(){function t(t){this.dep=new Di,Mi(t,"__luckyOb__",this),Array.isArray(t)&&(Li?t.__proto__=Ni:Object.getOwnPropertyNames(Ni).forEach((function(e){Mi(t,e,Ni[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Ui(t,e,t[e])}))},t}();function Gi(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Xi(t)}function Ui(t,e,i){var n=new Di,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(i=t[e]);var s=Gi(i);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):i;return Di.target&&(n.addSub(Di.target),s&&s.dep.addSub(Di.target)),e},set:function(e){e!==i&&(i=e,o&&!a||(a?a.call(t,e):i=e,s=Gi(e),n.notify()))}})}}var qi=0,Yi=function(){function t(t,e,i,n){void 0===n&&(n={}),this.id=qi++,this.$lucky=t,this.expr=e,this.deep=!!n.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],i="",n=0;n<t.length;n++){var r=t[n];if(/\[|\./.test(r))e.push(i),i="";else{if(/\W/.test(r))continue;i+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=i,this.value=this.get()}return t.prototype.get=function(){Di.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){ki(t,"array","object")&&Object.keys(t).forEach((function(i){var n=t[i];e(n)}))};e(t)}(t),Di.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),Ki=function(){function t(t,e){var i=this;this.version="1.7.11",this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","lucky-canvas@1.7.11"),t.canvasElement.addEventListener("click",(function(t){return i.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var i=null;return function(){for(var n=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i||(i=setTimeout((function(){t.apply(n,r),clearTimeout(i),i=null}),e))}}((function(){return i.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){i.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],i=t[1];this.ctx.clearRect(-e,-i,2*e,2*i)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,i=0,n=0;t.divElement&&(i=t.divElement.offsetWidth,n=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||i,this.boxHeight=this.getLength(e.height||t.height)||n,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,i=t.canvasElement,n=t.dpr,r=[this.boxWidth*n,this.boxHeight*n],o=r[0],a=r[1];i&&(i.width=o,i.height=a,i.style.width=o+"px",i.style.height=a+"px",i.style["transform-origin"]="left top",i.style.transform="scale("+1/n+")",e.scale(n,n))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,i){var n=this;return void 0===i&&(i="$resolve"),new Promise((function(r,o){if(t||o("=> '"+e.src+"' 不能为空或不合法"),"WEB"!==n.config.flag)return e[i]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '"+e.src+"' 图片加载失败")},a.src=t}))},t.prototype.drawImage=function(t,e){for(var i,n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))i=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");i=e.path}return 8===n.length&&(n=n.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([i],n))},t.prototype.getLength=function(t){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var i=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,n,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*i.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(n);var a=i.config.unitFunc;return a?a(n,r):n})))},t.prototype.getOffscreenCanvas=function(t,e){if(!Ei(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var i=this.config.dpr,n=this._offscreenCanvas;n.width=(t||300)*i,n.height=(e||150)*i;var r=n.getContext("2d");return r.clearRect(0,0,t,e),r.scale(i,i),r.dpr=i,{_offscreenCanvas:n,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var r=i.map((function(t){return e.getLength(t)}));return Fi.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;if(i.width=r,i.height=o,"string"==typeof n.filter)n.filter="opacity("+e+"%)",n.drawImage(t,0,0,r,o);else{n.drawImage(t,0,0,r,o);for(var a=n.getImageData(0,0,r,o),s=a.data,c=s.length,h=0;h<c;h+=4){var u=s[h+3];0!==u&&(s[h+3]=u*e/100)}n.putImageData(a,0,0)}return i}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Hi(t,this.getLength(e))},t.prototype.$set=function(t,e,i){t&&"object"==typeof t&&Ui(t,e,i)},t.prototype.$computed=function(t,e,i){var n=this;Object.defineProperty(t,e,{get:function(){return i.call(n)}})},t.prototype.$watch=function(t,e,i){void 0===i&&(i={}),"object"==typeof e&&(e=(i=e).handler);var n=new Yi(this,t,e,i);return i.immediate&&e.call(this,n.value),function(){}},t}(),Vi=function(t,e,i,n){return t>=n&&(t=n),i*(t/=n)*t+e},Ji=function(t,e,i,n){return t>=n&&(t=n),-i*(t/=n)*(t-2)+e},Qi=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.call(e)},o.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return i({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return i({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},o.prototype.handleClick=function(t){var e,i=this.ctx;i.beginPath(),i.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),i.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},o.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,a=n._defaultConfig,s=n._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,n){return Ai(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=i.ImageCache.blocks;if(a&&a[n]){var s=a[n][r];if(s){var c=i.computedWidthAndHeight(s,e,2*t,2*t),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate($i(i.rotateDeg)),i.drawImage(o,s,f,d,h,u),o.restore()}}})),t-i.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=$i(this.prizeDeg);var c=$i(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),h=function(t){return i.getOffsetX(o.measureText(t).width)},u=function(t,e,n){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return i.getHeight(t.top,e)+(n+1)*i.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var n=c+e*i.prizeRadian,r=i.prizeRadius-i.maxBtnRadius,l=t.background||s.background;Ai(l)&&(o.fillStyle=l,ji(o,i.maxBtnRadius,i.prizeRadius,n-i.prizeRadian/2,n+i.prizeRadian/2,i.getLength(a.gutter)),o.fill());var f=Math.cos(n)*i.prizeRadius,d=Math.sin(n)*i.prizeRadius;o.translate(f,d),o.rotate(n+$i(90)),t.imgs&&t.imgs.forEach((function(t,n){var a=i.ImageCache.prizes;if(a&&a[e]){var s=a[e][n];if(s){var c=i.computedWidthAndHeight(s,t,i.prizeRadian*i.prizeRadius,r),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,r)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,n=t.fontWeight||s.fontWeight,c=i.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font=n+" "+(c>>0)+"px "+l;var g=String(t.text);(f?Pi(o,Ti(g),(function(e){var n=2*((i.prizeRadius-u(t,r,e.length))*Math.tan(i.prizeRadian/2))-i.getLength(a.gutter);return i.getWidth(d,n)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,i){o.fillText(e,h(e),u(t,r,i))}))})),o.rotate($i(360)-n-$i(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var n=i.getHeight(t.radius);i.maxBtnRadius=Math.max(i.maxBtnRadius,n),Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,n,0,2*Math.PI,!1),o.fill()),t.pointer&&Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-n,0),o.lineTo(n,0),o.lineTo(0,2*-n),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=i.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=i.computedWidthAndHeight(s,t,2*n,2*n),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,n)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=i.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font=r+" "+(a>>0)+"px "+c,String(t.text).split("\n").forEach((function(e,i){o.fillText(e,h(e),u(t,n,i))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*n-n/2)*this.getLength(e.stopRange),c=0,h=0,u=0;++c;){var l=360*c-i*n-r-e.offsetDegree+s-n/2,f=Ji(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-h>f-a?l:u;break}u=l,h=f}},o.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},o.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=_i(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},o.prototype.run=function(t){var e;void 0===t&&(t=0);var i=this,n=i.rAF,r=i.step,o=i.prizeFlag,a=i.stopDeg,s=i.endDeg,c=i._defaultConfig,h=c.accelerationTime,u=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<h){this.FPS=f/t;var g=Vi(f,0,l,h);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=Ji(d,a,s,u),d>=u&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),n(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},o.prototype.getWidth=function(t,e){return void 0===e&&(e=this.prizeRadian*this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return void 0===e&&(e=this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t){return-t/2},o.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr-this.Radius,e/i.dpr-this.Radius]},o}(Ki),Zi=function(t){function a(e,i){var n,r=t.call(this,e,{width:i.width,height:i.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.call(e)},a.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},a.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},a.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return i({background:"#ffce98",shadow:""},t.activeStyle)}))},a.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},a.prototype.init=function(){var t,e;return n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i=t.buttons.map((function(t){return t.imgs}));t.button&&i.push(t.button.imgs);var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:i};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},a.prototype.handleClick=function(t){var e=this,i=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(n){var r;if(n){var o=e.getGeometricProperty([n.x,n.y,n.col||1,n.row||1]),a=o[0],s=o[1],c=o[2],h=o[3];i.beginPath(),i.rect(a,s,c,h),i.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof n.callback&&n.callback.call(e,n),null===(r=e.startCallback)||void 0===r||r.call(e,t,n))}}))},a.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if("buttons"===t&&!n.buttons.length&&n.button&&(s=n.button),s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]);var u=[n.loadImg(c.src,c),c.activeSrc&&n.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(u).then((function(t){var a=t[0],s=t[1],u=c.formatter;"function"==typeof u&&(a=u.call(n,a),s&&(s=u.call(n,s))),h[i][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},a.prototype.computedWidthAndHeight=function(t,e,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var n=this.getWidth(e.width,i.col);return[n,t.height*(n/t.width)]}if(!e.width&&e.height){var r=this.getHeight(e.height,i.row);return[t.width*(r/t.height),r]}return[this.getWidth(e.width,i.col),this.getHeight(e.height,i.row)]},a.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,a=n.ctx,s=n._defaultConfig,c=n._defaultStyle,h=n._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,a),a.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=o(o([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e){var n=t.x,r=t.y,o=t.w,s=t.h,h=Wi(e),u=h[0],l=h[1],f=h[2],d=h[3],p=e.borderRadius?i.getLength(e.borderRadius):0,g=e.background||c.background;return Ai(g)&&(a.fillStyle=i.handleBackground(n,r,o,s,g),Ri(a,n,r,o,s,p),a.fill()),{x:n+f,y:r+u,w:o-f-d,h:s-u-l}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var n=i.getGeometricProperty([t.x,t.y,t.col,t.row]),o=n[0],s=n[1],u=n[2],l=n[3],f=!1;(void 0===i.prizeFlag||i.prizeFlag>-1)&&(f=e===i.currIndex%i.prizes.length>>0);var d=f?h.background:t.background||c.background;if(Ai(d)){var p=(f?h.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(a.shadowColor=p[3],a.shadowOffsetX=p[0]*r.dpr,a.shadowOffsetY=p[1]*r.dpr,a.shadowBlur=p[2],p[0]>0?u-=p[0]:(u+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=i.handleBackground(o,s,u,l,d);var g=i.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Ri(a,o,s,u,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=i.prizes.length&&(v="buttons",e-=i.prizes.length),t.imgs&&t.imgs.forEach((function(n,r){var c=i.ImageCache[v];if(c[e]){var h=c[e][r];if(h){var u=f&&h.activeImg||h.defaultImg;if(u){var l=i.computedWidthAndHeight(u,n,t),d=l[0],p=l[1],g=[o+i.getOffsetX(d,t.col),s+i.getHeight(n.top,t.row)],y=g[0],m=g[1];i.drawImage(a,u,y,m,d,p)}}}})),t.fonts&&t.fonts.forEach((function(e){var n=f&&h.fontStyle?h.fontStyle:e.fontStyle||c.fontStyle,r=f&&h.fontWeight?h.fontWeight:e.fontWeight||c.fontWeight,u=f&&h.fontSize?i.getLength(h.fontSize):i.getLength(e.fontSize||c.fontSize),l=f&&h.lineHeight?h.lineHeight:e.lineHeight||c.lineHeight||e.fontSize||c.fontSize,d=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:c.wordWrap,p=e.lengthLimit||c.lengthLimit,g=e.lineClamp||c.lineClamp;a.font=r+" "+(u>>0)+"px "+n,a.fillStyle=f&&h.fontColor?h.fontColor:e.fontColor||c.fontColor;var v=[],y=String(e.text);if(d){var m=i.getWidth(p,t.col);v=Pi(a,Ti(y),(function(){return m}),g)}else v=y.split("\n");v.forEach((function(n,r){a.fillText(n,o+i.getOffsetX(a.measureText(n).width,t.col),s+i.getHeight(e.top,t.row)+(r+1)*i.getLength(l))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,i,n,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,i,n,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var h=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,i+r,e+n,i+r-n*h(s-0)]:s>=45&&s<90?c=[e,i+r,e+n-r*h(s-45),i]:s>=90&&s<135?c=[e+n,i+r,e+n-r*h(s-90),i]:s>=135&&s<180?c=[e+n,i+r,e,i+n*h(s-135)]:s>=180&&s<225?c=[e+n,i,e,i+n*h(s-180)]:s>=225&&s<270?c=[e+n,i,e+r*h(s-225),i+r]:s>=270&&s<315?c=[e,i,e+r*h(s-270),i+r]:s>=315&&s<360&&(c=[e,i,e+n,i+r-n*h(s-315)])}else s.includes("top")?c=[e,i+r,e,i]:s.includes("bottom")?c=[e,i,e,i+r]:s.includes("left")?c=[e+n,i,e,i]:s.includes("right")&&(c=[e,i,e+n,i]);var u=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,i){var n=e.split(" ");return 1===n.length?t.addColorStop(i,n[0]):2===n.length&&t.addColorStop.apply(t,n),t}),u)}(o,t,e,i,n,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=n,o=e.speed,a=0,s=0,c=0;++a;){var h=this.prizes.length*a+i-r,u=Ji(this.FPS,r,h,e.decelerationTime)-r;if(u>o){this.endIndex=o-s>u-o?h:c;break}c=h,s=u}},a.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},a.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=_i(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},a.prototype.run=function(t){var e;void 0===t&&(t=0);var i=this,n=i.rAF,r=i.step,o=i.prizes,a=i.prizeFlag,s=i.stopIndex,c=i.endIndex,h=i._defaultConfig,u=h.accelerationTime,l=h.decelerationTime,f=h.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<u){this.FPS=d/t;var v=Vi(d,.1,f-.1,u);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=Ji(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),n(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},a.prototype.getGeometricProperty=function(t){var e=t[0],i=t[1],n=t[2],r=void 0===n?1:n,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,h=this._defaultConfig.gutter,u=[this.prizeArea.x+(s+h)*e,this.prizeArea.y+(c+h)*i];return r&&a&&u.push(s*r+h*(r-1),c*a+h*(a-1)),u},a.prototype.getWidth=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellWidth*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getHeight=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellHeight*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getOffsetX=function(t,e){return void 0===e&&(e=1),(this.cellWidth*e+this._defaultConfig.gutter*(e-1)-t)/2},a.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr,e/i.dpr]},a}(Ki),tn=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.call(e)},o.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,i=this._defaultStyle,n=this.drawBlocks(),r=n.w,o=n.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,h=s.cellHeight,u=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,i){void 0===t.scroll[i]&&(t.scroll[i]=0),e.order=e.order||f;var n=e.order.length;d=Math.max(d,r+u*n),p=Math.max(p,o+l*n)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,y=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(n,r){var o=c*r,a=h*r,s=0,f=function(t,e){for(var i={},n=[],r=0;r<t.length;r++)i[r]=t[r];for(r=0;r<e.length;r++){var o=i[e[r]];o&&(n[r]=o)}return n}(t.prizes,n.order);if(f.length){f.forEach((function(r,f){if(r){var d=n.order[f],p=u*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,u]),m=v[0],w=v[1],b=v[2];s+=b;var S=r.background||i.background;if(Ai(S)){var C=t.getLength(Ei(r,"borderRadius")?r.borderRadius:i.borderRadius);Ri(y,m,w,c,c,C),y.fillStyle=S,y.fill()}r.imgs&&r.imgs.forEach((function(e,i){var n=Ii(t.ImageCache,"prizes."+d+"."+i);if(n){var r=t.computedWidthAndHeight(n,e,c,h),o=r[0],a=r[1],s=[m+t.getOffsetX(o,c),w+t.getHeight(e.top,h)],u=s[0],l=s[1];t.drawImage(y,n,u,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var n=e.fontStyle||i.fontStyle,r=e.fontWeight||i.fontWeight,o=t.getLength(e.fontSize||i.fontSize),a=e.lineHeight||i.lineHeight||e.fontSize||i.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:i.wordWrap,u=e.lengthLimit||i.lengthLimit,l=e.lineClamp||i.lineClamp;y.font=r+" "+(o>>0)+"px "+n,y.fillStyle=e.fontColor||i.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(u,c);f=Pi(y,Ti(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(i,n){y.fillText(i,m+t.getOffsetX(y.measureText(i).width,c),w+t.getHeight(e.top,h)+(n+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,h]),g=d[0],m=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,m]),x=C[0],z=C[1];t.drawImage(y,v,g,m,w,b,x,z,w,b),S+=s}}}))},o.prototype.drawBlocks=function(){var t=this,e=this;e.config;var i=e.ctx;e._defaultConfig;var n=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,h=e.h,u=Wi(r),l=u[0],f=u[1],d=u[2],p=u[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||n.background;return Ai(v)&&(Ri(i,a,s,c,h,g),i.fillStyle=v,i.fill()),r.imgs&&r.imgs.forEach((function(e,n){var r=Ii(t.ImageCache,"blocks."+o+"."+n);if(r){var u=t.computedWidthAndHeight(r,e,c,h),l=u[0],f=u[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,h)],p=d[0],g=d[1];t.drawImage(i,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:h-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,i=this,n=i.config,r=i.ctx;i._defaultConfig,i._defaultStyle,null===(t=n.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,h=o.h;if(this._offscreenCanvas){var u=this,l=u.cellWidth,f=u.cellHeight,d=u.cellAndSpacing,p=u.widthAndSpacing,g=u.heightAndSpacing;this.slots.forEach((function(t,i){var n=d*t.order.length,o=e.displacement(-(h-g)/2,-(c-p)/2),u=e.scroll[i]+o;u<0&&(u=u%n+n),u>n&&(u%=n);var v=e.displacement([l*i,u,l,h],[u,f*i,c,f]),y=v[0],m=v[1],w=v[2],b=v[3],S=e.displacement([a+p*i,s,l,h],[a,s+g*i,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,y,m,w,b,C,x,z,O)}))}},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,i=e._defaultConfig,n=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||i.speed,c=e.direction||i.direction,h=a.findIndex((function(t){return t===n[o]})),u=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*h+u*f*c-l,p=Ji(t.FPS,l,d,i.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},o.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},o.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!ki(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 "+typeof t);if(t.length!==this.slots.length)return this.stop(-1),console.error("stop(["+t+"]) 参数长度的不正确");this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},o.prototype.run=function(t){var e,i,n=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,h=r.cellAndSpacing,u=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==u.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;u.forEach((function(e,i){var r=e.order;if(r&&r.length){var o=h*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,y=0,m=n.scroll[i];if(1===a||d<l){n.FPS=d/t;var w=Vi(d,0,g,l);w===g&&(n.step=2),y=(m+w*v)%o}else if(2===a)y=(m+g*v)%o,(null==s?void 0:s.length)===u.length&&(n.step=3,n.stopScroll=[],n.endScroll=[]);else if(3===a&&p){var b=n.stopScroll[i],S=n.endScroll[i];y=Ji(p,b,S,f),p>=f&&(n.step=0)}n.scroll[i]=y}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<u.length;v++){var y=u[v],m=s[v];if(!(null===(e=y.order)||void 0===e?void 0:e.includes(m))||g!==m){g=-1;break}}null===(i=this.endCallback)||void 0===i||i.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},o.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},o.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,i=this._defaultConfig,n=i.colSpacing,r=i.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,h=o.h,u=0,l=0;return"horizontal"===t?(l=this.cellHeight=(h-r*(e-1))/e,u=this.cellWidth=l):(u=this.cellWidth=(c-n*(e-1))/e,l=this.cellHeight=u),a=this.widthAndSpacing=this.cellWidth+n,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:u,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o.prototype.getWidth=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t,e){return(e-t)/2},o}(Ki);exports.LuckyGrid=Zi,exports.LuckyWheel=Qi,exports.SlotMachine=tn; | ||
var t=function(e,n){return t=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])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};function i(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((i=i.apply(t,e||[])).next())}))}function r(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function o(t,e){for(var n=0,i=e.length,r=t.length;n<i;n++,r++)t[r]=e[n];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var c,u,h=function(t){return t&&t.Math==Math&&t},l=h("object"==typeof globalThis&&globalThis)||h("object"==typeof window&&window)||h("object"==typeof self&&self)||h("object"==typeof a&&a)||function(){return this}()||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},d=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=Function.prototype.call,g=p.bind?p.bind(p):function(){return p.apply(p,arguments)},v={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,y={f:m&&!v.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:v},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b=Function.prototype,S=b.bind,C=b.call,x=S&&S.bind(C),z=S?function(t){return t&&x(C,t)}:function(t){return t&&function(){return C.apply(t,arguments)}},O=z({}.toString),k=z("".slice),I=function(t){return k(O(t),8,-1)},E=l.Object,T=z("".split),A=f((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==I(t)?T(t,""):E(t)}:E,P=l.TypeError,_=function(t){if(null==t)throw P("Can't call method on "+t);return t},W=function(t){return A(_(t))},$=function(t){return"function"==typeof t},j=function(t){return"object"==typeof t?null!==t:$(t)},R=function(t){return $(t)?t:void 0},F=function(t,e){return arguments.length<2?R(l[t]):l[t]&&l[t][e]},D=z({}.isPrototypeOf),L=F("navigator","userAgent")||"",H=l.process,M=l.Deno,B=H&&H.versions||M&&M.version,N=B&&B.v8;N&&(u=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!u&&L&&(!(c=L.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=L.match(/Chrome\/(\d+)/))&&(u=+c[1]);var G=u,X=!!Object.getOwnPropertySymbols&&!f((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&G&&G<41})),U=X&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=l.Object,Y=U?function(t){return"symbol"==typeof t}:function(t){var e=F("Symbol");return $(e)&&D(e.prototype,q(t))},K=l.String,V=l.TypeError,J=function(t){if($(t))return t;throw V(function(t){try{return K(t)}catch(t){return"Object"}}(t)+" is not a function")},Q=l.TypeError,Z=Object.defineProperty,tt=function(t,e){try{Z(l,t,{value:e,configurable:!0,writable:!0})}catch(n){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),nt=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),it=l.Object,rt=function(t){return it(_(t))},ot=z({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ut=z(1..toString),ht=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ut(++st+ct,36)},lt=nt("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ht,gt=function(t){if(!at(lt,t)||!X&&"string"!=typeof lt[t]){var e="Symbol."+t;X&&at(ft,t)?lt[t]=ft[t]:lt[t]=U&&dt?dt(e):pt(e)}return lt[t]},vt=l.TypeError,mt=gt("toPrimitive"),yt=function(t,e){if(!j(t)||Y(t))return t;var n,i,r=null==(n=t[mt])?void 0:J(n);if(r){if(void 0===e&&(e="default"),i=g(r,t,e),!j(i)||Y(i))return i;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,i;if("string"===e&&$(n=t.toString)&&!j(i=g(n,t)))return i;if($(n=t.valueOf)&&!j(i=g(n,t)))return i;if("string"!==e&&$(n=t.toString)&&!j(i=g(n,t)))return i;throw Q("Can't convert object to primitive value")}(t,e)},wt=function(t){var e=yt(t,"string");return Y(e)?e:e+""},bt=l.document,St=j(bt)&&j(bt.createElement),Ct=function(t){return St?bt.createElement(t):{}},xt=!d&&!f((function(){return 7!=Object.defineProperty(Ct("div"),"a",{get:function(){return 7}}).a})),zt=Object.getOwnPropertyDescriptor,Ot={f:d?zt:function(t,e){if(t=W(t),e=wt(e),xt)try{return zt(t,e)}catch(t){}if(at(t,e))return w(!g(y.f,t,e),t[e])}},kt=l.String,It=l.TypeError,Et=function(t){if(j(t))return t;throw It(kt(t)+" is not an object")},Tt=l.TypeError,At=Object.defineProperty,Pt={f:d?At:function(t,e,n){if(Et(t),e=wt(e),Et(n),xt)try{return At(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Tt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},_t=d?function(t,e,n){return Pt.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},Wt=z(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Wt(t)});var $t,jt,Rt,Ft=et.inspectSource,Dt=l.WeakMap,Lt=$(Dt)&&/native code/.test(Ft(Dt)),Ht=nt("keys"),Mt=function(t){return Ht[t]||(Ht[t]=ht(t))},Bt={},Nt=l.TypeError,Gt=l.WeakMap;if(Lt||et.state){var Xt=et.state||(et.state=new Gt),Ut=z(Xt.get),qt=z(Xt.has),Yt=z(Xt.set);$t=function(t,e){if(qt(Xt,t))throw new Nt("Object already initialized");return e.facade=t,Yt(Xt,t,e),e},jt=function(t){return Ut(Xt,t)||{}},Rt=function(t){return qt(Xt,t)}}else{var Kt=Mt("state");Bt[Kt]=!0,$t=function(t,e){if(at(t,Kt))throw new Nt("Object already initialized");return e.facade=t,_t(t,Kt,e),e},jt=function(t){return at(t,Kt)?t[Kt]:{}},Rt=function(t){return at(t,Kt)}}var Vt,Jt={set:$t,get:jt,has:Rt,enforce:function(t){return Rt(t)?jt(t):$t(t,{})},getterFor:function(t){return function(e){var n;if(!j(e)||(n=jt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return n}}},Qt=Function.prototype,Zt=d&&Object.getOwnPropertyDescriptor,te=at(Qt,"name"),ee={EXISTS:te,PROPER:te&&"something"===function(){}.name,CONFIGURABLE:te&&(!d||d&&Zt(Qt,"name").configurable)},ne=s((function(t){var e=ee.CONFIGURABLE,n=Jt.get,i=Jt.enforce,r=String(String).split("String");(t.exports=function(t,n,o,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,h=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:n;$(o)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!at(o,"name")||e&&o.name!==f)&&_t(o,"name",f),(s=i(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!h&&t[n]&&(u=!0):delete t[n],u?t[n]=o:_t(t,n,o)):u?t[n]=o:tt(n,o)})(Function.prototype,"toString",(function(){return $(this)&&n(this).source||Ft(this)}))})),ie=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ie)(e)},ae=Math.max,se=Math.min,ce=Math.min,ue=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},he=function(t){return function(e,n,i){var r,o=W(e),a=ue(o),s=function(t,e){var n=oe(t);return n<0?ae(n+e,0):se(n,e)}(i,a);if(t&&n!=n){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},le={includes:he(!0),indexOf:he(!1)},fe=le.indexOf,de=z([].push),pe=function(t,e){var n,i=W(t),r=0,o=[];for(n in i)!at(Bt,n)&&at(i,n)&&de(o,n);for(;e.length>r;)at(i,n=e[r++])&&(~fe(o,n)||de(o,n));return o},ge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ve=ge.concat("length","prototype"),me={f:Object.getOwnPropertyNames||function(t){return pe(t,ve)}},ye={f:Object.getOwnPropertySymbols},we=z([].concat),be=F("Reflect","ownKeys")||function(t){var e=me.f(Et(t)),n=ye.f;return n?we(e,n(t)):e},Se=function(t,e){for(var n=be(e),i=Pt.f,r=Ot.f,o=0;o<n.length;o++){var a=n[o];at(t,a)||i(t,a,r(e,a))}},Ce=/#|\.prototype\./,xe=function(t,e){var n=Oe[ze(t)];return n==Ie||n!=ke&&($(e)?f(e):!!e)},ze=xe.normalize=function(t){return String(t).replace(Ce,".").toLowerCase()},Oe=xe.data={},ke=xe.NATIVE="N",Ie=xe.POLYFILL="P",Ee=xe,Te=Ot.f,Ae=function(t,e){var n,i,r,o,a,s=t.target,c=t.global,u=t.stat;if(n=c?l:u?l[s]||tt(s,{}):(l[s]||{}).prototype)for(i in e){if(o=e[i],r=t.noTargetGet?(a=Te(n,i))&&a.value:n[i],!Ee(c?i:s+(u?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ne(n,i,o,t)}},Pe=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var n,i=W(e),r=Pe(e),o=r.length,a=0;o>a;)Pt.f(t,n=r[a++],i[n]);return t},We=F("document","documentElement"),$e=Mt("IE_PROTO"),je=function(){},Re=function(t){return"<script>"+t+"<\/script>"},Fe=function(t){t.write(Re("")),t.close();var e=t.parentWindow.Object;return t=null,e},De=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;De="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",We.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Re("document.F=Object")),t.close(),t.F):Fe(Vt);for(var n=ge.length;n--;)delete De.prototype[ge[n]];return De()};Bt[$e]=!0;var Le=Object.create||function(t,e){var n;return null!==t?(je.prototype=Et(t),n=new je,je.prototype=null,n[$e]=t):n=De(),void 0===e?n:_e(n,e)},He=gt("unscopables"),Me=Array.prototype;null==Me[He]&&Pt.f(Me,He,{configurable:!0,value:Le(null)});var Be=function(t){Me[He][t]=!0},Ne=le.includes;Ae({target:"Array",proto:!0},{includes:function(t){return Ne(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("includes"),Ae({target:"Object",stat:!0,forced:!d,sham:!d},{defineProperty:Pt.f});var Ge=gt("match"),Xe=l.TypeError,Ue=function(t){if(function(t){var e;return j(t)&&(void 0!==(e=t[Ge])?!!e:"RegExp"==I(t))}(t))throw Xe("The method doesn't accept regular expressions");return t},qe={};qe[gt("toStringTag")]="z";var Ye="[object z]"===String(qe),Ke=gt("toStringTag"),Ve=l.Object,Je="Arguments"==I(function(){return arguments}()),Qe=Ye?I:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?n:Je?I(e):"Object"==(i=I(e))&&$(e.callee)?"Arguments":i},Ze=l.String,tn=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},en=gt("match"),nn=z("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[en]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~nn(tn(_(this)),tn(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var rn,on,an=le.indexOf,sn=z([].indexOf),cn=!!sn&&1/sn([1],1,-0)<0,un=!!(on=[]["indexOf"])&&f((function(){on.call(null,rn||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:cn||!un},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return cn?sn(this,t,e)||0:an(this,t,e)}});var hn=z(z.bind),ln=Array.isArray||function(t){return"Array"==I(t)},fn=function(){},dn=[],pn=F("Reflect","construct"),gn=/^\s*(?:class|function)\b/,vn=z(gn.exec),mn=!gn.exec(fn),yn=function(t){if(!$(t))return!1;try{return pn(fn,dn,t),!0}catch(t){return!1}},wn=!pn||f((function(){var t;return yn(yn.call)||!yn(Object)||!yn((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return mn||!!vn(gn,Ft(t))}:yn,bn=gt("species"),Sn=l.Array,Cn=function(t,e){return new(function(t){var e;return ln(t)&&(e=t.constructor,(wn(e)&&(e===Sn||ln(e.prototype))||j(e)&&null===(e=e[bn]))&&(e=void 0)),void 0===e?Sn:e}(t))(0===e?0:e)},xn=z([].push),zn=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,u,h,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hn?hn(t,e):function(){return t.apply(e,arguments)}}(u,h),m=ue(g),y=0,w=l||Cn,b=e?w(c,m):n||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:xn(b,f)}else switch(t){case 4:return!1;case 7:xn(b,f)}return o?-1:i||r?r:b}},On={forEach:zn(0),map:zn(1),filter:zn(2),some:zn(3),every:zn(4),find:zn(5),findIndex:zn(6),filterReject:zn(7)}.find,kn=!0;"find"in[]&&Array(1).find((function(){kn=!1})),Ae({target:"Array",proto:!0,forced:kn},{find:function(t){return On(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find");var In=Ye?{}.toString:function(){return"[object "+Qe(this)+"]"};Ye||ne(Object.prototype,"toString",In,{unsafe:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:i-Math.abs(a),0);for(;s<i;){if((r=n[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var o=e[r];if(t.call(i,o,r,e))return o;r++}}});var En=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Tn=function(t,e){for(var n=0,i=e.split(".");n<i.length;n++){var r=t[i[n]];if(!En(r,"object","array"))return r;t=r}return t},An=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Pn=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},_n=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(n=e)?0:"object"==typeof n?NaN:"number"==typeof n?n:"string"==typeof n?"%"===n[n.length-1]?Number(n.slice(0,-1))/100:Number(n):NaN))return!1}var n;return!0},Wn=function(t){var e,n=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],i=0,r=0,o=0,a=0;switch(n.length){case 1:i=r=o=a=n[0];break;case 2:i=r=n[0],o=a=n[1];break;case 3:i=n[0],o=a=n[1],r=n[2];break;default:i=n[0],r=n[1],o=n[2],a=n[3]}var s={paddingTop:i,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&En(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[i,r,o,a]},$n=function(t){var e=[],n=t.map((function(t){return Number(t)})).reduce((function(t,n){if(n>0){var i=t+n;return e.push(i),i}return e.push(NaN),t}),0),i=Math.random()*n;return e.findIndex((function(t){return i<=t}))},jn=function(t,e,n,i){void 0===i&&(i=1/0),i<=0&&(i=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,u=n(o);if(i===o.length+1&&(c+=a),u<0)return o;if(c>u&&(o.push(r.slice(0,-1)),r=e[s]),i===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Rn=function(t){return Math.PI/180*t},Fn=function(t,e,n,i,r,o){t.beginPath();var a,s,c=Rn(90/Math.PI/n*o),u=i+c,h=r-c;t.arc(0,0,n,u,h,!1),t.lineTo.apply(t,(a=(i+r)/2,s=o/2/Math.abs(Math.sin((i-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Dn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),u=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+s,r),t.lineTo(i+o-s,r),t.arc(i+o-s,r+s,s,-u/2,0),t.lineTo(i+o,r+a-s),t.arc(i+o-s,r+a-s,s,0,u/2),t.lineTo(i+s,r+a),t.arc(i+s,r+a-s,s,u/2,u),t.lineTo(i,r+s),t.arc(i+s,r+s,s,u,-u/2),t.closePath()},Ln=function(t,e,n,i,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,u=t.height;a.width=c,a.height=u;var h=c/i;return Dn(s,e*h,n*h,i*h,r*h,o*h),s.clip(),s.drawImage(t,0,0,c,u),a},Hn=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;n.width=r,n.height=o,i.drawImage(t,0,0,r,o);var a=i.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var n=Math.ceil(t),i=e*e,r=2*i,o=1/(2*Math.PI*i),a=[],s=0,c=-n;c<=n;c++)for(var u=-n;u<=n;u++){var h=o*Math.exp(-(c*c+u*u)/r);a.push(h),s+=h}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),i.putImageData(a,0,0),n},Mn=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Bn="__proto__"in{};function Nn(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var Gn=Array.prototype,Xn=Object.create(Gn);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Xn[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=Gn[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),i}}));var Un=function(){function t(t){this.dep=new Mn,Nn(t,"__luckyOb__",this),Array.isArray(t)&&(Bn?t.__proto__=Xn:Object.getOwnPropertyNames(Xn).forEach((function(e){Nn(t,e,Xn[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Yn(t,e,t[e])}))},t}();function qn(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Un(t)}function Yn(t,e,n){var i=new Mn,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(n=t[e]);var s=qn(n);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):n;return Mn.target&&(i.addSub(Mn.target),s&&s.dep.addSub(Mn.target)),e},set:function(e){e!==n&&(n=e,o&&!a||(a?a.call(t,e):n=e,s=qn(e),i.notify()))}})}}var Kn=0,Vn=function(){function t(t,e,n,i){void 0===i&&(i={}),this.id=Kn++,this.$lucky=t,this.expr=e,this.deep=!!i.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],n="",i=0;i<t.length;i++){var r=t[i];if(/\[|\./.test(r))e.push(n),n="";else{if(/\W/.test(r))continue;n+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=n,this.value=this.get()}return t.prototype.get=function(){Mn.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){En(t,"array","object")&&Object.keys(t).forEach((function(n){var i=t[n];e(i)}))};e(t)}(t),Mn.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),Jn=function(){function t(t,e){var n=this;this.version="1.7.12",this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","".concat("lucky-canvas","@").concat("1.7.12")),t.canvasElement.addEventListener("click",(function(t){return n.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var n=null;return function(){for(var i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){t.apply(i,r),clearTimeout(n),n=null}),e))}}((function(){return n.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){n.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],n=t[1];this.ctx.clearRect(-e,-n,2*e,2*n)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,n=0,i=0;t.divElement&&(n=t.divElement.offsetWidth,i=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||n,this.boxHeight=this.getLength(e.height||t.height)||i,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,n=t.canvasElement,i=t.dpr,r=[this.boxWidth*i,this.boxHeight*i],o=r[0],a=r[1];n&&(n.width=o,n.height=a,n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),n.style["transform-origin"]="left top",n.style.transform="scale(".concat(1/i,")"),e.scale(i,i))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,n){var i=this;return void 0===n&&(n="$resolve"),new Promise((function(r,o){if(t||o("=> '".concat(e.src,"' 不能为空或不合法")),"WEB"!==i.config.flag)return e[n]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '".concat(e.src,"' 图片加载失败"))},a.src=t}))},t.prototype.drawImage=function(t,e){for(var n,i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))n=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");n=e.path}return 8===i.length&&(i=i.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([n],i))},t.prototype.getLength=function(t){return En(t,"number")?t:En(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var n=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,i,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*n.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(i);var a=n.config.unitFunc;return a?a(i,r):i})))},t.prototype.computedWidthAndHeight=function(t,e,n,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,n);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,i);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,n),this.getHeight(e.height,i)]},t.prototype.getWidth=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getHeight=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getOffsetX=function(t,e){return void 0===e&&(e=0),(e-t)/2},t.prototype.getOffscreenCanvas=function(t,e){if(!An(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var n=this.config.dpr,i=this._offscreenCanvas;i.width=(t||300)*n,i.height=(e||150)*n;var r=i.getContext("2d");return r.clearRect(0,0,t,e),r.scale(n,n),r.dpr=n,{_offscreenCanvas:i,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=n.map((function(t){return e.getLength(t)}));return Ln.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;if(n.width=r,n.height=o,"string"==typeof i.filter)i.filter="opacity(".concat(e,"%)"),i.drawImage(t,0,0,r,o);else{i.drawImage(t,0,0,r,o);for(var a=i.getImageData(0,0,r,o),s=a.data,c=s.length,u=0;u<c;u+=4){var h=s[u+3];0!==h&&(s[u+3]=h*e/100)}i.putImageData(a,0,0)}return n}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Hn(t,this.getLength(e))},t.prototype.$set=function(t,e,n){t&&"object"==typeof t&&Yn(t,e,n)},t.prototype.$computed=function(t,e,n){var i=this;Object.defineProperty(t,e,{get:function(){return n.call(i)}})},t.prototype.$watch=function(t,e,n){void 0===n&&(n={}),"object"==typeof e&&(e=(n=e).handler);var i=new Vn(this,t,e,n);return n.immediate&&e.call(this,i.value),function(){}},t}(),Qn=function(t,e,n,i){return t>=i&&(t=i),n*(t/=i)*t+e},Zn=function(t,e,n,i){return t>=i&&(t=i),-n*(t/=i)*(t-2)+e},ti=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return n({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return n({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},o.prototype.handleClick=function(t){var e,n=this.ctx;n.beginPath(),n.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),n.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]),i.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(i,t)),u[n][e][o]=t,r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},o.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,a=i._defaultConfig,s=i._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,i){return _n(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=n.ImageCache.blocks;if(a&&a[i]){var s=a[i][r];if(s){var c=n.computedWidthAndHeight(s,e,2*t,2*t),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Rn(n.rotateDeg)),n.drawImage(o,s,f,d,u,h),o.restore()}}})),t-n.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Rn(this.prizeDeg);var c=Rn(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),u=function(t){return n.getOffsetX(o.measureText(t).width)},h=function(t,e,i){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return n.getHeight(t.top,e)+(i+1)*n.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var i=c+e*n.prizeRadian,r=n.prizeRadius-n.maxBtnRadius,l=t.background||s.background;_n(l)&&(o.fillStyle=l,Fn(o,n.maxBtnRadius,n.prizeRadius,i-n.prizeRadian/2,i+n.prizeRadian/2,n.getLength(a.gutter)),o.fill());var f=Math.cos(i)*n.prizeRadius,d=Math.sin(i)*n.prizeRadius;o.translate(f,d),o.rotate(i+Rn(90)),t.imgs&&t.imgs.forEach((function(t,i){var a=n.ImageCache.prizes;if(a&&a[e]){var s=a[e][i];if(s){var c=n.computedWidthAndHeight(s,t,n.prizeRadian*n.prizeRadius,r),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,r)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,i=t.fontWeight||s.fontWeight,c=n.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font="".concat(i," ").concat(c>>0,"px ").concat(l);var g=String(t.text);(f?jn(o,Pn(g),(function(e){var i=2*((n.prizeRadius-h(t,r,e.length))*Math.tan(n.prizeRadian/2))-n.getLength(a.gutter);return n.getWidth(d,i)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,n){o.fillText(e,u(e),h(t,r,n))}))})),o.rotate(Rn(360)-i-Rn(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var i=n.getHeight(t.radius,n.prizeRadius);n.maxBtnRadius=Math.max(n.maxBtnRadius,i),_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,i,0,2*Math.PI,!1),o.fill()),t.pointer&&_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-i,0),o.lineTo(i,0),o.lineTo(0,2*-i),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=n.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=n.computedWidthAndHeight(s,t,2*i,2*i),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,i)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=n.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font="".concat(r," ").concat(a>>0,"px ").concat(c),String(t.text).split("\n").forEach((function(e,n){o.fillText(e,u(e),h(t,i,n))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*i-i/2)*this.getLength(e.stopRange),c=0,u=0,h=0;++c;){var l=360*c-n*i-r-e.offsetDegree+s-i/2,f=Zn(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-u>f-a?l:h;break}h=l,u=f}},o.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},o.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=$n(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},o.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizeFlag,a=n.stopDeg,s=n.endDeg,c=n._defaultConfig,u=c.accelerationTime,h=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<u){this.FPS=f/t;var g=Qn(f,0,l,u);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=Zn(d,a,s,h),d>=h&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},o.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr-this.Radius,e/n.dpr-this.Radius]},o}(Jn),ei=function(t){function a(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},a.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},a.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},a.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return n({background:"#ffce98",shadow:""},t.activeStyle)}))},a.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},a.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n=t.buttons.map((function(t){return t.imgs}));t.button&&n.push(t.button.imgs);var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:n};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},a.prototype.handleClick=function(t){var e=this,n=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(i){var r;if(i){var o=e.getGeometricProperty([i.x,i.y,i.col||1,i.row||1]),a=o[0],s=o[1],c=o[2],u=o[3];n.beginPath(),n.rect(a,s,c,u),n.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof i.callback&&i.callback.call(e,i),null===(r=e.startCallback)||void 0===r||r.call(e,t,i))}}))},a.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if("buttons"===t&&!i.buttons.length&&i.button&&(s=i.button),s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]);var h=[i.loadImg(c.src,c),c.activeSrc&&i.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(h).then((function(t){var a=t[0],s=t[1],h=c.formatter;"function"==typeof h&&(a=h.call(i,a),s&&(s=h.call(i,s))),u[n][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},a.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,a=i.ctx,s=i._defaultConfig,c=i._defaultStyle,u=i._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,a),a.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=o(o([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e,i){var r=t.x,o=t.y,s=t.w,u=t.h,h=Wn(e),l=h[0],f=h[1],d=h[2],p=h[3],g=e.borderRadius?n.getLength(e.borderRadius):0,v=e.background||c.background;return _n(v)&&(a.fillStyle=n.handleBackground(r,o,s,u,v),Dn(a,r,o,s,u,g),a.fill()),e.imgs&&e.imgs.forEach((function(t,e){var c=Tn(n.ImageCache,"blocks.".concat(i,".").concat(e,".defaultImg"));if(c){var h=n.computedWidthAndHeight(c,t,s,u),l=h[0],f=h[1],d=[n.getOffsetX(l,s),n.getHeight(t.top,u)],p=d[0],g=d[1];n.drawImage(a,c,r+p,o+g,l,f)}})),{x:r+d,y:o+l,w:s-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var i=n.getGeometricProperty([t.x,t.y,t.col,t.row]),o=i[0],s=i[1],h=i[2],l=i[3],f=!1;(void 0===n.prizeFlag||n.prizeFlag>-1)&&(f=e===n.currIndex%n.prizes.length>>0);var d=f?u.background:t.background||c.background;if(_n(d)){var p=(f?u.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(a.shadowColor=p[3],a.shadowOffsetX=p[0]*r.dpr,a.shadowOffsetY=p[1]*r.dpr,a.shadowBlur=p[2],p[0]>0?h-=p[0]:(h+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=n.handleBackground(o,s,h,l,d);var g=n.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Dn(a,o,s,h,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=n.prizes.length&&(v="buttons",e-=n.prizes.length),t.imgs&&t.imgs.forEach((function(t,i){var r=n.ImageCache[v];if(r[e]){var c=r[e][i];if(c){var u=f&&c.activeImg||c.defaultImg;if(u){var d=n.computedWidthAndHeight(u,t,h,l),p=d[0],g=d[1],m=[o+n.getOffsetX(p,h),s+n.getHeight(t.top,l)],y=m[0],w=m[1];n.drawImage(a,u,y,w,p,g)}}}})),t.fonts&&t.fonts.forEach((function(t){var e=f&&u.fontStyle?u.fontStyle:t.fontStyle||c.fontStyle,i=f&&u.fontWeight?u.fontWeight:t.fontWeight||c.fontWeight,r=f&&u.fontSize?n.getLength(u.fontSize):n.getLength(t.fontSize||c.fontSize),d=f&&u.lineHeight?u.lineHeight:t.lineHeight||c.lineHeight||t.fontSize||c.fontSize,p=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:c.wordWrap,g=t.lengthLimit||c.lengthLimit,v=t.lineClamp||c.lineClamp;a.font="".concat(i," ").concat(r>>0,"px ").concat(e),a.fillStyle=f&&u.fontColor?u.fontColor:t.fontColor||c.fontColor;var m=[],y=String(t.text);if(p){var w=n.getWidth(g,h);m=jn(a,Pn(y),(function(){return w}),v)}else m=y.split("\n");m.forEach((function(e,i){a.fillText(e,o+n.getOffsetX(a.measureText(e).width,h),s+n.getHeight(t.top,l)+(i+1)*n.getLength(d))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,n,i,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,n,i,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var u=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,n+r,e+i,n+r-i*u(s-0)]:s>=45&&s<90?c=[e,n+r,e+i-r*u(s-45),n]:s>=90&&s<135?c=[e+i,n+r,e+i-r*u(s-90),n]:s>=135&&s<180?c=[e+i,n+r,e,n+i*u(s-135)]:s>=180&&s<225?c=[e+i,n,e,n+i*u(s-180)]:s>=225&&s<270?c=[e+i,n,e+r*u(s-225),n+r]:s>=270&&s<315?c=[e,n,e+r*u(s-270),n+r]:s>=315&&s<360&&(c=[e,n,e+i,n+r-i*u(s-315)])}else s.includes("top")?c=[e,n+r,e,n]:s.includes("bottom")?c=[e,n,e,n+r]:s.includes("left")?c=[e+i,n,e,n]:s.includes("right")&&(c=[e,n,e+i,n]);var h=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,n){var i=e.split(" ");return 1===i.length?t.addColorStop(n,i[0]):2===i.length&&t.addColorStop.apply(t,i),t}),h)}(o,t,e,n,i,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=i,o=e.speed,a=0,s=0,c=0;++a;){var u=this.prizes.length*a+n-r,h=Zn(this.FPS,r,u,e.decelerationTime)-r;if(h>o){this.endIndex=o-s>h-o?u:c;break}c=u,s=h}},a.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},a.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=$n(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},a.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizes,a=n.prizeFlag,s=n.stopIndex,c=n.endIndex,u=n._defaultConfig,h=u.accelerationTime,l=u.decelerationTime,f=u.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<h){this.FPS=d/t;var v=Qn(d,.1,f-.1,h);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=Zn(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},a.prototype.getGeometricProperty=function(t){var e=t[0],n=t[1],i=t[2],r=void 0===i?1:i,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,u=this._defaultConfig.gutter,h=[this.prizeArea.x+(s+u)*e,this.prizeArea.y+(c+u)*n];return r&&a&&h.push(s*r+u*(r-1),c*a+u*(a-1)),h},a.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr,e/n.dpr]},a}(Jn),ni=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]),i.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(i,t)),u[n][e][o]=t,r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,n=this._defaultStyle,i=this.drawBlocks(),r=i.w,o=i.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,u=s.cellHeight,h=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,n){void 0===t.scroll[n]&&(t.scroll[n]=0),e.order=e.order||f;var i=e.order.length;d=Math.max(d,r+h*i),p=Math.max(p,o+l*i)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(i,r){var o=c*r,a=u*r,s=0,f=function(t,e){for(var n={},i=[],r=0;r<t.length;r++)n[r]=t[r];for(r=0;r<e.length;r++){var o=n[e[r]];o&&(i[r]=o)}return i}(t.prizes,i.order);if(f.length){f.forEach((function(r,f){if(r){var d=i.order[f],p=h*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,h]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||n.background;if(_n(S)){var C=t.getLength(An(r,"borderRadius")?r.borderRadius:n.borderRadius);Dn(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,n){var i=Tn(t.ImageCache,"prizes.".concat(d,".").concat(n));if(i){var r=t.computedWidthAndHeight(i,e,c,u),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,u)],h=s[0],l=s[1];t.drawImage(m,i,h,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var i=e.fontStyle||n.fontStyle,r=e.fontWeight||n.fontWeight,o=t.getLength(e.fontSize||n.fontSize),a=e.lineHeight||n.lineHeight||e.fontSize||n.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:n.wordWrap,h=e.lengthLimit||n.lengthLimit,l=e.lineClamp||n.lineClamp;m.font="".concat(r," ").concat(o>>0,"px ").concat(i),m.fillStyle=e.fontColor||n.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(h,c);f=jn(m,Pn(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(n,i){m.fillText(n,y+t.getOffsetX(m.measureText(n).width,c),w+t.getHeight(e.top,u)+(i+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,u]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),x=C[0],z=C[1];t.drawImage(m,v,g,y,w,b,x,z,w,b),S+=s}}}))},o.prototype.drawBlocks=function(){var t=this,e=this;e.config;var n=e.ctx;e._defaultConfig;var i=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,u=e.h,h=Wn(r),l=h[0],f=h[1],d=h[2],p=h[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||i.background;return _n(v)&&(Dn(n,a,s,c,u,g),n.fillStyle=v,n.fill()),r.imgs&&r.imgs.forEach((function(e,i){var r=Tn(t.ImageCache,"blocks.".concat(o,".").concat(i));if(r){var h=t.computedWidthAndHeight(r,e,c,u),l=h[0],f=h[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,u)],p=d[0],g=d[1];t.drawImage(n,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,n=this,i=n.config,r=n.ctx;n._defaultConfig,n._defaultStyle,null===(t=i.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,u=o.h;if(this._offscreenCanvas){var h=this,l=h.cellWidth,f=h.cellHeight,d=h.cellAndSpacing,p=h.widthAndSpacing,g=h.heightAndSpacing;this.slots.forEach((function(t,n){var i=d*t.order.length,o=e.displacement(-(u-g)/2,-(c-p)/2),h=e.scroll[n]+o;h<0&&(h=h%i+i),h>i&&(h%=i);var v=e.displacement([l*n,h,l,u],[h,f*n,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*n,s,l,u],[a,s+g*n,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,x,z,O)}))}},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,n=e._defaultConfig,i=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||n.speed,c=e.direction||n.direction,u=a.findIndex((function(t){return t===i[o]})),h=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*u+h*f*c-l,p=Zn(t.FPS,l,d,n.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},o.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},o.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!En(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 ".concat(typeof t));if(t.length!==this.slots.length)return this.stop(-1),console.error("stop([".concat(t,"]) 参数长度的不正确"));this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},o.prototype.run=function(t){var e,n,i=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,u=r.cellAndSpacing,h=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==h.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;h.forEach((function(e,n){var r=e.order;if(r&&r.length){var o=u*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=i.scroll[n];if(1===a||d<l){i.FPS=d/t;var w=Qn(d,0,g,l);w===g&&(i.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===h.length&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===a&&p){var b=i.stopScroll[n],S=i.endScroll[n];m=Zn(p,b,S,f),p>=f&&(i.step=0)}i.scroll[n]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<h.length;v++){var m=h[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(n=this.endCallback)||void 0===n||n.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},o.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},o.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,n=this._defaultConfig,i=n.colSpacing,r=n.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,u=o.h,h=0,l=0;return"horizontal"===t?(l=this.cellHeight=(u-r*(e-1))/e,h=this.cellWidth=l):(h=this.cellWidth=(c-i*(e-1))/e,l=this.cellHeight=h),a=this.widthAndSpacing=this.cellWidth+i,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:h,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o}(Jn);exports.LuckyGrid=ei,exports.LuckyWheel=ti,exports.SlotMachine=ni; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -15,3 +15,3 @@ /*! ***************************************************************************** | ||
***************************************************************************** */ | ||
var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};function e(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function n(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function r(t,e){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function o(t,e){for(var i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}var c,h,u=function(t){return t&&t.Math==Math&&t},l=u("object"==typeof globalThis&&globalThis)||u("object"==typeof window&&window)||u("object"==typeof self&&self)||u("object"==typeof a&&a)||function(){return this}()||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},d=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=Function.prototype.call,g=p.bind?p.bind(p):function(){return p.apply(p,arguments)},v={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,y={f:m&&!v.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:v},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b=Function.prototype,S=b.bind,C=b.call,z=S&&S.bind(C),x=S?function(t){return t&&z(C,t)}:function(t){return t&&function(){return C.apply(t,arguments)}},O=x({}.toString),k=x("".slice),I=function(t){return k(O(t),8,-1)},E=l.Object,T=x("".split),A=f((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==I(t)?T(t,""):E(t)}:E,W=l.TypeError,_=function(t){if(null==t)throw W("Can't call method on "+t);return t},P=function(t){return A(_(t))},$=function(t){return"function"==typeof t},R=function(t){return"object"==typeof t?null!==t:$(t)},j=function(t){return $(t)?t:void 0},F=function(t,e){return arguments.length<2?j(l[t]):l[t]&&l[t][e]},H=x({}.isPrototypeOf),D=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(h=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!h&&D&&(!(c=D.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=D.match(/Chrome\/(\d+)/))&&(h=+c[1]);var X=h,G=!!Object.getOwnPropertySymbols&&!f((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),U=G&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=l.Object,Y=U?function(t){return"symbol"==typeof t}:function(t){var e=F("Symbol");return $(e)&&H(e.prototype,q(t))},K=l.String,V=l.TypeError,J=function(t){if($(t))return t;throw V(function(t){try{return K(t)}catch(t){return"Object"}}(t)+" is not a function")},Q=l.TypeError,Z=Object.defineProperty,tt=function(t,e){try{Z(l,t,{value:e,configurable:!0,writable:!0})}catch(i){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),it=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),nt=l.Object,rt=function(t){return nt(_(t))},ot=x({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ht=x(1..toString),ut=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ht(++st+ct,36)},lt=it("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ut,gt=function(t){if(!at(lt,t)||!G&&"string"!=typeof lt[t]){var e="Symbol."+t;G&&at(ft,t)?lt[t]=ft[t]:lt[t]=U&&dt?dt(e):pt(e)}return lt[t]},vt=l.TypeError,mt=gt("toPrimitive"),yt=function(t,e){if(!R(t)||Y(t))return t;var i,n,r=null==(i=t[mt])?void 0:J(i);if(r){if(void 0===e&&(e="default"),n=g(r,t,e),!R(n)||Y(n))return n;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var i,n;if("string"===e&&$(i=t.toString)&&!R(n=g(i,t)))return n;if($(i=t.valueOf)&&!R(n=g(i,t)))return n;if("string"!==e&&$(i=t.toString)&&!R(n=g(i,t)))return n;throw Q("Can't convert object to primitive value")}(t,e)},wt=function(t){var e=yt(t,"string");return Y(e)?e:e+""},bt=l.document,St=R(bt)&&R(bt.createElement),Ct=function(t){return St?bt.createElement(t):{}},zt=!d&&!f((function(){return 7!=Object.defineProperty(Ct("div"),"a",{get:function(){return 7}}).a})),xt=Object.getOwnPropertyDescriptor,Ot={f:d?xt:function(t,e){if(t=P(t),e=wt(e),zt)try{return xt(t,e)}catch(t){}if(at(t,e))return w(!g(y.f,t,e),t[e])}},kt=l.String,It=l.TypeError,Et=function(t){if(R(t))return t;throw It(kt(t)+" is not an object")},Tt=l.TypeError,At=Object.defineProperty,Wt={f:d?At:function(t,e,i){if(Et(t),e=wt(e),Et(i),zt)try{return At(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Tt("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},_t=d?function(t,e,i){return Wt.f(t,e,w(1,i))}:function(t,e,i){return t[e]=i,t},Pt=x(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Pt(t)});var $t,Rt,jt,Ft=et.inspectSource,Ht=l.WeakMap,Dt=$(Ht)&&/native code/.test(Ft(Ht)),Lt=it("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ut(t))},Bt={},Nt=l.TypeError,Xt=l.WeakMap;if(Dt||et.state){var Gt=et.state||(et.state=new Xt),Ut=x(Gt.get),qt=x(Gt.has),Yt=x(Gt.set);$t=function(t,e){if(qt(Gt,t))throw new Nt("Object already initialized");return e.facade=t,Yt(Gt,t,e),e},Rt=function(t){return Ut(Gt,t)||{}},jt=function(t){return qt(Gt,t)}}else{var Kt=Mt("state");Bt[Kt]=!0,$t=function(t,e){if(at(t,Kt))throw new Nt("Object already initialized");return e.facade=t,_t(t,Kt,e),e},Rt=function(t){return at(t,Kt)?t[Kt]:{}},jt=function(t){return at(t,Kt)}}var Vt,Jt={set:$t,get:Rt,has:jt,enforce:function(t){return jt(t)?Rt(t):$t(t,{})},getterFor:function(t){return function(e){var i;if(!R(e)||(i=Rt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return i}}},Qt=Function.prototype,Zt=d&&Object.getOwnPropertyDescriptor,te=at(Qt,"name"),ee={EXISTS:te,PROPER:te&&"something"===function(){}.name,CONFIGURABLE:te&&(!d||d&&Zt(Qt,"name").configurable)},ie=s((function(t){var e=ee.CONFIGURABLE,i=Jt.get,n=Jt.enforce,r=String(String).split("String");(t.exports=function(t,i,o,a){var s,c=!!a&&!!a.unsafe,h=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:i;$(o)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!at(o,"name")||e&&o.name!==f)&&_t(o,"name",f),(s=n(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!u&&t[i]&&(h=!0):delete t[i],h?t[i]=o:_t(t,i,o)):h?t[i]=o:tt(i,o)})(Function.prototype,"toString",(function(){return $(this)&&i(this).source||Ft(this)}))})),ne=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ne)(e)},ae=Math.max,se=Math.min,ce=Math.min,he=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},ue=function(t){return function(e,i,n){var r,o=P(e),a=he(o),s=function(t,e){var i=oe(t);return i<0?ae(i+e,0):se(i,e)}(n,a);if(t&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===i)return t||s||0;return!t&&-1}},le={includes:ue(!0),indexOf:ue(!1)},fe=le.indexOf,de=x([].push),pe=function(t,e){var i,n=P(t),r=0,o=[];for(i in n)!at(Bt,i)&&at(n,i)&&de(o,i);for(;e.length>r;)at(n,i=e[r++])&&(~fe(o,i)||de(o,i));return o},ge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ve=ge.concat("length","prototype"),me={f:Object.getOwnPropertyNames||function(t){return pe(t,ve)}},ye={f:Object.getOwnPropertySymbols},we=x([].concat),be=F("Reflect","ownKeys")||function(t){var e=me.f(Et(t)),i=ye.f;return i?we(e,i(t)):e},Se=function(t,e){for(var i=be(e),n=Wt.f,r=Ot.f,o=0;o<i.length;o++){var a=i[o];at(t,a)||n(t,a,r(e,a))}},Ce=/#|\.prototype\./,ze=function(t,e){var i=Oe[xe(t)];return i==Ie||i!=ke&&($(e)?f(e):!!e)},xe=ze.normalize=function(t){return String(t).replace(Ce,".").toLowerCase()},Oe=ze.data={},ke=ze.NATIVE="N",Ie=ze.POLYFILL="P",Ee=ze,Te=Ot.f,Ae=function(t,e){var i,n,r,o,a,s=t.target,c=t.global,h=t.stat;if(i=c?l:h?l[s]||tt(s,{}):(l[s]||{}).prototype)for(n in e){if(o=e[n],r=t.noTargetGet?(a=Te(i,n))&&a.value:i[n],!Ee(c?n:s+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ie(i,n,o,t)}},We=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var i,n=P(e),r=We(e),o=r.length,a=0;o>a;)Wt.f(t,i=r[a++],n[i]);return t},Pe=F("document","documentElement"),$e=Mt("IE_PROTO"),Re=function(){},je=function(t){return"<script>"+t+"<\/script>"},Fe=function(t){t.write(je("")),t.close();var e=t.parentWindow.Object;return t=null,e},He=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;He="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",Pe.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(je("document.F=Object")),t.close(),t.F):Fe(Vt);for(var i=ge.length;i--;)delete He.prototype[ge[i]];return He()};Bt[$e]=!0;var De=Object.create||function(t,e){var i;return null!==t?(Re.prototype=Et(t),i=new Re,Re.prototype=null,i[$e]=t):i=He(),void 0===e?i:_e(i,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&Wt.f(Me,Le,{configurable:!0,value:De(null)});var Be=function(t){Me[Le][t]=!0},Ne=le.includes;Ae({target:"Array",proto:!0},{includes:function(t){return Ne(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("includes"),Ae({target:"Object",stat:!0,forced:!d,sham:!d},{defineProperty:Wt.f});var Xe=gt("match"),Ge=l.TypeError,Ue=function(t){if(function(t){var e;return R(t)&&(void 0!==(e=t[Xe])?!!e:"RegExp"==I(t))}(t))throw Ge("The method doesn't accept regular expressions");return t},qe={};qe[gt("toStringTag")]="z";var Ye="[object z]"===String(qe),Ke=gt("toStringTag"),Ve=l.Object,Je="Arguments"==I(function(){return arguments}()),Qe=Ye?I:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?i:Je?I(e):"Object"==(n=I(e))&&$(e.callee)?"Arguments":n},Ze=l.String,ti=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},ei=gt("match"),ii=x("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[ei]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~ii(ti(_(this)),ti(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var ni,ri,oi=le.indexOf,ai=x([].indexOf),si=!!ai&&1/ai([1],1,-0)<0,ci=!!(ri=[]["indexOf"])&&f((function(){ri.call(null,ni||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:si||!ci},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return si?ai(this,t,e)||0:oi(this,t,e)}});var hi=x(x.bind),ui=Array.isArray||function(t){return"Array"==I(t)},li=function(){},fi=[],di=F("Reflect","construct"),pi=/^\s*(?:class|function)\b/,gi=x(pi.exec),vi=!pi.exec(li),mi=function(t){if(!$(t))return!1;try{return di(li,fi,t),!0}catch(t){return!1}},yi=!di||f((function(){var t;return mi(mi.call)||!mi(Object)||!mi((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return vi||!!gi(pi,Ft(t))}:mi,wi=gt("species"),bi=l.Array,Si=function(t,e){return new(function(t){var e;return ui(t)&&(e=t.constructor,(yi(e)&&(e===bi||ui(e.prototype))||R(e)&&null===(e=e[wi]))&&(e=void 0)),void 0===e?bi:e}(t))(0===e?0:e)},Ci=x([].push),zi=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,h,u,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hi?hi(t,e):function(){return t.apply(e,arguments)}}(h,u),m=he(g),y=0,w=l||Si,b=e?w(c,m):i||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:Ci(b,f)}else switch(t){case 4:return!1;case 7:Ci(b,f)}return o?-1:n||r?r:b}},xi={forEach:zi(0),map:zi(1),filter:zi(2),some:zi(3),every:zi(4),find:zi(5),findIndex:zi(6),filterReject:zi(7)}.find,Oi=!0;"find"in[]&&Array(1).find((function(){Oi=!1})),Ae({target:"Array",proto:!0,forced:Oi},{find:function(t){return xi(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find"),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var i=Object(this),n=i.length>>>0;if(0===n)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:n-Math.abs(a),0);for(;s<n;){if((r=i[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r<i;){var o=e[r];if(t.call(n,o,r,e))return o;r++}}});var ki=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Ii=function(t,e){for(var i=0,n=e.split(".");i<n.length;i++){var r=t[n[i]];if(!ki(r,"object","array"))return r;t=r}return t},Ei=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Ti=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},Ai=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(i=e)?0:"object"==typeof i?NaN:"number"==typeof i?i:"string"==typeof i?"%"===i[i.length-1]?Number(i.slice(0,-1))/100:Number(i):NaN))return!1}var i;return!0},Wi=function(t){var e,i=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],n=0,r=0,o=0,a=0;switch(i.length){case 1:n=r=o=a=i[0];break;case 2:n=r=i[0],o=a=i[1];break;case 3:n=i[0],o=a=i[1],r=i[2];break;default:n=i[0],r=i[1],o=i[2],a=i[3]}var s={paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&ki(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[n,r,o,a]},_i=function(t){var e=[],i=t.map((function(t){return Number(t)})).reduce((function(t,i){if(i>0){var n=t+i;return e.push(n),n}return e.push(NaN),t}),0),n=Math.random()*i;return e.findIndex((function(t){return n<=t}))},Pi=function(t,e,i,n){void 0===n&&(n=1/0),n<=0&&(n=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,h=i(o);if(n===o.length+1&&(c+=a),h<0)return o;if(c>h&&(o.push(r.slice(0,-1)),r=e[s]),n===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},$i=function(t){return Math.PI/180*t},Ri=function(t,e,i,n,r,o){t.beginPath();var a,s,c=$i(90/Math.PI/i*o),h=n+c,u=r-c;t.arc(0,0,i,h,u,!1),t.lineTo.apply(t,(a=(n+r)/2,s=o/2/Math.abs(Math.sin((n-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},ji=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),h=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(n+s,r),t.lineTo(n+s,r),t.lineTo(n+o-s,r),t.arc(n+o-s,r+s,s,-h/2,0),t.lineTo(n+o,r+a-s),t.arc(n+o-s,r+a-s,s,0,h/2),t.lineTo(n+s,r+a),t.arc(n+s,r+a-s,s,h/2,h),t.lineTo(n,r+s),t.arc(n+s,r+s,s,h,-h/2),t.closePath()},Fi=function(t,e,i,n,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,h=t.height;a.width=c,a.height=h;var u=c/n;return ji(s,e*u,i*u,n*u,r*u,o*u),s.clip(),s.drawImage(t,0,0,c,h),a},Hi=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;i.width=r,i.height=o,n.drawImage(t,0,0,r,o);var a=n.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var i=Math.ceil(t),n=e*e,r=2*n,o=1/(2*Math.PI*n),a=[],s=0,c=-i;c<=i;c++)for(var h=-i;h<=i;h++){var u=o*Math.exp(-(c*c+h*h)/r);a.push(u),s+=u}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),n.putImageData(a,0,0),i},Di=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Li="__proto__"in{};function Mi(t,e,i,n){Object.defineProperty(t,e,{value:i,enumerable:!!n,writable:!0,configurable:!0})}var Bi=Array.prototype,Ni=Object.create(Bi);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Ni[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=Bi[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),n}}));var Xi=function(){function t(t){this.dep=new Di,Mi(t,"__luckyOb__",this),Array.isArray(t)&&(Li?t.__proto__=Ni:Object.getOwnPropertyNames(Ni).forEach((function(e){Mi(t,e,Ni[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Ui(t,e,t[e])}))},t}();function Gi(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Xi(t)}function Ui(t,e,i){var n=new Di,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(i=t[e]);var s=Gi(i);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):i;return Di.target&&(n.addSub(Di.target),s&&s.dep.addSub(Di.target)),e},set:function(e){e!==i&&(i=e,o&&!a||(a?a.call(t,e):i=e,s=Gi(e),n.notify()))}})}}var qi=0,Yi=function(){function t(t,e,i,n){void 0===n&&(n={}),this.id=qi++,this.$lucky=t,this.expr=e,this.deep=!!n.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],i="",n=0;n<t.length;n++){var r=t[n];if(/\[|\./.test(r))e.push(i),i="";else{if(/\W/.test(r))continue;i+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=i,this.value=this.get()}return t.prototype.get=function(){Di.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){ki(t,"array","object")&&Object.keys(t).forEach((function(i){var n=t[i];e(n)}))};e(t)}(t),Di.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),Ki=function(){function t(t,e){var i=this;this.version="1.7.11",this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","lucky-canvas@1.7.11"),t.canvasElement.addEventListener("click",(function(t){return i.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var i=null;return function(){for(var n=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i||(i=setTimeout((function(){t.apply(n,r),clearTimeout(i),i=null}),e))}}((function(){return i.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){i.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],i=t[1];this.ctx.clearRect(-e,-i,2*e,2*i)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,i=0,n=0;t.divElement&&(i=t.divElement.offsetWidth,n=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||i,this.boxHeight=this.getLength(e.height||t.height)||n,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,i=t.canvasElement,n=t.dpr,r=[this.boxWidth*n,this.boxHeight*n],o=r[0],a=r[1];i&&(i.width=o,i.height=a,i.style.width=o+"px",i.style.height=a+"px",i.style["transform-origin"]="left top",i.style.transform="scale("+1/n+")",e.scale(n,n))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,i){var n=this;return void 0===i&&(i="$resolve"),new Promise((function(r,o){if(t||o("=> '"+e.src+"' 不能为空或不合法"),"WEB"!==n.config.flag)return e[i]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '"+e.src+"' 图片加载失败")},a.src=t}))},t.prototype.drawImage=function(t,e){for(var i,n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))i=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");i=e.path}return 8===n.length&&(n=n.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([i],n))},t.prototype.getLength=function(t){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var i=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,n,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*i.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(n);var a=i.config.unitFunc;return a?a(n,r):n})))},t.prototype.getOffscreenCanvas=function(t,e){if(!Ei(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var i=this.config.dpr,n=this._offscreenCanvas;n.width=(t||300)*i,n.height=(e||150)*i;var r=n.getContext("2d");return r.clearRect(0,0,t,e),r.scale(i,i),r.dpr=i,{_offscreenCanvas:n,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var r=i.map((function(t){return e.getLength(t)}));return Fi.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;if(i.width=r,i.height=o,"string"==typeof n.filter)n.filter="opacity("+e+"%)",n.drawImage(t,0,0,r,o);else{n.drawImage(t,0,0,r,o);for(var a=n.getImageData(0,0,r,o),s=a.data,c=s.length,h=0;h<c;h+=4){var u=s[h+3];0!==u&&(s[h+3]=u*e/100)}n.putImageData(a,0,0)}return i}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Hi(t,this.getLength(e))},t.prototype.$set=function(t,e,i){t&&"object"==typeof t&&Ui(t,e,i)},t.prototype.$computed=function(t,e,i){var n=this;Object.defineProperty(t,e,{get:function(){return i.call(n)}})},t.prototype.$watch=function(t,e,i){void 0===i&&(i={}),"object"==typeof e&&(e=(i=e).handler);var n=new Yi(this,t,e,i);return i.immediate&&e.call(this,n.value),function(){}},t}(),Vi=function(t,e,i,n){return t>=n&&(t=n),i*(t/=n)*t+e},Ji=function(t,e,i,n){return t>=n&&(t=n),-i*(t/=n)*(t-2)+e},Qi=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.call(e)},o.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return i({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return i({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},o.prototype.handleClick=function(t){var e,i=this.ctx;i.beginPath(),i.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),i.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},o.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,a=n._defaultConfig,s=n._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,n){return Ai(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=i.ImageCache.blocks;if(a&&a[n]){var s=a[n][r];if(s){var c=i.computedWidthAndHeight(s,e,2*t,2*t),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate($i(i.rotateDeg)),i.drawImage(o,s,f,d,h,u),o.restore()}}})),t-i.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=$i(this.prizeDeg);var c=$i(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),h=function(t){return i.getOffsetX(o.measureText(t).width)},u=function(t,e,n){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return i.getHeight(t.top,e)+(n+1)*i.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var n=c+e*i.prizeRadian,r=i.prizeRadius-i.maxBtnRadius,l=t.background||s.background;Ai(l)&&(o.fillStyle=l,Ri(o,i.maxBtnRadius,i.prizeRadius,n-i.prizeRadian/2,n+i.prizeRadian/2,i.getLength(a.gutter)),o.fill());var f=Math.cos(n)*i.prizeRadius,d=Math.sin(n)*i.prizeRadius;o.translate(f,d),o.rotate(n+$i(90)),t.imgs&&t.imgs.forEach((function(t,n){var a=i.ImageCache.prizes;if(a&&a[e]){var s=a[e][n];if(s){var c=i.computedWidthAndHeight(s,t,i.prizeRadian*i.prizeRadius,r),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,r)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,n=t.fontWeight||s.fontWeight,c=i.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font=n+" "+(c>>0)+"px "+l;var g=String(t.text);(f?Pi(o,Ti(g),(function(e){var n=2*((i.prizeRadius-u(t,r,e.length))*Math.tan(i.prizeRadian/2))-i.getLength(a.gutter);return i.getWidth(d,n)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,i){o.fillText(e,h(e),u(t,r,i))}))})),o.rotate($i(360)-n-$i(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var n=i.getHeight(t.radius);i.maxBtnRadius=Math.max(i.maxBtnRadius,n),Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,n,0,2*Math.PI,!1),o.fill()),t.pointer&&Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-n,0),o.lineTo(n,0),o.lineTo(0,2*-n),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=i.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=i.computedWidthAndHeight(s,t,2*n,2*n),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,n)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=i.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font=r+" "+(a>>0)+"px "+c,String(t.text).split("\n").forEach((function(e,i){o.fillText(e,h(e),u(t,n,i))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*n-n/2)*this.getLength(e.stopRange),c=0,h=0,u=0;++c;){var l=360*c-i*n-r-e.offsetDegree+s-n/2,f=Ji(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-h>f-a?l:u;break}u=l,h=f}},o.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},o.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=_i(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},o.prototype.run=function(t){var e;void 0===t&&(t=0);var i=this,n=i.rAF,r=i.step,o=i.prizeFlag,a=i.stopDeg,s=i.endDeg,c=i._defaultConfig,h=c.accelerationTime,u=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<h){this.FPS=f/t;var g=Vi(f,0,l,h);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=Ji(d,a,s,u),d>=u&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),n(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},o.prototype.getWidth=function(t,e){return void 0===e&&(e=this.prizeRadian*this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return void 0===e&&(e=this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t){return-t/2},o.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr-this.Radius,e/i.dpr-this.Radius]},o}(Ki),Zi=function(t){function a(e,i){var n,r=t.call(this,e,{width:i.width,height:i.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.call(e)},a.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},a.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},a.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return i({background:"#ffce98",shadow:""},t.activeStyle)}))},a.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},a.prototype.init=function(){var t,e;return n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i=t.buttons.map((function(t){return t.imgs}));t.button&&i.push(t.button.imgs);var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:i};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},a.prototype.handleClick=function(t){var e=this,i=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(n){var r;if(n){var o=e.getGeometricProperty([n.x,n.y,n.col||1,n.row||1]),a=o[0],s=o[1],c=o[2],h=o[3];i.beginPath(),i.rect(a,s,c,h),i.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof n.callback&&n.callback.call(e,n),null===(r=e.startCallback)||void 0===r||r.call(e,t,n))}}))},a.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if("buttons"===t&&!n.buttons.length&&n.button&&(s=n.button),s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]);var u=[n.loadImg(c.src,c),c.activeSrc&&n.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(u).then((function(t){var a=t[0],s=t[1],u=c.formatter;"function"==typeof u&&(a=u.call(n,a),s&&(s=u.call(n,s))),h[i][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},a.prototype.computedWidthAndHeight=function(t,e,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var n=this.getWidth(e.width,i.col);return[n,t.height*(n/t.width)]}if(!e.width&&e.height){var r=this.getHeight(e.height,i.row);return[t.width*(r/t.height),r]}return[this.getWidth(e.width,i.col),this.getHeight(e.height,i.row)]},a.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,a=n.ctx,s=n._defaultConfig,c=n._defaultStyle,h=n._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,a),a.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=o(o([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e){var n=t.x,r=t.y,o=t.w,s=t.h,h=Wi(e),u=h[0],l=h[1],f=h[2],d=h[3],p=e.borderRadius?i.getLength(e.borderRadius):0,g=e.background||c.background;return Ai(g)&&(a.fillStyle=i.handleBackground(n,r,o,s,g),ji(a,n,r,o,s,p),a.fill()),{x:n+f,y:r+u,w:o-f-d,h:s-u-l}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var n=i.getGeometricProperty([t.x,t.y,t.col,t.row]),o=n[0],s=n[1],u=n[2],l=n[3],f=!1;(void 0===i.prizeFlag||i.prizeFlag>-1)&&(f=e===i.currIndex%i.prizes.length>>0);var d=f?h.background:t.background||c.background;if(Ai(d)){var p=(f?h.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(a.shadowColor=p[3],a.shadowOffsetX=p[0]*r.dpr,a.shadowOffsetY=p[1]*r.dpr,a.shadowBlur=p[2],p[0]>0?u-=p[0]:(u+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=i.handleBackground(o,s,u,l,d);var g=i.getLength(t.borderRadius?t.borderRadius:c.borderRadius);ji(a,o,s,u,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=i.prizes.length&&(v="buttons",e-=i.prizes.length),t.imgs&&t.imgs.forEach((function(n,r){var c=i.ImageCache[v];if(c[e]){var h=c[e][r];if(h){var u=f&&h.activeImg||h.defaultImg;if(u){var l=i.computedWidthAndHeight(u,n,t),d=l[0],p=l[1],g=[o+i.getOffsetX(d,t.col),s+i.getHeight(n.top,t.row)],m=g[0],y=g[1];i.drawImage(a,u,m,y,d,p)}}}})),t.fonts&&t.fonts.forEach((function(e){var n=f&&h.fontStyle?h.fontStyle:e.fontStyle||c.fontStyle,r=f&&h.fontWeight?h.fontWeight:e.fontWeight||c.fontWeight,u=f&&h.fontSize?i.getLength(h.fontSize):i.getLength(e.fontSize||c.fontSize),l=f&&h.lineHeight?h.lineHeight:e.lineHeight||c.lineHeight||e.fontSize||c.fontSize,d=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:c.wordWrap,p=e.lengthLimit||c.lengthLimit,g=e.lineClamp||c.lineClamp;a.font=r+" "+(u>>0)+"px "+n,a.fillStyle=f&&h.fontColor?h.fontColor:e.fontColor||c.fontColor;var v=[],m=String(e.text);if(d){var y=i.getWidth(p,t.col);v=Pi(a,Ti(m),(function(){return y}),g)}else v=m.split("\n");v.forEach((function(n,r){a.fillText(n,o+i.getOffsetX(a.measureText(n).width,t.col),s+i.getHeight(e.top,t.row)+(r+1)*i.getLength(l))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,i,n,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,i,n,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var h=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,i+r,e+n,i+r-n*h(s-0)]:s>=45&&s<90?c=[e,i+r,e+n-r*h(s-45),i]:s>=90&&s<135?c=[e+n,i+r,e+n-r*h(s-90),i]:s>=135&&s<180?c=[e+n,i+r,e,i+n*h(s-135)]:s>=180&&s<225?c=[e+n,i,e,i+n*h(s-180)]:s>=225&&s<270?c=[e+n,i,e+r*h(s-225),i+r]:s>=270&&s<315?c=[e,i,e+r*h(s-270),i+r]:s>=315&&s<360&&(c=[e,i,e+n,i+r-n*h(s-315)])}else s.includes("top")?c=[e,i+r,e,i]:s.includes("bottom")?c=[e,i,e,i+r]:s.includes("left")?c=[e+n,i,e,i]:s.includes("right")&&(c=[e,i,e+n,i]);var u=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,i){var n=e.split(" ");return 1===n.length?t.addColorStop(i,n[0]):2===n.length&&t.addColorStop.apply(t,n),t}),u)}(o,t,e,i,n,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=n,o=e.speed,a=0,s=0,c=0;++a;){var h=this.prizes.length*a+i-r,u=Ji(this.FPS,r,h,e.decelerationTime)-r;if(u>o){this.endIndex=o-s>u-o?h:c;break}c=h,s=u}},a.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},a.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=_i(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},a.prototype.run=function(t){var e;void 0===t&&(t=0);var i=this,n=i.rAF,r=i.step,o=i.prizes,a=i.prizeFlag,s=i.stopIndex,c=i.endIndex,h=i._defaultConfig,u=h.accelerationTime,l=h.decelerationTime,f=h.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<u){this.FPS=d/t;var v=Vi(d,.1,f-.1,u);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=Ji(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),n(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},a.prototype.getGeometricProperty=function(t){var e=t[0],i=t[1],n=t[2],r=void 0===n?1:n,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,h=this._defaultConfig.gutter,u=[this.prizeArea.x+(s+h)*e,this.prizeArea.y+(c+h)*i];return r&&a&&u.push(s*r+h*(r-1),c*a+h*(a-1)),u},a.prototype.getWidth=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellWidth*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getHeight=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellHeight*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getOffsetX=function(t,e){return void 0===e&&(e=1),(this.cellWidth*e+this._defaultConfig.gutter*(e-1)-t)/2},a.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr,e/i.dpr]},a}(Ki),tn=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.call(e)},o.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,i=this._defaultStyle,n=this.drawBlocks(),r=n.w,o=n.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,h=s.cellHeight,u=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,i){void 0===t.scroll[i]&&(t.scroll[i]=0),e.order=e.order||f;var n=e.order.length;d=Math.max(d,r+u*n),p=Math.max(p,o+l*n)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(n,r){var o=c*r,a=h*r,s=0,f=function(t,e){for(var i={},n=[],r=0;r<t.length;r++)i[r]=t[r];for(r=0;r<e.length;r++){var o=i[e[r]];o&&(n[r]=o)}return n}(t.prizes,n.order);if(f.length){f.forEach((function(r,f){if(r){var d=n.order[f],p=u*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,u]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||i.background;if(Ai(S)){var C=t.getLength(Ei(r,"borderRadius")?r.borderRadius:i.borderRadius);ji(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,i){var n=Ii(t.ImageCache,"prizes."+d+"."+i);if(n){var r=t.computedWidthAndHeight(n,e,c,h),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,h)],u=s[0],l=s[1];t.drawImage(m,n,u,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var n=e.fontStyle||i.fontStyle,r=e.fontWeight||i.fontWeight,o=t.getLength(e.fontSize||i.fontSize),a=e.lineHeight||i.lineHeight||e.fontSize||i.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:i.wordWrap,u=e.lengthLimit||i.lengthLimit,l=e.lineClamp||i.lineClamp;m.font=r+" "+(o>>0)+"px "+n,m.fillStyle=e.fontColor||i.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(u,c);f=Pi(m,Ti(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(i,n){m.fillText(i,y+t.getOffsetX(m.measureText(i).width,c),w+t.getHeight(e.top,h)+(n+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,h]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),z=C[0],x=C[1];t.drawImage(m,v,g,y,w,b,z,x,w,b),S+=s}}}))},o.prototype.drawBlocks=function(){var t=this,e=this;e.config;var i=e.ctx;e._defaultConfig;var n=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,h=e.h,u=Wi(r),l=u[0],f=u[1],d=u[2],p=u[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||n.background;return Ai(v)&&(ji(i,a,s,c,h,g),i.fillStyle=v,i.fill()),r.imgs&&r.imgs.forEach((function(e,n){var r=Ii(t.ImageCache,"blocks."+o+"."+n);if(r){var u=t.computedWidthAndHeight(r,e,c,h),l=u[0],f=u[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,h)],p=d[0],g=d[1];t.drawImage(i,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:h-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,i=this,n=i.config,r=i.ctx;i._defaultConfig,i._defaultStyle,null===(t=n.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,h=o.h;if(this._offscreenCanvas){var u=this,l=u.cellWidth,f=u.cellHeight,d=u.cellAndSpacing,p=u.widthAndSpacing,g=u.heightAndSpacing;this.slots.forEach((function(t,i){var n=d*t.order.length,o=e.displacement(-(h-g)/2,-(c-p)/2),u=e.scroll[i]+o;u<0&&(u=u%n+n),u>n&&(u%=n);var v=e.displacement([l*i,u,l,h],[u,f*i,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*i,s,l,h],[a,s+g*i,c,f]),C=S[0],z=S[1],x=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,z,x,O)}))}},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,i=e._defaultConfig,n=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||i.speed,c=e.direction||i.direction,h=a.findIndex((function(t){return t===n[o]})),u=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*h+u*f*c-l,p=Ji(t.FPS,l,d,i.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},o.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},o.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!ki(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 "+typeof t);if(t.length!==this.slots.length)return this.stop(-1),console.error("stop(["+t+"]) 参数长度的不正确");this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},o.prototype.run=function(t){var e,i,n=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,h=r.cellAndSpacing,u=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==u.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;u.forEach((function(e,i){var r=e.order;if(r&&r.length){var o=h*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=n.scroll[i];if(1===a||d<l){n.FPS=d/t;var w=Vi(d,0,g,l);w===g&&(n.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===u.length&&(n.step=3,n.stopScroll=[],n.endScroll=[]);else if(3===a&&p){var b=n.stopScroll[i],S=n.endScroll[i];m=Ji(p,b,S,f),p>=f&&(n.step=0)}n.scroll[i]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<u.length;v++){var m=u[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(i=this.endCallback)||void 0===i||i.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},o.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},o.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,i=this._defaultConfig,n=i.colSpacing,r=i.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,h=o.h,u=0,l=0;return"horizontal"===t?(l=this.cellHeight=(h-r*(e-1))/e,u=this.cellWidth=l):(u=this.cellWidth=(c-n*(e-1))/e,l=this.cellHeight=u),a=this.widthAndSpacing=this.cellWidth+n,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:u,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o.prototype.getWidth=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t,e){return(e-t)/2},o}(Ki);export{Zi as LuckyGrid,Qi as LuckyWheel,tn as SlotMachine}; | ||
var t=function(e,n){return t=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])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};function i(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((i=i.apply(t,e||[])).next())}))}function r(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function o(t,e){for(var n=0,i=e.length,r=t.length;n<i;n++,r++)t[r]=e[n];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var c,u,h=function(t){return t&&t.Math==Math&&t},l=h("object"==typeof globalThis&&globalThis)||h("object"==typeof window&&window)||h("object"==typeof self&&self)||h("object"==typeof a&&a)||function(){return this}()||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},d=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=Function.prototype.call,g=p.bind?p.bind(p):function(){return p.apply(p,arguments)},v={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,y={f:m&&!v.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:v},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b=Function.prototype,S=b.bind,C=b.call,z=S&&S.bind(C),x=S?function(t){return t&&z(C,t)}:function(t){return t&&function(){return C.apply(t,arguments)}},O=x({}.toString),k=x("".slice),I=function(t){return k(O(t),8,-1)},E=l.Object,T=x("".split),A=f((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==I(t)?T(t,""):E(t)}:E,P=l.TypeError,_=function(t){if(null==t)throw P("Can't call method on "+t);return t},W=function(t){return A(_(t))},$=function(t){return"function"==typeof t},j=function(t){return"object"==typeof t?null!==t:$(t)},R=function(t){return $(t)?t:void 0},F=function(t,e){return arguments.length<2?R(l[t]):l[t]&&l[t][e]},D=x({}.isPrototypeOf),H=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(u=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!u&&H&&(!(c=H.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=H.match(/Chrome\/(\d+)/))&&(u=+c[1]);var X=u,G=!!Object.getOwnPropertySymbols&&!f((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),U=G&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=l.Object,Y=U?function(t){return"symbol"==typeof t}:function(t){var e=F("Symbol");return $(e)&&D(e.prototype,q(t))},K=l.String,V=l.TypeError,J=function(t){if($(t))return t;throw V(function(t){try{return K(t)}catch(t){return"Object"}}(t)+" is not a function")},Q=l.TypeError,Z=Object.defineProperty,tt=function(t,e){try{Z(l,t,{value:e,configurable:!0,writable:!0})}catch(n){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),nt=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),it=l.Object,rt=function(t){return it(_(t))},ot=x({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ut=x(1..toString),ht=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ut(++st+ct,36)},lt=nt("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ht,gt=function(t){if(!at(lt,t)||!G&&"string"!=typeof lt[t]){var e="Symbol."+t;G&&at(ft,t)?lt[t]=ft[t]:lt[t]=U&&dt?dt(e):pt(e)}return lt[t]},vt=l.TypeError,mt=gt("toPrimitive"),yt=function(t,e){if(!j(t)||Y(t))return t;var n,i,r=null==(n=t[mt])?void 0:J(n);if(r){if(void 0===e&&(e="default"),i=g(r,t,e),!j(i)||Y(i))return i;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,i;if("string"===e&&$(n=t.toString)&&!j(i=g(n,t)))return i;if($(n=t.valueOf)&&!j(i=g(n,t)))return i;if("string"!==e&&$(n=t.toString)&&!j(i=g(n,t)))return i;throw Q("Can't convert object to primitive value")}(t,e)},wt=function(t){var e=yt(t,"string");return Y(e)?e:e+""},bt=l.document,St=j(bt)&&j(bt.createElement),Ct=function(t){return St?bt.createElement(t):{}},zt=!d&&!f((function(){return 7!=Object.defineProperty(Ct("div"),"a",{get:function(){return 7}}).a})),xt=Object.getOwnPropertyDescriptor,Ot={f:d?xt:function(t,e){if(t=W(t),e=wt(e),zt)try{return xt(t,e)}catch(t){}if(at(t,e))return w(!g(y.f,t,e),t[e])}},kt=l.String,It=l.TypeError,Et=function(t){if(j(t))return t;throw It(kt(t)+" is not an object")},Tt=l.TypeError,At=Object.defineProperty,Pt={f:d?At:function(t,e,n){if(Et(t),e=wt(e),Et(n),zt)try{return At(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Tt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},_t=d?function(t,e,n){return Pt.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},Wt=x(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Wt(t)});var $t,jt,Rt,Ft=et.inspectSource,Dt=l.WeakMap,Ht=$(Dt)&&/native code/.test(Ft(Dt)),Lt=nt("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ht(t))},Bt={},Nt=l.TypeError,Xt=l.WeakMap;if(Ht||et.state){var Gt=et.state||(et.state=new Xt),Ut=x(Gt.get),qt=x(Gt.has),Yt=x(Gt.set);$t=function(t,e){if(qt(Gt,t))throw new Nt("Object already initialized");return e.facade=t,Yt(Gt,t,e),e},jt=function(t){return Ut(Gt,t)||{}},Rt=function(t){return qt(Gt,t)}}else{var Kt=Mt("state");Bt[Kt]=!0,$t=function(t,e){if(at(t,Kt))throw new Nt("Object already initialized");return e.facade=t,_t(t,Kt,e),e},jt=function(t){return at(t,Kt)?t[Kt]:{}},Rt=function(t){return at(t,Kt)}}var Vt,Jt={set:$t,get:jt,has:Rt,enforce:function(t){return Rt(t)?jt(t):$t(t,{})},getterFor:function(t){return function(e){var n;if(!j(e)||(n=jt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return n}}},Qt=Function.prototype,Zt=d&&Object.getOwnPropertyDescriptor,te=at(Qt,"name"),ee={EXISTS:te,PROPER:te&&"something"===function(){}.name,CONFIGURABLE:te&&(!d||d&&Zt(Qt,"name").configurable)},ne=s((function(t){var e=ee.CONFIGURABLE,n=Jt.get,i=Jt.enforce,r=String(String).split("String");(t.exports=function(t,n,o,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,h=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:n;$(o)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!at(o,"name")||e&&o.name!==f)&&_t(o,"name",f),(s=i(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!h&&t[n]&&(u=!0):delete t[n],u?t[n]=o:_t(t,n,o)):u?t[n]=o:tt(n,o)})(Function.prototype,"toString",(function(){return $(this)&&n(this).source||Ft(this)}))})),ie=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ie)(e)},ae=Math.max,se=Math.min,ce=Math.min,ue=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},he=function(t){return function(e,n,i){var r,o=W(e),a=ue(o),s=function(t,e){var n=oe(t);return n<0?ae(n+e,0):se(n,e)}(i,a);if(t&&n!=n){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},le={includes:he(!0),indexOf:he(!1)},fe=le.indexOf,de=x([].push),pe=function(t,e){var n,i=W(t),r=0,o=[];for(n in i)!at(Bt,n)&&at(i,n)&&de(o,n);for(;e.length>r;)at(i,n=e[r++])&&(~fe(o,n)||de(o,n));return o},ge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ve=ge.concat("length","prototype"),me={f:Object.getOwnPropertyNames||function(t){return pe(t,ve)}},ye={f:Object.getOwnPropertySymbols},we=x([].concat),be=F("Reflect","ownKeys")||function(t){var e=me.f(Et(t)),n=ye.f;return n?we(e,n(t)):e},Se=function(t,e){for(var n=be(e),i=Pt.f,r=Ot.f,o=0;o<n.length;o++){var a=n[o];at(t,a)||i(t,a,r(e,a))}},Ce=/#|\.prototype\./,ze=function(t,e){var n=Oe[xe(t)];return n==Ie||n!=ke&&($(e)?f(e):!!e)},xe=ze.normalize=function(t){return String(t).replace(Ce,".").toLowerCase()},Oe=ze.data={},ke=ze.NATIVE="N",Ie=ze.POLYFILL="P",Ee=ze,Te=Ot.f,Ae=function(t,e){var n,i,r,o,a,s=t.target,c=t.global,u=t.stat;if(n=c?l:u?l[s]||tt(s,{}):(l[s]||{}).prototype)for(i in e){if(o=e[i],r=t.noTargetGet?(a=Te(n,i))&&a.value:n[i],!Ee(c?i:s+(u?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ne(n,i,o,t)}},Pe=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var n,i=W(e),r=Pe(e),o=r.length,a=0;o>a;)Pt.f(t,n=r[a++],i[n]);return t},We=F("document","documentElement"),$e=Mt("IE_PROTO"),je=function(){},Re=function(t){return"<script>"+t+"<\/script>"},Fe=function(t){t.write(Re("")),t.close();var e=t.parentWindow.Object;return t=null,e},De=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;De="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",We.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Re("document.F=Object")),t.close(),t.F):Fe(Vt);for(var n=ge.length;n--;)delete De.prototype[ge[n]];return De()};Bt[$e]=!0;var He=Object.create||function(t,e){var n;return null!==t?(je.prototype=Et(t),n=new je,je.prototype=null,n[$e]=t):n=De(),void 0===e?n:_e(n,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&Pt.f(Me,Le,{configurable:!0,value:He(null)});var Be=function(t){Me[Le][t]=!0},Ne=le.includes;Ae({target:"Array",proto:!0},{includes:function(t){return Ne(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("includes"),Ae({target:"Object",stat:!0,forced:!d,sham:!d},{defineProperty:Pt.f});var Xe=gt("match"),Ge=l.TypeError,Ue=function(t){if(function(t){var e;return j(t)&&(void 0!==(e=t[Xe])?!!e:"RegExp"==I(t))}(t))throw Ge("The method doesn't accept regular expressions");return t},qe={};qe[gt("toStringTag")]="z";var Ye="[object z]"===String(qe),Ke=gt("toStringTag"),Ve=l.Object,Je="Arguments"==I(function(){return arguments}()),Qe=Ye?I:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?n:Je?I(e):"Object"==(i=I(e))&&$(e.callee)?"Arguments":i},Ze=l.String,tn=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},en=gt("match"),nn=x("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[en]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~nn(tn(_(this)),tn(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var rn,on,an=le.indexOf,sn=x([].indexOf),cn=!!sn&&1/sn([1],1,-0)<0,un=!!(on=[]["indexOf"])&&f((function(){on.call(null,rn||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:cn||!un},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return cn?sn(this,t,e)||0:an(this,t,e)}});var hn=x(x.bind),ln=Array.isArray||function(t){return"Array"==I(t)},fn=function(){},dn=[],pn=F("Reflect","construct"),gn=/^\s*(?:class|function)\b/,vn=x(gn.exec),mn=!gn.exec(fn),yn=function(t){if(!$(t))return!1;try{return pn(fn,dn,t),!0}catch(t){return!1}},wn=!pn||f((function(){var t;return yn(yn.call)||!yn(Object)||!yn((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return mn||!!vn(gn,Ft(t))}:yn,bn=gt("species"),Sn=l.Array,Cn=function(t,e){return new(function(t){var e;return ln(t)&&(e=t.constructor,(wn(e)&&(e===Sn||ln(e.prototype))||j(e)&&null===(e=e[bn]))&&(e=void 0)),void 0===e?Sn:e}(t))(0===e?0:e)},zn=x([].push),xn=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,u,h,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hn?hn(t,e):function(){return t.apply(e,arguments)}}(u,h),m=ue(g),y=0,w=l||Cn,b=e?w(c,m):n||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:zn(b,f)}else switch(t){case 4:return!1;case 7:zn(b,f)}return o?-1:i||r?r:b}},On={forEach:xn(0),map:xn(1),filter:xn(2),some:xn(3),every:xn(4),find:xn(5),findIndex:xn(6),filterReject:xn(7)}.find,kn=!0;"find"in[]&&Array(1).find((function(){kn=!1})),Ae({target:"Array",proto:!0,forced:kn},{find:function(t){return On(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find");var In=Ye?{}.toString:function(){return"[object "+Qe(this)+"]"};Ye||ne(Object.prototype,"toString",In,{unsafe:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:i-Math.abs(a),0);for(;s<i;){if((r=n[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var o=e[r];if(t.call(i,o,r,e))return o;r++}}});var En=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Tn=function(t,e){for(var n=0,i=e.split(".");n<i.length;n++){var r=t[i[n]];if(!En(r,"object","array"))return r;t=r}return t},An=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Pn=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},_n=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(n=e)?0:"object"==typeof n?NaN:"number"==typeof n?n:"string"==typeof n?"%"===n[n.length-1]?Number(n.slice(0,-1))/100:Number(n):NaN))return!1}var n;return!0},Wn=function(t){var e,n=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],i=0,r=0,o=0,a=0;switch(n.length){case 1:i=r=o=a=n[0];break;case 2:i=r=n[0],o=a=n[1];break;case 3:i=n[0],o=a=n[1],r=n[2];break;default:i=n[0],r=n[1],o=n[2],a=n[3]}var s={paddingTop:i,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&En(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[i,r,o,a]},$n=function(t){var e=[],n=t.map((function(t){return Number(t)})).reduce((function(t,n){if(n>0){var i=t+n;return e.push(i),i}return e.push(NaN),t}),0),i=Math.random()*n;return e.findIndex((function(t){return i<=t}))},jn=function(t,e,n,i){void 0===i&&(i=1/0),i<=0&&(i=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,u=n(o);if(i===o.length+1&&(c+=a),u<0)return o;if(c>u&&(o.push(r.slice(0,-1)),r=e[s]),i===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Rn=function(t){return Math.PI/180*t},Fn=function(t,e,n,i,r,o){t.beginPath();var a,s,c=Rn(90/Math.PI/n*o),u=i+c,h=r-c;t.arc(0,0,n,u,h,!1),t.lineTo.apply(t,(a=(i+r)/2,s=o/2/Math.abs(Math.sin((i-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Dn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),u=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+s,r),t.lineTo(i+o-s,r),t.arc(i+o-s,r+s,s,-u/2,0),t.lineTo(i+o,r+a-s),t.arc(i+o-s,r+a-s,s,0,u/2),t.lineTo(i+s,r+a),t.arc(i+s,r+a-s,s,u/2,u),t.lineTo(i,r+s),t.arc(i+s,r+s,s,u,-u/2),t.closePath()},Hn=function(t,e,n,i,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,u=t.height;a.width=c,a.height=u;var h=c/i;return Dn(s,e*h,n*h,i*h,r*h,o*h),s.clip(),s.drawImage(t,0,0,c,u),a},Ln=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;n.width=r,n.height=o,i.drawImage(t,0,0,r,o);var a=i.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var n=Math.ceil(t),i=e*e,r=2*i,o=1/(2*Math.PI*i),a=[],s=0,c=-n;c<=n;c++)for(var u=-n;u<=n;u++){var h=o*Math.exp(-(c*c+u*u)/r);a.push(h),s+=h}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),i.putImageData(a,0,0),n},Mn=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Bn="__proto__"in{};function Nn(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var Xn=Array.prototype,Gn=Object.create(Xn);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Gn[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=Xn[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),i}}));var Un=function(){function t(t){this.dep=new Mn,Nn(t,"__luckyOb__",this),Array.isArray(t)&&(Bn?t.__proto__=Gn:Object.getOwnPropertyNames(Gn).forEach((function(e){Nn(t,e,Gn[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Yn(t,e,t[e])}))},t}();function qn(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Un(t)}function Yn(t,e,n){var i=new Mn,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(n=t[e]);var s=qn(n);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):n;return Mn.target&&(i.addSub(Mn.target),s&&s.dep.addSub(Mn.target)),e},set:function(e){e!==n&&(n=e,o&&!a||(a?a.call(t,e):n=e,s=qn(e),i.notify()))}})}}var Kn=0,Vn=function(){function t(t,e,n,i){void 0===i&&(i={}),this.id=Kn++,this.$lucky=t,this.expr=e,this.deep=!!i.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],n="",i=0;i<t.length;i++){var r=t[i];if(/\[|\./.test(r))e.push(n),n="";else{if(/\W/.test(r))continue;n+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=n,this.value=this.get()}return t.prototype.get=function(){Mn.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){En(t,"array","object")&&Object.keys(t).forEach((function(n){var i=t[n];e(i)}))};e(t)}(t),Mn.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),Jn=function(){function t(t,e){var n=this;this.version="1.7.12",this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","".concat("lucky-canvas","@").concat("1.7.12")),t.canvasElement.addEventListener("click",(function(t){return n.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var n=null;return function(){for(var i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){t.apply(i,r),clearTimeout(n),n=null}),e))}}((function(){return n.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){n.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],n=t[1];this.ctx.clearRect(-e,-n,2*e,2*n)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,n=0,i=0;t.divElement&&(n=t.divElement.offsetWidth,i=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||n,this.boxHeight=this.getLength(e.height||t.height)||i,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,n=t.canvasElement,i=t.dpr,r=[this.boxWidth*i,this.boxHeight*i],o=r[0],a=r[1];n&&(n.width=o,n.height=a,n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),n.style["transform-origin"]="left top",n.style.transform="scale(".concat(1/i,")"),e.scale(i,i))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,n){var i=this;return void 0===n&&(n="$resolve"),new Promise((function(r,o){if(t||o("=> '".concat(e.src,"' 不能为空或不合法")),"WEB"!==i.config.flag)return e[n]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '".concat(e.src,"' 图片加载失败"))},a.src=t}))},t.prototype.drawImage=function(t,e){for(var n,i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))n=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");n=e.path}return 8===i.length&&(i=i.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([n],i))},t.prototype.getLength=function(t){return En(t,"number")?t:En(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var n=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,i,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*n.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(i);var a=n.config.unitFunc;return a?a(i,r):i})))},t.prototype.computedWidthAndHeight=function(t,e,n,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,n);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,i);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,n),this.getHeight(e.height,i)]},t.prototype.getWidth=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getHeight=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getOffsetX=function(t,e){return void 0===e&&(e=0),(e-t)/2},t.prototype.getOffscreenCanvas=function(t,e){if(!An(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var n=this.config.dpr,i=this._offscreenCanvas;i.width=(t||300)*n,i.height=(e||150)*n;var r=i.getContext("2d");return r.clearRect(0,0,t,e),r.scale(n,n),r.dpr=n,{_offscreenCanvas:i,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=n.map((function(t){return e.getLength(t)}));return Hn.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;if(n.width=r,n.height=o,"string"==typeof i.filter)i.filter="opacity(".concat(e,"%)"),i.drawImage(t,0,0,r,o);else{i.drawImage(t,0,0,r,o);for(var a=i.getImageData(0,0,r,o),s=a.data,c=s.length,u=0;u<c;u+=4){var h=s[u+3];0!==h&&(s[u+3]=h*e/100)}i.putImageData(a,0,0)}return n}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Ln(t,this.getLength(e))},t.prototype.$set=function(t,e,n){t&&"object"==typeof t&&Yn(t,e,n)},t.prototype.$computed=function(t,e,n){var i=this;Object.defineProperty(t,e,{get:function(){return n.call(i)}})},t.prototype.$watch=function(t,e,n){void 0===n&&(n={}),"object"==typeof e&&(e=(n=e).handler);var i=new Vn(this,t,e,n);return n.immediate&&e.call(this,i.value),function(){}},t}(),Qn=function(t,e,n,i){return t>=i&&(t=i),n*(t/=i)*t+e},Zn=function(t,e,n,i){return t>=i&&(t=i),-n*(t/=i)*(t-2)+e},ti=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return n({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return n({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},o.prototype.handleClick=function(t){var e,n=this.ctx;n.beginPath(),n.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),n.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]),i.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(i,t)),u[n][e][o]=t,r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},o.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,a=i._defaultConfig,s=i._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,i){return _n(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=n.ImageCache.blocks;if(a&&a[i]){var s=a[i][r];if(s){var c=n.computedWidthAndHeight(s,e,2*t,2*t),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Rn(n.rotateDeg)),n.drawImage(o,s,f,d,u,h),o.restore()}}})),t-n.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Rn(this.prizeDeg);var c=Rn(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),u=function(t){return n.getOffsetX(o.measureText(t).width)},h=function(t,e,i){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return n.getHeight(t.top,e)+(i+1)*n.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var i=c+e*n.prizeRadian,r=n.prizeRadius-n.maxBtnRadius,l=t.background||s.background;_n(l)&&(o.fillStyle=l,Fn(o,n.maxBtnRadius,n.prizeRadius,i-n.prizeRadian/2,i+n.prizeRadian/2,n.getLength(a.gutter)),o.fill());var f=Math.cos(i)*n.prizeRadius,d=Math.sin(i)*n.prizeRadius;o.translate(f,d),o.rotate(i+Rn(90)),t.imgs&&t.imgs.forEach((function(t,i){var a=n.ImageCache.prizes;if(a&&a[e]){var s=a[e][i];if(s){var c=n.computedWidthAndHeight(s,t,n.prizeRadian*n.prizeRadius,r),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,r)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,i=t.fontWeight||s.fontWeight,c=n.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font="".concat(i," ").concat(c>>0,"px ").concat(l);var g=String(t.text);(f?jn(o,Pn(g),(function(e){var i=2*((n.prizeRadius-h(t,r,e.length))*Math.tan(n.prizeRadian/2))-n.getLength(a.gutter);return n.getWidth(d,i)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,n){o.fillText(e,u(e),h(t,r,n))}))})),o.rotate(Rn(360)-i-Rn(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var i=n.getHeight(t.radius,n.prizeRadius);n.maxBtnRadius=Math.max(n.maxBtnRadius,i),_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,i,0,2*Math.PI,!1),o.fill()),t.pointer&&_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-i,0),o.lineTo(i,0),o.lineTo(0,2*-i),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=n.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=n.computedWidthAndHeight(s,t,2*i,2*i),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,i)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=n.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font="".concat(r," ").concat(a>>0,"px ").concat(c),String(t.text).split("\n").forEach((function(e,n){o.fillText(e,u(e),h(t,i,n))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*i-i/2)*this.getLength(e.stopRange),c=0,u=0,h=0;++c;){var l=360*c-n*i-r-e.offsetDegree+s-i/2,f=Zn(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-u>f-a?l:h;break}h=l,u=f}},o.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},o.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=$n(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},o.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizeFlag,a=n.stopDeg,s=n.endDeg,c=n._defaultConfig,u=c.accelerationTime,h=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<u){this.FPS=f/t;var g=Qn(f,0,l,u);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=Zn(d,a,s,h),d>=h&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},o.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr-this.Radius,e/n.dpr-this.Radius]},o}(Jn),ei=function(t){function a(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},a.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},a.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},a.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return n({background:"#ffce98",shadow:""},t.activeStyle)}))},a.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},a.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n=t.buttons.map((function(t){return t.imgs}));t.button&&n.push(t.button.imgs);var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:n};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},a.prototype.handleClick=function(t){var e=this,n=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(i){var r;if(i){var o=e.getGeometricProperty([i.x,i.y,i.col||1,i.row||1]),a=o[0],s=o[1],c=o[2],u=o[3];n.beginPath(),n.rect(a,s,c,u),n.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof i.callback&&i.callback.call(e,i),null===(r=e.startCallback)||void 0===r||r.call(e,t,i))}}))},a.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if("buttons"===t&&!i.buttons.length&&i.button&&(s=i.button),s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]);var h=[i.loadImg(c.src,c),c.activeSrc&&i.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(h).then((function(t){var a=t[0],s=t[1],h=c.formatter;"function"==typeof h&&(a=h.call(i,a),s&&(s=h.call(i,s))),u[n][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},a.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,a=i.ctx,s=i._defaultConfig,c=i._defaultStyle,u=i._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,a),a.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=o(o([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e,i){var r=t.x,o=t.y,s=t.w,u=t.h,h=Wn(e),l=h[0],f=h[1],d=h[2],p=h[3],g=e.borderRadius?n.getLength(e.borderRadius):0,v=e.background||c.background;return _n(v)&&(a.fillStyle=n.handleBackground(r,o,s,u,v),Dn(a,r,o,s,u,g),a.fill()),e.imgs&&e.imgs.forEach((function(t,e){var c=Tn(n.ImageCache,"blocks.".concat(i,".").concat(e,".defaultImg"));if(c){var h=n.computedWidthAndHeight(c,t,s,u),l=h[0],f=h[1],d=[n.getOffsetX(l,s),n.getHeight(t.top,u)],p=d[0],g=d[1];n.drawImage(a,c,r+p,o+g,l,f)}})),{x:r+d,y:o+l,w:s-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var i=n.getGeometricProperty([t.x,t.y,t.col,t.row]),o=i[0],s=i[1],h=i[2],l=i[3],f=!1;(void 0===n.prizeFlag||n.prizeFlag>-1)&&(f=e===n.currIndex%n.prizes.length>>0);var d=f?u.background:t.background||c.background;if(_n(d)){var p=(f?u.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(a.shadowColor=p[3],a.shadowOffsetX=p[0]*r.dpr,a.shadowOffsetY=p[1]*r.dpr,a.shadowBlur=p[2],p[0]>0?h-=p[0]:(h+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=n.handleBackground(o,s,h,l,d);var g=n.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Dn(a,o,s,h,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=n.prizes.length&&(v="buttons",e-=n.prizes.length),t.imgs&&t.imgs.forEach((function(t,i){var r=n.ImageCache[v];if(r[e]){var c=r[e][i];if(c){var u=f&&c.activeImg||c.defaultImg;if(u){var d=n.computedWidthAndHeight(u,t,h,l),p=d[0],g=d[1],m=[o+n.getOffsetX(p,h),s+n.getHeight(t.top,l)],y=m[0],w=m[1];n.drawImage(a,u,y,w,p,g)}}}})),t.fonts&&t.fonts.forEach((function(t){var e=f&&u.fontStyle?u.fontStyle:t.fontStyle||c.fontStyle,i=f&&u.fontWeight?u.fontWeight:t.fontWeight||c.fontWeight,r=f&&u.fontSize?n.getLength(u.fontSize):n.getLength(t.fontSize||c.fontSize),d=f&&u.lineHeight?u.lineHeight:t.lineHeight||c.lineHeight||t.fontSize||c.fontSize,p=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:c.wordWrap,g=t.lengthLimit||c.lengthLimit,v=t.lineClamp||c.lineClamp;a.font="".concat(i," ").concat(r>>0,"px ").concat(e),a.fillStyle=f&&u.fontColor?u.fontColor:t.fontColor||c.fontColor;var m=[],y=String(t.text);if(p){var w=n.getWidth(g,h);m=jn(a,Pn(y),(function(){return w}),v)}else m=y.split("\n");m.forEach((function(e,i){a.fillText(e,o+n.getOffsetX(a.measureText(e).width,h),s+n.getHeight(t.top,l)+(i+1)*n.getLength(d))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,n,i,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,n,i,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var u=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,n+r,e+i,n+r-i*u(s-0)]:s>=45&&s<90?c=[e,n+r,e+i-r*u(s-45),n]:s>=90&&s<135?c=[e+i,n+r,e+i-r*u(s-90),n]:s>=135&&s<180?c=[e+i,n+r,e,n+i*u(s-135)]:s>=180&&s<225?c=[e+i,n,e,n+i*u(s-180)]:s>=225&&s<270?c=[e+i,n,e+r*u(s-225),n+r]:s>=270&&s<315?c=[e,n,e+r*u(s-270),n+r]:s>=315&&s<360&&(c=[e,n,e+i,n+r-i*u(s-315)])}else s.includes("top")?c=[e,n+r,e,n]:s.includes("bottom")?c=[e,n,e,n+r]:s.includes("left")?c=[e+i,n,e,n]:s.includes("right")&&(c=[e,n,e+i,n]);var h=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,n){var i=e.split(" ");return 1===i.length?t.addColorStop(n,i[0]):2===i.length&&t.addColorStop.apply(t,i),t}),h)}(o,t,e,n,i,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=i,o=e.speed,a=0,s=0,c=0;++a;){var u=this.prizes.length*a+n-r,h=Zn(this.FPS,r,u,e.decelerationTime)-r;if(h>o){this.endIndex=o-s>h-o?u:c;break}c=u,s=h}},a.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},a.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=$n(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},a.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizes,a=n.prizeFlag,s=n.stopIndex,c=n.endIndex,u=n._defaultConfig,h=u.accelerationTime,l=u.decelerationTime,f=u.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<h){this.FPS=d/t;var v=Qn(d,.1,f-.1,h);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=Zn(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},a.prototype.getGeometricProperty=function(t){var e=t[0],n=t[1],i=t[2],r=void 0===i?1:i,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,u=this._defaultConfig.gutter,h=[this.prizeArea.x+(s+u)*e,this.prizeArea.y+(c+u)*n];return r&&a&&h.push(s*r+u*(r-1),c*a+u*(a-1)),h},a.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr,e/n.dpr]},a}(Jn),ni=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]),i.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(i,t)),u[n][e][o]=t,r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,n=this._defaultStyle,i=this.drawBlocks(),r=i.w,o=i.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,u=s.cellHeight,h=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,n){void 0===t.scroll[n]&&(t.scroll[n]=0),e.order=e.order||f;var i=e.order.length;d=Math.max(d,r+h*i),p=Math.max(p,o+l*i)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(i,r){var o=c*r,a=u*r,s=0,f=function(t,e){for(var n={},i=[],r=0;r<t.length;r++)n[r]=t[r];for(r=0;r<e.length;r++){var o=n[e[r]];o&&(i[r]=o)}return i}(t.prizes,i.order);if(f.length){f.forEach((function(r,f){if(r){var d=i.order[f],p=h*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,h]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||n.background;if(_n(S)){var C=t.getLength(An(r,"borderRadius")?r.borderRadius:n.borderRadius);Dn(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,n){var i=Tn(t.ImageCache,"prizes.".concat(d,".").concat(n));if(i){var r=t.computedWidthAndHeight(i,e,c,u),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,u)],h=s[0],l=s[1];t.drawImage(m,i,h,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var i=e.fontStyle||n.fontStyle,r=e.fontWeight||n.fontWeight,o=t.getLength(e.fontSize||n.fontSize),a=e.lineHeight||n.lineHeight||e.fontSize||n.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:n.wordWrap,h=e.lengthLimit||n.lengthLimit,l=e.lineClamp||n.lineClamp;m.font="".concat(r," ").concat(o>>0,"px ").concat(i),m.fillStyle=e.fontColor||n.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(h,c);f=jn(m,Pn(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(n,i){m.fillText(n,y+t.getOffsetX(m.measureText(n).width,c),w+t.getHeight(e.top,u)+(i+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,u]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),z=C[0],x=C[1];t.drawImage(m,v,g,y,w,b,z,x,w,b),S+=s}}}))},o.prototype.drawBlocks=function(){var t=this,e=this;e.config;var n=e.ctx;e._defaultConfig;var i=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,u=e.h,h=Wn(r),l=h[0],f=h[1],d=h[2],p=h[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||i.background;return _n(v)&&(Dn(n,a,s,c,u,g),n.fillStyle=v,n.fill()),r.imgs&&r.imgs.forEach((function(e,i){var r=Tn(t.ImageCache,"blocks.".concat(o,".").concat(i));if(r){var h=t.computedWidthAndHeight(r,e,c,u),l=h[0],f=h[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,u)],p=d[0],g=d[1];t.drawImage(n,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,n=this,i=n.config,r=n.ctx;n._defaultConfig,n._defaultStyle,null===(t=i.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,u=o.h;if(this._offscreenCanvas){var h=this,l=h.cellWidth,f=h.cellHeight,d=h.cellAndSpacing,p=h.widthAndSpacing,g=h.heightAndSpacing;this.slots.forEach((function(t,n){var i=d*t.order.length,o=e.displacement(-(u-g)/2,-(c-p)/2),h=e.scroll[n]+o;h<0&&(h=h%i+i),h>i&&(h%=i);var v=e.displacement([l*n,h,l,u],[h,f*n,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*n,s,l,u],[a,s+g*n,c,f]),C=S[0],z=S[1],x=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,z,x,O)}))}},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,n=e._defaultConfig,i=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||n.speed,c=e.direction||n.direction,u=a.findIndex((function(t){return t===i[o]})),h=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*u+h*f*c-l,p=Zn(t.FPS,l,d,n.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},o.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},o.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!En(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 ".concat(typeof t));if(t.length!==this.slots.length)return this.stop(-1),console.error("stop([".concat(t,"]) 参数长度的不正确"));this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},o.prototype.run=function(t){var e,n,i=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,u=r.cellAndSpacing,h=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==h.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;h.forEach((function(e,n){var r=e.order;if(r&&r.length){var o=u*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=i.scroll[n];if(1===a||d<l){i.FPS=d/t;var w=Qn(d,0,g,l);w===g&&(i.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===h.length&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===a&&p){var b=i.stopScroll[n],S=i.endScroll[n];m=Zn(p,b,S,f),p>=f&&(i.step=0)}i.scroll[n]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<h.length;v++){var m=h[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(n=this.endCallback)||void 0===n||n.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},o.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},o.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,n=this._defaultConfig,i=n.colSpacing,r=n.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,u=o.h,h=0,l=0;return"horizontal"===t?(l=this.cellHeight=(u-r*(e-1))/e,h=this.cellWidth=l):(h=this.cellWidth=(c-i*(e-1))/e,l=this.cellHeight=h),a=this.widthAndSpacing=this.cellWidth+i,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:h,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o}(Jn);export{ei as LuckyGrid,ti as LuckyWheel,ni as SlotMachine}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -15,3 +15,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).LuckyCanvas={})}(this,(function(t){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},e(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n=function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};function r(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function a(t,e){for(var i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}var h,u,l=function(t){return t&&t.Math==Math&&t},f=l("object"==typeof globalThis&&globalThis)||l("object"==typeof window&&window)||l("object"==typeof self&&self)||l("object"==typeof s&&s)||function(){return this}()||Function("return this")(),d=function(t){try{return!!t()}catch(t){return!0}},p=!d((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),g=Function.prototype.call,v=g.bind?g.bind(g):function(){return g.apply(g,arguments)},y={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,w={f:m&&!y.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:y},b=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},S=Function.prototype,C=S.bind,x=S.call,z=C&&C.bind(x),O=C?function(t){return t&&z(x,t)}:function(t){return t&&function(){return x.apply(t,arguments)}},k=O({}.toString),I=O("".slice),T=function(t){return I(k(t),8,-1)},E=f.Object,A=O("".split),W=d((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==T(t)?A(t,""):E(t)}:E,P=f.TypeError,_=function(t){if(null==t)throw P("Can't call method on "+t);return t},$=function(t){return W(_(t))},R=function(t){return"function"==typeof t},j=function(t){return"object"==typeof t?null!==t:R(t)},F=function(t){return R(t)?t:void 0},H=function(t,e){return arguments.length<2?F(f[t]):f[t]&&f[t][e]},D=O({}.isPrototypeOf),L=H("navigator","userAgent")||"",M=f.process,B=f.Deno,N=M&&M.versions||B&&B.version,X=N&&N.v8;X&&(u=(h=X.split("."))[0]>0&&h[0]<4?1:+(h[0]+h[1])),!u&&L&&(!(h=L.match(/Edge\/(\d+)/))||h[1]>=74)&&(h=L.match(/Chrome\/(\d+)/))&&(u=+h[1]);var G=u,U=!!Object.getOwnPropertySymbols&&!d((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&G&&G<41})),q=U&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Y=f.Object,K=q?function(t){return"symbol"==typeof t}:function(t){var e=H("Symbol");return R(e)&&D(e.prototype,Y(t))},V=f.String,J=f.TypeError,Q=function(t){if(R(t))return t;throw J(function(t){try{return V(t)}catch(t){return"Object"}}(t)+" is not a function")},Z=f.TypeError,tt=Object.defineProperty,et=function(t,e){try{tt(f,t,{value:e,configurable:!0,writable:!0})}catch(i){f[t]=e}return e},it="__core-js_shared__",nt=f[it]||et(it,{}),rt=c((function(t){(t.exports=function(t,e){return nt[t]||(nt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),ot=f.Object,at=function(t){return ot(_(t))},st=O({}.hasOwnProperty),ct=Object.hasOwn||function(t,e){return st(at(t),e)},ht=0,ut=Math.random(),lt=O(1..toString),ft=function(t){return"Symbol("+(void 0===t?"":t)+")_"+lt(++ht+ut,36)},dt=rt("wks"),pt=f.Symbol,gt=pt&&pt.for,vt=q?pt:pt&&pt.withoutSetter||ft,yt=function(t){if(!ct(dt,t)||!U&&"string"!=typeof dt[t]){var e="Symbol."+t;U&&ct(pt,t)?dt[t]=pt[t]:dt[t]=q&>?gt(e):vt(e)}return dt[t]},mt=f.TypeError,wt=yt("toPrimitive"),bt=function(t,e){if(!j(t)||K(t))return t;var i,n,r=null==(i=t[wt])?void 0:Q(i);if(r){if(void 0===e&&(e="default"),n=v(r,t,e),!j(n)||K(n))return n;throw mt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var i,n;if("string"===e&&R(i=t.toString)&&!j(n=v(i,t)))return n;if(R(i=t.valueOf)&&!j(n=v(i,t)))return n;if("string"!==e&&R(i=t.toString)&&!j(n=v(i,t)))return n;throw Z("Can't convert object to primitive value")}(t,e)},St=function(t){var e=bt(t,"string");return K(e)?e:e+""},Ct=f.document,xt=j(Ct)&&j(Ct.createElement),zt=function(t){return xt?Ct.createElement(t):{}},Ot=!p&&!d((function(){return 7!=Object.defineProperty(zt("div"),"a",{get:function(){return 7}}).a})),kt=Object.getOwnPropertyDescriptor,It={f:p?kt:function(t,e){if(t=$(t),e=St(e),Ot)try{return kt(t,e)}catch(t){}if(ct(t,e))return b(!v(w.f,t,e),t[e])}},Tt=f.String,Et=f.TypeError,At=function(t){if(j(t))return t;throw Et(Tt(t)+" is not an object")},Wt=f.TypeError,Pt=Object.defineProperty,_t={f:p?Pt:function(t,e,i){if(At(t),e=St(e),At(i),Ot)try{return Pt(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Wt("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},$t=p?function(t,e,i){return _t.f(t,e,b(1,i))}:function(t,e,i){return t[e]=i,t},Rt=O(Function.toString);R(nt.inspectSource)||(nt.inspectSource=function(t){return Rt(t)});var jt,Ft,Ht,Dt=nt.inspectSource,Lt=f.WeakMap,Mt=R(Lt)&&/native code/.test(Dt(Lt)),Bt=rt("keys"),Nt=function(t){return Bt[t]||(Bt[t]=ft(t))},Xt={},Gt="Object already initialized",Ut=f.TypeError,qt=f.WeakMap;if(Mt||nt.state){var Yt=nt.state||(nt.state=new qt),Kt=O(Yt.get),Vt=O(Yt.has),Jt=O(Yt.set);jt=function(t,e){if(Vt(Yt,t))throw new Ut(Gt);return e.facade=t,Jt(Yt,t,e),e},Ft=function(t){return Kt(Yt,t)||{}},Ht=function(t){return Vt(Yt,t)}}else{var Qt=Nt("state");Xt[Qt]=!0,jt=function(t,e){if(ct(t,Qt))throw new Ut(Gt);return e.facade=t,$t(t,Qt,e),e},Ft=function(t){return ct(t,Qt)?t[Qt]:{}},Ht=function(t){return ct(t,Qt)}}var Zt,te={set:jt,get:Ft,has:Ht,enforce:function(t){return Ht(t)?Ft(t):jt(t,{})},getterFor:function(t){return function(e){var i;if(!j(e)||(i=Ft(e)).type!==t)throw Ut("Incompatible receiver, "+t+" required");return i}}},ee=Function.prototype,ie=p&&Object.getOwnPropertyDescriptor,ne=ct(ee,"name"),re={EXISTS:ne,PROPER:ne&&"something"===function(){}.name,CONFIGURABLE:ne&&(!p||p&&ie(ee,"name").configurable)},oe=c((function(t){var e=re.CONFIGURABLE,i=te.get,n=te.enforce,r=String(String).split("String");(t.exports=function(t,i,o,a){var s,c=!!a&&!!a.unsafe,h=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet,l=a&&void 0!==a.name?a.name:i;R(o)&&("Symbol("===String(l).slice(0,7)&&(l="["+String(l).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!ct(o,"name")||e&&o.name!==l)&&$t(o,"name",l),(s=n(o)).source||(s.source=r.join("string"==typeof l?l:""))),t!==f?(c?!u&&t[i]&&(h=!0):delete t[i],h?t[i]=o:$t(t,i,o)):h?t[i]=o:et(i,o)})(Function.prototype,"toString",(function(){return R(this)&&i(this).source||Dt(this)}))})),ae=Math.ceil,se=Math.floor,ce=function(t){var e=+t;return e!=e||0===e?0:(e>0?se:ae)(e)},he=Math.max,ue=Math.min,le=Math.min,fe=function(t){return(e=t.length)>0?le(ce(e),9007199254740991):0;var e},de=function(t){return function(e,i,n){var r,o=$(e),a=fe(o),s=function(t,e){var i=ce(t);return i<0?he(i+e,0):ue(i,e)}(n,a);if(t&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===i)return t||s||0;return!t&&-1}},pe={includes:de(!0),indexOf:de(!1)},ge=pe.indexOf,ve=O([].push),ye=function(t,e){var i,n=$(t),r=0,o=[];for(i in n)!ct(Xt,i)&&ct(n,i)&&ve(o,i);for(;e.length>r;)ct(n,i=e[r++])&&(~ge(o,i)||ve(o,i));return o},me=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],we=me.concat("length","prototype"),be={f:Object.getOwnPropertyNames||function(t){return ye(t,we)}},Se={f:Object.getOwnPropertySymbols},Ce=O([].concat),xe=H("Reflect","ownKeys")||function(t){var e=be.f(At(t)),i=Se.f;return i?Ce(e,i(t)):e},ze=function(t,e){for(var i=xe(e),n=_t.f,r=It.f,o=0;o<i.length;o++){var a=i[o];ct(t,a)||n(t,a,r(e,a))}},Oe=/#|\.prototype\./,ke=function(t,e){var i=Te[Ie(t)];return i==Ae||i!=Ee&&(R(e)?d(e):!!e)},Ie=ke.normalize=function(t){return String(t).replace(Oe,".").toLowerCase()},Te=ke.data={},Ee=ke.NATIVE="N",Ae=ke.POLYFILL="P",We=ke,Pe=It.f,_e=function(t,e){var i,n,r,o,a,s=t.target,c=t.global,h=t.stat;if(i=c?f:h?f[s]||et(s,{}):(f[s]||{}).prototype)for(n in e){if(o=e[n],r=t.noTargetGet?(a=Pe(i,n))&&a.value:i[n],!We(c?n:s+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;ze(o,r)}(t.sham||r&&r.sham)&&$t(o,"sham",!0),oe(i,n,o,t)}},$e=Object.keys||function(t){return ye(t,me)},Re=p?Object.defineProperties:function(t,e){At(t);for(var i,n=$(e),r=$e(e),o=r.length,a=0;o>a;)_t.f(t,i=r[a++],n[i]);return t},je=H("document","documentElement"),Fe=Nt("IE_PROTO"),He=function(){},De=function(t){return"<script>"+t+"</"+"script>"},Le=function(t){t.write(De("")),t.close();var e=t.parentWindow.Object;return t=null,e},Me=function(){try{Zt=new ActiveXObject("htmlfile")}catch(t){}var t,e;Me="undefined"!=typeof document?document.domain&&Zt?Le(Zt):((e=zt("iframe")).style.display="none",je.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(De("document.F=Object")),t.close(),t.F):Le(Zt);for(var i=me.length;i--;)delete Me.prototype[me[i]];return Me()};Xt[Fe]=!0;var Be=Object.create||function(t,e){var i;return null!==t?(He.prototype=At(t),i=new He,He.prototype=null,i[Fe]=t):i=Me(),void 0===e?i:Re(i,e)},Ne=yt("unscopables"),Xe=Array.prototype;null==Xe[Ne]&&_t.f(Xe,Ne,{configurable:!0,value:Be(null)});var Ge=function(t){Xe[Ne][t]=!0},Ue=pe.includes;_e({target:"Array",proto:!0},{includes:function(t){return Ue(this,t,arguments.length>1?arguments[1]:void 0)}}),Ge("includes"),_e({target:"Object",stat:!0,forced:!p,sham:!p},{defineProperty:_t.f});var qe=yt("match"),Ye=f.TypeError,Ke=function(t){if(function(t){var e;return j(t)&&(void 0!==(e=t[qe])?!!e:"RegExp"==T(t))}(t))throw Ye("The method doesn't accept regular expressions");return t},Ve={};Ve[yt("toStringTag")]="z";var Je="[object z]"===String(Ve),Qe=yt("toStringTag"),Ze=f.Object,ti="Arguments"==T(function(){return arguments}()),ei=Je?T:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ze(t),Qe))?i:ti?T(e):"Object"==(n=T(e))&&R(e.callee)?"Arguments":n},ii=f.String,ni=function(t){if("Symbol"===ei(t))throw TypeError("Cannot convert a Symbol value to a string");return ii(t)},ri=yt("match"),oi=O("".indexOf);_e({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[ri]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~oi(ni(_(this)),ni(Ke(t)),arguments.length>1?arguments[1]:void 0)}});var ai,si,ci=pe.indexOf,hi=O([].indexOf),ui=!!hi&&1/hi([1],1,-0)<0,li=!!(si=[]["indexOf"])&&d((function(){si.call(null,ai||function(){throw 1},1)}));_e({target:"Array",proto:!0,forced:ui||!li},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return ui?hi(this,t,e)||0:ci(this,t,e)}});var fi=O(O.bind),di=Array.isArray||function(t){return"Array"==T(t)},pi=function(){},gi=[],vi=H("Reflect","construct"),yi=/^\s*(?:class|function)\b/,mi=O(yi.exec),wi=!yi.exec(pi),bi=function(t){if(!R(t))return!1;try{return vi(pi,gi,t),!0}catch(t){return!1}},Si=!vi||d((function(){var t;return bi(bi.call)||!bi(Object)||!bi((function(){t=!0}))||t}))?function(t){if(!R(t))return!1;switch(ei(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return wi||!!mi(yi,Dt(t))}:bi,Ci=yt("species"),xi=f.Array,zi=function(t,e){return new(function(t){var e;return di(t)&&(e=t.constructor,(Si(e)&&(e===xi||di(e.prototype))||j(e)&&null===(e=e[Ci]))&&(e=void 0)),void 0===e?xi:e}(t))(0===e?0:e)},Oi=O([].push),ki=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,h,u,l){for(var f,d,p=at(c),g=W(p),v=function(t,e){return Q(t),void 0===e?t:fi?fi(t,e):function(){return t.apply(e,arguments)}}(h,u),y=fe(g),m=0,w=l||zi,b=e?w(c,y):i||a?w(c,0):void 0;y>m;m++)if((s||m in g)&&(d=v(f=g[m],m,p),t))if(e)b[m]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:Oi(b,f)}else switch(t){case 4:return!1;case 7:Oi(b,f)}return o?-1:n||r?r:b}},Ii={forEach:ki(0),map:ki(1),filter:ki(2),some:ki(3),every:ki(4),find:ki(5),findIndex:ki(6),filterReject:ki(7)}.find,Ti="find",Ei=!0;Ti in[]&&Array(1).find((function(){Ei=!1})),_e({target:"Array",proto:!0,forced:Ei},{find:function(t){return Ii(this,t,arguments.length>1?arguments[1]:void 0)}}),Ge(Ti),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var i=Object(this),n=i.length>>>0;if(0===n)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:n-Math.abs(a),0);for(;s<n;){if((r=i[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r<i;){var o=e[r];if(t.call(n,o,r,e))return o;r++}}});var Ai=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Wi=function(t,e){for(var i=0,n=e.split(".");i<n.length;i++){var r=t[n[i]];if(!Ai(r,"object","array"))return r;t=r}return t},Pi=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},_i=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},$i=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(i=e)?0:"object"==typeof i?NaN:"number"==typeof i?i:"string"==typeof i?"%"===i[i.length-1]?Number(i.slice(0,-1))/100:Number(i):NaN))return!1}var i;return!0},Ri=function(t){var e,i=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],n=0,r=0,o=0,a=0;switch(i.length){case 1:n=r=o=a=i[0];break;case 2:n=r=i[0],o=a=i[1];break;case 3:n=i[0],o=a=i[1],r=i[2];break;default:n=i[0],r=i[1],o=i[2],a=i[3]}var s={paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&Ai(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[n,r,o,a]},ji=function(t){var e=[],i=t.map((function(t){return Number(t)})).reduce((function(t,i){if(i>0){var n=t+i;return e.push(n),n}return e.push(NaN),t}),0),n=Math.random()*i;return e.findIndex((function(t){return n<=t}))},Fi=function(t,e,i,n){void 0===n&&(n=1/0),n<=0&&(n=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,h=i(o);if(n===o.length+1&&(c+=a),h<0)return o;if(c>h&&(o.push(r.slice(0,-1)),r=e[s]),n===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Hi=function(t){return Math.PI/180*t},Di=function(t,e,i,n,r,o){t.beginPath();var a,s,c=Hi(90/Math.PI/i*o),h=n+c,u=r-c;t.arc(0,0,i,h,u,!1),t.lineTo.apply(t,(a=(n+r)/2,s=o/2/Math.abs(Math.sin((n-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Li=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),h=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(n+s,r),t.lineTo(n+s,r),t.lineTo(n+o-s,r),t.arc(n+o-s,r+s,s,-h/2,0),t.lineTo(n+o,r+a-s),t.arc(n+o-s,r+a-s,s,0,h/2),t.lineTo(n+s,r+a),t.arc(n+s,r+a-s,s,h/2,h),t.lineTo(n,r+s),t.arc(n+s,r+s,s,h,-h/2),t.closePath()},Mi=function(t,e,i,n,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,h=t.height;a.width=c,a.height=h;var u=c/n;return Li(s,e*u,i*u,n*u,r*u,o*u),s.clip(),s.drawImage(t,0,0,c,h),a},Bi=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;i.width=r,i.height=o,n.drawImage(t,0,0,r,o);var a=n.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var i=Math.ceil(t),n=e*e,r=2*n,o=1/(2*Math.PI*n),a=[],s=0,c=-i;c<=i;c++)for(var h=-i;h<=i;h++){var u=o*Math.exp(-(c*c+h*h)/r);a.push(u),s+=u}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),n.putImageData(a,0,0),i},Ni="1.7.11",Xi=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Gi="__proto__"in{};function Ui(t,e,i,n){Object.defineProperty(t,e,{value:i,enumerable:!!n,writable:!0,configurable:!0})}var qi=Array.prototype,Yi=Object.create(qi);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Yi[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=qi[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),n}}));var Ki=function(){function t(t){this.dep=new Xi,Ui(t,"__luckyOb__",this),Array.isArray(t)&&(Gi?t.__proto__=Yi:Object.getOwnPropertyNames(Yi).forEach((function(e){Ui(t,e,Yi[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Ji(t,e,t[e])}))},t}();function Vi(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Ki(t)}function Ji(t,e,i){var n=new Xi,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(i=t[e]);var s=Vi(i);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):i;return Xi.target&&(n.addSub(Xi.target),s&&s.dep.addSub(Xi.target)),e},set:function(e){e!==i&&(i=e,o&&!a||(a?a.call(t,e):i=e,s=Vi(e),n.notify()))}})}}var Qi=0,Zi=function(){function t(t,e,i,n){void 0===n&&(n={}),this.id=Qi++,this.$lucky=t,this.expr=e,this.deep=!!n.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],i="",n=0;n<t.length;n++){var r=t[n];if(/\[|\./.test(r))e.push(i),i="";else{if(/\W/.test(r))continue;i+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=i,this.value=this.get()}return t.prototype.get=function(){Xi.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){Ai(t,"array","object")&&Object.keys(t).forEach((function(i){var n=t[i];e(n)}))};e(t)}(t),Xi.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),tn=function(){function t(t,e){var i=this;this.version=Ni,this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","lucky-canvas@1.7.11"),t.canvasElement.addEventListener("click",(function(t){return i.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var i=null;return function(){for(var n=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i||(i=setTimeout((function(){t.apply(n,r),clearTimeout(i),i=null}),e))}}((function(){return i.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){i.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],i=t[1];this.ctx.clearRect(-e,-i,2*e,2*i)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,i=0,n=0;t.divElement&&(i=t.divElement.offsetWidth,n=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||i,this.boxHeight=this.getLength(e.height||t.height)||n,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,i=t.canvasElement,n=t.dpr,r=[this.boxWidth*n,this.boxHeight*n],o=r[0],a=r[1];i&&(i.width=o,i.height=a,i.style.width=o+"px",i.style.height=a+"px",i.style["transform-origin"]="left top",i.style.transform="scale("+1/n+")",e.scale(n,n))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,i){var n=this;return void 0===i&&(i="$resolve"),new Promise((function(r,o){if(t||o("=> '"+e.src+"' 不能为空或不合法"),"WEB"!==n.config.flag)return e[i]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '"+e.src+"' 图片加载失败")},a.src=t}))},t.prototype.drawImage=function(t,e){for(var i,n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.config,s=o.flag,c=o.dpr;if(["WEB","MP-WX"].includes(s))i=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");i=e.path}return 8===n.length&&(n=n.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,a([i],n))},t.prototype.getLength=function(t){return Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var i=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,n,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*i.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(n);var a=i.config.unitFunc;return a?a(n,r):n})))},t.prototype.getOffscreenCanvas=function(t,e){if(!Pi(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var i=this.config.dpr,n=this._offscreenCanvas;n.width=(t||300)*i,n.height=(e||150)*i;var r=n.getContext("2d");return r.clearRect(0,0,t,e),r.scale(i,i),r.dpr=i,{_offscreenCanvas:n,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var r=i.map((function(t){return e.getLength(t)}));return Mi.apply(void 0,a([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;if(i.width=r,i.height=o,"string"==typeof n.filter)n.filter="opacity("+e+"%)",n.drawImage(t,0,0,r,o);else{n.drawImage(t,0,0,r,o);for(var a=n.getImageData(0,0,r,o),s=a.data,c=s.length,h=0;h<c;h+=4){var u=s[h+3];0!==u&&(s[h+3]=u*e/100)}n.putImageData(a,0,0)}return i}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Bi(t,this.getLength(e))},t.prototype.$set=function(t,e,i){t&&"object"==typeof t&&Ji(t,e,i)},t.prototype.$computed=function(t,e,i){var n=this;Object.defineProperty(t,e,{get:function(){return i.call(n)}})},t.prototype.$watch=function(t,e,i){void 0===i&&(i={}),"object"==typeof e&&(e=(i=e).handler);var n=new Zi(this,t,e,i);return i.immediate&&e.call(this,n.value),function(){}},t}(),en=function(t,e,i,n){return t>=n&&(t=n),i*(t/=n)*t+e},nn=function(t,e,i,n){return t>=n&&(t=n),-i*(t/=n)*(t-2)+e},rn=function(t){function e(e,i){var n,r=t.call(this,e,{width:i.width,height:i.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return i(e,t),e.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.call(e)},e.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return n({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return n({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var i;return o(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},e.prototype.handleClick=function(t){var e,i=this.ctx;i.beginPath(),i.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),i.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},e.prototype.loadAndCacheImg=function(t,e,i,n){return r(this,void 0,void 0,(function(){var r=this;return o(this,(function(o){return[2,new Promise((function(o,a){var s=r[t][e];if(s&&s.imgs){var c=s.imgs[n];if(c){var h=r.ImageCache;h[i][e]||(h[i][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),h[i][e][n]=t,o()})).catch((function(i){console.error(t+"["+e+"].imgs["+n+"] "+i),a()}))}}}))]}))}))},e.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},e.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,a=n._defaultConfig,s=n._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,n){return $i(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=i.ImageCache.blocks;if(a&&a[n]){var s=a[n][r];if(s){var c=i.computedWidthAndHeight(s,e,2*t,2*t),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Hi(i.rotateDeg)),i.drawImage(o,s,f,d,h,u),o.restore()}}})),t-i.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Hi(this.prizeDeg);var c=Hi(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),h=function(t){return i.getOffsetX(o.measureText(t).width)},u=function(t,e,n){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return i.getHeight(t.top,e)+(n+1)*i.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var n=c+e*i.prizeRadian,r=i.prizeRadius-i.maxBtnRadius,l=t.background||s.background;$i(l)&&(o.fillStyle=l,Di(o,i.maxBtnRadius,i.prizeRadius,n-i.prizeRadian/2,n+i.prizeRadian/2,i.getLength(a.gutter)),o.fill());var f=Math.cos(n)*i.prizeRadius,d=Math.sin(n)*i.prizeRadius;o.translate(f,d),o.rotate(n+Hi(90)),t.imgs&&t.imgs.forEach((function(t,n){var a=i.ImageCache.prizes;if(a&&a[e]){var s=a[e][n];if(s){var c=i.computedWidthAndHeight(s,t,i.prizeRadian*i.prizeRadius,r),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,r)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,n=t.fontWeight||s.fontWeight,c=i.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font=n+" "+(c>>0)+"px "+l;var g=String(t.text);(f?Fi(o,_i(g),(function(e){var n=2*((i.prizeRadius-u(t,r,e.length))*Math.tan(i.prizeRadian/2))-i.getLength(a.gutter);return i.getWidth(d,n)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,i){o.fillText(e,h(e),u(t,r,i))}))})),o.rotate(Hi(360)-n-Hi(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var n=i.getHeight(t.radius);i.maxBtnRadius=Math.max(i.maxBtnRadius,n),$i(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,n,0,2*Math.PI,!1),o.fill()),t.pointer&&$i(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-n,0),o.lineTo(n,0),o.lineTo(0,2*-n),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=i.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=i.computedWidthAndHeight(s,t,2*n,2*n),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,n)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=i.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font=r+" "+(a>>0)+"px "+c,String(t.text).split("\n").forEach((function(e,i){o.fillText(e,h(e),u(t,n,i))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*n-n/2)*this.getLength(e.stopRange),c=0,h=0,u=0;++c;){var l=360*c-i*n-r-e.offsetDegree+s-n/2,f=nn(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-h>f-a?l:u;break}u=l,h=f}},e.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},e.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=ji(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},e.prototype.run=function(t){var e;void 0===t&&(t=0);var i=this,n=i.rAF,r=i.step,o=i.prizeFlag,a=i.stopDeg,s=i.endDeg,c=i._defaultConfig,h=c.accelerationTime,u=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<h){this.FPS=f/t;var g=en(f,0,l,h);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=nn(d,a,s,u),d>=u&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),n(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},e.prototype.getWidth=function(t,e){return void 0===e&&(e=this.prizeRadian*this.prizeRadius),Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,e):0},e.prototype.getHeight=function(t,e){return void 0===e&&(e=this.prizeRadius),Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,e):0},e.prototype.getOffsetX=function(t){return-t/2},e.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr-this.Radius,e/i.dpr-this.Radius]},e}(tn),on=function(t){function e(e,i){var n,r=t.call(this,e,{width:i.width,height:i.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return i(e,t),e.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.call(e)},e.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return n({background:"#ffce98",shadow:""},t.activeStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var i;return o(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i=t.buttons.map((function(t){return t.imgs}));t.button&&i.push(t.button.imgs);var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:i};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},e.prototype.handleClick=function(t){var e=this,i=this.ctx;a(a([],this.buttons),[this.button]).forEach((function(n){var r;if(n){var o=e.getGeometricProperty([n.x,n.y,n.col||1,n.row||1]),a=o[0],s=o[1],c=o[2],h=o[3];i.beginPath(),i.rect(a,s,c,h),i.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof n.callback&&n.callback.call(e,n),null===(r=e.startCallback)||void 0===r||r.call(e,t,n))}}))},e.prototype.loadAndCacheImg=function(t,e,i,n){return r(this,void 0,void 0,(function(){var r=this;return o(this,(function(o){return[2,new Promise((function(o,a){var s=r[t][e];if("buttons"===t&&!r.buttons.length&&r.button&&(s=r.button),s&&s.imgs){var c=s.imgs[n];if(c){var h=r.ImageCache;h[i][e]||(h[i][e]=[]);var u=[r.loadImg(c.src,c),c.activeSrc&&r.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(u).then((function(t){var a=t[0],s=t[1],u=c.formatter;"function"==typeof u&&(a=u.call(r,a),s&&(s=u.call(r,s))),h[i][e][n]={defaultImg:a,activeImg:s},o()})).catch((function(i){console.error(t+"["+e+"].imgs["+n+"] "+i),a()}))}}}))]}))}))},e.prototype.computedWidthAndHeight=function(t,e,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var n=this.getWidth(e.width,i.col);return[n,t.height*(n/t.width)]}if(!e.width&&e.height){var r=this.getHeight(e.height,i.row);return[t.width*(r/t.height),r]}return[this.getWidth(e.width,i.col),this.getHeight(e.height,i.row)]},e.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,s=n._defaultConfig,c=n._defaultStyle,h=n._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=a(a([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e){var n=t.x,r=t.y,a=t.w,s=t.h,h=Ri(e),u=h[0],l=h[1],f=h[2],d=h[3],p=e.borderRadius?i.getLength(e.borderRadius):0,g=e.background||c.background;return $i(g)&&(o.fillStyle=i.handleBackground(n,r,a,s,g),Li(o,n,r,a,s,p),o.fill()),{x:n+f,y:r+u,w:a-f-d,h:s-u-l}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var n=i.getGeometricProperty([t.x,t.y,t.col,t.row]),a=n[0],s=n[1],u=n[2],l=n[3],f=!1;(void 0===i.prizeFlag||i.prizeFlag>-1)&&(f=e===i.currIndex%i.prizes.length>>0);var d=f?h.background:t.background||c.background;if($i(d)){var p=(f?h.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(o.shadowColor=p[3],o.shadowOffsetX=p[0]*r.dpr,o.shadowOffsetY=p[1]*r.dpr,o.shadowBlur=p[2],p[0]>0?u-=p[0]:(u+=p[0],a-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),o.fillStyle=i.handleBackground(a,s,u,l,d);var g=i.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Li(o,a,s,u,l,g),o.fill(),o.shadowColor="rgba(0, 0, 0, 0)",o.shadowOffsetX=0,o.shadowOffsetY=0,o.shadowBlur=0}var v="prizes";e>=i.prizes.length&&(v="buttons",e-=i.prizes.length),t.imgs&&t.imgs.forEach((function(n,r){var c=i.ImageCache[v];if(c[e]){var h=c[e][r];if(h){var u=f&&h.activeImg||h.defaultImg;if(u){var l=i.computedWidthAndHeight(u,n,t),d=l[0],p=l[1],g=[a+i.getOffsetX(d,t.col),s+i.getHeight(n.top,t.row)],y=g[0],m=g[1];i.drawImage(o,u,y,m,d,p)}}}})),t.fonts&&t.fonts.forEach((function(e){var n=f&&h.fontStyle?h.fontStyle:e.fontStyle||c.fontStyle,r=f&&h.fontWeight?h.fontWeight:e.fontWeight||c.fontWeight,u=f&&h.fontSize?i.getLength(h.fontSize):i.getLength(e.fontSize||c.fontSize),l=f&&h.lineHeight?h.lineHeight:e.lineHeight||c.lineHeight||e.fontSize||c.fontSize,d=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:c.wordWrap,p=e.lengthLimit||c.lengthLimit,g=e.lineClamp||c.lineClamp;o.font=r+" "+(u>>0)+"px "+n,o.fillStyle=f&&h.fontColor?h.fontColor:e.fontColor||c.fontColor;var v=[],y=String(e.text);if(d){var m=i.getWidth(p,t.col);v=Fi(o,_i(y),(function(){return m}),g)}else v=y.split("\n");v.forEach((function(n,r){o.fillText(n,a+i.getOffsetX(o.measureText(n).width,t.col),s+i.getHeight(e.top,t.row)+(r+1)*i.getLength(l))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.handleBackground=function(t,e,i,n,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,i,n,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var h=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,i+r,e+n,i+r-n*h(s-0)]:s>=45&&s<90?c=[e,i+r,e+n-r*h(s-45),i]:s>=90&&s<135?c=[e+n,i+r,e+n-r*h(s-90),i]:s>=135&&s<180?c=[e+n,i+r,e,i+n*h(s-135)]:s>=180&&s<225?c=[e+n,i,e,i+n*h(s-180)]:s>=225&&s<270?c=[e+n,i,e+r*h(s-225),i+r]:s>=270&&s<315?c=[e,i,e+r*h(s-270),i+r]:s>=315&&s<360&&(c=[e,i,e+n,i+r-n*h(s-315)])}else s.includes("top")?c=[e,i+r,e,i]:s.includes("bottom")?c=[e,i,e,i+r]:s.includes("left")?c=[e+n,i,e,i]:s.includes("right")&&(c=[e,i,e+n,i]);var u=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,i){var n=e.split(" ");return 1===n.length?t.addColorStop(i,n[0]):2===n.length&&t.addColorStop.apply(t,n),t}),u)}(o,t,e,i,n,r)),r},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=n,o=e.speed,a=0,s=0,c=0;++a;){var h=this.prizes.length*a+i-r,u=nn(this.FPS,r,h,e.decelerationTime)-r;if(u>o){this.endIndex=o-s>u-o?h:c;break}c=h,s=u}},e.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},e.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=ji(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},e.prototype.run=function(t){var e;void 0===t&&(t=0);var i=this,n=i.rAF,r=i.step,o=i.prizes,a=i.prizeFlag,s=i.stopIndex,c=i.endIndex,h=i._defaultConfig,u=h.accelerationTime,l=h.decelerationTime,f=h.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<u){this.FPS=d/t;var v=en(d,.1,f-.1,u);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=nn(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),n(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},e.prototype.getGeometricProperty=function(t){var e=t[0],i=t[1],n=t[2],r=void 0===n?1:n,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,h=this._defaultConfig.gutter,u=[this.prizeArea.x+(s+h)*e,this.prizeArea.y+(c+h)*i];return r&&a&&u.push(s*r+h*(r-1),c*a+h*(a-1)),u},e.prototype.getWidth=function(t,e){return void 0===e&&(e=1),Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,this.cellWidth*e+this._defaultConfig.gutter*(e-1)):0},e.prototype.getHeight=function(t,e){return void 0===e&&(e=1),Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,this.cellHeight*e+this._defaultConfig.gutter*(e-1)):0},e.prototype.getOffsetX=function(t,e){return void 0===e&&(e=1),(this.cellWidth*e+this._defaultConfig.gutter*(e-1)-t)/2},e.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr,e/i.dpr]},e}(tn),an=function(t){function e(e,i){var n,r=t.call(this,e,{width:i.width,height:i.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return i(e,t),e.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.call(e)},e.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var i;return o(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},e.prototype.loadAndCacheImg=function(t,e,i,n){return r(this,void 0,void 0,(function(){var r=this;return o(this,(function(o){return[2,new Promise((function(o,a){var s=r[t][e];if(s&&s.imgs){var c=s.imgs[n];if(c){var h=r.ImageCache;h[i][e]||(h[i][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),h[i][e][n]=t,o()})).catch((function(i){console.error(t+"["+e+"].imgs["+n+"] "+i),a()}))}}}))]}))}))},e.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},e.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,i=this._defaultStyle,n=this.drawBlocks(),r=n.w,o=n.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,h=s.cellHeight,u=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,i){void 0===t.scroll[i]&&(t.scroll[i]=0),e.order=e.order||f;var n=e.order.length;d=Math.max(d,r+u*n),p=Math.max(p,o+l*n)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,y=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(n,r){var o=c*r,a=h*r,s=0,f=function(t,e){for(var i={},n=[],r=0;r<t.length;r++)i[r]=t[r];for(r=0;r<e.length;r++){var o=i[e[r]];o&&(n[r]=o)}return n}(t.prizes,n.order);if(f.length){f.forEach((function(r,f){if(r){var d=n.order[f],p=u*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,u]),m=v[0],w=v[1],b=v[2];s+=b;var S=r.background||i.background;if($i(S)){var C=t.getLength(Pi(r,"borderRadius")?r.borderRadius:i.borderRadius);Li(y,m,w,c,c,C),y.fillStyle=S,y.fill()}r.imgs&&r.imgs.forEach((function(e,i){var n=Wi(t.ImageCache,"prizes."+d+"."+i);if(n){var r=t.computedWidthAndHeight(n,e,c,h),o=r[0],a=r[1],s=[m+t.getOffsetX(o,c),w+t.getHeight(e.top,h)],u=s[0],l=s[1];t.drawImage(y,n,u,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var n=e.fontStyle||i.fontStyle,r=e.fontWeight||i.fontWeight,o=t.getLength(e.fontSize||i.fontSize),a=e.lineHeight||i.lineHeight||e.fontSize||i.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:i.wordWrap,u=e.lengthLimit||i.lengthLimit,l=e.lineClamp||i.lineClamp;y.font=r+" "+(o>>0)+"px "+n,y.fillStyle=e.fontColor||i.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(u,c);f=Fi(y,_i(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(i,n){y.fillText(i,m+t.getOffsetX(y.measureText(i).width,c),w+t.getHeight(e.top,h)+(n+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,h]),g=d[0],m=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,m]),x=C[0],z=C[1];t.drawImage(y,v,g,m,w,b,x,z,w,b),S+=s}}}))},e.prototype.drawBlocks=function(){var t=this,e=this;e.config;var i=e.ctx;e._defaultConfig;var n=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,h=e.h,u=Ri(r),l=u[0],f=u[1],d=u[2],p=u[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||n.background;return $i(v)&&(Li(i,a,s,c,h,g),i.fillStyle=v,i.fill()),r.imgs&&r.imgs.forEach((function(e,n){var r=Wi(t.ImageCache,"blocks."+o+"."+n);if(r){var u=t.computedWidthAndHeight(r,e,c,h),l=u[0],f=u[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,h)],p=d[0],g=d[1];t.drawImage(i,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:h-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},e.prototype.draw=function(){var t,e=this,i=this,n=i.config,r=i.ctx;i._defaultConfig,i._defaultStyle,null===(t=n.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,h=o.h;if(this._offscreenCanvas){var u=this,l=u.cellWidth,f=u.cellHeight,d=u.cellAndSpacing,p=u.widthAndSpacing,g=u.heightAndSpacing;this.slots.forEach((function(t,i){var n=d*t.order.length,o=e.displacement(-(h-g)/2,-(c-p)/2),u=e.scroll[i]+o;u<0&&(u=u%n+n),u>n&&(u%=n);var v=e.displacement([l*i,u,l,h],[u,f*i,c,f]),y=v[0],m=v[1],w=v[2],b=v[3],S=e.displacement([a+p*i,s,l,h],[a,s+g*i,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,y,m,w,b,C,x,z,O)}))}},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,i=e._defaultConfig,n=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||i.speed,c=e.direction||i.direction,h=a.findIndex((function(t){return t===n[o]})),u=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*h+u*f*c-l,p=nn(t.FPS,l,d,i.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},e.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},e.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!Ai(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 "+typeof t);if(t.length!==this.slots.length)return this.stop(-1),console.error("stop(["+t+"]) 参数长度的不正确");this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},e.prototype.run=function(t){var e,i,n=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,h=r.cellAndSpacing,u=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==u.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;u.forEach((function(e,i){var r=e.order;if(r&&r.length){var o=h*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,y=0,m=n.scroll[i];if(1===a||d<l){n.FPS=d/t;var w=en(d,0,g,l);w===g&&(n.step=2),y=(m+w*v)%o}else if(2===a)y=(m+g*v)%o,(null==s?void 0:s.length)===u.length&&(n.step=3,n.stopScroll=[],n.endScroll=[]);else if(3===a&&p){var b=n.stopScroll[i],S=n.endScroll[i];y=nn(p,b,S,f),p>=f&&(n.step=0)}n.scroll[i]=y}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<u.length;v++){var y=u[v],m=s[v];if(!(null===(e=y.order)||void 0===e?void 0:e.includes(m))||g!==m){g=-1;break}}null===(i=this.endCallback)||void 0===i||i.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},e.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},e.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,i=this._defaultConfig,n=i.colSpacing,r=i.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,h=o.h,u=0,l=0;return"horizontal"===t?(l=this.cellHeight=(h-r*(e-1))/e,u=this.cellWidth=l):(u=this.cellWidth=(c-n*(e-1))/e,l=this.cellHeight=u),a=this.widthAndSpacing=this.cellWidth+n,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:u,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},e.prototype.getWidth=function(t,e){return Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,e):0},e.prototype.getHeight=function(t,e){return Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,e):0},e.prototype.getOffsetX=function(t,e){return(e-t)/2},e}(tn);t.LuckyGrid=on,t.LuckyWheel=rn,t.SlotMachine=an,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
***************************************************************************** */var e=function(t,n){return e=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])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function r(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((i=i.apply(t,e||[])).next())}))}function o(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function a(t,e){for(var n=0,i=e.length,r=t.length;n<i;n++,r++)t[r]=e[n];return t}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var u,h,l=function(t){return t&&t.Math==Math&&t},f=l("object"==typeof globalThis&&globalThis)||l("object"==typeof window&&window)||l("object"==typeof self&&self)||l("object"==typeof s&&s)||function(){return this}()||Function("return this")(),d=function(t){try{return!!t()}catch(t){return!0}},p=!d((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),g=Function.prototype.call,v=g.bind?g.bind(g):function(){return g.apply(g,arguments)},m={}.propertyIsEnumerable,y=Object.getOwnPropertyDescriptor,w={f:y&&!m.call({1:2},1)?function(t){var e=y(this,t);return!!e&&e.enumerable}:m},b=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},S=Function.prototype,C=S.bind,x=S.call,z=C&&C.bind(x),O=C?function(t){return t&&z(x,t)}:function(t){return t&&function(){return x.apply(t,arguments)}},k=O({}.toString),I=O("".slice),T=function(t){return I(k(t),8,-1)},E=f.Object,A=O("".split),P=d((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==T(t)?A(t,""):E(t)}:E,W=f.TypeError,_=function(t){if(null==t)throw W("Can't call method on "+t);return t},$=function(t){return P(_(t))},j=function(t){return"function"==typeof t},R=function(t){return"object"==typeof t?null!==t:j(t)},F=function(t){return j(t)?t:void 0},D=function(t,e){return arguments.length<2?F(f[t]):f[t]&&f[t][e]},L=O({}.isPrototypeOf),H=D("navigator","userAgent")||"",M=f.process,B=f.Deno,N=M&&M.versions||B&&B.version,G=N&&N.v8;G&&(h=(u=G.split("."))[0]>0&&u[0]<4?1:+(u[0]+u[1])),!h&&H&&(!(u=H.match(/Edge\/(\d+)/))||u[1]>=74)&&(u=H.match(/Chrome\/(\d+)/))&&(h=+u[1]);var X=h,U=!!Object.getOwnPropertySymbols&&!d((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),q=U&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Y=f.Object,K=q?function(t){return"symbol"==typeof t}:function(t){var e=D("Symbol");return j(e)&&L(e.prototype,Y(t))},V=f.String,J=f.TypeError,Q=function(t){if(j(t))return t;throw J(function(t){try{return V(t)}catch(t){return"Object"}}(t)+" is not a function")},Z=f.TypeError,tt=Object.defineProperty,et=function(t,e){try{tt(f,t,{value:e,configurable:!0,writable:!0})}catch(n){f[t]=e}return e},nt="__core-js_shared__",it=f[nt]||et(nt,{}),rt=c((function(t){(t.exports=function(t,e){return it[t]||(it[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),ot=f.Object,at=function(t){return ot(_(t))},st=O({}.hasOwnProperty),ct=Object.hasOwn||function(t,e){return st(at(t),e)},ut=0,ht=Math.random(),lt=O(1..toString),ft=function(t){return"Symbol("+(void 0===t?"":t)+")_"+lt(++ut+ht,36)},dt=rt("wks"),pt=f.Symbol,gt=pt&&pt.for,vt=q?pt:pt&&pt.withoutSetter||ft,mt=function(t){if(!ct(dt,t)||!U&&"string"!=typeof dt[t]){var e="Symbol."+t;U&&ct(pt,t)?dt[t]=pt[t]:dt[t]=q&>?gt(e):vt(e)}return dt[t]},yt=f.TypeError,wt=mt("toPrimitive"),bt=function(t,e){if(!R(t)||K(t))return t;var n,i,r=null==(n=t[wt])?void 0:Q(n);if(r){if(void 0===e&&(e="default"),i=v(r,t,e),!R(i)||K(i))return i;throw yt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,i;if("string"===e&&j(n=t.toString)&&!R(i=v(n,t)))return i;if(j(n=t.valueOf)&&!R(i=v(n,t)))return i;if("string"!==e&&j(n=t.toString)&&!R(i=v(n,t)))return i;throw Z("Can't convert object to primitive value")}(t,e)},St=function(t){var e=bt(t,"string");return K(e)?e:e+""},Ct=f.document,xt=R(Ct)&&R(Ct.createElement),zt=function(t){return xt?Ct.createElement(t):{}},Ot=!p&&!d((function(){return 7!=Object.defineProperty(zt("div"),"a",{get:function(){return 7}}).a})),kt=Object.getOwnPropertyDescriptor,It={f:p?kt:function(t,e){if(t=$(t),e=St(e),Ot)try{return kt(t,e)}catch(t){}if(ct(t,e))return b(!v(w.f,t,e),t[e])}},Tt=f.String,Et=f.TypeError,At=function(t){if(R(t))return t;throw Et(Tt(t)+" is not an object")},Pt=f.TypeError,Wt=Object.defineProperty,_t={f:p?Wt:function(t,e,n){if(At(t),e=St(e),At(n),Ot)try{return Wt(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Pt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},$t=p?function(t,e,n){return _t.f(t,e,b(1,n))}:function(t,e,n){return t[e]=n,t},jt=O(Function.toString);j(it.inspectSource)||(it.inspectSource=function(t){return jt(t)});var Rt,Ft,Dt,Lt=it.inspectSource,Ht=f.WeakMap,Mt=j(Ht)&&/native code/.test(Lt(Ht)),Bt=rt("keys"),Nt=function(t){return Bt[t]||(Bt[t]=ft(t))},Gt={},Xt="Object already initialized",Ut=f.TypeError,qt=f.WeakMap;if(Mt||it.state){var Yt=it.state||(it.state=new qt),Kt=O(Yt.get),Vt=O(Yt.has),Jt=O(Yt.set);Rt=function(t,e){if(Vt(Yt,t))throw new Ut(Xt);return e.facade=t,Jt(Yt,t,e),e},Ft=function(t){return Kt(Yt,t)||{}},Dt=function(t){return Vt(Yt,t)}}else{var Qt=Nt("state");Gt[Qt]=!0,Rt=function(t,e){if(ct(t,Qt))throw new Ut(Xt);return e.facade=t,$t(t,Qt,e),e},Ft=function(t){return ct(t,Qt)?t[Qt]:{}},Dt=function(t){return ct(t,Qt)}}var Zt,te={set:Rt,get:Ft,has:Dt,enforce:function(t){return Dt(t)?Ft(t):Rt(t,{})},getterFor:function(t){return function(e){var n;if(!R(e)||(n=Ft(e)).type!==t)throw Ut("Incompatible receiver, "+t+" required");return n}}},ee=Function.prototype,ne=p&&Object.getOwnPropertyDescriptor,ie=ct(ee,"name"),re={EXISTS:ie,PROPER:ie&&"something"===function(){}.name,CONFIGURABLE:ie&&(!p||p&&ne(ee,"name").configurable)},oe=c((function(t){var e=re.CONFIGURABLE,n=te.get,i=te.enforce,r=String(String).split("String");(t.exports=function(t,n,o,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,h=!!a&&!!a.noTargetGet,l=a&&void 0!==a.name?a.name:n;j(o)&&("Symbol("===String(l).slice(0,7)&&(l="["+String(l).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!ct(o,"name")||e&&o.name!==l)&&$t(o,"name",l),(s=i(o)).source||(s.source=r.join("string"==typeof l?l:""))),t!==f?(c?!h&&t[n]&&(u=!0):delete t[n],u?t[n]=o:$t(t,n,o)):u?t[n]=o:et(n,o)})(Function.prototype,"toString",(function(){return j(this)&&n(this).source||Lt(this)}))})),ae=Math.ceil,se=Math.floor,ce=function(t){var e=+t;return e!=e||0===e?0:(e>0?se:ae)(e)},ue=Math.max,he=Math.min,le=Math.min,fe=function(t){return(e=t.length)>0?le(ce(e),9007199254740991):0;var e},de=function(t){return function(e,n,i){var r,o=$(e),a=fe(o),s=function(t,e){var n=ce(t);return n<0?ue(n+e,0):he(n,e)}(i,a);if(t&&n!=n){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},pe={includes:de(!0),indexOf:de(!1)},ge=pe.indexOf,ve=O([].push),me=function(t,e){var n,i=$(t),r=0,o=[];for(n in i)!ct(Gt,n)&&ct(i,n)&&ve(o,n);for(;e.length>r;)ct(i,n=e[r++])&&(~ge(o,n)||ve(o,n));return o},ye=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],we=ye.concat("length","prototype"),be={f:Object.getOwnPropertyNames||function(t){return me(t,we)}},Se={f:Object.getOwnPropertySymbols},Ce=O([].concat),xe=D("Reflect","ownKeys")||function(t){var e=be.f(At(t)),n=Se.f;return n?Ce(e,n(t)):e},ze=function(t,e){for(var n=xe(e),i=_t.f,r=It.f,o=0;o<n.length;o++){var a=n[o];ct(t,a)||i(t,a,r(e,a))}},Oe=/#|\.prototype\./,ke=function(t,e){var n=Te[Ie(t)];return n==Ae||n!=Ee&&(j(e)?d(e):!!e)},Ie=ke.normalize=function(t){return String(t).replace(Oe,".").toLowerCase()},Te=ke.data={},Ee=ke.NATIVE="N",Ae=ke.POLYFILL="P",Pe=ke,We=It.f,_e=function(t,e){var n,i,r,o,a,s=t.target,c=t.global,u=t.stat;if(n=c?f:u?f[s]||et(s,{}):(f[s]||{}).prototype)for(i in e){if(o=e[i],r=t.noTargetGet?(a=We(n,i))&&a.value:n[i],!Pe(c?i:s+(u?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;ze(o,r)}(t.sham||r&&r.sham)&&$t(o,"sham",!0),oe(n,i,o,t)}},$e=Object.keys||function(t){return me(t,ye)},je=p?Object.defineProperties:function(t,e){At(t);for(var n,i=$(e),r=$e(e),o=r.length,a=0;o>a;)_t.f(t,n=r[a++],i[n]);return t},Re=D("document","documentElement"),Fe=Nt("IE_PROTO"),De=function(){},Le=function(t){return"<script>"+t+"</"+"script>"},He=function(t){t.write(Le("")),t.close();var e=t.parentWindow.Object;return t=null,e},Me=function(){try{Zt=new ActiveXObject("htmlfile")}catch(t){}var t,e;Me="undefined"!=typeof document?document.domain&&Zt?He(Zt):((e=zt("iframe")).style.display="none",Re.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Le("document.F=Object")),t.close(),t.F):He(Zt);for(var n=ye.length;n--;)delete Me.prototype[ye[n]];return Me()};Gt[Fe]=!0;var Be=Object.create||function(t,e){var n;return null!==t?(De.prototype=At(t),n=new De,De.prototype=null,n[Fe]=t):n=Me(),void 0===e?n:je(n,e)},Ne=mt("unscopables"),Ge=Array.prototype;null==Ge[Ne]&&_t.f(Ge,Ne,{configurable:!0,value:Be(null)});var Xe=function(t){Ge[Ne][t]=!0},Ue=pe.includes;_e({target:"Array",proto:!0},{includes:function(t){return Ue(this,t,arguments.length>1?arguments[1]:void 0)}}),Xe("includes"),_e({target:"Object",stat:!0,forced:!p,sham:!p},{defineProperty:_t.f});var qe=mt("match"),Ye=f.TypeError,Ke=function(t){if(function(t){var e;return R(t)&&(void 0!==(e=t[qe])?!!e:"RegExp"==T(t))}(t))throw Ye("The method doesn't accept regular expressions");return t},Ve={};Ve[mt("toStringTag")]="z";var Je="[object z]"===String(Ve),Qe=mt("toStringTag"),Ze=f.Object,tn="Arguments"==T(function(){return arguments}()),en=Je?T:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ze(t),Qe))?n:tn?T(e):"Object"==(i=T(e))&&j(e.callee)?"Arguments":i},nn=f.String,rn=function(t){if("Symbol"===en(t))throw TypeError("Cannot convert a Symbol value to a string");return nn(t)},on=mt("match"),an=O("".indexOf);_e({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[on]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~an(rn(_(this)),rn(Ke(t)),arguments.length>1?arguments[1]:void 0)}});var sn,cn,un=pe.indexOf,hn=O([].indexOf),ln=!!hn&&1/hn([1],1,-0)<0,fn=!!(cn=[]["indexOf"])&&d((function(){cn.call(null,sn||function(){throw 1},1)}));_e({target:"Array",proto:!0,forced:ln||!fn},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return ln?hn(this,t,e)||0:un(this,t,e)}});var dn=O(O.bind),pn=Array.isArray||function(t){return"Array"==T(t)},gn=function(){},vn=[],mn=D("Reflect","construct"),yn=/^\s*(?:class|function)\b/,wn=O(yn.exec),bn=!yn.exec(gn),Sn=function(t){if(!j(t))return!1;try{return mn(gn,vn,t),!0}catch(t){return!1}},Cn=!mn||d((function(){var t;return Sn(Sn.call)||!Sn(Object)||!Sn((function(){t=!0}))||t}))?function(t){if(!j(t))return!1;switch(en(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return bn||!!wn(yn,Lt(t))}:Sn,xn=mt("species"),zn=f.Array,On=function(t,e){return new(function(t){var e;return pn(t)&&(e=t.constructor,(Cn(e)&&(e===zn||pn(e.prototype))||R(e)&&null===(e=e[xn]))&&(e=void 0)),void 0===e?zn:e}(t))(0===e?0:e)},kn=O([].push),In=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,u,h,l){for(var f,d,p=at(c),g=P(p),v=function(t,e){return Q(t),void 0===e?t:dn?dn(t,e):function(){return t.apply(e,arguments)}}(u,h),m=fe(g),y=0,w=l||On,b=e?w(c,m):n||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:kn(b,f)}else switch(t){case 4:return!1;case 7:kn(b,f)}return o?-1:i||r?r:b}},Tn={forEach:In(0),map:In(1),filter:In(2),some:In(3),every:In(4),find:In(5),findIndex:In(6),filterReject:In(7)}.find,En="find",An=!0;En in[]&&Array(1).find((function(){An=!1})),_e({target:"Array",proto:!0,forced:An},{find:function(t){return Tn(this,t,arguments.length>1?arguments[1]:void 0)}}),Xe(En);var Pn=Je?{}.toString:function(){return"[object "+en(this)+"]"};Je||oe(Object.prototype,"toString",Pn,{unsafe:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:i-Math.abs(a),0);for(;s<i;){if((r=n[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var o=e[r];if(t.call(i,o,r,e))return o;r++}}});var Wn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},_n=function(t,e){for(var n=0,i=e.split(".");n<i.length;n++){var r=t[i[n]];if(!Wn(r,"object","array"))return r;t=r}return t},$n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},jn=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},Rn=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(n=e)?0:"object"==typeof n?NaN:"number"==typeof n?n:"string"==typeof n?"%"===n[n.length-1]?Number(n.slice(0,-1))/100:Number(n):NaN))return!1}var n;return!0},Fn=function(t){var e,n=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],i=0,r=0,o=0,a=0;switch(n.length){case 1:i=r=o=a=n[0];break;case 2:i=r=n[0],o=a=n[1];break;case 3:i=n[0],o=a=n[1],r=n[2];break;default:i=n[0],r=n[1],o=n[2],a=n[3]}var s={paddingTop:i,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&Wn(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[i,r,o,a]},Dn=function(t){var e=[],n=t.map((function(t){return Number(t)})).reduce((function(t,n){if(n>0){var i=t+n;return e.push(i),i}return e.push(NaN),t}),0),i=Math.random()*n;return e.findIndex((function(t){return i<=t}))},Ln=function(t,e,n,i){void 0===i&&(i=1/0),i<=0&&(i=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,u=n(o);if(i===o.length+1&&(c+=a),u<0)return o;if(c>u&&(o.push(r.slice(0,-1)),r=e[s]),i===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Hn=function(t){return Math.PI/180*t},Mn=function(t,e,n,i,r,o){t.beginPath();var a,s,c=Hn(90/Math.PI/n*o),u=i+c,h=r-c;t.arc(0,0,n,u,h,!1),t.lineTo.apply(t,(a=(i+r)/2,s=o/2/Math.abs(Math.sin((i-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Bn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),u=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+s,r),t.lineTo(i+o-s,r),t.arc(i+o-s,r+s,s,-u/2,0),t.lineTo(i+o,r+a-s),t.arc(i+o-s,r+a-s,s,0,u/2),t.lineTo(i+s,r+a),t.arc(i+s,r+a-s,s,u/2,u),t.lineTo(i,r+s),t.arc(i+s,r+s,s,u,-u/2),t.closePath()},Nn=function(t,e,n,i,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,u=t.height;a.width=c,a.height=u;var h=c/i;return Bn(s,e*h,n*h,i*h,r*h,o*h),s.clip(),s.drawImage(t,0,0,c,u),a},Gn=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;n.width=r,n.height=o,i.drawImage(t,0,0,r,o);var a=i.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var n=Math.ceil(t),i=e*e,r=2*i,o=1/(2*Math.PI*i),a=[],s=0,c=-n;c<=n;c++)for(var u=-n;u<=n;u++){var h=o*Math.exp(-(c*c+u*u)/r);a.push(h),s+=h}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),i.putImageData(a,0,0),n},Xn="1.7.12",Un=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),qn="__proto__"in{};function Yn(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var Kn=Array.prototype,Vn=Object.create(Kn);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Vn[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=Kn[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),i}}));var Jn=function(){function t(t){this.dep=new Un,Yn(t,"__luckyOb__",this),Array.isArray(t)&&(qn?t.__proto__=Vn:Object.getOwnPropertyNames(Vn).forEach((function(e){Yn(t,e,Vn[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Zn(t,e,t[e])}))},t}();function Qn(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Jn(t)}function Zn(t,e,n){var i=new Un,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(n=t[e]);var s=Qn(n);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):n;return Un.target&&(i.addSub(Un.target),s&&s.dep.addSub(Un.target)),e},set:function(e){e!==n&&(n=e,o&&!a||(a?a.call(t,e):n=e,s=Qn(e),i.notify()))}})}}var ti=0,ei=function(){function t(t,e,n,i){void 0===i&&(i={}),this.id=ti++,this.$lucky=t,this.expr=e,this.deep=!!i.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],n="",i=0;i<t.length;i++){var r=t[i];if(/\[|\./.test(r))e.push(n),n="";else{if(/\W/.test(r))continue;n+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=n,this.value=this.get()}return t.prototype.get=function(){Un.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){Wn(t,"array","object")&&Object.keys(t).forEach((function(n){var i=t[n];e(i)}))};e(t)}(t),Un.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),ni=function(){function t(t,e){var n=this;this.version=Xn,this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","".concat("lucky-canvas","@").concat(Xn)),t.canvasElement.addEventListener("click",(function(t){return n.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var n=null;return function(){for(var i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){t.apply(i,r),clearTimeout(n),n=null}),e))}}((function(){return n.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){n.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],n=t[1];this.ctx.clearRect(-e,-n,2*e,2*n)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,n=0,i=0;t.divElement&&(n=t.divElement.offsetWidth,i=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||n,this.boxHeight=this.getLength(e.height||t.height)||i,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,n=t.canvasElement,i=t.dpr,r=[this.boxWidth*i,this.boxHeight*i],o=r[0],a=r[1];n&&(n.width=o,n.height=a,n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),n.style["transform-origin"]="left top",n.style.transform="scale(".concat(1/i,")"),e.scale(i,i))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,n){var i=this;return void 0===n&&(n="$resolve"),new Promise((function(r,o){if(t||o("=> '".concat(e.src,"' 不能为空或不合法")),"WEB"!==i.config.flag)return e[n]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '".concat(e.src,"' 图片加载失败"))},a.src=t}))},t.prototype.drawImage=function(t,e){for(var n,i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var o=this.config,s=o.flag,c=o.dpr;if(["WEB","MP-WX"].includes(s))n=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");n=e.path}return 8===i.length&&(i=i.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,a([n],i))},t.prototype.getLength=function(t){return Wn(t,"number")?t:Wn(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var n=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,i,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*n.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(i);var a=n.config.unitFunc;return a?a(i,r):i})))},t.prototype.computedWidthAndHeight=function(t,e,n,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,n);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,i);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,n),this.getHeight(e.height,i)]},t.prototype.getWidth=function(t,e){return Wn(t,"number")?t:Wn(t,"string")?this.changeUnits(t,e):0},t.prototype.getHeight=function(t,e){return Wn(t,"number")?t:Wn(t,"string")?this.changeUnits(t,e):0},t.prototype.getOffsetX=function(t,e){return void 0===e&&(e=0),(e-t)/2},t.prototype.getOffscreenCanvas=function(t,e){if(!$n(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var n=this.config.dpr,i=this._offscreenCanvas;i.width=(t||300)*n,i.height=(e||150)*n;var r=i.getContext("2d");return r.clearRect(0,0,t,e),r.scale(n,n),r.dpr=n,{_offscreenCanvas:i,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=n.map((function(t){return e.getLength(t)}));return Nn.apply(void 0,a([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;if(n.width=r,n.height=o,"string"==typeof i.filter)i.filter="opacity(".concat(e,"%)"),i.drawImage(t,0,0,r,o);else{i.drawImage(t,0,0,r,o);for(var a=i.getImageData(0,0,r,o),s=a.data,c=s.length,u=0;u<c;u+=4){var h=s[u+3];0!==h&&(s[u+3]=h*e/100)}i.putImageData(a,0,0)}return n}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Gn(t,this.getLength(e))},t.prototype.$set=function(t,e,n){t&&"object"==typeof t&&Zn(t,e,n)},t.prototype.$computed=function(t,e,n){var i=this;Object.defineProperty(t,e,{get:function(){return n.call(i)}})},t.prototype.$watch=function(t,e,n){void 0===n&&(n={}),"object"==typeof e&&(e=(n=e).handler);var i=new ei(this,t,e,n);return n.immediate&&e.call(this,i.value),function(){}},t}(),ii=function(t,e,n,i){return t>=i&&(t=i),n*(t/=i)*t+e},ri=function(t,e,n,i){return t>=i&&(t=i),-n*(t/=i)*(t-2)+e},oi=function(t){function e(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return n(e,t),e.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},e.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return i({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return i({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},e.prototype.handleClick=function(t){var e,n=this.ctx;n.beginPath(),n.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),n.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},e.prototype.loadAndCacheImg=function(t,e,n,i){return r(this,void 0,void 0,(function(){var r=this;return o(this,(function(o){return[2,new Promise((function(o,a){var s=r[t][e];if(s&&s.imgs){var c=s.imgs[i];if(c){var u=r.ImageCache;u[n][e]||(u[n][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),u[n][e][i]=t,o()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(i,"] ").concat(n)),a()}))}}}))]}))}))},e.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,a=i._defaultConfig,s=i._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,i){return Rn(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=n.ImageCache.blocks;if(a&&a[i]){var s=a[i][r];if(s){var c=n.computedWidthAndHeight(s,e,2*t,2*t),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Hn(n.rotateDeg)),n.drawImage(o,s,f,d,u,h),o.restore()}}})),t-n.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Hn(this.prizeDeg);var c=Hn(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),u=function(t){return n.getOffsetX(o.measureText(t).width)},h=function(t,e,i){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return n.getHeight(t.top,e)+(i+1)*n.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var i=c+e*n.prizeRadian,r=n.prizeRadius-n.maxBtnRadius,l=t.background||s.background;Rn(l)&&(o.fillStyle=l,Mn(o,n.maxBtnRadius,n.prizeRadius,i-n.prizeRadian/2,i+n.prizeRadian/2,n.getLength(a.gutter)),o.fill());var f=Math.cos(i)*n.prizeRadius,d=Math.sin(i)*n.prizeRadius;o.translate(f,d),o.rotate(i+Hn(90)),t.imgs&&t.imgs.forEach((function(t,i){var a=n.ImageCache.prizes;if(a&&a[e]){var s=a[e][i];if(s){var c=n.computedWidthAndHeight(s,t,n.prizeRadian*n.prizeRadius,r),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,r)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,i=t.fontWeight||s.fontWeight,c=n.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font="".concat(i," ").concat(c>>0,"px ").concat(l);var g=String(t.text);(f?Ln(o,jn(g),(function(e){var i=2*((n.prizeRadius-h(t,r,e.length))*Math.tan(n.prizeRadian/2))-n.getLength(a.gutter);return n.getWidth(d,i)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,n){o.fillText(e,u(e),h(t,r,n))}))})),o.rotate(Hn(360)-i-Hn(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var i=n.getHeight(t.radius,n.prizeRadius);n.maxBtnRadius=Math.max(n.maxBtnRadius,i),Rn(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,i,0,2*Math.PI,!1),o.fill()),t.pointer&&Rn(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-i,0),o.lineTo(i,0),o.lineTo(0,2*-i),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=n.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=n.computedWidthAndHeight(s,t,2*i,2*i),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,i)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=n.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font="".concat(r," ").concat(a>>0,"px ").concat(c),String(t.text).split("\n").forEach((function(e,n){o.fillText(e,u(e),h(t,i,n))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*i-i/2)*this.getLength(e.stopRange),c=0,u=0,h=0;++c;){var l=360*c-n*i-r-e.offsetDegree+s-i/2,f=ri(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-u>f-a?l:h;break}h=l,u=f}},e.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},e.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=Dn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},e.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizeFlag,a=n.stopDeg,s=n.endDeg,c=n._defaultConfig,u=c.accelerationTime,h=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<u){this.FPS=f/t;var g=ii(f,0,l,u);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=ri(d,a,s,h),d>=h&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},e.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr-this.Radius,e/n.dpr-this.Radius]},e}(ni),ai=function(t){function e(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return n(e,t),e.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},e.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return i({background:"#ffce98",shadow:""},t.activeStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n=t.buttons.map((function(t){return t.imgs}));t.button&&n.push(t.button.imgs);var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:n};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},e.prototype.handleClick=function(t){var e=this,n=this.ctx;a(a([],this.buttons),[this.button]).forEach((function(i){var r;if(i){var o=e.getGeometricProperty([i.x,i.y,i.col||1,i.row||1]),a=o[0],s=o[1],c=o[2],u=o[3];n.beginPath(),n.rect(a,s,c,u),n.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof i.callback&&i.callback.call(e,i),null===(r=e.startCallback)||void 0===r||r.call(e,t,i))}}))},e.prototype.loadAndCacheImg=function(t,e,n,i){return r(this,void 0,void 0,(function(){var r=this;return o(this,(function(o){return[2,new Promise((function(o,a){var s=r[t][e];if("buttons"===t&&!r.buttons.length&&r.button&&(s=r.button),s&&s.imgs){var c=s.imgs[i];if(c){var u=r.ImageCache;u[n][e]||(u[n][e]=[]);var h=[r.loadImg(c.src,c),c.activeSrc&&r.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(h).then((function(t){var a=t[0],s=t[1],h=c.formatter;"function"==typeof h&&(a=h.call(r,a),s&&(s=h.call(r,s))),u[n][e][i]={defaultImg:a,activeImg:s},o()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(i,"] ").concat(n)),a()}))}}}))]}))}))},e.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,s=i._defaultConfig,c=i._defaultStyle,u=i._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=a(a([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e,i){var r=t.x,a=t.y,s=t.w,u=t.h,h=Fn(e),l=h[0],f=h[1],d=h[2],p=h[3],g=e.borderRadius?n.getLength(e.borderRadius):0,v=e.background||c.background;return Rn(v)&&(o.fillStyle=n.handleBackground(r,a,s,u,v),Bn(o,r,a,s,u,g),o.fill()),e.imgs&&e.imgs.forEach((function(t,e){var c=_n(n.ImageCache,"blocks.".concat(i,".").concat(e,".defaultImg"));if(c){var h=n.computedWidthAndHeight(c,t,s,u),l=h[0],f=h[1],d=[n.getOffsetX(l,s),n.getHeight(t.top,u)],p=d[0],g=d[1];n.drawImage(o,c,r+p,a+g,l,f)}})),{x:r+d,y:a+l,w:s-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var i=n.getGeometricProperty([t.x,t.y,t.col,t.row]),a=i[0],s=i[1],h=i[2],l=i[3],f=!1;(void 0===n.prizeFlag||n.prizeFlag>-1)&&(f=e===n.currIndex%n.prizes.length>>0);var d=f?u.background:t.background||c.background;if(Rn(d)){var p=(f?u.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(o.shadowColor=p[3],o.shadowOffsetX=p[0]*r.dpr,o.shadowOffsetY=p[1]*r.dpr,o.shadowBlur=p[2],p[0]>0?h-=p[0]:(h+=p[0],a-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),o.fillStyle=n.handleBackground(a,s,h,l,d);var g=n.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Bn(o,a,s,h,l,g),o.fill(),o.shadowColor="rgba(0, 0, 0, 0)",o.shadowOffsetX=0,o.shadowOffsetY=0,o.shadowBlur=0}var v="prizes";e>=n.prizes.length&&(v="buttons",e-=n.prizes.length),t.imgs&&t.imgs.forEach((function(t,i){var r=n.ImageCache[v];if(r[e]){var c=r[e][i];if(c){var u=f&&c.activeImg||c.defaultImg;if(u){var d=n.computedWidthAndHeight(u,t,h,l),p=d[0],g=d[1],m=[a+n.getOffsetX(p,h),s+n.getHeight(t.top,l)],y=m[0],w=m[1];n.drawImage(o,u,y,w,p,g)}}}})),t.fonts&&t.fonts.forEach((function(t){var e=f&&u.fontStyle?u.fontStyle:t.fontStyle||c.fontStyle,i=f&&u.fontWeight?u.fontWeight:t.fontWeight||c.fontWeight,r=f&&u.fontSize?n.getLength(u.fontSize):n.getLength(t.fontSize||c.fontSize),d=f&&u.lineHeight?u.lineHeight:t.lineHeight||c.lineHeight||t.fontSize||c.fontSize,p=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:c.wordWrap,g=t.lengthLimit||c.lengthLimit,v=t.lineClamp||c.lineClamp;o.font="".concat(i," ").concat(r>>0,"px ").concat(e),o.fillStyle=f&&u.fontColor?u.fontColor:t.fontColor||c.fontColor;var m=[],y=String(t.text);if(p){var w=n.getWidth(g,h);m=Ln(o,jn(y),(function(){return w}),v)}else m=y.split("\n");m.forEach((function(e,i){o.fillText(e,a+n.getOffsetX(o.measureText(e).width,h),s+n.getHeight(t.top,l)+(i+1)*n.getLength(d))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.handleBackground=function(t,e,n,i,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,n,i,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var u=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,n+r,e+i,n+r-i*u(s-0)]:s>=45&&s<90?c=[e,n+r,e+i-r*u(s-45),n]:s>=90&&s<135?c=[e+i,n+r,e+i-r*u(s-90),n]:s>=135&&s<180?c=[e+i,n+r,e,n+i*u(s-135)]:s>=180&&s<225?c=[e+i,n,e,n+i*u(s-180)]:s>=225&&s<270?c=[e+i,n,e+r*u(s-225),n+r]:s>=270&&s<315?c=[e,n,e+r*u(s-270),n+r]:s>=315&&s<360&&(c=[e,n,e+i,n+r-i*u(s-315)])}else s.includes("top")?c=[e,n+r,e,n]:s.includes("bottom")?c=[e,n,e,n+r]:s.includes("left")?c=[e+i,n,e,n]:s.includes("right")&&(c=[e,n,e+i,n]);var h=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,n){var i=e.split(" ");return 1===i.length?t.addColorStop(n,i[0]):2===i.length&&t.addColorStop.apply(t,i),t}),h)}(o,t,e,n,i,r)),r},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=i,o=e.speed,a=0,s=0,c=0;++a;){var u=this.prizes.length*a+n-r,h=ri(this.FPS,r,u,e.decelerationTime)-r;if(h>o){this.endIndex=o-s>h-o?u:c;break}c=u,s=h}},e.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},e.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=Dn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},e.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizes,a=n.prizeFlag,s=n.stopIndex,c=n.endIndex,u=n._defaultConfig,h=u.accelerationTime,l=u.decelerationTime,f=u.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<h){this.FPS=d/t;var v=ii(d,.1,f-.1,h);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=ri(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},e.prototype.getGeometricProperty=function(t){var e=t[0],n=t[1],i=t[2],r=void 0===i?1:i,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,u=this._defaultConfig.gutter,h=[this.prizeArea.x+(s+u)*e,this.prizeArea.y+(c+u)*n];return r&&a&&h.push(s*r+u*(r-1),c*a+u*(a-1)),h},e.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr,e/n.dpr]},e}(ni),si=function(t){function e(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return n(e,t),e.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},e.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},e.prototype.loadAndCacheImg=function(t,e,n,i){return r(this,void 0,void 0,(function(){var r=this;return o(this,(function(o){return[2,new Promise((function(o,a){var s=r[t][e];if(s&&s.imgs){var c=s.imgs[i];if(c){var u=r.ImageCache;u[n][e]||(u[n][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),u[n][e][i]=t,o()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(i,"] ").concat(n)),a()}))}}}))]}))}))},e.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,n=this._defaultStyle,i=this.drawBlocks(),r=i.w,o=i.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,u=s.cellHeight,h=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,n){void 0===t.scroll[n]&&(t.scroll[n]=0),e.order=e.order||f;var i=e.order.length;d=Math.max(d,r+h*i),p=Math.max(p,o+l*i)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(i,r){var o=c*r,a=u*r,s=0,f=function(t,e){for(var n={},i=[],r=0;r<t.length;r++)n[r]=t[r];for(r=0;r<e.length;r++){var o=n[e[r]];o&&(i[r]=o)}return i}(t.prizes,i.order);if(f.length){f.forEach((function(r,f){if(r){var d=i.order[f],p=h*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,h]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||n.background;if(Rn(S)){var C=t.getLength($n(r,"borderRadius")?r.borderRadius:n.borderRadius);Bn(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,n){var i=_n(t.ImageCache,"prizes.".concat(d,".").concat(n));if(i){var r=t.computedWidthAndHeight(i,e,c,u),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,u)],h=s[0],l=s[1];t.drawImage(m,i,h,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var i=e.fontStyle||n.fontStyle,r=e.fontWeight||n.fontWeight,o=t.getLength(e.fontSize||n.fontSize),a=e.lineHeight||n.lineHeight||e.fontSize||n.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:n.wordWrap,h=e.lengthLimit||n.lengthLimit,l=e.lineClamp||n.lineClamp;m.font="".concat(r," ").concat(o>>0,"px ").concat(i),m.fillStyle=e.fontColor||n.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(h,c);f=Ln(m,jn(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(n,i){m.fillText(n,y+t.getOffsetX(m.measureText(n).width,c),w+t.getHeight(e.top,u)+(i+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,u]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),x=C[0],z=C[1];t.drawImage(m,v,g,y,w,b,x,z,w,b),S+=s}}}))},e.prototype.drawBlocks=function(){var t=this,e=this;e.config;var n=e.ctx;e._defaultConfig;var i=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,u=e.h,h=Fn(r),l=h[0],f=h[1],d=h[2],p=h[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||i.background;return Rn(v)&&(Bn(n,a,s,c,u,g),n.fillStyle=v,n.fill()),r.imgs&&r.imgs.forEach((function(e,i){var r=_n(t.ImageCache,"blocks.".concat(o,".").concat(i));if(r){var h=t.computedWidthAndHeight(r,e,c,u),l=h[0],f=h[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,u)],p=d[0],g=d[1];t.drawImage(n,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},e.prototype.draw=function(){var t,e=this,n=this,i=n.config,r=n.ctx;n._defaultConfig,n._defaultStyle,null===(t=i.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,u=o.h;if(this._offscreenCanvas){var h=this,l=h.cellWidth,f=h.cellHeight,d=h.cellAndSpacing,p=h.widthAndSpacing,g=h.heightAndSpacing;this.slots.forEach((function(t,n){var i=d*t.order.length,o=e.displacement(-(u-g)/2,-(c-p)/2),h=e.scroll[n]+o;h<0&&(h=h%i+i),h>i&&(h%=i);var v=e.displacement([l*n,h,l,u],[h,f*n,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*n,s,l,u],[a,s+g*n,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,x,z,O)}))}},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,n=e._defaultConfig,i=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||n.speed,c=e.direction||n.direction,u=a.findIndex((function(t){return t===i[o]})),h=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*u+h*f*c-l,p=ri(t.FPS,l,d,n.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},e.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},e.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!Wn(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 ".concat(typeof t));if(t.length!==this.slots.length)return this.stop(-1),console.error("stop([".concat(t,"]) 参数长度的不正确"));this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},e.prototype.run=function(t){var e,n,i=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,u=r.cellAndSpacing,h=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==h.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;h.forEach((function(e,n){var r=e.order;if(r&&r.length){var o=u*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=i.scroll[n];if(1===a||d<l){i.FPS=d/t;var w=ii(d,0,g,l);w===g&&(i.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===h.length&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===a&&p){var b=i.stopScroll[n],S=i.endScroll[n];m=ri(p,b,S,f),p>=f&&(i.step=0)}i.scroll[n]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<h.length;v++){var m=h[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(n=this.endCallback)||void 0===n||n.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},e.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},e.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,n=this._defaultConfig,i=n.colSpacing,r=n.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,u=o.h,h=0,l=0;return"horizontal"===t?(l=this.cellHeight=(u-r*(e-1))/e,h=this.cellWidth=l):(h=this.cellWidth=(c-i*(e-1))/e,l=this.cellHeight=h),a=this.widthAndSpacing=this.cellWidth+i,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:h,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},e}(ni);t.LuckyGrid=ai,t.LuckyWheel=oi,t.SlotMachine=si,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "lucky-canvas", | ||
"version": "1.7.11", | ||
"version": "1.7.12", | ||
"description": "一个基于原生 js 的(大转盘 / 九宫格 / 老虎机)抽奖插件", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -141,2 +141,31 @@ declare type FontItemType = { | ||
protected changeUnits(value: string, denominator?: number): number; | ||
/** | ||
* 计算图片的渲染宽高 | ||
* @param imgObj 图片标签元素 | ||
* @param imgInfo 图片信息 | ||
* @param maxWidth 最大宽度 | ||
* @param maxHeight 最大高度 | ||
* @return [渲染宽度, 渲染高度] | ||
*/ | ||
protected computedWidthAndHeight(imgObj: ImgType, imgInfo: ImgItemType, maxWidth: number, maxHeight: number): [number, number]; | ||
/** | ||
* 转换并获取宽度 | ||
* @param width 将要转换的宽度 | ||
* @param maxWidth 最大宽度 | ||
* @return 返回相对宽度 | ||
*/ | ||
protected getWidth(width: string | number | undefined, maxWidth: number): number; | ||
/** | ||
* 转换并获取高度 | ||
* @param height 将要转换的高度 | ||
* @param maxHeight 最大高度 | ||
* @return 返回相对高度 | ||
*/ | ||
protected getHeight(height: string | number | undefined, maxHeight: number): number; | ||
/** | ||
* 获取相对(居中)X坐标 | ||
* @param width | ||
* @param col | ||
*/ | ||
protected getOffsetX(width: number, maxWidth?: number): number; | ||
protected getOffscreenCanvas(width: number, height: number): { | ||
@@ -318,11 +347,2 @@ _offscreenCanvas: HTMLCanvasElement; | ||
/** | ||
* 计算图片的渲染宽高 | ||
* @param imgObj 图片标签元素 | ||
* @param imgInfo 图片信息 | ||
* @param maxWidth 最大宽度 | ||
* @param maxHeight 最大高度 | ||
* @return [渲染宽度, 渲染高度] | ||
*/ | ||
private computedWidthAndHeight; | ||
/** | ||
* 开始绘制 | ||
@@ -350,22 +370,2 @@ */ | ||
/** | ||
* 获取相对宽度 | ||
* @param length 将要转换的宽度 | ||
* @param width 宽度计算百分比 | ||
* @return 返回相对宽度 | ||
*/ | ||
private getWidth; | ||
/** | ||
* 获取相对高度 | ||
* @param length 将要转换的高度 | ||
* @param height 高度计算百分比 | ||
* @return 返回相对高度 | ||
*/ | ||
private getHeight; | ||
/** | ||
* 获取相对(居中)X坐标 | ||
* @param width | ||
* @return 返回x坐标 | ||
*/ | ||
private getOffsetX; | ||
/** | ||
* 换算渲染坐标 | ||
@@ -544,10 +544,2 @@ * @param x | ||
/** | ||
* 计算图片的渲染宽高 | ||
* @param imgObj 图片标签元素 | ||
* @param imgInfo 图片信息 | ||
* @param cell 格子信息 | ||
* @return [渲染宽度, 渲染高度] | ||
*/ | ||
private computedWidthAndHeight; | ||
/** | ||
* 绘制九宫格抽奖 | ||
@@ -591,22 +583,2 @@ */ | ||
/** | ||
* 转换并获取宽度 | ||
* @param width 将要转换的宽度 | ||
* @param col 横向合并的格子 | ||
* @return 返回相对宽度 | ||
*/ | ||
private getWidth; | ||
/** | ||
* 转换并获取高度 | ||
* @param height 将要转换的高度 | ||
* @param row 纵向合并的格子 | ||
* @return 返回相对高度 | ||
*/ | ||
private getHeight; | ||
/** | ||
* 获取相对(居中)X坐标 | ||
* @param width | ||
* @param col | ||
*/ | ||
private getOffsetX; | ||
/** | ||
* 换算渲染坐标 | ||
@@ -761,11 +733,2 @@ * @param x | ||
/** | ||
* 计算图片的渲染宽高 | ||
* @param imgObj 图片标签元素 | ||
* @param imgInfo 图片信息 | ||
* @param maxWidth 最大宽度 | ||
* @param maxHeight 最大高度 | ||
* @return [渲染宽度, 渲染高度] | ||
*/ | ||
private computedWidthAndHeight; | ||
/** | ||
* 绘制离屏canvas | ||
@@ -798,24 +761,4 @@ */ | ||
private displacementWidthOrHeight; | ||
/** | ||
* 获取相对宽度 | ||
* @param length 将要转换的宽度 | ||
* @param width 宽度计算百分比 | ||
* @return 返回相对宽度 | ||
*/ | ||
private getWidth; | ||
/** | ||
* 转换并获取高度 | ||
* @param height 将要转换的高度 | ||
* @param row 纵向合并的格子 | ||
* @return 返回相对高度 | ||
*/ | ||
private getHeight; | ||
/** | ||
* 获取相对(居中)X坐标 | ||
* @param width | ||
* @return 返回x坐标 | ||
*/ | ||
private getOffsetX; | ||
} | ||
export { LuckyGrid, LuckyWheel, SlotMachine }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
934248
1449