@lottielab/lottie-player
Version:
Versatile Lottie animation player based on lottie-web. Supports HTML (via Web Components) and React.
1 lines • 199 kB
JavaScript
import t,{forwardRef as e,useRef as i,useState as s,useCallback as a,useEffect as r}from"react";function n(t){switch(t.event){case"finish":return"finish";case"click":case"mouseDown":case"mouseUp":case"mouseEnter":case"mouseLeave":return t.target?`${t.event}:${t.target}`:t.event;case"custom":return"custom:"+t.name}}var o=Object.freeze({__proto__:null,eventToString:n});class h{constructor(){this.listeners=[]}addListener(t){this.listeners.push(t)}removeListener(t){this.listeners=this.listeners.filter((e=>e!==t))}hasListeners(){return this.listeners.length>0}removeAllListeners(){this.listeners=[]}emit(t){for(const e of this.listeners)e(t)}}function l(t){return t?t.fr:100}class p{constructor(){this.playing=!0,this.time=0,this.speed=1,this.direction=1,this._loop=!0,this._loopsRemaining=1/0,this.loopEvent=new h,this.finishEvent=new h}get effectiveSegment(){var t;return this.segment?this.segment:[0,null!==(t=this._duration)&&void 0!==t?t:0]}globalTimeToSegmentTime(t){const[e,i]=this.effectiveSegment;return Math.min(Math.max(t-e,0),i-e)}segmentTimeToGlobalTime(t){const[e]=this.effectiveSegment;return e+t}advance(t,e,i){const{lottie:s}=t;if(this._fps=l(s),this._duration=function(t){return t?(t.op-t.ip)/l(t):0}(s),!this.playing)return{time:this.time,lottie:s};const a=this.globalTimeToSegmentTime(this.time);let r;r=a+e*this.speed*this.direction;const n=[];if(this.durationOfSegment>0){const t=Math.abs(Math.floor(r/this.durationOfSegment)),e=this.durationOfSegment-a;for(let i=0;i<t;i++){this._loopsRemaining--;const t=e+i*this.durationOfSegment;if(!(this._loopsRemaining>0)){n.push({type:"finish",relativeTime:t}),r=Math.max(0,Math.min(r,this.durationOfSegment)),this._loopsRemaining=0,this.playing=!1;break}n.push({type:"loop",relativeTime:t}),r>=this.durationOfSegment?r-=this.durationOfSegment:r+=this.durationOfSegment}}else r=0,n.push({type:"loop",relativeTime:0});const o=this.segmentTimeToGlobalTime(r);if(this.time=o,n.length>0){null!=i&&i.push(...n);for(const t of n)"loop"===t.type?this.loopEvent.emit(void 0):"finish"===t.type&&this.finishEvent.emit(void 0)}return{time:o,lottie:s}}play(){this.playing=!0}pause(){this.playing=!1}stop(){this.playing=!1,this.seek(0),this.loop=this._loop}seek(t){this.time=t}seekToFrame(t){this.time=t/this.frameRate}loopBetween(t,e){this.segment=[t,e]}loopBetweenFrames(t,e){this.segment=[t/this.frameRate,e/this.frameRate]}get loop(){return this._loop}set loop(t){this._loop=t,this._loopsRemaining="number"==typeof t?t:t?1/0:1}get currentTime(){return this.time}get currentFrame(){return this.time*this.frameRate}get timeInSegment(){return this.globalTimeToSegmentTime(this.time)}set timeInSegment(t){this.time=this.segmentTimeToGlobalTime(t)}get frameInSegment(){return this.timeInSegment*this.frameRate}get frameRate(){var t;return null!==(t=this._fps)&&void 0!==t?t:100}get duration(){var t;return null!==(t=this._duration)&&void 0!==t?t:0}get durationFrames(){return this.duration*this.frameRate}get durationOfSegment(){const[t,e]=this.effectiveSegment;return e-t}get animation(){throw new Error("This is just a driver and implements ILottie for clarity; you shouldn't directly call this function")}get animationData(){throw new Error("This is just a driver and implements ILottie for clarity; you shouldn't directly call this function")}toInteractive(){throw new Error("This is just a driver and implements ILottie for clarity; you shouldn't directly call this function")}toPlayback(){}on(t,e){throw new Error("This is just a driver and implements ILottie for clarity; you shouldn't directly call this function")}off(t,e){throw new Error("This is just a driver and implements ILottie for clarity; you shouldn't directly call this function")}}function d(t){throw new Error(`Unexpected ${t.name} at position ${t.position}.`)}const f=(()=>{const t=[{name:"number",lbp:2,detect:t=>/^([1-9]\d*|0)(\.\d*)?$/.test(t),nud:(t,e)=>({type:0,value:parseFloat(e.value)})},{name:"identifier",lbp:2,detect:t=>/^[_a-zA-Z][_a-zA-Z0-9]*(\.[a-zA-Z]+)*$/.test(t),nud:(t,e)=>({type:1,name:e.value})},{name:"^",lbp:9,led:(t,e)=>({type:3,operator:"^",left:e,right:t.parse(8)})},{name:"!",lbp:10,nud:t=>({type:2,operator:"!",operand:t.parse(10)})},{name:"conditional-operator",detect:t=>"?"==t,lbp:3,led:(t,e)=>{const i=t.parse(2),s=t.pop();":"!=s.name&&d(s);return{type:4,condition:e,thenBranch:i,elseBranch:t.parse(2)}}},{name:"(",lbp:11,nud:t=>{const e=t.parse(1),i=t.pop();return")"!=i.name&&d(i),e},led:(t,e,i)=>{1!=e.type&&d(i);const s=[];if(")"==t.peek().name)t.pop();else for(;;){s.push(t.parse(1));const e=t.pop();if(")"==e.name)break;","!=e.name&&d(e)}return{type:5,name:e.name,operands:s}}},{name:"end of input",lbp:0}];for(const e of["+","-"])t.push({name:e,lbp:7,nud:t=>({type:2,operator:e,operand:t.parse(7)}),led:(t,i)=>({type:3,operator:e,left:i,right:t.parse(7)})});const e=[["*",8],["/",8],["<",6],["<=",6],[">",6],[">=",6],["==",6],["&&",5],["||",4]];for(const[i,s]of e)t.push({name:i,lbp:s,led:(t,e)=>({type:3,operator:i,left:e,right:t.parse(s)})});for(const e of[",",")",":"])t.push({name:e,lbp:1});return t})();function c(t){const e=function(t){const e=/^\s*$/,i=t.split(/([+\-*/^(),?:!]|<=|>=|==|>(?!=)|<(?!=)|\|\||&&|\s+)/g);i.push("end of input");let s=0;const a=[];for(const t of i){if(!f.some((e=>{var i;if((null!==(i=e.detect)&&void 0!==i?i:t=>t==e.name)(t))return a.push(Object.assign(Object.assign({},e),{value:t,position:s})),!0}))&&!e.test(t))throw new Error(`Invalid token ${t} at position ${s}`);s+=t.length}return a}(t);let i=0;const s={peek:()=>e[i],pop:()=>e[i++],parse:t=>{let e=s.pop();e.nud||d(e);let i=e.nud(s,e);for(;s.peek().lbp>t;)e=s.pop(),e.led||d(e),i=e.led(s,i,e);return i}};return s.parse(0)}const u=Math;function m(t){throw new Error(`Symbol ${t} is not defined and not a built in symbol.`)}function g(t,e){var i,s;switch(t.type){case 0:return t.value;case 1:{const s=t.name,a=null!==(i=e[s])&&void 0!==i?i:u[s];if(null==a&&m(s),"boolean"!=typeof a&&"number"!=typeof a)throw new Error(`Symbol ${s} is a function and must be used in a function call.`);return a}case 2:{const i=g(t.operand,e);return function(t,e){switch(t){case"+":return+e;case"-":return-e;case"!":return!e}}(t.operator,i)}case 3:{const i=g(t.left,e),s=g(t.right,e);return function(t,e,i){switch(t){case"+":return e+i;case"-":return e-i;case"*":return e*i;case"/":return e/i;case"^":return Math.pow(e,i);case"<":return e<i;case"<=":return e<=i;case">":return e>i;case">=":return e>=i;case"==":return e==i;case"&&":return e&&i;case"||":return e||i}}(t.operator,i,s)}case 4:{const i=g(t.condition,e);return g(i?t.thenBranch:t.elseBranch,e)}case 5:{const i=t.name,a=null!==(s=e[i])&&void 0!==s?s:u[i];if(null==a&&m(i),"function"!=typeof a)throw new Error(`Symbol ${i} has value ${a} and is not callable.`);if(a.length!=t.operands.length)throw new Error(`Expected ${a.length} operands for ${i}, received ${t.operands.length}`);const r=t.operands.map((t=>g(t,e)));return a.apply(null,r)}}}const v={time:0,"time.diff":0,playhead:0,"playhead.progress":0,"playhead.abs":0,"mouse.x":0,"mouse.y":0,"mouse.progress.x":0,"mouse.progress.y":0,"mouse.abs.x":0,"mouse.abs.y":0,"mouse.buttons.left":!1,"mouse.buttons.right":!1,"mouse.buttons.middle":!1};function y(t,e){const i=Object.assign({},t);for(const t in e){if(!/^[a-zA-Z_][a-zA-Z0-9_.]*$/.test(t))continue;const s=e[t];"object"==typeof s&&"x"in s&&"y"in s&&"number"==typeof s.x&&"number"==typeof s.y?(i[t+".x"]=s.x,i[t+".y"]=s.y):i[t]="number"==typeof s||"boolean"==typeof s?s:0}return i}function b(t,e,i){var s,a,r,n;return null==t?e:null==e?t:"number"==typeof t?"number"!=typeof e?i>.5?e:t:(1-i)*t+i*e:Array.isArray(t)||t instanceof Float32Array?Array.isArray(e)||e instanceof Float32Array?t.map(((t,s)=>{var a;return b(t,null!==(a=e[s])&&void 0!==a?a:t,i)})):i>.5?e:t:"i"in t&&"v"in t&&"o"in t&&"object"==typeof e&&"i"in e&&"v"in e&&"o"in e?{closed:t.closed&&e.closed,i:b(t.i,e.i,i),o:b(t.o,e.o,i),v:b(t.v,e.v,i),length:Math.max(null!==(s=t.length)&&void 0!==s?s:0,null!==(a=e.length)&&void 0!==a?a:0),_length:Math.max(null!==(r=t._length)&&void 0!==r?r:0,null!==(n=e._length)&&void 0!==n?n:0)}:i>.5?e:t}class _{constructor(t){var e;this.ops=[],this.lottie=t;const i=t.renderer,s=new WeakSet;(null!==(e=null==i?void 0:i.elements)&&void 0!==e?e:[]).forEach((t=>this.attach(t,s)))}attachToProp(t){var e;const i=this,s=t;if(!(null===(e=t.effectsSequence)||void 0===e?void 0:e.length))return;const a=[];for(let e=0;e<8;e++)a[e]={_caching:structuredClone(t._caching),propType:s.propType,offsetTime:s.offsetTime,keyframes:s.keyframes,keyframesMetadata:s.keyframesMetadata,sh:s.sh,pv:structuredClone(s.pv)};t.addEffect((function(e){const r=i.ops.slice(-8);t.interpolateShape&&null==e&&(e=structuredClone(s.pv));for(let n=0;n<r.length;n++){const o=r[n],h=a[n];!h._caching&&t._caching&&(h._caching=structuredClone(t._caching)),!h.keyframes&&s.keyframes&&(h.keyframes=s.keyframes),!h.keyframesMetadata&&s.keyframesMetadata&&(h.keyframesMetadata=s.keyframesMetadata);const l=Math.min(Math.max(Math.round(o.time*i.lottie.frameRate),0),i.lottie.getDuration(!0)-1e-5);try{let i;h.offsetTime=t.offsetTime,t.interpolateValue?(h._caching.lastFrame>=l&&(h._caching._lastKeyframeIndex=-1,h._caching.lastIndex=0),i=t.interpolateValue.call(h,l,h._caching),h.pv=i):t.interpolateShape?(h._caching.lastIndex=h._caching.lastFrame<l?h._caching.lastIndex:0,t.interpolateShape.call(h,l,h.pv,h._caching),i=h.pv):i=0,h._caching.lastFrame=l,e=b(e,i,o.strength)}catch(t){console.warn("[@lottielab/lottie-player:morph]",t)}}return e}))}attach(t,e=new WeakSet){if(!e.has(t)&&"object"==typeof t&&null!=t)if(e.add(t),t.interpolateShape||t.interpolateValue||t.addEffect||t.effectsSequence)this.attachToProp(t);else for(const i of Object.values(t))this.attach(i,e)}detach(){}}function k(t,e){return function(t,e){return function(t,e){return t.reduce(((t,i,s)=>({x:t.x+e[s]*i.x,y:t.y+e[s]*i.y})),{x:0,y:0})}(function(t){return[t.start,t.controlPoint1,t.controlPoint2,t.end]}(t),[Math.pow(1-e,3),3*Math.pow(1-e,2)*e,3*(1-e)*Math.pow(e,2),Math.pow(e,3)])}(function(t){return{start:{x:0,y:0},end:{x:1,y:1},controlPoint1:t.o,controlPoint2:t.i}}(t),e).y}function w(t,e){try{const i=c(t);return t=>{try{return+g(i,t)}catch(t){return e}}}catch(t){return()=>e}}function S(t){var e;const i=new p;i.segment=t.segment,i.loop=null===(e=t.loop)||void 0===e||e,t.direction&&(i.direction="forward"===t.direction?1:-1);const s={driver:i};return"number"==typeof t.speed?i.speed=t.speed:"string"==typeof t.speed&&(s.speedControl=w(t.speed,1)),t.playhead&&(s.playheadControl=w(t.playhead,0)),s}function A(t,e,i,s,a,r){var n,o;const h=t.playback,l=Object.assign(Object.assign({},a),{time:s,"time.diff":i,playhead:h.driver.timeInSegment,"playhead.progress":h.driver.durationOfSegment>0?h.driver.timeInSegment/h.driver.durationOfSegment:0,"playhead.abs":h.driver.currentTime});h.speedControl&&(h.driver.speed=h.speedControl(a));const p=h.driver.advance(e,i,r);h.playheadControl&&(p.time=h.playheadControl(l)*h.driver.durationOfSegment+(null!==(o=null===(n=h.driver.segment)||void 0===n?void 0:n[0])&&void 0!==o?o:0));const d=function(t,e,i){var s,a;if(!t.morphing)return;const r=null!==(a=null===(s=t.def.morphing)||void 0===s?void 0:s.timeRemap)&&void 0!==a?a:"proportional";let n;const o=e.morphs?e.morphs[e.morphs.length-1].time:e.time;switch(r){case"proportional":n=D(o,t.def.segment,t.morphing.other.def.segment);break;case"wrap":n=T(o,t.def.segment,t.morphing.other.def.segment);break;case"clamp":n=C(o,t.def.segment,t.morphing.other.def.segment);break;default:return void console.warn(`[@lottielab/lottie-player:interactive] Unknown timeRemap: ${r}`)}return{time:n,strength:"number"==typeof t.morphing.strength?t.morphing.strength:t.morphing.strength(i)}}(t,p,a);return d&&(p.morphs=[d]),p}function D(t,e,i,s=1){const a=e[1]-e[0],r=i[1]-i[0];let n=a>0?(t-e[0])/a:0;return n=Math.min(1,Math.max(0,n))*s,i[0]+n*r}function T(t,e,i){const s=i[1]-i[0],a=t-e[0],r=i[0]+(s>0?a%(i[1]-i[0]):0);return Math.min(i[1],Math.max(i[0],r))}function C(t,e,i){const s=t-e[0]+i[0];return Math.min(i[1],Math.max(i[0],s))}function P(t,e,i,s,a,r=!0,n=8){var o;let h=e.next?A(e.next,t,i,s,a):t;if(e&&e.def.duration){let l;l="state"===e.prev.type?A(e.prev,t,i,s,a):P(t,e.prev,i,s,a,!1,n-1),r&&(e.progress+=i/e.def.duration),e.progress=Math.min(1,e.progress);let p=e.progress;if(e.def.easing&&(p=k(e.def.easing,p)),1===p)h=Object.assign(Object.assign({},l),{morphs:t.morphs,time:h.time});else if(n>0){const e=h.time;h=Object.assign({},l),h.morphs=(null!==(o=h.morphs)&&void 0!==o?o:[]).concat([{time:e,strength:p}]),t.morphs&&t.morphs.length>0&&(h.morphs=[...t.morphs,{time:h.time,strength:1-h.morphs[0].strength}],h.time=t.time)}else h=Object.assign(Object.assign({},l),{time:p>.5?h.time:l.time})}else e.def.duration||console.warn("[@lottielab/lottie-player:interactive] Transition duration of 0/unset is not expected here");return h}class E{constructor(t){this.builtinVariables=Object.assign({},v),this.userVariables={},this.variables={},this.clock=0,this.transitionStartEvent=new h,this.transitionEndEvent=new h,this._definition=t;const e=t.states[t.initialState];if(!e)throw new Error(`Initial state ${t.initialState} does not exist`);this.enterState(e)}setupMorphingForCurrentState(t){(null==t?void 0:t.force)&&(this.state.morphing=void 0);const e=this.state.def;if(e.morphing&&!this.state.morphing){const t=this._definition.states[e.morphing.otherState];t?this.state.morphing={other:{type:"state",def:t,playback:S(t)},strength:"number"==typeof e.morphing.strength?e.morphing.strength:w(e.morphing.strength,0)}:console.warn(`[@lottielab/lottie-player:interactivity] State '${e.morphing.otherState}' to morph with does not exist`)}else!e.morphing&&this.state.morphing&&(this.state.morphing=void 0)}enterState(t){const e=S(t);this.state={type:"state",def:t,playback:e,remainingDuration:t.duration},this.setupMorphingForCurrentState({force:!0})}getCurrentState(){return this.state}goToState(t,e){const i=this.state,s=i.def.segment;this.transition&&this.transitionEndEvent.emit({from:this.transition.from,to:this.state.def,transition:this.transition.def});const a=this.state.playback.driver.time;this.enterState(t),e=null!=e?e:{startAt:"start"},this.transitionStartEvent.emit({from:i.def,to:t,transition:e});const r=t.segment;switch(null==e?void 0:e.startAt){case"start":case void 0:this.state.playback.driver.time=r[0];break;case"end":this.state.playback.driver.time=r[1];break;case"proportional":this.state.playback.driver.time=D(a,s,r);break;case"wrap":this.state.playback.driver.time=T(a,s,r);break;case"clamp":this.state.playback.driver.time=C(a,s,r);break;default:console.warn(`[@lottielab/lottie-player:interactive] Unknown startAt value in ttransition: ${e.startAt}`)}if(e.duration){const t=this.transition?Object.assign(Object.assign({},this.transition),{next:i}):i;this.transition={type:"transition",prev:t,progress:0,def:e,from:i.def}}else this.transition=void 0,this.transitionEndEvent.emit({from:i.def,to:t,transition:e})}get definition(){return this._definition}set definition(t){var e;const i=null===(e=Object.entries(this._definition.states).find((([t,e])=>e===this.state.def)))||void 0===e?void 0:e[0];if(this._definition=t,i&&this._definition.states[i])this.enterState(t.states[i]);else{if(!t.states[t.initialState])throw this.enterState({segment:[0,0],loop:!1,speed:1,direction:"forward"}),new Error(`Initial state ${t.initialState} does not exist`);const e=this.state.playback.driver.time;this.enterState(t.states[t.initialState]),this.state.playback.driver.time=e,this.transition=void 0}}updateVariables(t){this.builtinVariables=Object.assign(Object.assign({},this.builtinVariables),t),this.variables=y(this.builtinVariables,this.userVariables)}setUserVariables(t){this.userVariables=t,this.variables=y(this.builtinVariables,this.userVariables)}handle(t){var e;const i=null===(e=this.state.def.on)||void 0===e?void 0:e[n(t)];if(!i)return;const s=this._definition.states[i.goTo];s?this.goToState(s,i):console.warn(`[@lottielab/lottie-player:interactive] State ${i.goTo} does not exist`)}getEffectiveState(t){return"state"===t.type||t.progress<1?t:t.next?t.next:this.state}applyTransition(t,e,i){let s=t;return this.transition&&(s=P(t,this.transition,e,i,this.variables),this.transition.progress>=1?(this.transitionEndEvent.emit({from:this.transition.from,to:this.state.def,transition:this.transition.def}),this.transition=void 0):this.transition.prev=this.getEffectiveState(this.transition.prev)),s}advance(t,e){let i=Object.assign({},t);const s=this.clock+=e;this.setupMorphingForCurrentState();const a=[];if(void 0===this.state.remainingDuration)i=A(this.state,Object.assign(Object.assign({},t),{morphs:void 0}),e,s,this.variables,a);else{const r=this.state.remainingDuration;if(r>0){const n=Math.min(r,e);this.state.remainingDuration-=n,i=A(this.state,Object.assign(Object.assign({},t),{morphs:void 0}),n,s,this.variables,a),this.state.remainingDuration<=0&&(this.state.remainingDuration=0,this.handle({event:"finish"}))}}for(const t of a)"finish"===t.type&&this.handle({event:"finish"});return i=this.applyTransition(i,e,s),i}get currentTime(){return this.state.playback.playheadControl?this.state.playback.playheadControl(this.variables):this.state.playback.driver.currentTime}get currentFrame(){return this.currentTime/this.state.playback.driver.frameRate}}const F="ll-enclosing-rect";function x(t,e,i){return Math.min(Math.max(t,e),i)}class M{attachContinuousListeners(t){const e=e=>{var i;const s=t.getBoundingClientRect();null===(i=this.handler)||void 0===i||i.updateVariables({"mouse.x":e.clientX-s.left,"mouse.y":e.clientY-s.top,"mouse.abs.x":e.clientX,"mouse.abs.y":e.clientY,"mouse.progress.x":x((e.clientX-s.left)/s.width,0,1),"mouse.progress.y":x((e.clientY-s.top)/s.height,0,1)})};window.addEventListener("mousemove",e),this.disposers.push((()=>window.removeEventListener("mousemove",e)));const i=t=>{var e;null===(e=this.handler)||void 0===e||e.updateVariables({"mouse.buttons.left":0!=(1&t.buttons),"mouse.buttons.right":0!=(2&t.buttons),"mouse.buttons.middle":0!=(4&t.buttons)})};window.addEventListener("mousedown",i),this.disposers.push((()=>window.removeEventListener("mousedown",i)));const s=()=>{var t;null===(t=this.handler)||void 0===t||t.updateVariables({"mouse.buttons.left":!1,"mouse.buttons.right":!1,"mouse.buttons.middle":!1})};window.addEventListener("mouseup",s),this.disposers.push((()=>window.removeEventListener("mouseup",s)))}attachListener(t,e,i){let s;switch(i){case"click":s="click";break;case"mouseEnter":s="mouseenter";break;case"mouseLeave":s="mouseleave";break;case"mouseDown":s="mousedown";break;case"mouseUp":s="mouseup";break;default:throw new Error("InteractiveEventDispatcher: not a DOM event: "+i)}const a=t=>{var s,a;e===F?null===(s=this.handler)||void 0===s||s.handle({event:i}):null===(a=this.handler)||void 0===a||a.handle({event:i,target:null!=e?e:void 0})};t.addEventListener(s,a),this.disposers.push((()=>{t.removeEventListener(s,a)}))}constructor(t,e=[]){var i,s;this.container=t,this.disposers=[],this.currentClickableClassNames=[];const a=t.querySelector("svg"),r=null!==(s=null===(i=null==a?void 0:a.getAttribute("viewBox"))||void 0===i?void 0:i.split(" ").map((t=>parseFloat(t))))&&void 0!==s?s:[1200,900],n=null==a?void 0:a.querySelector("svg > g"),o=document.createElementNS("http://www.w3.org/2000/svg","rect");[["x","0"],["y","0"],["width",r[2].toString()],["height",r[3].toString()],["fill","transparent"],["pointer-events","bounding-box"],["class",F]].forEach((([t,e])=>{o.setAttribute(t,e)})),null==n||n.insertBefore(o,n.firstChild),this.disposers.push((()=>o.remove()));const h=new Set;for(const t of[F].concat(e)){h.has(t)&&console.warn(`[@lottielab/lottie-player:interactive] Duplicate class name ${t} in reactivity event dispatcher`),h.add(t);const e=t===F?n:this.container.querySelector(`.${t}`);if(e)for(const i of["click","mouseDown","mouseUp","mouseEnter","mouseLeave"])this.attachListener(e,t,i);else console.warn(`[@lottielab/lottie-player:interactive] Could not find element with class name ${t}`)}this.attachContinuousListeners(o)}setClickableClassNames(t){const e=(t,e)=>{const i="full"===t?this.container:this.container.querySelector(`.${t}`);i&&(i.style.cursor=e)};this.currentClickableClassNames.forEach((t=>e(t,"initial"))),this.currentClickableClassNames=t,t.forEach((t=>e(t,"pointer")))}destroy(){this.setClickableClassNames([]),this.disposers.forEach((t=>t()))}}var I;!function(t){t.Linear={i:{x:.75,y:.75},o:{x:.25,y:.25}},t.Natural={o:{x:.4,y:0},i:{x:.8,y:1}},t.BounceIn={o:{x:.8,y:0},i:{x:.5,y:1.5}},t.BounceOut={o:{x:.5,y:-.5},i:{x:.2,y:1}},t.Accelerate={o:{x:.42,y:0},i:{x:1,y:1}},t.SlowDown={o:{x:0,y:0},i:{x:.58,y:1}}}(I||(I={}));class L{constructor(t){this.onUpdate=t,this.variables={}}set(t,e){this.variables[t]=e,this.onUpdate(this.variables)}get(t){return this.variables[t]}delete(t){delete this.variables[t],this.onUpdate(this.variables)}clear(){this.variables={},this.onUpdate(this.variables)}}class R{constructor(t,e){this._transitionStartEvent=new h,this._transitionEndEvent=new h,this._userProvidedDefinition={set:!1},this._rootElement=t,this._lottie=e;const i=this.effectiveDefinition();this._driver=new E(i),this._dispatcher=new M(this._rootElement,this.getObservedClassNames(i)),this._dispatcher.setClickableClassNames(this.getClickableClassNames()),this._dispatcher.handler=this._driver;this._driver.transitionStartEvent.addListener((t=>{this._transitionStartEvent.emit(this.translateTransitionEvent(t)),this._dispatcher.setClickableClassNames(this.getClickableClassNames())})),this._driver.transitionEndEvent.addListener((t=>this._transitionEndEvent.emit(this.translateTransitionEvent(t)))),this.inputs=new L((t=>this._driver.setUserVariables(t)))}get definition(){var t,e;return this._userProvidedDefinition.set?this._userProvidedDefinition.value:null===(e=null===(t=this._lottie)||void 0===t?void 0:t.metadata)||void 0===e?void 0:e.lottielabInteractivity}set definition(t){this._userProvidedDefinition={set:!0,value:t},this.updateReactivity()}get state(){const t=this._driver.getCurrentState().def,e=this.lookupStateName(t);return Object.assign(Object.assign({},t),{name:null!=e?e:"<custom>"})}set state(t){this._driver.goToState(this.findState(t))}goToState(t,e){this._driver.goToState(this.findState(t),e)}hasUserProvidedDefinition(){return this._userProvidedDefinition.set}resetDefinition(){this._userProvidedDefinition={set:!1},this.updateReactivity()}on(t,e){switch(t){case"transitionstart":this._transitionStartEvent.addListener(e);break;case"transitionend":this._transitionEndEvent.addListener(e)}}off(t,e){switch(t){case"transitionstart":this._transitionStartEvent.removeListener(e);break;case"transitionend":this._transitionEndEvent.removeListener(e)}}trigger(t){this._driver.handle({event:"custom",name:t})}_destroy(){var t;null===(t=this._dispatcher)||void 0===t||t.destroy()}_getDriver(){return this._driver}translateTransitionEvent(t){var e,i;return{from:Object.assign(Object.assign({},t.from),{name:null!==(e=this.lookupStateName(t.from))&&void 0!==e?e:"<custom>"}),to:Object.assign(Object.assign({},t.to),{name:null!==(i=this.lookupStateName(t.to))&&void 0!==i?i:"<custom>"}),transition:t.transition}}effectiveDefinition(){var t;const e=this._lottie?this._lottie.op/this._lottie.fr:0;return null!==(t=this.definition)&&void 0!==t?t:{__version:"v1",initialState:"default",states:{default:{segment:[0,e]}}}}lookupStateName(t){var e;return null===(e=Object.entries(this.effectiveDefinition().states).find((([e,i])=>i===t)))||void 0===e?void 0:e[0]}findState(t){let e;if(e="string"==typeof t?this.effectiveDefinition().states[t]:t,!t)throw new Error(`State ${t} not found`);return e}getObservedClassNames(t){return t?[...new Set(Object.values(t.states).flatMap((t=>{var e;return Object.keys(null!==(e=t.on)&&void 0!==e?e:{})})).flatMap((t=>{const[e,i]=t.split(":");return"custom"!==e&&i?[i]:[]})))]:[]}getClickableClassNames(){var t;return[...new Set(Object.keys(null!==(t=this.state.on)&&void 0!==t?t:{}).flatMap((t=>{const[e,i]=t.split(":");return["click","mouseDown","mouseUp"].includes(e)?i?[i]:["full"]:[]})))]}updateReactivity(){var t;const e=this.effectiveDefinition();this._driver.definition=e,null===(t=this._dispatcher)||void 0===t||t.destroy(),this._dispatcher=new M(this._rootElement,this.getObservedClassNames(e)),this._dispatcher.handler=this._driver}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function O(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var V,N={exports:{}};V=N.exports,"undefined"!=typeof navigator&&(N.exports=function(){var t="http://www.w3.org/2000/svg",e="",i=!1,s=-999999,a=function(t){i=!!t},r=function(){return i},n=function(t){e=t},o=function(){return e};function h(t){return document.createElement(t)}function l(t,e){var i,s,a=t.length;for(i=0;i<a;i+=1)for(var r in s=t[i].prototype)Object.prototype.hasOwnProperty.call(s,r)&&(e.prototype[r]=s[r])}function p(t){function e(){}return e.prototype=t,e}var d=function(){function t(t){this.audios=[],this.audioFactory=t,this._volume=1,this._isMuted=!1}return t.prototype={addAudio:function(t){this.audios.push(t)},pause:function(){var t,e=this.audios.length;for(t=0;t<e;t+=1)this.audios[t].pause()},resume:function(){var t,e=this.audios.length;for(t=0;t<e;t+=1)this.audios[t].resume()},setRate:function(t){var e,i=this.audios.length;for(e=0;e<i;e+=1)this.audios[e].setRate(t)},createAudio:function(t){return this.audioFactory?this.audioFactory(t):window.Howl?new window.Howl({src:[t]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(t){this.audioFactory=t},setVolume:function(t){this._volume=t,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var t,e=this.audios.length;for(t=0;t<e;t+=1)this.audios[t].volume(this._volume*(this._isMuted?0:1))}},function(){return new t}}(),f=function(){function t(t,e){var i,s=0,a=[];switch(t){case"int16":case"uint8c":i=1;break;default:i=1.1}for(s=0;s<e;s+=1)a.push(i);return a}function e(e,i){return"float32"===e?new Float32Array(i):"int16"===e?new Int16Array(i):"uint8c"===e?new Uint8ClampedArray(i):t(e,i)}return"function"==typeof Uint8ClampedArray&&"function"==typeof Float32Array?e:t}();function c(t){return Array.apply(null,{length:t})}var u=!0,m=null,g="",v=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),y=Math.pow,b=Math.sqrt,_=Math.floor,k=Math.min,w=150,S=Math.PI/180,A=.5519;function D(t,e,i,s){this.type=t,this.currentTime=e,this.totalTime=i,this.direction=s<0?-1:1}function T(t,e){this.type=t,this.direction=e<0?-1:1}function C(t,e,i,s){this.type=t,this.currentLoop=i,this.totalLoops=e,this.direction=s<0?-1:1}function P(t,e,i){this.type=t,this.firstFrame=e,this.totalFrames=i}function E(t,e){this.type=t,this.target=e}function F(t,e){this.type="renderFrameError",this.nativeError=t,this.currentTime=e}function x(t){this.type="configError",this.nativeError=t}var M,I=(M=0,function(){return g+"__lottie_element_"+(M+=1)});function L(t,e,i){var s,a,r,n,o,h,l,p;switch(h=i*(1-e),l=i*(1-(o=6*t-(n=Math.floor(6*t)))*e),p=i*(1-(1-o)*e),n%6){case 0:s=i,a=p,r=h;break;case 1:s=l,a=i,r=h;break;case 2:s=h,a=i,r=p;break;case 3:s=h,a=l,r=i;break;case 4:s=p,a=h,r=i;break;case 5:s=i,a=h,r=l}return[s,a,r]}function R(t,e,i){var s,a=Math.max(t,e,i),r=Math.min(t,e,i),n=a-r,o=0===a?0:n/a,h=a/255;switch(a){case r:s=0;break;case t:s=e-i+n*(e<i?6:0),s/=6*n;break;case e:s=i-t+2*n,s/=6*n;break;case i:s=t-e+4*n,s/=6*n}return[s,o,h]}function O(t,e){var i=R(255*t[0],255*t[1],255*t[2]);return i[1]+=e,i[1]>1?i[1]=1:i[1]<=0&&(i[1]=0),L(i[0],i[1],i[2])}function N(t,e){var i=R(255*t[0],255*t[1],255*t[2]);return i[2]+=e,i[2]>1?i[2]=1:i[2]<0&&(i[2]=0),L(i[0],i[1],i[2])}function z(t,e){var i=R(255*t[0],255*t[1],255*t[2]);return i[0]+=e/360,i[0]>1?i[0]-=1:i[0]<0&&(i[0]+=1),L(i[0],i[1],i[2])}var j=function(){var t,e,i=[];for(t=0;t<256;t+=1)e=t.toString(16),i[t]=1===e.length?"0"+e:e;return function(t,e,s){return t<0&&(t=0),e<0&&(e=0),s<0&&(s=0),"#"+i[t]+i[e]+i[s]}}(),B=function(t){u=!!t},q=function(){return u},W=function(t){m=t},$=function(){return m},H=function(t){w=t},G=function(){return w},X=function(t){g=t};function U(e){return document.createElementNS(t,e)}function Y(t){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y(t)}var Z=function(){var t,e,i=1,s=[],a={onmessage:function(){},postMessage:function(e){t({data:e})}},n={postMessage:function(t){a.onmessage({data:t})}};function o(e){if(window.Worker&&window.Blob&&r()){var i=new Blob(["var _workerSelf = self; self.onmessage = ",e.toString()],{type:"text/javascript"}),s=URL.createObjectURL(i);return new Worker(s)}return t=e,a}function h(){e||((e=o((function(t){function e(){function t(e,i){var n,o,h,l,p,d,f=e.length;for(o=0;o<f;o+=1)if("ks"in(n=e[o])&&!n.completed){if(n.completed=!0,n.hasMask){var c=n.masksProperties;for(l=c.length,h=0;h<l;h+=1)if(c[h].pt.k.i)r(c[h].pt.k);else for(d=c[h].pt.k.length,p=0;p<d;p+=1)c[h].pt.k[p].s&&r(c[h].pt.k[p].s[0]),c[h].pt.k[p].e&&r(c[h].pt.k[p].e[0])}0===n.ty?(n.layers=s(n.refId,i),t(n.layers,i)):4===n.ty?a(n.shapes):5===n.ty&&u(n)}}function e(e,i){if(e){var a=0,r=e.length;for(a=0;a<r;a+=1)1===e[a].t&&(e[a].data.layers=s(e[a].data.refId,i),t(e[a].data.layers,i))}}function i(t,e){for(var i=0,s=e.length;i<s;){if(e[i].id===t)return e[i];i+=1}return null}function s(t,e){var s=i(t,e);return s?s.layers.__used?JSON.parse(JSON.stringify(s.layers)):(s.layers.__used=!0,s.layers):null}function a(t){var e,i,s;for(e=t.length-1;e>=0;e-=1)if("sh"===t[e].ty)if(t[e].ks.k.i)r(t[e].ks.k);else for(s=t[e].ks.k.length,i=0;i<s;i+=1)t[e].ks.k[i].s&&r(t[e].ks.k[i].s[0]),t[e].ks.k[i].e&&r(t[e].ks.k[i].e[0]);else"gr"===t[e].ty&&a(t[e].it)}function r(t){var e,i=t.i.length;for(e=0;e<i;e+=1)t.i[e][0]+=t.v[e][0],t.i[e][1]+=t.v[e][1],t.o[e][0]+=t.v[e][0],t.o[e][1]+=t.v[e][1]}function n(t,e){var i=e?e.split("."):[100,100,100];return t[0]>i[0]||!(i[0]>t[0])&&(t[1]>i[1]||!(i[1]>t[1])&&(t[2]>i[2]||!(i[2]>t[2])&&null))}var o,h=function(){var t=[4,4,14];function e(t){var e=t.t.d;t.t.d={k:[{s:e,t:0}]}}function i(t){var i,s=t.length;for(i=0;i<s;i+=1)5===t[i].ty&&e(t[i])}return function(e){if(n(t,e.v)&&(i(e.layers),e.assets)){var s,a=e.assets.length;for(s=0;s<a;s+=1)e.assets[s].layers&&i(e.assets[s].layers)}}}(),l=(o=[4,7,99],function(t){if(t.chars&&!n(o,t.v)){var e,i=t.chars.length;for(e=0;e<i;e+=1){var s=t.chars[e];s.data&&s.data.shapes&&(a(s.data.shapes),s.data.ip=0,s.data.op=99999,s.data.st=0,s.data.sr=1,s.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},t.chars[e].t||(s.data.shapes.push({ty:"no"}),s.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}),p=function(){var t=[5,7,15];function e(t){var e=t.t.p;"number"==typeof e.a&&(e.a={a:0,k:e.a}),"number"==typeof e.p&&(e.p={a:0,k:e.p}),"number"==typeof e.r&&(e.r={a:0,k:e.r})}function i(t){var i,s=t.length;for(i=0;i<s;i+=1)5===t[i].ty&&e(t[i])}return function(e){if(n(t,e.v)&&(i(e.layers),e.assets)){var s,a=e.assets.length;for(s=0;s<a;s+=1)e.assets[s].layers&&i(e.assets[s].layers)}}}(),d=function(){var t=[4,1,9];function e(t){var i,s,a,r=t.length;for(i=0;i<r;i+=1)if("gr"===t[i].ty)e(t[i].it);else if("fl"===t[i].ty||"st"===t[i].ty)if(t[i].c.k&&t[i].c.k[0].i)for(a=t[i].c.k.length,s=0;s<a;s+=1)t[i].c.k[s].s&&(t[i].c.k[s].s[0]/=255,t[i].c.k[s].s[1]/=255,t[i].c.k[s].s[2]/=255,t[i].c.k[s].s[3]/=255),t[i].c.k[s].e&&(t[i].c.k[s].e[0]/=255,t[i].c.k[s].e[1]/=255,t[i].c.k[s].e[2]/=255,t[i].c.k[s].e[3]/=255);else t[i].c.k[0]/=255,t[i].c.k[1]/=255,t[i].c.k[2]/=255,t[i].c.k[3]/=255}function i(t){var i,s=t.length;for(i=0;i<s;i+=1)4===t[i].ty&&e(t[i].shapes)}return function(e){if(n(t,e.v)&&(i(e.layers),e.assets)){var s,a=e.assets.length;for(s=0;s<a;s+=1)e.assets[s].layers&&i(e.assets[s].layers)}}}(),f=function(){var t=[4,4,18];function e(t){var i,s,a;for(i=t.length-1;i>=0;i-=1)if("sh"===t[i].ty)if(t[i].ks.k.i)t[i].ks.k.c=t[i].closed;else for(a=t[i].ks.k.length,s=0;s<a;s+=1)t[i].ks.k[s].s&&(t[i].ks.k[s].s[0].c=t[i].closed),t[i].ks.k[s].e&&(t[i].ks.k[s].e[0].c=t[i].closed);else"gr"===t[i].ty&&e(t[i].it)}function i(t){var i,s,a,r,n,o,h=t.length;for(s=0;s<h;s+=1){if((i=t[s]).hasMask){var l=i.masksProperties;for(r=l.length,a=0;a<r;a+=1)if(l[a].pt.k.i)l[a].pt.k.c=l[a].cl;else for(o=l[a].pt.k.length,n=0;n<o;n+=1)l[a].pt.k[n].s&&(l[a].pt.k[n].s[0].c=l[a].cl),l[a].pt.k[n].e&&(l[a].pt.k[n].e[0].c=l[a].cl)}4===i.ty&&e(i.shapes)}}return function(e){if(n(t,e.v)&&(i(e.layers),e.assets)){var s,a=e.assets.length;for(s=0;s<a;s+=1)e.assets[s].layers&&i(e.assets[s].layers)}}}();function c(i){i.__complete||(d(i),h(i),l(i),p(i),f(i),t(i.layers,i.assets),e(i.chars,i.assets),i.__complete=!0)}function u(t){0===t.t.a.length&&t.t.p}var m={};return m.completeData=c,m.checkColors=d,m.checkChars=l,m.checkPathProperties=p,m.checkShapes=f,m.completeLayers=t,m}if(n.dataManager||(n.dataManager=e()),n.assetLoader||(n.assetLoader=function(){function t(t){var e=t.getResponseHeader("content-type");return e&&"json"===t.responseType&&-1!==e.indexOf("json")||t.response&&"object"===Y(t.response)?t.response:t.response&&"string"==typeof t.response?JSON.parse(t.response):t.responseText?JSON.parse(t.responseText):null}function e(e,i,s,a){var r,n=new XMLHttpRequest;try{n.responseType="json"}catch(t){}n.onreadystatechange=function(){if(4===n.readyState)if(200===n.status)r=t(n),s(r);else try{r=t(n),s(r)}catch(t){a&&a(t)}};try{n.open(["G","E","T"].join(""),e,!0)}catch(t){n.open(["G","E","T"].join(""),i+"/"+e,!0)}n.send()}return{load:e}}()),"loadAnimation"===t.data.type)n.assetLoader.load(t.data.path,t.data.fullPath,(function(e){n.dataManager.completeData(e),n.postMessage({id:t.data.id,payload:e,status:"success"})}),(function(){n.postMessage({id:t.data.id,status:"error"})}));else if("complete"===t.data.type){var i=t.data.animation;n.dataManager.completeData(i),n.postMessage({id:t.data.id,payload:i,status:"success"})}else"loadData"===t.data.type&&n.assetLoader.load(t.data.path,t.data.fullPath,(function(e){n.postMessage({id:t.data.id,payload:e,status:"success"})}),(function(){n.postMessage({id:t.data.id,status:"error"})}))}))).onmessage=function(t){var e=t.data,i=e.id,a=s[i];s[i]=null,"success"===e.status?a.onComplete(e.payload):a.onError&&a.onError()})}function l(t,e){var a="processId_"+(i+=1);return s[a]={onComplete:t,onError:e},a}function p(t,i,s){h();var a=l(i,s);e.postMessage({type:"loadAnimation",path:t,fullPath:window.location.origin+window.location.pathname,id:a})}function d(t,i,s){h();var a=l(i,s);e.postMessage({type:"loadData",path:t,fullPath:window.location.origin+window.location.pathname,id:a})}function f(t,i,s){h();var a=l(i,s);e.postMessage({type:"complete",animation:t,id:a})}return{loadAnimation:p,loadData:d,completeAnimation:f}}(),J=function(){var t=function(){var t=h("canvas");t.width=1,t.height=1;var e=t.getContext("2d");return e.fillStyle="rgba(0,0,0,0)",e.fillRect(0,0,1,1),t}();function e(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function i(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function s(t,e,i){var s="";if(t.e)s=t.p;else if(e){var a=t.p;-1!==a.indexOf("images/")&&(a=a.split("/")[1]),s=e+a}else s=i,s+=t.u?t.u:"",s+=t.p;return s}function a(t){var e=0,i=setInterval(function(){(t.getBBox().width||e>500)&&(this._imageLoaded(),clearInterval(i)),e+=1}.bind(this),50)}function r(e){var i=s(e,this.assetsPath,this.path),a=U("image");v?this.testImageLoaded(a):a.addEventListener("load",this._imageLoaded,!1),a.addEventListener("error",function(){r.img=t,this._imageLoaded()}.bind(this),!1),a.setAttributeNS("http://www.w3.org/1999/xlink","href",i),this._elementHelper.append?this._elementHelper.append(a):this._elementHelper.appendChild(a);var r={img:a,assetData:e};return r}function n(e){var i=s(e,this.assetsPath,this.path),a=h("img");a.crossOrigin="anonymous",a.addEventListener("load",this._imageLoaded,!1),a.addEventListener("error",function(){r.img=t,this._imageLoaded()}.bind(this),!1),a.src=i;var r={img:a,assetData:e};return r}function o(t){var e={assetData:t},i=s(t,this.assetsPath,this.path);return Z.loadData(i,function(t){e.img=t,this._footageLoaded()}.bind(this),function(){e.img={},this._footageLoaded()}.bind(this)),e}function l(t,e){var i;this.imagesLoadedCb=e;var s=t.length;for(i=0;i<s;i+=1)t[i].layers||(t[i].t&&"seq"!==t[i].t?3===t[i].t&&(this.totalFootages+=1,this.images.push(this.createFootageData(t[i]))):(this.totalImages+=1,this.images.push(this._createImageData(t[i]))))}function p(t){this.path=t||""}function d(t){this.assetsPath=t||""}function f(t){for(var e=0,i=this.images.length;e<i;){if(this.images[e].assetData===t)return this.images[e].img;e+=1}return null}function c(){this.imagesLoadedCb=null,this.images.length=0}function u(){return this.totalImages===this.loadedAssets}function m(){return this.totalFootages===this.loadedFootagesCount}function g(t,e){"svg"===t?(this._elementHelper=e,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}function y(){this._imageLoaded=e.bind(this),this._footageLoaded=i.bind(this),this.testImageLoaded=a.bind(this),this.createFootageData=o.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return y.prototype={loadAssets:l,setAssetsPath:d,setPath:p,loadedImages:u,loadedFootages:m,destroy:c,getAsset:f,createImgData:n,createImageData:r,imageLoaded:e,footageLoaded:i,setCacheType:g},y}();function K(){}K.prototype={triggerEvent:function(t,e){if(this._cbs[t])for(var i=this._cbs[t],s=0;s<i.length;s+=1)i[s](e)},addEventListener:function(t,e){return this._cbs[t]||(this._cbs[t]=[]),this._cbs[t].push(e),function(){this.removeEventListener(t,e)}.bind(this)},removeEventListener:function(t,e){if(e){if(this._cbs[t]){for(var i=0,s=this._cbs[t].length;i<s;)this._cbs[t][i]===e&&(this._cbs[t].splice(i,1),i-=1,s-=1),i+=1;this._cbs[t].length||(this._cbs[t]=null)}}else this._cbs[t]=null}};var Q=function(){function t(t){for(var e,i=t.split("\r\n"),s={},a=0,r=0;r<i.length;r+=1)2===(e=i[r].split(":")).length&&(s[e[0]]=e[1].trim(),a+=1);if(0===a)throw new Error;return s}return function(e){for(var i=[],s=0;s<e.length;s+=1){var a=e[s],r={time:a.tm,duration:a.dr};try{r.payload=JSON.parse(e[s].cm)}catch(i){try{r.payload=t(e[s].cm)}catch(t){r.payload={name:e[s].cm}}}i.push(r)}return i}}(),tt=function(){function t(t){this.compositions.push(t)}return function(){function e(t){for(var e=0,i=this.compositions.length;e<i;){if(this.compositions[e].data&&this.compositions[e].data.nm===t)return this.compositions[e].prepareFrame&&this.compositions[e].data.xt&&this.compositions[e].prepareFrame(this.currentFrame),this.compositions[e].compInterface;e+=1}return null}return e.compositions=[],e.currentFrame=0,e.registerComposition=t,e}}(),et={},it=function(t,e){et[t]=e};function st(t){return et[t]}function at(){if(et.canvas)return"canvas";for(var t in et)if(et[t])return t;return""}function rt(t){return rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rt(t)}var nt=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=I(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=q(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=tt(),this.imagePreloader=new J,this.audioController=d(),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new D("drawnFrame",0,0,0),this.expressionsPlugin=$()};l([K],nt),nt.prototype.setParams=function(t){(t.wrapper||t.container)&&(this.wrapper=t.wrapper||t.container);var e="svg";t.animType?e=t.animType:t.renderer&&(e=t.renderer);var i=st(e);this.renderer=new i(this,t.rendererSettings),this.imagePreloader.setCacheType(e,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=e,""===t.loop||null===t.loop||void 0===t.loop||!0===t.loop?this.loop=!0:!1===t.loop?this.loop=!1:this.loop=parseInt(t.loop,10),this.autoplay=!("autoplay"in t)||t.autoplay,this.name=t.name?t.name:"",this.autoloadSegments=!Object.prototype.hasOwnProperty.call(t,"autoloadSegments")||t.autoloadSegments,this.assetsPath=t.assetsPath,this.initialSegment=t.initialSegment,t.audioFactory&&this.audioController.setAudioFactory(t.audioFactory),t.animationData?this.setupAnimation(t.animationData):t.path&&(-1!==t.path.lastIndexOf("\\")?this.path=t.path.substr(0,t.path.lastIndexOf("\\")+1):this.path=t.path.substr(0,t.path.lastIndexOf("/")+1),this.fileName=t.path.substr(t.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),Z.loadAnimation(t.path,this.configAnimation,this.onSetupError))},nt.prototype.onSetupError=function(){this.trigger("data_failed")},nt.prototype.setupAnimation=function(t){Z.completeAnimation(t,this.configAnimation)},nt.prototype.setData=function(t,e){e&&"object"!==rt(e)&&(e=JSON.parse(e));var i={wrapper:t,animationData:e},s=t.attributes;i.path=s.getNamedItem("data-animation-path")?s.getNamedItem("data-animation-path").value:s.getNamedItem("data-bm-path")?s.getNamedItem("data-bm-path").value:s.getNamedItem("bm-path")?s.getNamedItem("bm-path").value:"",i.animType=s.getNamedItem("data-anim-type")?s.getNamedItem("data-anim-type").value:s.getNamedItem("data-bm-type")?s.getNamedItem("data-bm-type").value:s.getNamedItem("bm-type")?s.getNamedItem("bm-type").value:s.getNamedItem("data-bm-renderer")?s.getNamedItem("data-bm-renderer").value:s.getNamedItem("bm-renderer")?s.getNamedItem("bm-renderer").value:at()||"canvas";var a=s.getNamedItem("data-anim-loop")?s.getNamedItem("data-anim-loop").value:s.getNamedItem("data-bm-loop")?s.getNamedItem("data-bm-loop").value:s.getNamedItem("bm-loop")?s.getNamedItem("bm-loop").value:"";"false"===a?i.loop=!1:"true"===a?i.loop=!0:""!==a&&(i.loop=parseInt(a,10));var r=s.getNamedItem("data-anim-autoplay")?s.getNamedItem("data-anim-autoplay").value:s.getNamedItem("data-bm-autoplay")?s.getNamedItem("data-bm-autoplay").value:!s.getNamedItem("bm-autoplay")||s.getNamedItem("bm-autoplay").value;i.autoplay="false"!==r,i.name=s.getNamedItem("data-name")?s.getNamedItem("data-name").value:s.getNamedItem("data-bm-name")?s.getNamedItem("data-bm-name").value:s.getNamedItem("bm-name")?s.getNamedItem("bm-name").value:"","false"===(s.getNamedItem("data-anim-prerender")?s.getNamedItem("data-anim-prerender").value:s.getNamedItem("data-bm-prerender")?s.getNamedItem("data-bm-prerender").value:s.getNamedItem("bm-prerender")?s.getNamedItem("bm-prerender").value:"")&&(i.prerender=!1),i.path?this.setParams(i):this.trigger("destroy")},nt.prototype.includeLayers=function(t){t.op>this.animationData.op&&(this.animationData.op=t.op,this.totalFrames=Math.floor(t.op-this.animationData.ip));var e,i,s=this.animationData.layers,a=s.length,r=t.layers,n=r.length;for(i=0;i<n;i+=1)for(e=0;e<a;){if(s[e].id===r[i].id){s[e]=r[i];break}e+=1}if((t.chars||t.fonts)&&(this.renderer.globalData.fontManager.addChars(t.chars),this.renderer.globalData.fontManager.addFonts(t.fonts,this.renderer.globalData.defs)),t.assets)for(a=t.assets.length,e=0;e<a;e+=1)this.animationData.assets.push(t.assets[e]);this.animationData.__complete=!1,Z.completeAnimation(this.animationData,this.onSegmentComplete)},nt.prototype.onSegmentComplete=function(t){this.animationData=t;var e=$();e&&e.initExpressions(this),this.loadNextSegment()},nt.prototype.loadNextSegment=function(){var t=this.animationData.segments;if(!t||0===t.length||!this.autoloadSegments)return this.trigger("data_ready"),void(this.timeCompleted=this.totalFrames);var e=t.shift();this.timeCompleted=e.time*this.frameRate;var i=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,Z.loadData(i,this.includeLayers.bind(this),function(){this.trigger("data_failed")}.bind(this))},nt.prototype.loadSegments=function(){this.animationData.segments||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},nt.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},nt.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},nt.prototype.configAnimation=function(t){if(this.renderer)try{this.animationData=t,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(t),t.assets||(t.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(t.assets),this.markers=Q(t.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(t){this.triggerConfigError(t)}},nt.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},nt.prototype.checkLoaded=function(){if(!this.isLoaded&&this.renderer.globalData.fontManager.isLoaded&&(this.imagePreloader.loadedImages()||"canvas"!==this.renderer.rendererType)&&this.imagePreloader.loadedFootages()){this.isLoaded=!0;var t=$();t&&t.initExpressions(this),this.renderer.initItems(),setTimeout(function(){this.trigger("DOMLoaded")}.bind(this),0),this.gotoFrame(),this.autoplay&&this.play()}},nt.prototype.resize=function(t,e){var i="number"==typeof t?t:void 0,s="number"==typeof e?e:void 0;this.renderer.updateContainerSize(i,s)},nt.prototype.setSubframe=function(t){this.isSubframeEnabled=!!t},nt.prototype.gotoFrame=function(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},nt.prototype.renderFrame=function(){if(!1!==this.isLoaded&&this.renderer)try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(t){this.triggerRenderFrameError(t)}},nt.prototype.play=function(t){t&&this.name!==t||!0===this.isPaused&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},nt.prototype.pause=function(t){t&&this.name!==t||!1===this.isPaused&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},nt.prototype.togglePause=function(t){t&&this.name!==t||(!0===this.isPaused?this.play():this.pause())},nt.prototype.stop=function(t){t&&this.name!==t||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},nt.prototype.getMarkerData=function(t){for(var e,i=0;i<this.markers.length;i+=1)if((e=this.markers[i]).payload&&e.payload.name===t)return e;return null},nt.prototype.goToAndStop=function(t,e,i){if(!i||this.name===i){var s=Number(t);if(isNaN(s)){var a=this.getMarkerData(t);a&&this.goToAndStop(a.time,!0)}else e?this.setCurrentRawFrameValue(t):this.setCurrentRawFrameValue(t*this.frameModifier);this.pause()}},nt.prototype.goToAndPlay=function(t,e,i){if(!i||this.name===i){var s=Number(t);if(isNaN(s)){var a=this.getMarkerData(t);a&&(a.duration?this.playSegments([a.time,a.time+a.duration],!0):this.goToAndStop(a.time,!0))}else this.goToAndStop(s,e,i);this.play()}},nt.prototype.advanceTime=function(t){if(!0!==this.isPaused&&!1!==this.isLoaded){var e=this.currentRawFrame+t*this.frameModifier,i=!1;e>=this.totalFrames-1&&this.frameModifier>0?this.loop&&this.playCount!==this.loop?e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(i=!0,e=this.totalFrames-1):e<0?this.checkSegments(e%this.totalFrames)||(!this.loop||this.playCount--<=0&&!0!==this.loop?(i=!0,e=0):(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0)):this.setCurrentRawFrameValue(e),i&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},nt.prototype.adjustSegment=function(t,e){this.playCount=0,t[1]<t[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=t[0]-t[1],this.timeCompleted=this.totalFrames,this.firstFrame=t[1],this.setCurrentRawFrameValue(this.totalFrames-.0