@gamelearn/arcade-components 3.16.2 → 3.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,7 +68,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
68
68
  ${v!=null&&v.feedback?"":"conversation--layer__defaultFeedback"}
69
69
  ${E==="results"?"conversation--layer__feedback":""}`,children:jsxRuntimeExports.jsxs("div",{className:`conversation ${t?"conversation--inScene":""}`,style:(M=o.background)!=null&&M.img?{backgroundImage:`url("${(U=o.background.img)==null?void 0:U.url}")`}:null,children:[jsxRuntimeExports.jsx(SlotList,{...P,children:E==="results"&&(v!=null&&v.feedback)?jsxRuntimeExports.jsx(FeedBack,{question:h,soundActions:e,inherited:S,choice:v,rewards:(v==null?void 0:v.rewards)||[],emitEvent:l}):null}),jsxRuntimeExports.jsx(DecisionBody,{...k})]})}):jsxRuntimeExports.jsx("div",{className:"popup--layer popup--layer--transparent",children:jsxRuntimeExports.jsx(DecisionBody,{...k,children:jsxRuntimeExports.jsx(FeedBack,{question:h,soundActions:e,inherited:S,choice:v,rewards:(v==null?void 0:v.rewards)||[],emitEvent:l})})})}function ImageComponent({emitEvent:l,img:e,imgName:n,documentType:t,visible:a,viewed:o,imgId_labelId:d,soundActions:f,keyboardControl:h}){const u=v=>l({type:"translate",payload:v}),[p,_]=React$2.useState(!1),b=e.url,[S]=f,E=React$2.useCallback(()=>{S("click-ui"),l({type:"finishMedia",payload:{imgId:d,name:n,imgName:n,documentType:t,type:"image"}})},[S,d,n,t,l]),g=h({disabled:o,forward:E,escape:E});return React$2.useEffect(()=>g(),[g]),React$2.useEffect(()=>{!a&&!p&&(_(!0),E())},[E,a,p]),a?jsxRuntimeExports.jsx("div",{className:o?"notes--results":"readings--container readings--container--darkopacity",children:jsxRuntimeExports.jsxs("div",{className:o?"notes--results__text":"readings readings--image",children:[b&&jsxRuntimeExports.jsx("img",{src:b,alt:n}),o?null:jsxRuntimeExports.jsx("div",{className:b?"readings--image--closeBtn":"position--absolute top right",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn__round gat--btn__close",onClick:E,"aria-label":u("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})})]})}):null}function VoiceOver({name:l}){return jsxRuntimeExports.jsx("div",{className:"conversation--voice__over",children:jsxRuntimeExports.jsx("span",{children:l||"Voice-Over"})})}function ThinkFul({text:l}){return jsxRuntimeExports.jsxs("div",{className:"conversation--voice__over",children:[jsxRuntimeExports.jsx("span",{className:"icon-bubble-thinkful-black"}),jsxRuntimeExports.jsxs("span",{children:["[",l,"]"]})]})}function Message({current:l,translate:e}){var t,a;const n=l.text;return jsxRuntimeExports.jsxs("div",{className:`conversation--message ${l.voiceOver||(t=l==null?void 0:l.emotion)!=null&&t.includes("think")?"voice--over":""}`,children:[l.voiceOver?jsxRuntimeExports.jsx(VoiceOver,{name:l.name}):null,(a=l==null?void 0:l.emotion)!=null&&a.includes("think")?jsxRuntimeExports.jsx(ThinkFul,{text:e("emotion.thinking")}):null,jsxRuntimeExports.jsx("div",{className:"conversation--main__text",children:HTMLReactParser$1(n)})]})}Message.defaultProps={current:{},voiceOver:!1};const characterMs$3=75,minMs$1=1400;function ConversationalProComponent({keyboardControl:l,emitEvent:e,pause:n,lines:t,edges:a,characters:o,actors:d,background:f,soundActions:h,lodSettings:u,autoPlay:p,autoEnd:_,progress:b}){var xt,Et,Qe;const S=t.length-1<=(b==null?void 0:b.line)?t.length-1:(b==null?void 0:b.line)||0,[E,g]=React$2.useState(!1),[v,T]=React$2.useState(!0),[R,x]=React$2.useState(!!p),[C,w]=React$2.useState(!1),[P,D]=React$2.useState(S),[N,k]=React$2.useState(!1),[F]=h,{start:M,stop:U}=useTimeout(),$=((xt=f==null?void 0:f.img)==null?void 0:xt.url)||null,B=t[P],{voiceOver:J,decision:ne}=B;let{flex:ie}=B,Y=[];const q=!!a,re=J||B.type==="conversationalNarration",ce=ne||B.type==="conversationalDecision",fe=B.type==="conversationalCamera",[te,H]=React$2.useState([]),W=React$2.useMemo(()=>te[te.length-1],[te]),V=React$2.useCallback(()=>{const Be=a.find(Ye=>Ye.fromId===W)||a.find(Ye=>Ye.toId===W),Xe=t.find(Ye=>Ye.id===(Be==null?void 0:Be.fromId));return!W&&(b==null?void 0:b.line)>=0?{decision:!0}:Xe},[a,t,W,b==null?void 0:b.line]),z=React$2.useCallback(()=>{if(q){const Xe=V();return Xe==null?void 0:Xe.decision}const Be=t[P-1]?t[P-1]:{};return P>0&&(Be==null?void 0:Be.decision)},[q,V,t,P]),Q=React$2.useCallback(()=>{if(q){const Xe=V();return(Xe==null?void 0:Xe.type)==="conversationalCamera"}const Be=t[P-1]?t[P-1]:{};return P>0&&(Be==null?void 0:Be.type)==="conversationalCamera"},[q,t,P,V]),ee=React$2.useCallback(Be=>e({type:"translate",payload:Be}),[e]),le=React$2.useMemo(()=>{var Xe,Ye;if(ce)return{};if(re)return B;const Be=(Xe=B==null?void 0:B.slots)==null?void 0:Xe.find(Pe=>Pe.uid&&Pe.talking);return Be||((Ye=B==null?void 0:B.slots)==null?void 0:Ye.find(Pe=>Pe.uid&&Pe.text))},[B,re,ce]),ue=t.slice(0,P+1).reverse().find(Be=>Be.slots),he=!ce&&((Et=B.slots)==null?void 0:Et.filter(Be=>Be.uid).length),ve=characterMs$3*(((Qe=le==null?void 0:le.text)==null?void 0:Qe.length)||0);let be=[];B.slots?be=B.slots:ue&&(be=ue.slots);const Re=be.filter(Be=>Be.uid).map(Be=>{const Xe=(o||d||[]).find(Ye=>Ye.uid===Be.uid);return Xe&&(Be.resource=Xe.resource,Be.type=Xe.type),Be.resource||(Be.resource={}),Be}),Le={characters:Re,lodSettings:u,actors:d,currentMessage:le||{},slots:re?Y:B.slots,flex:ie,pause:n,emitEvent:e};if(re){const Be=t.slice(P).find(Ye=>Ye.slots),Xe=ue||Be;Xe&&(Y=Xe.slots,ie=Xe.flex)}else if(!ce&&he&&(B.slots.forEach(Be=>{const Xe=Re.findIndex(Ye=>Ye.uid===Be.uid);Xe>=0&&(Re[Xe].emotion=Be.emotion)}),le&&le.uid)){const Be=B.slots.findIndex(Ye=>Ye.uid===le.uid),Xe=Re.findIndex(Ye=>Ye.uid===le.uid);Re.forEach(Ye=>{Ye.uid===le.uid&&(Ye.name=le.alias)}),le.position=ie?Xe:Be}const Oe=React$2.useCallback(()=>{e({type:"success"})},[e]),Ke=React$2.useCallback((Be,Xe)=>{const Ye=[3,2,1][Be.id],Ae=a.filter(_e=>_e.fromId===B.id).find(_e=>parseInt(_e.fromPointIndex)===Ye);if(Ae){const _e=t.findIndex(Ie=>Ie.id===Ae.toId);Ae.fromId===Ae.toId?Xe():_e>=0?(D(_e),e({type:"notifyProgress",payload:{line:_e}})):Oe()}else Oe()},[B.id,a,e,Oe,t]),St=React$2.useCallback((Be=!0)=>{const Xe=Be?["fromId","toId"]:["toId","fromId"],Ye=a.filter(_e=>_e[Xe[0]]===B.id),Pe=Ye.length===1?Ye[0]:Ye.find(_e=>_e[Xe[1]]===W);if(!(Pe!=null&&Pe[Xe[0]])){Oe();return}Be||H(te.slice(0,-1));const Ae=t.findIndex(_e=>_e.id===Pe[Xe[1]]);Ae>=0?(D(Ae),e({type:"notifyProgress",payload:{line:Ae}})):Oe()},[B.id,a,te,e,Oe,W,t]),it=React$2.useCallback(Be=>{if(q){if(Be){const Xe=[3,2,1][Be.id],Pe=a.filter(Ae=>Ae.fromId===B.id).find(Ae=>parseInt(Ae.fromPointIndex)===Xe);if(Pe){const Ae=t.findIndex(_e=>_e.id===Pe.toId);Ae>=0&&e({type:"notifyProgress",payload:{line:Ae}})}else e({type:"saveNode"})}}else if(P<t.length-1){const Ye=P+1;e({type:"notifyProgress",payload:{line:Ye}})}else e({type:"saveNode"})},[a,t,e,P,B.id,q]),gt=React$2.useCallback((Be,Xe)=>{let Ye=!1;if(k(!1),H([...te,B.id]),T(!1),w(!1),q)Be?Ke(Be,Xe):St();else if(P<t.length-1){const Ae=P+1;D(Ae),e({type:"notifyProgress",payload:{line:Ae}}),Xe&&Xe()}else _||ce||fe?Oe():Ye=!0;Ye||T(!0)},[te,B.id,q,P,t.length,_,ce,fe,Ke,St,e,Oe]),Ge=()=>{if(T(!1),k(!1),w(!1),q)St(!1);else if(!z()){const Be=P-1;D(Be),e({type:"notifyProgress",payload:{line:Be}})}T(!0)},Me=React$2.useCallback(()=>q?B&&B.type!=="conversationalDecision"&&!a.find(Be=>Be.fromId===B.id):P===t.length-1,[P,B,a,q,t.length]),De=()=>{F("click-ui"),Me()?Oe():(x(!1),gt())},Ve=()=>{F("click-ui"),x(!1),Ge()},ct=R&&!ce&&!n&&!fe,dt=React$2.useMemo(()=>P===0||z()||Q(),[P,z,Q]);useEkho({audioType:B==null?void 0:B.audioType,volume:B==null?void 0:B.audioVolume,voice:B==null?void 0:B.voice,started:v,slide:P,text:cleanTextOfHtmlTags(le==null?void 0:le.text),audio:B==null?void 0:B.audio,soundActions:h,emitEvent:e,pauseTTS:n,onStart:()=>{var Be;(Be=le==null?void 0:le.emotion)!=null&&Be.includes("think")||k(!0)},onError:()=>{w(!0)},onFinish:()=>{k(!1),ct&&gt()}}),React$2.useEffect(()=>{var Xe;let Be;return ce?()=>{}:(((B==null?void 0:B.audioType)==="none"||C)&&!((Xe=le==null?void 0:le.emotion)!=null&&Xe.includes("think"))&&(k(!0),Be=setTimeout(()=>{k(!1)},ve<minMs$1?minMs$1:ve)),()=>{Be&&clearTimeout(Be)})},[C,B,le==null?void 0:le.emotion,ve,ce]),React$2.useEffect(()=>(ct&&((B==null?void 0:B.audioType)==="none"||C)&&(!Me()||Me()&&_)&&M(gt,ve<minMs$1?minMs$1:ve),()=>{U()}),[le,M,U,gt,B==null?void 0:B.audioType,ct,C,_,t,Me,ve]),React$2.useEffect(()=>{if(fe){const{targetUid:Be}=B;e({type:"changeCamera",payload:{targetUid:Be,transition:{type:"none"}}}),gt()}},[fe,gt,e,B]),React$2.useEffect(()=>{if(q&&!E){const Be=b==null?void 0:b.line;if(Be>=0){g(!0),D(Be);return}const Xe=t.filter(Ye=>!a.find(Pe=>Pe.toId===Ye.id));if(Xe.length){const Ye=Xe[0],Pe=t.indexOf(Ye);Pe>=0&&(g(!0),D(Pe))}}},[a,q,t,E,b==null?void 0:b.line]);const rt=l({disabled:ce,repeat:!1,forward:De,rewind:dt?null:Ve});if(React$2.useEffect(()=>rt(),[rt]),ce){const Be=t[P].id?t.filter(Ye=>Ye.decision).findIndex(Ye=>Ye.id===t[P].id)+1:t.filter(Ye=>Ye.decision).findIndex(Ye=>Ye===t[P])+1,Xe={...B.payload,decisionNumber:Be,required:!q,branched:q,onAddPoints:it,onFinish:gt,keyboardControl:l,emitEvent:e,soundActions:h,inheritProps:{characters:Re,background:f,flex:ue?ue.flex:!0,slots:ue?ue.slots:[]}};return jsxRuntimeExports.jsx(DecisionComponent,{...Xe})}return jsxRuntimeExports.jsx("div",{className:"conversation--layer",children:jsxRuntimeExports.jsxs("div",{"data-testid":"conversational-pro-image",className:"conversation",style:$?{backgroundImage:`url("${$}")`}:null,children:[jsxRuntimeExports.jsx(SlotList,{...Le,ttsStarted:N}),jsxRuntimeExports.jsxs("div",{className:"conversation--body",dir:"auto",children:[le?jsxRuntimeExports.jsx(Message,{current:le,translate:ee}):null,jsxRuntimeExports.jsxs("div",{className:"conversation--controls",children:[jsxRuntimeExports.jsx("button",{"data-testid":"conversational-pro-button-back",className:`gat--btn__round ${dt?"disabled":""}`,disabled:dt?!0:"",type:"button",onClick:Ve,"aria-label":LangIsRtl()?ee("storylines.misc.forward"):ee("storylines.misc.rewind"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),jsxRuntimeExports.jsx("button",{"data-testid":"conversational-pro-button-next",className:`gat--btn__round ${R&&Me()?"glowing-animation":""}`,type:"button",onClick:De,"aria-label":LangIsRtl()?ee("storylines.misc.rewind"):ee("storylines.misc.forward"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})]})]})})}ConversationalProComponent.defaultProps={background:{},emitEvent:()=>{},soundActions:[()=>{},()=>{}]};function ConversationalComponent({emitEvent:l,soundActions:e,messages:n,characters:t,alias:a,background:o,lodSettings:d}){var g;const[f,h]=React$2.useState(0),[u]=e,p=((g=o==null?void 0:o.img)==null?void 0:g.url)||null,_=n[f],b=t.map((v,T)=>({...v,name:a[T]?a[T]:v.name,uid:T})),S=()=>{const v=n.length-1;u("click-ui"),f+1<=v?h(f+1):l({type:"success"})},E=()=>{f>0&&(h(f-1),u("click-ui"))};return jsxRuntimeExports.jsx("div",{className:"conversation--layer",children:jsxRuntimeExports.jsxs("div",{"data-testid":"conversation-component",className:"conversation arcade-conversation",style:p?{backgroundImage:`url("${p}")`}:{},children:[jsxRuntimeExports.jsx(SlotList,{characters:b,lodSettings:d,currentMessage:_,slots:b,emitEvent:l,flex:!0}),jsxRuntimeExports.jsxs("div",{className:"conversation--body",children:[_?jsxRuntimeExports.jsx(Message,{current:_,voiceOver:_.emotion===null}):jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsxs("div",{className:"conversation--controls arcade-conversation--controls",children:[jsxRuntimeExports.jsx("button",{"data-testid":"conversational-back-button",className:`gat--btn__round ${f>0?"":"visibility--hidden"}`,type:"button",onClick:E,children:jsxRuntimeExports.jsx("span",{className:"icon-back"})}),jsxRuntimeExports.jsx("button",{"data-testid":"conversational-next-button",className:"gat--btn__round",type:"button",onClick:S,children:jsxRuntimeExports.jsx("span",{className:"icon-next"})})]})]})]})})}function Vignette({vignette:l,alias:e,translate:n,backgroundImageCover:t}){var u;const o=(l.img||{url:"https://min.gamelearn.io/css-resources/gamelearn/resources/conversation.jpg"}).url,[d,f]=React$2.useState(!0),h=p=>{document.querySelector(`#${p}`).focus(),f(!d)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{"data-testid":"comic-image",className:`comic-image ${t?"comic-image--cover":""}`,children:o&&jsxRuntimeExports.jsx("img",{src:o,alt:"comic pic"})}),(u=l==null?void 0:l.textData)!=null&&u.text?jsxRuntimeExports.jsxs("div",{"data-testid":"comicCollapsable",className:`comic-collapsable ${d?"comic-collapsable--opened":""}`,children:[jsxRuntimeExports.jsx("button",{id:"buttonDown","data-testid":"buttonDown",onClick:()=>h("buttonUp"),type:"button",className:"un-btn comic-collapsable__headertoggle","aria-label":n("comic.toggleText"),children:jsxRuntimeExports.jsx("span",{className:"icon-down-arrow"})}),jsxRuntimeExports.jsxs("div",{className:"comic-collapsable__text",children:[e?jsxRuntimeExports.jsxs("b",{children:[e,": "]}):null,HTMLReactParser$1(l.textData.text)]})]}):null,jsxRuntimeExports.jsx("button",{id:"buttonUp","data-testid":"buttonUp",tabIndex:d?"-1":"0","aria-hidden":d,className:`unset-button comic-buttonup
70
70
  ${d?"":"comic-buttonup--visible"}`,type:"button",onClick:()=>h("buttonDown"),"aria-label":n("comic.toggleText"),children:jsxRuntimeExports.jsx("span",{className:"icon-up-arrow"})})]})}function Slide({slide:l,transition:e,translate:n,backgroundImageCover:t}){const a=l.transitionEffects||e;return jsxRuntimeExports.jsx("div",{className:`comic-slide__item ${a}`,"aria-label":"comic slide item",children:l.vignettes.map(o=>jsxRuntimeExports.jsx(Vignette,{vignette:o,alias:l.alias,"aria-hidden":"true",translate:n,backgroundImageCover:t},`Vignete ${o.vignetteOrder}`))})}const characterMs$2=75;function ComicComponent({slides:l,emitEvent:e,soundActions:n=[()=>{},()=>{}],autoPlay:t,autoEnd:a,pause:o,isFirstNode:d=!1,progress:f,keyboardControl:h,backgroundImageCover:u=!1}){var ne,ie,Y,q,re,ce,fe,te;const p=(f==null?void 0:f.slide)||0,_=H=>e({type:"translate",payload:H}),[b,S]=React$2.useState(!0),[E,g]=React$2.useState(!!t),[v,T]=React$2.useState(!1),{start:R,stop:x}=useTimeout(),[C,w]=React$2.useState(p),[P,D]=React$2.useState("slide-animation"),[N]=n,k=l==null?void 0:l[C],F=React$2.useCallback(()=>{S(!1),e({type:"success"})},[e]),M=React$2.useCallback(()=>{if(S(!1),T(!1),C+1<l.length&&!o){const H=C+1;D("slide-animation"),w(H),S(!0),e({type:"notifyProgress",payload:{slide:H}})}else a&&!o&&F()},[C,l.length,o,a,e,F]),U=React$2.useCallback(()=>{if(S(!1),T(!1),C-1>=0){const H=C-1;D("slide-animation"),w(H),S(!0),N("click-ui"),e({type:"notifyProgress",payload:{slide:H}})}},[N,C,e]),$=()=>{N("click-ui"),g(!1),M()},B=()=>{N("click-ui"),g(!1),U()},J=h({repeat:!1,rewind:C>0?B:null,forward:C+1>=l.length?F:$,escape:C+1>=l.length?F:null});return React$2.useEffect(()=>J(),[J]),useEkho({audioType:(ne=l==null?void 0:l[C])==null?void 0:ne.audioType,voice:(ie=l==null?void 0:l[C])==null?void 0:ie.voice,text:cleanTextOfHtmlTags((q=(Y=l==null?void 0:l[C])==null?void 0:Y.vignettes[0].textData)==null?void 0:q.text),audio:(re=l==null?void 0:l[C])==null?void 0:re.audio,slide:C,started:b,soundActions:n,emitEvent:e,pauseTTS:o,volume:(ce=l==null?void 0:l[C])!=null&&ce.audioVolume||((fe=l==null?void 0:l[C])==null?void 0:fe.audioVolume)===0?(te=l==null?void 0:l[C])==null?void 0:te.audioVolume:.5,onError:()=>{T(!0)},onFinish:()=>{E&&!(k!=null&&k.slideTimer)&&M()}}),React$2.useEffect(()=>{var H,W;if(E){if(k!=null&&k.slideTimer)R(M,k.slideTimer*1e3);else if((k==null?void 0:k.audioType)==="none"&&!o||v&&!o){const V=characterMs$2*(((W=(H=k==null?void 0:k.vignettes[0])==null?void 0:H.textData)==null?void 0:W.text.length)||0);R(M,V<1400?1400:V)}}return()=>{x()}},[v,E,M,o,k==null?void 0:k.audio,k==null?void 0:k.audioType,k==null?void 0:k.slideTimer,k==null?void 0:k.vignettes,R,x]),l!=null&&l.length?jsxRuntimeExports.jsx("div",{dir:LangIsRtl()?"rtl":"auto",className:`comic component ${d?"":"growIn-animation"}`,role:"main","aria-label":"Comic",children:jsxRuntimeExports.jsxs("div",{className:"comic-slider",role:"navigation","aria-label":"Slider",children:[l[C]&&jsxRuntimeExports.jsx(Slide,{slide:l[C],transition:P,soundActions:n,emitEvent:e,role:"complementary","aria-hidden":"true",translate:_,backgroundImageCover:u},`comic page ${l[C].slideOrder}`),C>0&&jsxRuntimeExports.jsx("button",{type:"button",className:"comic-control comic-control--left gat--btn__round","data-testid":"btn-bck",onClick:B,"aria-label":LangIsRtl()?_("comic.next"):_("comic.previous"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),C<l.length&&jsxRuntimeExports.jsx("button",{type:"button",className:`comic-control comic-control--right gat--btn__round
71
- ${E&&C+1>=l.length?"glowing-animation":""}`,"data-testid":"btn-nxt",onClick:()=>{C+1<l.length?$():(N("click-ui"),F())},"aria-label":LangIsRtl()?_("comic.previous"):_("comic.next"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})}):null}const characterMs$1=75;function CartelComponent({img:l,text:e,audio:n,audioType:t,voice:a,emitEvent:o,soundActions:d,audioVolume:f,pause:h,keyboardControl:u,backgroundImageCover:p=!1,autoEnd:_=!1}){const[b,S]=React$2.useState(!1),E=k=>o({type:"translate",payload:k}),g=(l==null?void 0:l.url)||"https://min.gamelearn.io/css-resources/gamelearn/resources/conversation.jpg",v=React$2.useRef(),T=React$2.useRef(),[R]=d,{start:x,stop:C}=useTimeout();useEkho({audioType:t,voice:a,text:e,audio:n,soundActions:d,emitEvent:o,volume:f,pauseTTS:h,onError:()=>{S(!0)},onFinish:()=>{_&&w()}});const w=React$2.useCallback(()=>{R("click-ui"),o({type:"success"})},[o,R]),P=u({repeat:!1,forward:w,escape:w});React$2.useEffect(()=>P(),[P]);const D=(k,F)=>window.matchMedia("(min-width: 1280px)").matches?F:k,N=React$2.useCallback(()=>{if(p!==!0&&e&&T.current){const k=T.current.naturalWidth/T.current.naturalHeight;let F=T.current.height*k,M=T.current.height;if(F>T.current.width&&(F=T.current.width,M=T.current.width/k),v.current.style.width=`${F}px`,window.innerHeight<T.current.width)v.current.style.bottom=`${D(24,48)+D(36,100)}px`;else{const U=(window.innerHeight-M)/2+D(36,100);v.current.style.bottom=`${U}px`}}},[p,e]);return React$2.useEffect(()=>{T.current&&new ResizeObserver(()=>{D(24,48),N()}).observe(T.current)},[N]),React$2.useEffect(()=>{if(_&&!h&&(!n||b)){const k=characterMs$1*(e.length||0);x(()=>{w()},k<2400?2400:k)}return()=>{C()}},[n,b,_,w,h,x,C,e]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`cartel ${p?"cartel--cover":""}`,children:jsxRuntimeExports.jsxs("div",{className:"cartel__imagewrap",children:[jsxRuntimeExports.jsx("img",{ref:T,onLoad:N,className:"cartel__image",src:g,alt:"cartel pic"}),e?jsxRuntimeExports.jsx("div",{ref:v,className:"cartel__textwrap",children:jsxRuntimeExports.jsx("div",{className:"cartel__text",children:jsxRuntimeExports.jsx("span",{children:e})})}):null]})}),jsxRuntimeExports.jsx("div",{className:"position--absolute center right",children:jsxRuntimeExports.jsx("button",{"data-testid":"cartel-close-button",type:"button",className:"gat--btn__round",onClick:()=>w(),"aria-label":E("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})})]})}var Typist$1={exports:{}};(function(l){l.exports=function(e){var n={};function t(a){if(n[a])return n[a].exports;var o=n[a]={exports:{},id:a,loaded:!1};return e[a].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}return t.m=e,t.c=n,t.p="",t(0)}([function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0});var a=Object.assign||function(k){for(var F=1;F<arguments.length;F++){var M=arguments[F];for(var U in M)Object.prototype.hasOwnProperty.call(M,U)&&(k[U]=M[U])}return k},o=function(){function k(F,M){for(var U=0;U<M.length;U++){var $=M[U];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(F,$.key,$)}}return function(F,M,U){return M&&k(F.prototype,M),U&&k(F,U),F}}(),d=t(1),f=x(d),h=t(2),u=x(h),p=t(10),_=x(p),b=t(12),S=x(b),E=t(13),g=x(E),v=t(14),T=R(v);function R(k){if(k&&k.__esModule)return k;var F={};if(k!=null)for(var M in k)Object.prototype.hasOwnProperty.call(k,M)&&(F[M]=k[M]);return F.default=k,F}function x(k){return k&&k.__esModule?k:{default:k}}function C(k,F){if(!(k instanceof F))throw new TypeError("Cannot call a class as a function")}function w(k,F){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return F&&(typeof F=="object"||typeof F=="function")?F:k}function P(k,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof F);k.prototype=Object.create(F&&F.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),F&&(Object.setPrototypeOf?Object.setPrototypeOf(k,F):k.__proto__=F)}var D=["🔙","⏰"],N=function(k){P(F,k);function F(M){C(this,F);var U=w(this,(F.__proto__||Object.getPrototypeOf(F)).call(this,M));return U.state={textLines:[],isDone:!1},U.onTypingDone=function(){U.mounted&&(U.setState({isDone:!0}),U.props.onTypingDone())},U.delayGenerator=function($,B,J,ne){var ie=U.props.avgTypingDelay,Y=U.props.stdTypingDelay;return U.props.delayGenerator(ie,Y,{line:$,lineIdx:B,character:J,charIdx:ne,defDelayGenerator:function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ie,ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Y;return T.gaussianRnd(re,ce)}})},U.typeLine=function($,B){if(!U.mounted)return Promise.resolve();var J=$,ne=U.props.onLineTyped;return T.isBackspaceElement($)?($.props.delay>0&&(U.introducedDelay=$.props.delay),J="🔙".repeat($.props.count)):T.isDelayElement($)&&(U.introducedDelay=$.props.ms,J="⏰"),new Promise(function(ie,Y){U.setState({textLines:U.state.textLines.concat([""])},function(){T.eachPromise(J,U.typeCharacter,J,B).then(function(){return ne(J,B)}).then(ie).catch(Y)})})},U.typeCharacter=function($,B,J,ne){if(!U.mounted)return Promise.resolve();var ie=U.props.onCharacterTyped;return new Promise(function(Y){var q=U.state.textLines.slice();T.sleep(U.introducedDelay).then(function(){U.introducedDelay=null;var re=$==="🔙",ce=$==="⏰";if(ce){Y();return}if(re&&ne>0){for(var fe=ne-1,te=q[fe],H=fe;H>=0&&!(te.length>0&&!D.includes(te[0]));H--)fe=H,te=q[fe];q[fe]=te.substr(0,te.length-1)}else q[ne]+=$;U.setState({textLines:q},function(){var W=U.delayGenerator(J,ne,$,B);ie($,B),setTimeout(Y,W)})})})},U.mounted=!1,U.linesToType=[],U.introducedDelay=null,M.children&&(U.linesToType=T.extractTextFromElement(M.children)),U}return o(F,[{key:"componentDidMount",value:function(){this.mounted=!0;var U=this.props,$=U.children,B=U.startDelay;$?B>0&&typeof window<"u"?setTimeout(this.typeAllLines.bind(this),B):this.typeAllLines():this.onTypingDone()}},{key:"shouldComponentUpdate",value:function(U,$){if($.textLines.length!==this.state.textLines.length)return!0;for(var B=0;B<$.textLines.length;B++){var J=this.state.textLines[B],ne=$.textLines[B];if(J!==ne)return!0}return this.state.isDone!==$.isDone}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"typeAllLines",value:function(){var U=this,$=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.linesToType;return T.eachPromise($,this.typeLine).then(function(){return U.onTypingDone()})}},{key:"render",value:function(){var U=this.props,$=U.className,B=U.cursor,J=this.state.isDone,ne=T.cloneElementWithSpecifiedText({element:this.props.children,textLines:this.state.textLines});return f.default.createElement("div",{className:"Typist "+$},ne,f.default.createElement(_.default,a({isDone:J},B)))}}]),F}(d.Component);N.propTypes={children:u.default.node,className:u.default.string,avgTypingDelay:u.default.number,stdTypingDelay:u.default.number,startDelay:u.default.number,cursor:u.default.object,onCharacterTyped:u.default.func,onLineTyped:u.default.func,onTypingDone:u.default.func,delayGenerator:u.default.func},N.defaultProps={className:"",avgTypingDelay:70,stdTypingDelay:25,startDelay:0,cursor:{},onCharacterTyped:function(){},onLineTyped:function(){},onTypingDone:function(){},delayGenerator:T.gaussianRnd},n.default=N,N.Backspace=S.default,N.Delay=g.default},function(e,n){e.exports=React$2},function(e,n,t){if(process.env.NODE_ENV!=="production"){var a=typeof Symbol=="function"&&Symbol.for&&Symbol.for("react.element")||60103,o=function(f){return typeof f=="object"&&f!==null&&f.$$typeof===a},d=!0;e.exports=t(3)(o,d)}else e.exports=t(9)()},function(e,n,t){var a=t(4),o=t(5),d=t(6),f=t(7),h=t(8);e.exports=function(u,p){var _=typeof Symbol=="function"&&Symbol.iterator,b="@@iterator";function S(q){var re=q&&(_&&q[_]||q[b]);if(typeof re=="function")return re}var E="<<anonymous>>",g={array:x("array"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:C(),arrayOf:w,element:P(),instanceOf:D,node:M(),objectOf:k,oneOf:N,oneOfType:F,shape:U};function v(q,re){return q===re?q!==0||1/q===1/re:q!==q&&re!==re}function T(q){this.message=q,this.stack=""}T.prototype=Error.prototype;function R(q){if(process.env.NODE_ENV!=="production")var re={},ce=0;function fe(H,W,V,z,Q,ee,le){if(z=z||E,ee=ee||V,le!==f){if(p)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ue=z+":"+V;!re[ue]&&ce<3&&(d(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",ee,z),re[ue]=!0,ce++)}}return W[V]==null?H?W[V]===null?new T("The "+Q+" `"+ee+"` is marked as required "+("in `"+z+"`, but its value is `null`.")):new T("The "+Q+" `"+ee+"` is marked as required in "+("`"+z+"`, but its value is `undefined`.")):null:q(W,V,z,Q,ee)}var te=fe.bind(null,!1);return te.isRequired=fe.bind(null,!0),te}function x(q){function re(ce,fe,te,H,W,V){var z=ce[fe],Q=J(z);if(Q!==q){var ee=ne(z);return new T("Invalid "+H+" `"+W+"` of type "+("`"+ee+"` supplied to `"+te+"`, expected ")+("`"+q+"`."))}return null}return R(re)}function C(){return R(a.thatReturnsNull)}function w(q){function re(ce,fe,te,H,W){if(typeof q!="function")return new T("Property `"+W+"` of component `"+te+"` has invalid PropType notation inside arrayOf.");var V=ce[fe];if(!Array.isArray(V)){var z=J(V);return new T("Invalid "+H+" `"+W+"` of type "+("`"+z+"` supplied to `"+te+"`, expected an array."))}for(var Q=0;Q<V.length;Q++){var ee=q(V,Q,te,H,W+"["+Q+"]",f);if(ee instanceof Error)return ee}return null}return R(re)}function P(){function q(re,ce,fe,te,H){var W=re[ce];if(!u(W)){var V=J(W);return new T("Invalid "+te+" `"+H+"` of type "+("`"+V+"` supplied to `"+fe+"`, expected a single ReactElement."))}return null}return R(q)}function D(q){function re(ce,fe,te,H,W){if(!(ce[fe]instanceof q)){var V=q.name||E,z=Y(ce[fe]);return new T("Invalid "+H+" `"+W+"` of type "+("`"+z+"` supplied to `"+te+"`, expected ")+("instance of `"+V+"`."))}return null}return R(re)}function N(q){if(!Array.isArray(q))return process.env.NODE_ENV!=="production"&&d(!1,"Invalid argument supplied to oneOf, expected an instance of array."),a.thatReturnsNull;function re(ce,fe,te,H,W){for(var V=ce[fe],z=0;z<q.length;z++)if(v(V,q[z]))return null;var Q=JSON.stringify(q);return new T("Invalid "+H+" `"+W+"` of value `"+V+"` "+("supplied to `"+te+"`, expected one of "+Q+"."))}return R(re)}function k(q){function re(ce,fe,te,H,W){if(typeof q!="function")return new T("Property `"+W+"` of component `"+te+"` has invalid PropType notation inside objectOf.");var V=ce[fe],z=J(V);if(z!=="object")return new T("Invalid "+H+" `"+W+"` of type "+("`"+z+"` supplied to `"+te+"`, expected an object."));for(var Q in V)if(V.hasOwnProperty(Q)){var ee=q(V,Q,te,H,W+"."+Q,f);if(ee instanceof Error)return ee}return null}return R(re)}function F(q){if(!Array.isArray(q))return process.env.NODE_ENV!=="production"&&d(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),a.thatReturnsNull;for(var re=0;re<q.length;re++){var ce=q[re];if(typeof ce!="function")return d(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",ie(ce),re),a.thatReturnsNull}function fe(te,H,W,V,z){for(var Q=0;Q<q.length;Q++){var ee=q[Q];if(ee(te,H,W,V,z,f)==null)return null}return new T("Invalid "+V+" `"+z+"` supplied to "+("`"+W+"`."))}return R(fe)}function M(){function q(re,ce,fe,te,H){return $(re[ce])?null:new T("Invalid "+te+" `"+H+"` supplied to "+("`"+fe+"`, expected a ReactNode."))}return R(q)}function U(q){function re(ce,fe,te,H,W){var V=ce[fe],z=J(V);if(z!=="object")return new T("Invalid "+H+" `"+W+"` of type `"+z+"` "+("supplied to `"+te+"`, expected `object`."));for(var Q in q){var ee=q[Q];if(ee){var le=ee(V,Q,te,H,W+"."+Q,f);if(le)return le}}return null}return R(re)}function $(q){switch(typeof q){case"number":case"string":case"undefined":return!0;case"boolean":return!q;case"object":if(Array.isArray(q))return q.every($);if(q===null||u(q))return!0;var re=S(q);if(re){var ce=re.call(q),fe;if(re!==q.entries){for(;!(fe=ce.next()).done;)if(!$(fe.value))return!1}else for(;!(fe=ce.next()).done;){var te=fe.value;if(te&&!$(te[1]))return!1}}else return!1;return!0;default:return!1}}function B(q,re){return q==="symbol"||re["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&re instanceof Symbol}function J(q){var re=typeof q;return Array.isArray(q)?"array":q instanceof RegExp?"object":B(re,q)?"symbol":re}function ne(q){if(typeof q>"u"||q===null)return""+q;var re=J(q);if(re==="object"){if(q instanceof Date)return"date";if(q instanceof RegExp)return"regexp"}return re}function ie(q){var re=ne(q);switch(re){case"array":case"object":return"an "+re;case"boolean":case"date":case"regexp":return"a "+re;default:return re}}function Y(q){return!q.constructor||!q.constructor.name?E:q.constructor.name}return g.checkPropTypes=h,g.PropTypes=g,g}},function(e,n){function t(o){return function(){return o}}var a=function(){};a.thatReturns=t,a.thatReturnsFalse=t(!1),a.thatReturnsTrue=t(!0),a.thatReturnsNull=t(null),a.thatReturnsThis=function(){return this},a.thatReturnsArgument=function(o){return o},e.exports=a},function(e,n){var t=function(d){};process.env.NODE_ENV!=="production"&&(t=function(d){if(d===void 0)throw new Error("invariant requires an error message argument")});function a(o,d,f,h,u,p,_,b){if(t(d),!o){var S;if(d===void 0)S=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var E=[f,h,u,p,_,b],g=0;S=new Error(d.replace(/%s/g,function(){return E[g++]})),S.name="Invariant Violation"}throw S.framesToPop=1,S}}e.exports=a},function(e,n,t){var a=t(4),o=a;process.env.NODE_ENV!=="production"&&function(){var d=function(h){for(var u=arguments.length,p=Array(u>1?u-1:0),_=1;_<u;_++)p[_-1]=arguments[_];var b=0,S="Warning: "+h.replace(/%s/g,function(){return p[b++]});typeof console<"u"&&console.error(S);try{throw new Error(S)}catch{}};o=function(h,u){if(u===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(u.indexOf("Failed Composite propType: ")!==0&&!h){for(var p=arguments.length,_=Array(p>2?p-2:0),b=2;b<p;b++)_[b-2]=arguments[b];d.apply(void 0,[u].concat(_))}}}(),e.exports=o},function(e,n){var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=t},function(e,n,t){if(process.env.NODE_ENV!=="production")var a=t(5),o=t(6),d=t(7),f={};function h(u,p,_,b,S){if(process.env.NODE_ENV!=="production"){for(var E in u)if(u.hasOwnProperty(E)){var g;try{a(typeof u[E]=="function","%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",b||"React class",_,E),g=u[E](p,E,b,_,null,d)}catch(T){g=T}if(o(!g||g instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",b||"React class",_,E,typeof g),g instanceof Error&&!(g.message in f)){f[g.message]=!0;var v=S?S():"";o(!1,"Failed %s type: %s%s",_,g.message,v??"")}}}}e.exports=h},function(e,n,t){var a=t(4),o=t(5),d=t(7);e.exports=function(){function f(p,_,b,S,E,g){g!==d&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}f.isRequired=f;function h(){return f}var u={array:f,bool:f,func:f,number:f,object:f,string:f,symbol:f,any:f,arrayOf:h,element:f,instanceOf:h,node:f,objectOf:h,oneOf:h,oneOfType:h,shape:h};return u.checkPropTypes=a,u.PropTypes=u,u}},function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function E(g,v){for(var T=0;T<v.length;T++){var R=v[T];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(g,R.key,R)}}return function(g,v,T){return v&&E(g.prototype,v),T&&E(g,T),g}}(),o=t(1),d=u(o),f=t(2),h=u(f);t(11);function u(E){return E&&E.__esModule?E:{default:E}}function p(E,g){if(!(E instanceof g))throw new TypeError("Cannot call a class as a function")}function _(E,g){if(!E)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g&&(typeof g=="object"||typeof g=="function")?g:E}function b(E,g){if(typeof g!="function"&&g!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof g);E.prototype=Object.create(g&&g.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),g&&(Object.setPrototypeOf?Object.setPrototypeOf(E,g):E.__proto__=g)}var S=function(E){b(g,E);function g(v){p(this,g);var T=_(this,(g.__proto__||Object.getPrototypeOf(g)).call(this,v));return T._isReRenderingCursor=!1,T.state={shouldRender:T.props.show},T}return a(g,[{key:"componentWillReceiveProps",value:function(T){var R=this,x=!this.props.isDone&&T.isDone&&this.props.hideWhenDone;x&&setTimeout(function(){return R.setState({shouldRender:!1})},this.props.hideWhenDoneDelay)}},{key:"componentDidUpdate",value:function(){var T=this.props,R=T.show,x=T.isDone;R&&(x||this._isReRenderingCursor||this._reRenderCursor())}},{key:"_reRenderCursor",value:function(){var T=this;this._isReRenderingCursor=!0,this.setState({shouldRender:!1},function(){T.setState({shouldRender:!0},function(){T._isReRenderingCursor=!1})})}},{key:"render",value:function(){if(this.state.shouldRender){var T=this.props.blink?" Cursor--blinking":"";return d.default.createElement("span",{className:"Cursor"+T},this.props.element)}return null}}]),g}(o.Component);S.propTypes={blink:h.default.bool,show:h.default.bool,element:h.default.node,hideWhenDone:h.default.bool,hideWhenDoneDelay:h.default.number,isDone:h.default.bool},S.defaultProps={blink:!0,show:!0,element:"|",hideWhenDone:!1,hideWhenDoneDelay:1e3,isDone:!1},n.default=S},function(e,n){},function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0});var a=t(1),o=h(a),d=t(2),f=h(d);function h(p){return p&&p.__esModule?p:{default:p}}var u=function(){return o.default.createElement("noscript",null)};u.componentName="Backspace",u.propTypes={count:f.default.number,delay:f.default.number},u.defaultProps={count:1,delay:0},n.default=u},function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0});var a=t(1),o=h(a),d=t(2),f=h(d);function h(p){return p&&p.__esModule?p:{default:p}}var u=function(){return o.default.createElement("noscript",null)};u.componentName="Delay",u.propTypes={ms:f.default.number.isRequired},n.default=u},function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.sleep=void 0;var a=function(){function R(x,C){var w=[],P=!0,D=!1,N=void 0;try{for(var k=x[Symbol.iterator](),F;!(P=(F=k.next()).done)&&(w.push(F.value),!(C&&w.length===C));P=!0);}catch(M){D=!0,N=M}finally{try{!P&&k.return&&k.return()}finally{if(D)throw N}}return w}return function(x,C){if(Array.isArray(x))return x;if(Symbol.iterator in Object(x))return R(x,C);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();n.gaussianRnd=u,n.eachPromise=p,n.exclude=_,n.isBackspaceElement=b,n.isDelayElement=S,n.extractTextFromElement=E,n.cloneElement=g,n.cloneElementWithSpecifiedText=T;var o=t(1),d=f(o);function f(R){return R&&R.__esModule?R:{default:R}}function h(R){if(Array.isArray(R)){for(var x=0,C=Array(R.length);x<R.length;x++)C[x]=R[x];return C}else return Array.from(R)}n.sleep=function(x){return new Promise(function(C){return x!=null?setTimeout(C,x):C()})};function u(R,x){for(var C=12,w=0,P=0;P<C;P++)w+=Math.random();return w-=C/2,Math.round(w*x)+R}function p(R,x){for(var C=arguments.length,w=Array(C>2?C-2:0),P=2;P<C;P++)w[P-2]=arguments[P];var D=function(k,F,M){return k.then(function(){return x.apply(void 0,[F,M].concat(w))})};return Array.from(R).reduce(D,Promise.resolve())}function _(R,x){var C={};for(var w in R)x.indexOf(w)===-1&&(C[w]=R[w]);return C}function b(R){return R&&R.type&&R.type.componentName==="Backspace"}function S(R){return R&&R.type&&R.type.componentName==="Delay"}function E(R){for(var x=R?[R]:[],C=[];x.length>0;){var w=x.pop();if(d.default.isValidElement(w))b(w)||S(w)?C.unshift(w):d.default.Children.forEach(w.props.children,function(U){x.push(U)});else if(Array.isArray(w)){var P=!0,D=!1,N=void 0;try{for(var k=w[Symbol.iterator](),F;!(P=(F=k.next()).done);P=!0){var M=F.value;x.push(M)}}catch(U){D=!0,N=U}finally{try{!P&&k.return&&k.return()}finally{if(D)throw N}}}else C.unshift(w)}return C}function g(R,x){var C=R.type,w=_(R.props,["children"]),P=new Date().getUTCMilliseconds(),D=P+Math.random()+Math.random();return w.key="Typist-element-"+C+"-"+D,d.default.createElement.apply(d.default,[C,w].concat(h(x)))}function v(R,x,C){if(C>=x.length)return[null,C];var w=C,P=function(M){var U=v(M,x,w),$=a(U,2),B=$[0],J=$[1];return w=J,B},D=d.default.isValidElement(R)&&!(b(R)||S(R));if(D){var N=d.default.Children.map(R.props.children,P)||[];return[g(R,N),w]}if(Array.isArray(R)){var k=R.map(P);return[k,w]}return[x[w],w+1]}function T(R){var x=R.element,C=R.textLines;if(x)return v(x,C,0)[0]}}])})(Typist$1);var TypistExports=Typist$1.exports;const Typist=getDefaultExportFromCjs(TypistExports),languages={js:["var rows = prompt('How many rows for your multiplication table?');","var cols = prompt('How many columns for your multiplication table?');"," ","if(rows == '' || rows == null)"," rows = 10;"," ","if(cols== '' || cols== null)"," cols = 10;"," ","createTable(rows, cols);"," ","function createTable(rows, cols)","{"," var j=1;"," var output = '<table border='1' width='500' cellspacing='0'cellpadding='5'>';"," "," for(i=1;i<=rows;i++)"," {"," output = output + '<tr>';"," while(j<=cols)"," {"," output = output + '<td>' + i*j + '</td>';"," j = j+1;"," }"," output = output + '</tr>';"," j = 1;"," }"," "," output = output + '</table>';"," document.write(output);","}"],lua:["-- Ensure that that the element at i is in the right position,","-- and return a closure which can be used for continuing the sort."," ","function quicksorter(i, vec, low, high)"," if low >= high then"," return quicksorter"," else -- low < high"," -- partition the vector and initialize the child closures"," local middle = partition(vec, low, high)"," local left, right = quicksorter"," ","-- Create the promise"," local function self(i, vec, low, high)"," if i < middle then"," left = left(i, vec, low, middle-1)"," return self"," elseif i > middle then"," right = right(i, vec, middle+1, high)"," return self"," end"," end"," ","-- Force the promise until i is in the right position"," return self(i, vec, low, high)"," end","end"," ","function lazysort(vec, low, high)"," local sorter = quicksorter"," return function(i)"," sorter = sorter(i, vec, low, high)"," return vec[i]"," end","end"],python:["#ask the user to enter four pieces of information"," ","firstname = input('Enter your first name: ')","surname = input('Enter your surname: ')","email = input('Enter your email: ')","yearsteaching = input('Enter the number of years teaching: ')"," ","file = open('staff.csv','r') #opens the file in read mode","found=False #sets whether the user is found to False"," ","for line in file: #reads each line in the file"," staff = line.split(',') #splits the line into the list called staff"," if staff[2] == email: #checks if the email entered is in the list"," found=True #if it is changes found to True"," ","file.close() #closes the file"," ","if found==True: #after the loop checks if the user is found"," print('Staff member already exists in the file') #displays on screen","else:"," #if the email was not in the file"," writefile=open('staff.csv','a') #open the file in append mode"," writefile.write(firstname + ',' + surname + ',' + email + ',' + yearsteaching) #write the new information to the file"," writefile.close() #close the file"," print('Staff member added to file')"]},themes={theme1:{bg:1,color:1,typo:2},theme2:{bg:3,color:2,typo:3},theme3:{bg:5,color:4,typo:1},theme4:{bg:1,color:3,typo:2},theme5:{bg:2,color:5,typo:1},theme6:{bg:5,color:6,typo:2},theme7:{bg:1,color:7,typo:3}};function ProgressBar({progress:l,type:e}){const n=languages[e];if(n){const t=n.reduce((d,f)=>(d.length?d.length:d)+f.length),a=Math.floor(l*100/t),o=a===100?"puzzle--hacker__percentage percentage--label":"puzzle--hacker__percentage";return jsxRuntimeExports.jsx("div",{className:"puzzle--hacker__progress",children:jsxRuntimeExports.jsx("span",{className:"puzzle--hacker__progress--item",style:{width:`${Math.floor(l*100/t)}%`},children:jsxRuntimeExports.jsxs("span",{className:o,children:[a,"%"]})})})}return null}function Code({codeContainer:l}){const e=l,n=e.split("<br>");return n.length>0?n.map((t,a)=>{const o=t.replace(/ /g," ");return jsxRuntimeExports.jsx("p",{children:o},`line_${0+a}`)}):jsxRuntimeExports.jsx("p",{children:e})}function HackerPuzzleComponent({emitEvent:l,soundActions:e,info:n,themeNumber:t,type:a,writingSpeed:o,disableExit:d,setResolveAction:f}){const h=B=>l({type:"translate",payload:B}),[u]=e,{solution:p}=n,b=themes[`theme${t||1}`],[S,E]=React$2.useState(""),[g,v]=React$2.useState(0),[T,R]=React$2.useState(0),[x,C]=React$2.useState(!1),[w,P]=React$2.useState({start:0,end:0}),D=React$2.useRef(),N=React$2.useRef(),k=h("puzzle.hacker.congratulations"),F=(B,J)=>B>J.length?J.length:B,M=()=>{u("click-ui");const{rewards:B}=p.right;l({type:"addPoints",complex:!0,finish:!0,payload:B}),l({type:"passPuzzle"})};React$2.useEffect(()=>{D.current.focus(),x&&d(!0)},[x]),React$2.useEffect(()=>{f(B=>{u("score"),C(!0),l({type:"hidePuzzleButtons",payload:!1}),B()})},[f]);const U=()=>{if(languages[a]&&!x){N.current&&(N.current.scrollTop=D.current.scrollHeight);const B=languages[a],J=B[g],ne=B.reduce((Y,q)=>(Y.length?Y.length:Y)+q.length),ie=o>0?o:Math.floor(ne/50)+g;if(J){const Y=J.split(""),q=F(w.end,Y),re=Y.slice(w.start,q),ce=S+re.join("");R(T+re.join("").length),E(ce),q===Y.length?g+1>=B.length?(u("score"),C(!0)):(v(g+1),E(`${S+re.join("")}<br>`),P({start:0,end:F(ie,Y)})):P({start:q,end:F(q+ie,Y)})}}},$=B=>{B.preventDefault(),U()};return jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,"data-testid":"hacker",ref:D,onKeyDown:$,onTouchStart:$,className:`puzzle--hacker__container background-hacker-${b.bg}`,children:[jsxRuntimeExports.jsx("div",{className:"puzzle--hacker__header",children:jsxRuntimeExports.jsx("span",{className:"title",children:"Console"})}),jsxRuntimeExports.jsxs("div",{className:`puzzle--hacker__body color-hacker-${b.color} typography-hacker-${b.typo}`,children:[jsxRuntimeExports.jsxs("div",{className:"puzzle--hacker__code",ref:N,children:[jsxRuntimeExports.jsx(Code,{codeContainer:S}),x?jsxRuntimeExports.jsxs(Typist,{avgTypingDelay:110,onCharacterTyped:()=>{N.current&&(N.current.scrollTop=D.current.scrollHeight)},cursor:{hideWhenDone:!0},className:"puzzle--hacker__result",children:[jsxRuntimeExports.jsx(Typist.Delay,{ms:300}),p.right.desc?`// ${p.right.desc}`:`${k}`]}):null]}),jsxRuntimeExports.jsx(ProgressBar,{type:a,progress:T})]}),x?jsxRuntimeExports.jsx("div",{className:"position--absolute bottom center",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary gat--btn__cracker",onClick:M,children:h("screens.continue")})}):null]})}HackerPuzzleComponent.defaultProps={type:"",writingSpeed:0,context:{},info:{},themeNumber:1};const imagenPorDefecto="https://min.gamelearn.io/css-resources/gamelearn/resources/puzzle-login-low.png";function LoginPuzzleComponent({emitEvent:l,soundActions:e,info:n,user:t,login:a,password:o,image:d,setResolveAction:f,nodeId:h}){var q;const u=re=>l({type:"translate",payload:re}),p=`login-puzzle_${h}`,_=LangIsRtl(),[b,S]=React$2.useState(""),[E,g]=React$2.useState(""),[v,T]=React$2.useState(!1),[R,x]=React$2.useState(""),[C,w]=React$2.useState(""),[P,D]=React$2.useState(!1),[N,k]=React$2.useState(!1),[F,M]=React$2.useState(!1),[U]=e,[$,B]=React$2.useState([]),J=((q=d.img)==null?void 0:q.url)||imagenPorDefecto,ne=()=>{const{rewards:re}=n.solution.right,ce=[...$,...re];l({type:"addPoints",complex:!0,finish:!0,payload:ce}),l({type:"passPuzzle"})},ie=()=>{U("click-ui");const re={login:!0,password:!1};a&&(re.login=t===b),re.password=o===E,re.login&&re.password?(w("success"),D(!0),k(!1),U("score"),setTimeout(()=>{ne()},2e3)):(B([...$,...n.solution.wrong.rewards]),U("fail"),w("failed"),k(!0),l({type:"failPuzzle"}))},Y=re=>{let ce="";if(re.length>=0){for(let fe=0;fe<re.length;fe+=1)ce+="•";x(ce)}};return React$2.useEffect(()=>{f(()=>{const re=[...$,...n.resolve.rewards];M(!0),setTimeout(()=>{l({type:"hidePuzzleButtons",payload:!1}),l({type:"puzzleAction",action:"resolve",payload:{element:p,rewards:re,finish:!0}})},2e3)})},[$,n.resolve.rewards,l,f,p]),jsxRuntimeExports.jsx("div",{className:"puzzle--layer",style:{backgroundImage:`url("${J}")`},children:jsxRuntimeExports.jsxs("div",{className:`puzzle--login ${t?"puzzle--login--withuser":""}`,children:[jsxRuntimeExports.jsx("span",{className:"icon-login-puzzle",children:" "}),jsxRuntimeExports.jsx("span",{className:"puzzle--login__title",children:u("puzzle.initSession")}),jsxRuntimeExports.jsxs("div",{children:[a&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--login__label",children:u("puzzle.user")}),jsxRuntimeExports.jsxs("div",{dir:"auto",className:"puzzle--login__group",children:[F?jsxRuntimeExports.jsx("input",{dir:_?"rtl":"auto",disabled:P,"data-testid":"username",className:"puzzle--login__input success",type:"text",placeholder:t,value:t}):jsxRuntimeExports.jsx("input",{dir:_?"rtl":"auto",disabled:P,"data-testid":"username",className:`puzzle--login__input ${C}`,type:"text",placeholder:u("puzzle.user"),onChange:re=>{S(re.target.value),w(""),k(!1)}}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check",children:" "})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--login__label",children:jsxRuntimeExports.jsx("span",{children:u("puzzle.password")})}),jsxRuntimeExports.jsxs("div",{dir:"auto",className:"puzzle--login__group",children:[F?jsxRuntimeExports.jsx("input",{dir:_?"rtl":"auto",disabled:!0,"data-testid":"password",className:"puzzle--login__input puzzle--login__input--fakepassword success",type:"text",placeholder:o,value:o,style:{opacity:1}}):jsxRuntimeExports.jsx("input",{dir:_?"rtl":"auto",disabled:P,"data-testid":"password",className:`puzzle--login__input puzzle--login__input--fakepassword ${C}`,type:"text",placeholder:u("puzzle.password"),onFocus:()=>{T(!0)},onBlur:()=>{T(!1)},onChange:re=>{g(re.target.value),Y(re.target.value),w(""),k(!1)}}),F?null:jsxRuntimeExports.jsx("div",{dir:_?"rtl":"auto",className:`login-fakepassword${v?" login-fakepassword--focus":""}${R.length?" login-fakepassword--fill":""} ${C||""}`,children:E?R:u("puzzle.password")}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check",children:" "})]})]})]}),jsxRuntimeExports.jsx("button",{type:"button",className:`gat--btn gat--btn__primary ${E.length!==0&&!P?"":"disabled"}`,onClick:ie,children:u("puzzle.loginIn")}),!F&&N&&n.solution.wrong.desc!==""&&jsxRuntimeExports.jsx("div",{className:"puzzle--login__label--error",children:n.solution.wrong.desc})]})})}function FeedbackComponent$1({text:l,success:e,playSound:n,additionalStyle:t,functionOnClose:a,secondText:o,translate:d,shortText:f,hasTimeout:h,delay:u,timeExpired:p,keyboardControl:_}){const[b,S]=React$2.useState();React$2.useEffect(()=>{let T;return n&&n(e?"score":"fail"),l&&!f&&(T=setTimeout(()=>{S(!0)},1e3)),()=>{T&&clearTimeout(T)}},[n,e,f,l]),React$2.useEffect(()=>{let T;return h&&a&&(T=setTimeout(a,u)),()=>{T&&clearTimeout(T)}},[u,a,h]);const E=()=>e?"success":"failed",g=()=>e?"icon-correct-thumb":p?"icon-times-up":"icon-incorrect-thumb",v=_({disabled:!(l&&a&&b),repeat:!1,forward:a,close:a});return React$2.useEffect(()=>v(),[v]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{"data-testid":"feedback-layer",className:`feedback-layer ${b?"feedback-layer--withexplain":""}`,children:[jsxRuntimeExports.jsxs("div",{className:`feedback-layer__header ${f?"feedback-layer__header--in-shortText":""} ${t||""} ${E()}`,children:[o&&jsxRuntimeExports.jsxs("span",{className:"puzzle--terminal__visor--file",children:[jsxRuntimeExports.jsx("span",{className:`puzzle--terminal__icon ${t||""}`}),jsxRuntimeExports.jsx("span",{children:o})]}),jsxRuntimeExports.jsx("span",{className:"feedback-layer__maintitle",children:!l||!f?jsxRuntimeExports.jsx("div",{title:d(`tooltip.${e?"correct":"incorrect"}`),className:`${g()}`}):l}),f&&jsxRuntimeExports.jsx("button",{type:"button",className:"feedback-layer__closeX",onClick:()=>a(),"aria-label":d("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})]}),!f&&l!==""&&jsxRuntimeExports.jsx("div",{className:"feedback-layer__explainwrap",children:jsxRuntimeExports.jsxs("div",{className:"feedback-layer__explain",children:[jsxRuntimeExports.jsx("div",{dir:"auto",children:HTMLReactParser$1(l)}),l&&a&&b&&jsxRuntimeExports.jsx("button",{type:"button","data-testid":"close-feedback",className:"gat--btn__navigation",onClick:()=>a(),"aria-label":d("storylines.misc.closePiece"),style:{display:"flex",margin:"auto",marginTop:"24px"},children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})})]})})}FeedbackComponent$1.defaultProps={text:"",hasTimeout:!1,delay:3e3,success:!1};function KeyboardPuzzleComponent({emitEvent:l,image:e,password:n,keyboard:t,info:a,disableExit:o,soundActions:d,setResolveAction:f,nodeId:h,keyboardControl:u,styles:p="default-theme"}){var ie,Y;const[_,b]=React$2.useState(""),[S,E]=React$2.useState(""),[g,v]=React$2.useState(!1),[T,R]=React$2.useState(""),[x,C]=React$2.useState(!1),[w,P]=React$2.useState([]),D=q=>l({type:"translate",payload:q}),N=`keyboard-puzzle_${h}`,[k]=d,F=React$2.useCallback(q=>{v(!1),C(!1),l({type:"hidePuzzleButtons",payload:!1}),l({type:"addPoints",complex:!0,finish:!0,payload:q})},[l]),M=()=>{if(g){const{rewards:q}=a.solution.right,re=[...w,...q];k("score"),F(re)}else l({type:"hidePuzzleButtons",payload:!1}),v(!1),o(!1),C(!1);R("")},U=q=>{q===n?(o(!1),b("success"),k("score"),l({type:"passPuzzle"}),v(!0),C(!0),a.solution.right.desc?R(a.solution.right.desc):setTimeout(()=>{const{rewards:re}=a.solution.right,ce=[...w,...re];F(ce)},3e3)):(C(!0),b("failed"),k("fail"),l({type:"failPuzzle"}),v(!1),P([...w,...a.solution.wrong.rewards]),l({type:"hidePuzzleButtons",payload:!1}),b(""),E(""),C(!0),a.solution.wrong.desc?R(a.solution.wrong.desc):setTimeout(()=>{M()},3e3))};React$2.useEffect(()=>{f(()=>{o(!1),k("score"),b("success"),v(!0),R(a.solution.right.desc),E(n);const q=[...w,...a.resolve.rewards];setTimeout(()=>{v(!1),C(!1),l({type:"hidePuzzleButtons",payload:!1}),l({type:"puzzleAction",action:"resolve",payload:{element:N,rewards:q,finish:!0}})},2e3)})},[f,o,a.solution.right.desc,k,a.resolve.rewards,w,n,l,N]);const $=(q,re)=>{const ce=t[q][re];k("click-ui"),S.length<n.length+1&&(E(S+ce),S.length+1===n.length&&U(S+ce))},B=()=>{k("click-ui"),E(S.substring(0,S.length-1))},ne={backgroundImage:`url("${((ie=e.img)==null?void 0:ie.url)||""}")`,backgroudPosition:"center center"};return jsxRuntimeExports.jsxs("div",{className:`puzzle-keyboard puzzle-keyboard--${p}`,style:(Y=e.img)!=null&&Y.url?ne:null,children:[jsxRuntimeExports.jsx("div",{className:"puzzle-keyboard__header",children:jsxRuntimeExports.jsxs("div",{className:"puzzle-keyboard__digits",children:[n.split("").map((q,re)=>jsxRuntimeExports.jsx("div",{className:`puzzle-keyboard__digit ${_}`,children:S.split("")[re]?S.split("")[re]:""},`${q+re}`)),_!==""?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:_==="success"?jsxRuntimeExports.jsx("span",{className:"puzzle-keyboard__positionatedToDigits icon-mini-check-circle"}):jsxRuntimeExports.jsx("span",{className:"puzzle-keyboard__positionatedToDigits icon-mini-error-circle"})}):jsxRuntimeExports.jsx("button",{type:"button",onClick:B,className:"puzzle-keyboard__positionatedToDigits puzzle-keyboard__delete","aria-label":D("puzzles.keyboard-puzzle.deleteButton"),children:jsxRuntimeExports.jsx("span",{className:"icon-delete-key-2023"})})]})}),jsxRuntimeExports.jsxs("div",{className:"puzzle-keyboard__keypad",children:[p==="scifi-theme"&&jsxRuntimeExports.jsx("div",{"aria-hidden":!0,className:"puzzle-keyboard__scifi-notch",children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{fill:"none",fillRule:"evenodd",children:[jsxRuntimeExports.jsxs("g",{transform:"translate(3 3)",children:[jsxRuntimeExports.jsx("circle",{fill:"#1E282F",cx:"5",cy:"5",r:"5"}),jsxRuntimeExports.jsx("path",{d:"M1.48 8.55a5 5 0 1 0 7.008-7.133",fillOpacity:".096",fill:"#1DDDD8"}),jsxRuntimeExports.jsx("circle",{fill:"#1DDDD8",opacity:".359",cx:"3",cy:"3",r:"2"})]}),jsxRuntimeExports.jsx("circle",{stroke:"#1E282F",cx:"8",cy:"8",r:"7.5"})]})})})}),jsxRuntimeExports.jsx("div",{className:`keyboard-keys keyboard-keys--${p}`,children:t.map((q,re)=>(Array.isArray(q)?q:Object.values(q)).map((ce,fe)=>jsxRuntimeExports.jsx("button",{className:`keyboard-key keyboard-key--${p} ${ce==="*"?"keyboard-key--star":""}`,type:"button",onClick:()=>$(re,fe),children:jsxRuntimeExports.jsx("div",{children:ce})},ce)))}),p==="scifi-theme"&&jsxRuntimeExports.jsx("hr",{"aria-hidden":!0,className:"puzzle-keyboard__scifi-line"})]}),x&&jsxRuntimeExports.jsx(FeedbackComponent$1,{translate:D,text:T,success:g,functionOnClose:M,keyboardControl:u})]})}var lib$1={exports:{}},_FullInternals={},_CoreInternals={},Global={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l._registerNode=l.Konva=l.glob=void 0;const e=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}l.glob=typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},l.Konva={_global:l.glob,version:"9.3.0",isBrowser:n(),isUnminified:/param/.test((function(a){}).toString()),dblClickWindow:400,getAngle(a){return l.Konva.angleDeg?a*e:a},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return l.Konva.DD.isDragging},isDragReady(){return!!l.Konva.DD.node},releaseCanvasOnDestroy:!0,document:l.glob.document,_injectGlobal(a){l.glob.Konva=a}};const t=a=>{l.Konva[a.prototype.getClassName()]=a};l._registerNode=t,l.Konva._injectGlobal(l.Konva)})(Global);var Util={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Util=l.Transform=void 0;const e=Global;class n{constructor(C=[1,0,0,1,0,0]){this.dirty=!1,this.m=C&&C.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(C){C.m[0]=this.m[0],C.m[1]=this.m[1],C.m[2]=this.m[2],C.m[3]=this.m[3],C.m[4]=this.m[4],C.m[5]=this.m[5]}point(C){var w=this.m;return{x:w[0]*C.x+w[2]*C.y+w[4],y:w[1]*C.x+w[3]*C.y+w[5]}}translate(C,w){return this.m[4]+=this.m[0]*C+this.m[2]*w,this.m[5]+=this.m[1]*C+this.m[3]*w,this}scale(C,w){return this.m[0]*=C,this.m[1]*=C,this.m[2]*=w,this.m[3]*=w,this}rotate(C){var w=Math.cos(C),P=Math.sin(C),D=this.m[0]*w+this.m[2]*P,N=this.m[1]*w+this.m[3]*P,k=this.m[0]*-P+this.m[2]*w,F=this.m[1]*-P+this.m[3]*w;return this.m[0]=D,this.m[1]=N,this.m[2]=k,this.m[3]=F,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(C,w){var P=this.m[0]+this.m[2]*w,D=this.m[1]+this.m[3]*w,N=this.m[2]+this.m[0]*C,k=this.m[3]+this.m[1]*C;return this.m[0]=P,this.m[1]=D,this.m[2]=N,this.m[3]=k,this}multiply(C){var w=this.m[0]*C.m[0]+this.m[2]*C.m[1],P=this.m[1]*C.m[0]+this.m[3]*C.m[1],D=this.m[0]*C.m[2]+this.m[2]*C.m[3],N=this.m[1]*C.m[2]+this.m[3]*C.m[3],k=this.m[0]*C.m[4]+this.m[2]*C.m[5]+this.m[4],F=this.m[1]*C.m[4]+this.m[3]*C.m[5]+this.m[5];return this.m[0]=w,this.m[1]=P,this.m[2]=D,this.m[3]=N,this.m[4]=k,this.m[5]=F,this}invert(){var C=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),w=this.m[3]*C,P=-this.m[1]*C,D=-this.m[2]*C,N=this.m[0]*C,k=C*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),F=C*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=w,this.m[1]=P,this.m[2]=D,this.m[3]=N,this.m[4]=k,this.m[5]=F,this}getMatrix(){return this.m}decompose(){var C=this.m[0],w=this.m[1],P=this.m[2],D=this.m[3],N=this.m[4],k=this.m[5],F=C*D-w*P;let M={x:N,y:k,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(C!=0||w!=0){var U=Math.sqrt(C*C+w*w);M.rotation=w>0?Math.acos(C/U):-Math.acos(C/U),M.scaleX=U,M.scaleY=F/U,M.skewX=(C*P+w*D)/F,M.skewY=0}else if(P!=0||D!=0){var $=Math.sqrt(P*P+D*D);M.rotation=Math.PI/2-(D>0?Math.acos(-P/$):-Math.acos(P/$)),M.scaleX=F/$,M.scaleY=$,M.skewX=0,M.skewY=(C*P+w*D)/F}return M.rotation=l.Util._getRotation(M.rotation),M}}l.Transform=n;var t="[object Array]",a="[object Number]",o="[object String]",d="[object Boolean]",f=Math.PI/180,h=180/Math.PI,u="#",p="",_="0",b="Konva warning: ",S="Konva error: ",E="rgb(",g={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},v=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,T=[];const R=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(x){setTimeout(x,60)};l.Util={_isElement(x){return!!(x&&x.nodeType==1)},_isFunction(x){return!!(x&&x.constructor&&x.call&&x.apply)},_isPlainObject(x){return!!x&&x.constructor===Object},_isArray(x){return Object.prototype.toString.call(x)===t},_isNumber(x){return Object.prototype.toString.call(x)===a&&!isNaN(x)&&isFinite(x)},_isString(x){return Object.prototype.toString.call(x)===o},_isBoolean(x){return Object.prototype.toString.call(x)===d},isObject(x){return x instanceof Object},isValidSelector(x){if(typeof x!="string")return!1;var C=x[0];return C==="#"||C==="."||C===C.toUpperCase()},_sign(x){return x===0||x>0?1:-1},requestAnimFrame(x){T.push(x),T.length===1&&R(function(){const C=T;T=[],C.forEach(function(w){w()})})},createCanvasElement(){var x=document.createElement("canvas");try{x.style=x.style||{}}catch{}return x},createImageElement(){return document.createElement("img")},_isInDocument(x){for(;x=x.parentNode;)if(x==document)return!0;return!1},_urlToImage(x,C){var w=l.Util.createImageElement();w.onload=function(){C(w)},w.src=x},_rgbToHex(x,C,w){return((1<<24)+(x<<16)+(C<<8)+w).toString(16).slice(1)},_hexToRgb(x){x=x.replace(u,p);var C=parseInt(x,16);return{r:C>>16&255,g:C>>8&255,b:C&255}},getRandomColor(){for(var x=(Math.random()*16777215<<0).toString(16);x.length<6;)x=_+x;return u+x},getRGB(x){var C;return x in g?(C=g[x],{r:C[0],g:C[1],b:C[2]}):x[0]===u?this._hexToRgb(x.substring(1)):x.substr(0,4)===E?(C=v.exec(x.replace(/ /g,"")),{r:parseInt(C[1],10),g:parseInt(C[2],10),b:parseInt(C[3],10)}):{r:0,g:0,b:0}},colorToRGBA(x){return x=x||"black",l.Util._namedColorToRBA(x)||l.Util._hex3ColorToRGBA(x)||l.Util._hex4ColorToRGBA(x)||l.Util._hex6ColorToRGBA(x)||l.Util._hex8ColorToRGBA(x)||l.Util._rgbColorToRGBA(x)||l.Util._rgbaColorToRGBA(x)||l.Util._hslColorToRGBA(x)},_namedColorToRBA(x){var C=g[x.toLowerCase()];return C?{r:C[0],g:C[1],b:C[2],a:1}:null},_rgbColorToRGBA(x){if(x.indexOf("rgb(")===0){x=x.match(/rgb\(([^)]+)\)/)[1];var C=x.split(/ *, */).map(Number);return{r:C[0],g:C[1],b:C[2],a:1}}},_rgbaColorToRGBA(x){if(x.indexOf("rgba(")===0){x=x.match(/rgba\(([^)]+)\)/)[1];var C=x.split(/ *, */).map((w,P)=>w.slice(-1)==="%"?P===3?parseInt(w)/100:parseInt(w)/100*255:Number(w));return{r:C[0],g:C[1],b:C[2],a:C[3]}}},_hex8ColorToRGBA(x){if(x[0]==="#"&&x.length===9)return{r:parseInt(x.slice(1,3),16),g:parseInt(x.slice(3,5),16),b:parseInt(x.slice(5,7),16),a:parseInt(x.slice(7,9),16)/255}},_hex6ColorToRGBA(x){if(x[0]==="#"&&x.length===7)return{r:parseInt(x.slice(1,3),16),g:parseInt(x.slice(3,5),16),b:parseInt(x.slice(5,7),16),a:1}},_hex4ColorToRGBA(x){if(x[0]==="#"&&x.length===5)return{r:parseInt(x[1]+x[1],16),g:parseInt(x[2]+x[2],16),b:parseInt(x[3]+x[3],16),a:parseInt(x[4]+x[4],16)/255}},_hex3ColorToRGBA(x){if(x[0]==="#"&&x.length===4)return{r:parseInt(x[1]+x[1],16),g:parseInt(x[2]+x[2],16),b:parseInt(x[3]+x[3],16),a:1}},_hslColorToRGBA(x){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(x)){const[C,...w]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(x),P=Number(w[0])/360,D=Number(w[1])/100,N=Number(w[2])/100;let k,F,M;if(D===0)return M=N*255,{r:Math.round(M),g:Math.round(M),b:Math.round(M),a:1};N<.5?k=N*(1+D):k=N+D-N*D;const U=2*N-k,$=[0,0,0];for(let B=0;B<3;B++)F=P+1/3*-(B-1),F<0&&F++,F>1&&F--,6*F<1?M=U+(k-U)*6*F:2*F<1?M=k:3*F<2?M=U+(k-U)*(2/3-F)*6:M=U,$[B]=M*255;return{r:Math.round($[0]),g:Math.round($[1]),b:Math.round($[2]),a:1}}},haveIntersection(x,C){return!(C.x>x.x+x.width||C.x+C.width<x.x||C.y>x.y+x.height||C.y+C.height<x.y)},cloneObject(x){var C={};for(var w in x)this._isPlainObject(x[w])?C[w]=this.cloneObject(x[w]):this._isArray(x[w])?C[w]=this.cloneArray(x[w]):C[w]=x[w];return C},cloneArray(x){return x.slice(0)},degToRad(x){return x*f},radToDeg(x){return x*h},_degToRad(x){return l.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),l.Util.degToRad(x)},_radToDeg(x){return l.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),l.Util.radToDeg(x)},_getRotation(x){return e.Konva.angleDeg?l.Util.radToDeg(x):x},_capitalize(x){return x.charAt(0).toUpperCase()+x.slice(1)},throw(x){throw new Error(S+x)},error(x){console.error(S+x)},warn(x){e.Konva.showWarnings&&console.warn(b+x)},each(x,C){for(var w in x)C(w,x[w])},_inRange(x,C,w){return C<=x&&x<w},_getProjectionToSegment(x,C,w,P,D,N){var k,F,M,U=(x-w)*(x-w)+(C-P)*(C-P);if(U==0)k=x,F=C,M=(D-w)*(D-w)+(N-P)*(N-P);else{var $=((D-x)*(w-x)+(N-C)*(P-C))/U;$<0?(k=x,F=C,M=(x-D)*(x-D)+(C-N)*(C-N)):$>1?(k=w,F=P,M=(w-D)*(w-D)+(P-N)*(P-N)):(k=x+$*(w-x),F=C+$*(P-C),M=(k-D)*(k-D)+(F-N)*(F-N))}return[k,F,M]},_getProjectionToLine(x,C,w){var P=l.Util.cloneObject(x),D=Number.MAX_VALUE;return C.forEach(function(N,k){if(!(!w&&k===C.length-1)){var F=C[(k+1)%C.length],M=l.Util._getProjectionToSegment(N.x,N.y,F.x,F.y,x.x,x.y),U=M[0],$=M[1],B=M[2];B<D&&(P.x=U,P.y=$,D=B)}}),P},_prepareArrayForTween(x,C,w){var P,D=[],N=[];if(x.length>C.length){var k=C;C=x,x=k}for(P=0;P<x.length;P+=2)D.push({x:x[P],y:x[P+1]});for(P=0;P<C.length;P+=2)N.push({x:C[P],y:C[P+1]});var F=[];return N.forEach(function(M){var U=l.Util._getProjectionToLine(M,D,w);F.push(U.x),F.push(U.y)}),F},_prepareToStringify(x){var C;x.visitedByCircularReferenceRemoval=!0;for(var w in x)if(x.hasOwnProperty(w)&&x[w]&&typeof x[w]=="object"){if(C=Object.getOwnPropertyDescriptor(x,w),x[w].visitedByCircularReferenceRemoval||l.Util._isElement(x[w]))if(C.configurable)delete x[w];else return null;else if(l.Util._prepareToStringify(x[w])===null)if(C.configurable)delete x[w];else return null}return delete x.visitedByCircularReferenceRemoval,x},_assign(x,C){for(var w in C)x[w]=C[w];return x},_getFirstPointerId(x){return x.touches?x.changedTouches[0].identifier:x.pointerId||999},releaseCanvas(...x){e.Konva.releaseCanvasOnDestroy&&x.forEach(C=>{C.width=0,C.height=0})},drawRoundedRectPath(x,C,w,P){let D=0,N=0,k=0,F=0;typeof P=="number"?D=N=k=F=Math.min(P,C/2,w/2):(D=Math.min(P[0]||0,C/2,w/2),N=Math.min(P[1]||0,C/2,w/2),F=Math.min(P[2]||0,C/2,w/2),k=Math.min(P[3]||0,C/2,w/2)),x.moveTo(D,0),x.lineTo(C-N,0),x.arc(C-N,N,N,Math.PI*3/2,0,!1),x.lineTo(C,w-F),x.arc(C-F,w-F,F,0,Math.PI/2,!1),x.lineTo(k,w),x.arc(k,w-k,k,Math.PI/2,Math.PI,!1),x.lineTo(0,D),x.arc(D,D,D,Math.PI,Math.PI*3/2,!1)}}})(Util);var Node$1={},Factory={},Validators={};Object.defineProperty(Validators,"__esModule",{value:!0});Validators.getComponentValidator=Validators.getBooleanValidator=Validators.getNumberArrayValidator=Validators.getFunctionValidator=Validators.getStringOrGradientValidator=Validators.getStringValidator=Validators.getNumberOrAutoValidator=Validators.getNumberOrArrayOfNumbersValidator=Validators.getNumberValidator=Validators.alphaComponent=Validators.RGBComponent=void 0;const Global_1$p=Global,Util_1$f=Util;function _formatValue(l){return Util_1$f.Util._isString(l)?'"'+l+'"':Object.prototype.toString.call(l)==="[object Number]"||Util_1$f.Util._isBoolean(l)?l:Object.prototype.toString.call(l)}function RGBComponent(l){return l>255?255:l<0?0:Math.round(l)}Validators.RGBComponent=RGBComponent;function alphaComponent(l){return l>1?1:l<1e-4?1e-4:l}Validators.alphaComponent=alphaComponent;function getNumberValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){return Util_1$f.Util._isNumber(l)||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),l}}Validators.getNumberValidator=getNumberValidator;function getNumberOrArrayOfNumbersValidator(l){if(Global_1$p.Konva.isUnminified)return function(e,n){let t=Util_1$f.Util._isNumber(e),a=Util_1$f.Util._isArray(e)&&e.length==l;return!t&&!a&&Util_1$f.Util.warn(_formatValue(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+l+")"),e}}Validators.getNumberOrArrayOfNumbersValidator=getNumberOrArrayOfNumbersValidator;function getNumberOrAutoValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){var n=Util_1$f.Util._isNumber(l),t=l==="auto";return n||t||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),l}}Validators.getNumberOrAutoValidator=getNumberOrAutoValidator;function getStringValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){return Util_1$f.Util._isString(l)||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),l}}Validators.getStringValidator=getStringValidator;function getStringOrGradientValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){const n=Util_1$f.Util._isString(l),t=Object.prototype.toString.call(l)==="[object CanvasGradient]"||l&&l.addColorStop;return n||t||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),l}}Validators.getStringOrGradientValidator=getStringOrGradientValidator;function getFunctionValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){return Util_1$f.Util._isFunction(l)||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),l}}Validators.getFunctionValidator=getFunctionValidator;function getNumberArrayValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&l instanceof n||(Util_1$f.Util._isArray(l)?l.forEach(function(t){Util_1$f.Util._isNumber(t)||Util_1$f.Util.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")}):Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),l}}Validators.getNumberArrayValidator=getNumberArrayValidator;function getBooleanValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){var n=l===!0||l===!1;return n||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),l}}Validators.getBooleanValidator=getBooleanValidator;function getComponentValidator(l){if(Global_1$p.Konva.isUnminified)return function(e,n){return e==null||Util_1$f.Util.isObject(e)||Util_1$f.Util.warn(_formatValue(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+l),e}}Validators.getComponentValidator=getComponentValidator;(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Factory=void 0;const e=Util,n=Validators;var t="get",a="set";l.Factory={addGetterSetter(o,d,f,h,u){l.Factory.addGetter(o,d,f),l.Factory.addSetter(o,d,h,u),l.Factory.addOverloadedGetterSetter(o,d)},addGetter(o,d,f){var h=t+e.Util._capitalize(d);o.prototype[h]=o.prototype[h]||function(){var u=this.attrs[d];return u===void 0?f:u}},addSetter(o,d,f,h){var u=a+e.Util._capitalize(d);o.prototype[u]||l.Factory.overWriteSetter(o,d,f,h)},overWriteSetter(o,d,f,h){var u=a+e.Util._capitalize(d);o.prototype[u]=function(p){return f&&p!==void 0&&p!==null&&(p=f.call(this,p,d)),this._setAttr(d,p),h&&h.call(this),this}},addComponentsGetterSetter(o,d,f,h,u){var p=f.length,_=e.Util._capitalize,b=t+_(d),S=a+_(d),E,g;o.prototype[b]=function(){var T={};for(E=0;E<p;E++)g=f[E],T[g]=this.getAttr(d+_(g));return T};var v=(0,n.getComponentValidator)(f);o.prototype[S]=function(T){var R=this.attrs[d],x;h&&(T=h.call(this,T)),v&&v.call(this,T,d);for(x in T)T.hasOwnProperty(x)&&this._setAttr(d+_(x),T[x]);return T||f.forEach(C=>{this._setAttr(d+_(C),void 0)}),this._fireChangeEvent(d,R,T),u&&u.call(this),this},l.Factory.addOverloadedGetterSetter(o,d)},addOverloadedGetterSetter(o,d){var f=e.Util._capitalize(d),h=a+f,u=t+f;o.prototype[d]=function(){return arguments.length?(this[h](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,d,f,h){e.Util.error("Adding deprecated "+d);var u=t+e.Util._capitalize(d),p=d+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){e.Util.error(p);var _=this.attrs[d];return _===void 0?f:_},l.Factory.addSetter(o,d,h,function(){e.Util.error(p)}),l.Factory.addOverloadedGetterSetter(o,d)},backCompat(o,d){e.Util.each(d,function(f,h){var u=o.prototype[h],p=t+e.Util._capitalize(f),_=a+e.Util._capitalize(f);function b(){u.apply(this,arguments),e.Util.error('"'+f+'" method is deprecated and will be removed soon. Use ""'+h+'" instead.')}o.prototype[f]=b,o.prototype[p]=b,o.prototype[_]=b})},afterSetFilter(){this._filterUpToDate=!1}}})(Factory);var Canvas$1={},Context$2={};Object.defineProperty(Context$2,"__esModule",{value:!0});Context$2.HitContext=Context$2.SceneContext=Context$2.Context=void 0;const Util_1$e=Util,Global_1$o=Global;function simplifyArray(l){var e=[],n=l.length,t=Util_1$e.Util,a,o;for(a=0;a<n;a++)o=l[a],t._isNumber(o)?o=Math.round(o*1e3)/1e3:t._isString(o)||(o=o+""),e.push(o);return e}var COMMA=",",OPEN_PAREN="(",CLOSE_PAREN=")",OPEN_PAREN_BRACKET="([",CLOSE_BRACKET_PAREN="])",SEMICOLON=";",DOUBLE_PAREN="()",EQUALS="=",CONTEXT_METHODS=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],CONTEXT_PROPERTIES=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const traceArrMax=100;let Context$1=class{constructor(e){this.canvas=e,Global_1$o.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,n){var t=this.traceArr,a=t.length,o="",d,f,h,u;for(d=0;d<a;d++)f=t[d],h=f.method,h?(u=f.args,o+=h,e?o+=DOUBLE_PAREN:Util_1$e.Util._isArray(u[0])?o+=OPEN_PAREN_BRACKET+u.join(COMMA)+CLOSE_BRACKET_PAREN:(n&&(u=u.map(p=>typeof p=="number"?Math.floor(p):p)),o+=OPEN_PAREN+u.join(COMMA)+CLOSE_PAREN)):(o+=f.property,e||(o+=EQUALS+f.val)),o+=SEMICOLON;return o}clearTrace(){this.traceArr=[]}_trace(e){var n=this.traceArr,t;n.push(e),t=n.length,t>=traceArrMax&&n.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){const n=e.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(e){var n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){const n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,t,a,o,d){this._context.arc(e,n,t,a,o,d)}arcTo(e,n,t,a,o){this._context.arcTo(e,n,t,a,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,t,a,o,d){this._context.bezierCurveTo(e,n,t,a,o,d)}clearRect(e,n,t,a){this._context.clearRect(e,n,t,a)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){var t=arguments;if(t.length===2)return this._context.createImageData(e,n);if(t.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,t,a){return this._context.createLinearGradient(e,n,t,a)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,t,a,o,d){return this._context.createRadialGradient(e,n,t,a,o,d)}drawImage(e,n,t,a,o,d,f,h,u){var p=arguments,_=this._context;p.length===3?_.drawImage(e,n,t):p.length===5?_.drawImage(e,n,t,a,o):p.length===9&&_.drawImage(e,n,t,a,o,d,f,h,u)}ellipse(e,n,t,a,o,d,f,h){this._context.ellipse(e,n,t,a,o,d,f,h)}isPointInPath(e,n,t,a){return t?this._context.isPointInPath(t,e,n,a):this._context.isPointInPath(e,n,a)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,t,a){this._context.fillRect(e,n,t,a)}strokeRect(e,n,t,a){this._context.strokeRect(e,n,t,a)}fillText(e,n,t,a){a?this._context.fillText(e,n,t,a):this._context.fillText(e,n,t)}measureText(e){return this._context.measureText(e)}getImageData(e,n,t,a){return this._context.getImageData(e,n,t,a)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,t,a){this._context.rect(e,n,t,a)}putImageData(e,n,t){this._context.putImageData(e,n,t)}quadraticCurveTo(e,n,t,a){this._context.quadraticCurveTo(e,n,t,a)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,t,a,o,d){this._context.setTransform(e,n,t,a,o,d)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,t,a){this._context.strokeText(e,n,t,a)}transform(e,n,t,a,o,d){this._context.transform(e,n,t,a,o,d)}translate(e,n){this._context.translate(e,n)}_enableTrace(){var e=this,n=CONTEXT_METHODS.length,t=this.setAttr,a,o,d=function(f){var h=e[f],u;e[f]=function(){return o=simplifyArray(Array.prototype.slice.call(arguments,0)),u=h.apply(e,arguments),e._trace({method:f,args:o}),u}};for(a=0;a<n;a++)d(CONTEXT_METHODS[a]);e.setAttr=function(){t.apply(e,arguments);var f=arguments[0],h=arguments[1];(f==="shadowOffsetX"||f==="shadowOffsetY"||f==="shadowBlur")&&(h=h/this.canvas.getPixelRatio()),e._trace({property:f,val:h})}}_applyGlobalCompositeOperation(e){const n=e.attrs.globalCompositeOperation;var t=!n||n==="source-over";t||this.setAttr("globalCompositeOperation",n)}};Context$2.Context=Context$1;CONTEXT_PROPERTIES.forEach(function(l){Object.defineProperty(Context$1.prototype,l,{get(){return this._context[l]},set(e){this._context[l]=e}})});class SceneContext extends Context$1{constructor(e,{willReadFrequently:n=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:n})}_fillColor(e){var n=e.fill();this.setAttr("fillStyle",n),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){var n=e._getLinearGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fillRadialGradient(e){const n=e._getRadialGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fill(e){const n=e.fill(),t=e.getFillPriority();if(n&&t==="color"){this._fillColor(e);return}const a=e.getFillPatternImage();if(a&&t==="pattern"){this._fillPattern(e);return}const o=e.getFillLinearGradientColorStops();if(o&&t==="linear-gradient"){this._fillLinearGradient(e);return}const d=e.getFillRadialGradientColorStops();if(d&&t==="radial-gradient"){this._fillRadialGradient(e);return}n?this._fillColor(e):a?this._fillPattern(e):o?this._fillLinearGradient(e):d&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const n=e.getStrokeLinearGradientStartPoint(),t=e.getStrokeLinearGradientEndPoint(),a=e.getStrokeLinearGradientColorStops(),o=this.createLinearGradient(n.x,n.y,t.x,t.y);if(a){for(var d=0;d<a.length;d+=2)o.addColorStop(a[d],a[d+1]);this.setAttr("strokeStyle",o)}}_stroke(e){var n=e.dash(),t=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!t){this.save();var a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}this._applyLineCap(e),n&&e.dashEnabled()&&(this.setLineDash(n),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");var o=e.getStrokeLinearGradientColorStops();o?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),t||this.restore()}}_applyShadow(e){var n,t,a,o=(n=e.getShadowRGBA())!==null&&n!==void 0?n:"black",d=(t=e.getShadowBlur())!==null&&t!==void 0?t:5,f=(a=e.getShadowOffset())!==null&&a!==void 0?a:{x:0,y:0},h=e.getAbsoluteScale(),u=this.canvas.getPixelRatio(),p=h.x*u,_=h.y*u;this.setAttr("shadowColor",o),this.setAttr("shadowBlur",d*Math.min(Math.abs(p),Math.abs(_))),this.setAttr("shadowOffsetX",f.x*p),this.setAttr("shadowOffsetY",f.y*_)}}Context$2.SceneContext=SceneContext;class HitContext extends Context$1{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const o=e.getStrokeScaleEnabled();if(!o){this.save();var n=this.getCanvas().getPixelRatio();this.setTransform(n,0,0,n,0,0)}this._applyLineCap(e);var t=e.hitStrokeWidth(),a=t==="auto"?e.strokeWidth():t;this.setAttr("lineWidth",a),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),o||this.restore()}}}Context$2.HitContext=HitContext;Object.defineProperty(Canvas$1,"__esModule",{value:!0});Canvas$1.HitCanvas=Canvas$1.SceneCanvas=Canvas$1.Canvas=void 0;const Util_1$d=Util,Context_1=Context$2,Global_1$n=Global,Factory_1$z=Factory,Validators_1$y=Validators;var _pixelRatio;function getDevicePixelRatio(){if(_pixelRatio)return _pixelRatio;var l=Util_1$d.Util.createCanvasElement(),e=l.getContext("2d");return _pixelRatio=function(){var n=Global_1$n.Konva._global.devicePixelRatio||1,t=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return n/t}(),Util_1$d.Util.releaseCanvas(l),_pixelRatio}class Canvas{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var n=e||{},t=n.pixelRatio||Global_1$n.Konva.pixelRatio||getDevicePixelRatio();this.pixelRatio=t,this._canvas=Util_1$d.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){var n=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/n,this.getHeight()/n)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";var n=this.pixelRatio,t=this.getContext()._context;t.scale(n,n)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";var n=this.pixelRatio,t=this.getContext()._context;t.scale(n,n)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,n){this.setWidth(e||0),this.setHeight(n||0)}toDataURL(e,n){try{return this._canvas.toDataURL(e,n)}catch{try{return this._canvas.toDataURL()}catch(a){return Util_1$d.Util.error("Unable to get data URL. "+a.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}Canvas$1.Canvas=Canvas;Factory_1$z.Factory.addGetterSetter(Canvas,"pixelRatio",void 0,(0,Validators_1$y.getNumberValidator)());class SceneCanvas extends Canvas{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new Context_1.SceneContext(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}Canvas$1.SceneCanvas=SceneCanvas;class HitCanvas extends Canvas{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new Context_1.HitContext(this),this.setSize(e.width,e.height)}}Canvas$1.HitCanvas=HitCanvas;var DragAndDrop={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.DD=void 0;const e=Global,n=Util;l.DD={get isDragging(){var t=!1;return l.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){var t;return l.DD._dragElements.forEach(a=>{t=a.node}),t},_dragElements:new Map,_drag(t){const a=[];l.DD._dragElements.forEach((o,d)=>{const{node:f}=o,h=f.getStage();h.setPointersPositions(t),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(t));const u=h._changedPointerPositions.find(b=>b.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var p=f.dragDistance(),_=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(_<p||(f.startDrag({evt:t}),!f.isDragging()))return}f._setDragPosition(t,o),a.push(f)}}),a.forEach(o=>{o.fire("dragmove",{type:"dragmove",target:o,evt:t},!0)})},_endDragBefore(t){const a=[];l.DD._dragElements.forEach(o=>{const{node:d}=o,f=d.getStage();if(t&&f.setPointersPositions(t),!f._changedPointerPositions.find(p=>p.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(l.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof e.Konva.Stage&&o.node;u&&a.indexOf(u)===-1&&a.push(u)}),a.forEach(o=>{o.draw()})},_endDragAfter(t){l.DD._dragElements.forEach((a,o)=>{a.dragStatus==="stopped"&&a.node.fire("dragend",{type:"dragend",target:a.node,evt:t},!0),a.dragStatus!=="dragging"&&l.DD._dragElements.delete(o)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",l.DD._endDragBefore,!0),window.addEventListener("touchend",l.DD._endDragBefore,!0),window.addEventListener("mousemove",l.DD._drag),window.addEventListener("touchmove",l.DD._drag),window.addEventListener("mouseup",l.DD._endDragAfter,!1),window.addEventListener("touchend",l.DD._endDragAfter,!1))})(DragAndDrop);Object.defineProperty(Node$1,"__esModule",{value:!0});Node$1.Node=void 0;const Util_1$c=Util,Factory_1$y=Factory,Canvas_1$1=Canvas$1,Global_1$m=Global,DragAndDrop_1=DragAndDrop,Validators_1$x=Validators;var ABSOLUTE_OPACITY="absoluteOpacity",ALL_LISTENERS="allEventListeners",ABSOLUTE_TRANSFORM="absoluteTransform",ABSOLUTE_SCALE="absoluteScale",CANVAS="canvas",CHANGE="Change",CHILDREN="children",KONVA="konva",LISTENING="listening",MOUSEENTER="mouseenter",MOUSELEAVE="mouseleave",SET="set",SHAPE="Shape",SPACE$1=" ",STAGE="stage",TRANSFORM="transform",UPPER_STAGE="Stage",VISIBLE="visible",TRANSFORM_CHANGE_STR$1=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(SPACE$1);let idCounter=1;class Node{constructor(e){this._id=idCounter++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===TRANSFORM||e===ABSOLUTE_TRANSFORM)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){var t=this._cache.get(e),a=e===TRANSFORM||e===ABSOLUTE_TRANSFORM,o=t===void 0||a&&t.dirty===!0;return o&&(t=n.call(this),this._cache.set(e,t)),t}_calculate(e,n,t){if(!this._attachedDepsListeners.get(e)){const a=n.map(o=>o+"Change.konva").join(SPACE$1);this.on(a,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,t)}_getCanvasCache(){return this._cache.get(CANVAS)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===ABSOLUTE_TRANSFORM&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(CANVAS)){const{scene:e,filter:n,hit:t}=this._cache.get(CANVAS);Util_1$c.Util.releaseCanvas(e,n,t),this._cache.delete(CANVAS)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var n=e||{},t={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(t=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var a=Math.ceil(n.width||t.width),o=Math.ceil(n.height||t.height),d=n.pixelRatio,f=n.x===void 0?Math.floor(t.x):n.x,h=n.y===void 0?Math.floor(t.y):n.y,u=n.offset||0,p=n.drawBorder||!1,_=n.hitCanvasPixelRatio||1;if(!a||!o){Util_1$c.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}a+=u*2+1,o+=u*2+1,f-=u,h-=u;var b=new Canvas_1$1.SceneCanvas({pixelRatio:d,width:a,height:o}),S=new Canvas_1$1.SceneCanvas({pixelRatio:d,width:0,height:0,willReadFrequently:!0}),E=new Canvas_1$1.HitCanvas({pixelRatio:_,width:a,height:o}),g=b.getContext(),v=E.getContext();return E.isCache=!0,b.isCache=!0,this._cache.delete(CANVAS),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(b.getContext()._context.imageSmoothingEnabled=!1,S.getContext()._context.imageSmoothingEnabled=!1),g.save(),v.save(),g.translate(-f,-h),v.translate(-f,-h),this._isUnderCache=!0,this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY),this._clearSelfAndDescendantCache(ABSOLUTE_SCALE),this.drawScene(b,this),this.drawHit(E,this),this._isUnderCache=!1,g.restore(),v.restore(),p&&(g.save(),g.beginPath(),g.rect(0,0,a,o),g.closePath(),g.setAttr("strokeStyle","red"),g.setAttr("lineWidth",5),g.stroke(),g.restore()),this._cache.set(CANVAS,{scene:b,filter:S,hit:E,x:f,y:h}),this._requestDraw(),this}isCached(){return this._cache.has(CANVAS)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){var t=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],a=1/0,o=1/0,d=-1/0,f=-1/0,h=this.getAbsoluteTransform(n);return t.forEach(function(u){var p=h.point(u);a===void 0&&(a=d=p.x,o=f=p.y),a=Math.min(a,p.x),o=Math.min(o,p.y),d=Math.max(d,p.x),f=Math.max(f,p.y)}),{x:a,y:o,width:d-a,height:f-o}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);var t=this._getCachedSceneCanvas(),a=t.pixelRatio;e.drawImage(t._canvas,0,0,t.width/a,t.height/a),e.restore()}_drawCachedHitCanvas(e){var n=this._getCanvasCache(),t=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(t._canvas,0,0,t.width/t.pixelRatio,t.height/t.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e=this.filters(),n=this._getCanvasCache(),t=n.scene,a=n.filter,o=a.getContext(),d,f,h,u;if(e){if(!this._filterUpToDate){var p=t.pixelRatio;a.setSize(t.width/t.pixelRatio,t.height/t.pixelRatio);try{for(d=e.length,o.clear(),o.drawImage(t._canvas,0,0,t.getWidth()/p,t.getHeight()/p),f=o.getImageData(0,0,a.getWidth(),a.getHeight()),h=0;h<d;h++){if(u=e[h],typeof u!="function"){Util_1$c.Util.error("Filter should be type of function, but got "+typeof u+" instead. Please check correct filters");continue}u.call(this,f),o.putImageData(f,0,0)}}catch(_){Util_1$c.Util.error("Unable to apply filter. "+_.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return a}return t}on(e,n){if(this._cache&&this._cache.delete(ALL_LISTENERS),arguments.length===3)return this._delegate.apply(this,arguments);var t=e.split(SPACE$1),a=t.length,o,d,f,h,u;for(o=0;o<a;o++)d=t[o],f=d.split("."),h=f[0],u=f[1]||"",this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:u,handler:n});return this}off(e,n){var t=(e||"").split(SPACE$1),a=t.length,o,d,f,h,u,p;if(this._cache&&this._cache.delete(ALL_LISTENERS),!e)for(d in this.eventListeners)this._off(d);for(o=0;o<a;o++)if(f=t[o],h=f.split("."),u=h[0],p=h[1],u)this.eventListeners[u]&&this._off(u,p,n);else for(d in this.eventListeners)this._off(d,p,n);return this}dispatchEvent(e){var n={target:this,type:e.type,evt:e};return this.fire(e.type,n),this}addEventListener(e,n){return this.on(e,function(t){n.call(this,t.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,n,t){var a=this;this.on(e,function(o){for(var d=o.target.findAncestors(n,!0,a),f=0;f<d.length;f++)o=Util_1$c.Util.cloneObject(o),o.currentTarget=d[f],t.call(d[f],o)})}remove(){return this.isDragging()&&this.stopDrag(),DragAndDrop_1.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY),this._clearSelfAndDescendantCache(ABSOLUTE_SCALE),this._clearSelfAndDescendantCache(STAGE),this._clearSelfAndDescendantCache(VISIBLE),this._clearSelfAndDescendantCache(LISTENING)}_remove(){this._clearCaches();var e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){var n="get"+Util_1$c.Util._capitalize(e);return Util_1$c.Util._isFunction(this[n])?this[n]():this.attrs[e]}getAncestors(){for(var e=this.getParent(),n=[];e;)n.push(e),e=e.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{var n,t;if(!e)return this;for(n in e)n!==CHILDREN&&(t=SET+Util_1$c.Util._capitalize(n),Util_1$c.Util._isFunction(this[t])?this[t](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(LISTENING,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return t&&t!==e&&this!==e?t._isListening(e):!0}isVisible(){return this._getCache(VISIBLE,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return t&&t!==e&&this!==e?t._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);var t=this.getLayer(),a=!1;DragAndDrop_1.DD._dragElements.forEach(d=>{d.dragStatus==="dragging"&&(d.node.nodeType==="Stage"||d.node.getLayer()===t)&&(a=!0)});var o=!n&&!Global_1$m.Konva.hitOnDragEnabled&&a;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),n=this,t=0,a,o,d,f;function h(p){for(a=[],o=p.length,d=0;d<o;d++)f=p[d],t++,f.nodeType!==SHAPE&&(a=a.concat(f.getChildren().slice())),f._id===n._id&&(d=o);a.length>0&&a[0].getDepth()<=e&&h(a)}const u=this.getStage();return n.nodeType!==UPPER_STAGE&&u&&h(u.getChildren()),t}getDepth(){for(var e=0,n=this.parent;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;var n=e.getPointerPosition();if(!n)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(n)}getAbsolutePosition(e){let n=!1,t=this.parent;for(;t;){if(t.isCached()){n=!0;break}t=t.parent}n&&!e&&(e=!0);var a=this.getAbsoluteTransform(e).getMatrix(),o=new Util_1$c.Transform,d=this.offset();return o.m=a.slice(),o.translate(d.x,d.y),o.getTranslation()}setAbsolutePosition(e){const{x:n,y:t,...a}=this._clearTransform();this.attrs.x=n,this.attrs.y=t,this._clearCache(TRANSFORM);var o=this._getAbsoluteTransform().copy();return o.invert(),o.translate(e.x,e.y),e={x:this.attrs.x+o.getTranslation().x,y:this.attrs.y+o.getTranslation().y},this._setTransform(a),this.setPosition({x:e.x,y:e.y}),this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM),this}_setTransform(e){var n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var n=e.x,t=e.y,a=this.x(),o=this.y();return n!==void 0&&(a+=n),t!==void 0&&(o+=t),this.setPosition({x:a,y:o}),this}_eachAncestorReverse(e,n){var t=[],a=this.getParent(),o,d;if(!(n&&n._id===this._id)){for(t.unshift(this);a&&(!n||a._id!==n._id);)t.unshift(a),a=a.parent;for(o=t.length,d=0;d<o;d++)e(t[d])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Util_1$c.Util.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(ABSOLUTE_OPACITY,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},n=this.getAttrs(),t,a,o,d,f;e.attrs={};for(t in n)a=n[t],f=Util_1$c.Util.isObject(a)&&!Util_1$c.Util._isPlainObject(a)&&!Util_1$c.Util._isArray(a),!f&&(o=typeof this[t]=="function"&&this[t],delete n[t],d=o?o.call(this):null,n[t]=a,d!==a&&(e.attrs[t]=a));return e.className=this.getClassName(),Util_1$c.Util._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,t){var a=[];n&&this._isMatch(e)&&a.push(this);for(var o=this.parent;o;){if(o===t)return a;o._isMatch(e)&&a.push(o),o=o.parent}return a}isAncestorOf(e){return!1}findAncestor(e,n,t){return this.findAncestors(e,n,t)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);var n=e.replace(/ /g,"").split(","),t=n.length,a,o;for(a=0;a<t;a++)if(o=n[a],Util_1$c.Util.isValidSelector(o)||(Util_1$c.Util.warn('Selector "'+o+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Util_1$c.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Util_1$c.Util.warn("Konva is awesome, right?")),o.charAt(0)==="#"){if(this.id()===o.slice(1))return!0}else if(o.charAt(0)==="."){if(this.hasName(o.slice(1)))return!0}else if(this.className===o||this.nodeType===o)return!0;return!1}getLayer(){var e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(STAGE,this._getStage)}_getStage(){var e=this.getParent();return e?e.getStage():null}fire(e,n={},t){return n.target=n.target||this,t?this._fireAndBubble(e,n):this._fire(e,n),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(ABSOLUTE_TRANSFORM,this._getAbsoluteTransform)}_getAbsoluteTransform(e){var n;if(e)return n=new Util_1$c.Transform,this._eachAncestorReverse(function(a){var o=a.transformsEnabled();o==="all"?n.multiply(a.getTransform()):o==="position"&&n.translate(a.x()-a.offsetX(),a.y()-a.offsetY())},e),n;n=this._cache.get(ABSOLUTE_TRANSFORM)||new Util_1$c.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();var t=this.transformsEnabled();if(t==="all")n.multiply(this.getTransform());else if(t==="position"){const a=this.attrs.x||0,o=this.attrs.y||0,d=this.attrs.offsetX||0,f=this.attrs.offsetY||0;n.translate(a-d,o-f)}return n.dirty=!1,n}getAbsoluteScale(e){for(var n=this;n;)n._isUnderCache&&(e=n),n=n.getParent();const a=this.getAbsoluteTransform(e).decompose();return{x:a.scaleX,y:a.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(TRANSFORM,this._getTransform)}_getTransform(){var e,n,t=this._cache.get(TRANSFORM)||new Util_1$c.Transform;t.reset();var a=this.x(),o=this.y(),d=Global_1$m.Konva.getAngle(this.rotation()),f=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,h=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,u=this.attrs.skewX||0,p=this.attrs.skewY||0,_=this.attrs.offsetX||0,b=this.attrs.offsetY||0;return(a!==0||o!==0)&&t.translate(a,o),d!==0&&t.rotate(d),(u!==0||p!==0)&&t.skew(u,p),(f!==1||h!==1)&&t.scale(f,h),(_!==0||b!==0)&&t.translate(-1*_,-1*b),t.dirty=!1,t}clone(e){var n=Util_1$c.Util.cloneObject(this.attrs),t,a,o,d,f;for(t in e)n[t]=e[t];var h=new this.constructor(n);for(t in this.eventListeners)for(a=this.eventListeners[t],o=a.length,d=0;d<o;d++)f=a[d],f.name.indexOf(KONVA)<0&&(h.eventListeners[t]||(h.eventListeners[t]=[]),h.eventListeners[t].push(f));return h}_toKonvaCanvas(e){e=e||{};var n=this.getClientRect(),t=this.getStage(),a=e.x!==void 0?e.x:Math.floor(n.x),o=e.y!==void 0?e.y:Math.floor(n.y),d=e.pixelRatio||1,f=new Canvas_1$1.SceneCanvas({width:e.width||Math.ceil(n.width)||(t?t.width():0),height:e.height||Math.ceil(n.height)||(t?t.height():0),pixelRatio:d}),h=f.getContext();return e.imageSmoothingEnabled===!1&&(h._context.imageSmoothingEnabled=!1),h.save(),(a||o)&&h.translate(-1*a,-1*o),this.drawScene(f),h.restore(),f}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};var n=e.mimeType||null,t=e.quality||null,a=this._toKonvaCanvas(e).toDataURL(n,t);return e.callback&&e.callback(a),a}toImage(e){return new Promise((n,t)=>{try{const a=e==null?void 0:e.callback;a&&delete e.callback,Util_1$c.Util._urlToImage(this.toDataURL(e),function(o){n(o),a==null||a(o)})}catch(a){t(a)}})}toBlob(e){return new Promise((n,t)=>{try{const a=e==null?void 0:e.callback;a&&delete e.callback,this.toCanvas(e).toBlob(o=>{n(o),a==null||a(o)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(a){t(a)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Global_1$m.Konva.dragDistance}_off(e,n,t){var a=this.eventListeners[e],o,d,f;for(o=0;o<a.length;o++)if(d=a[o].name,f=a[o].handler,(d!=="konva"||n==="konva")&&(!n||d===n)&&(!t||t===f)){if(a.splice(o,1),a.length===0){delete this.eventListeners[e];break}o--}}_fireChangeEvent(e,n,t){this._fire(e+CHANGE,{oldVal:n,newVal:t})}addName(e){if(!this.hasName(e)){var n=this.name(),t=n?n+" "+e:e;this.name(t)}return this}hasName(e){if(!e)return!1;const n=this.name();if(!n)return!1;var t=(n||"").split(/\s/g);return t.indexOf(e)!==-1}removeName(e){var n=(this.name()||"").split(/\s/g),t=n.indexOf(e);return t!==-1&&(n.splice(t,1),this.name(n.join(" "))),this}setAttr(e,n){var t=this[SET+Util_1$c.Util._capitalize(e)];return Util_1$c.Util._isFunction(t)?t.call(this,n):this._setAttr(e,n),this}_requestDraw(){if(Global_1$m.Konva.autoDrawEnabled){const e=this.getLayer()||this.getStage();e==null||e.batchDraw()}}_setAttr(e,n){var t=this.attrs[e];t===n&&!Util_1$c.Util.isObject(n)||(n==null?delete this.attrs[e]:this.attrs[e]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(e,t,n),this._requestDraw())}_setComponentAttr(e,n,t){var a;t!==void 0&&(a=this.attrs[e],a||(this.attrs[e]=this.getAttr(e)),this.attrs[e][n]=t,this._fireChangeEvent(e,a,t))}_fireAndBubble(e,n,t){n&&this.nodeType===SHAPE&&(n.target=this);var a=(e===MOUSEENTER||e===MOUSELEAVE)&&(t&&(this===t||this.isAncestorOf&&this.isAncestorOf(t))||this.nodeType==="Stage"&&!t);if(!a){this._fire(e,n);var o=(e===MOUSEENTER||e===MOUSELEAVE)&&t&&t.isAncestorOf&&t.isAncestorOf(this)&&!t.isAncestorOf(this.parent);(n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!o&&(t&&t.parent?this._fireAndBubble.call(this.parent,e,n,t):this._fireAndBubble.call(this.parent,e,n))}}_getProtoListeners(e){var n,t,a;const o=(n=this._cache.get(ALL_LISTENERS))!==null&&n!==void 0?n:{};let d=o==null?void 0:o[e];if(d===void 0){d=[];let f=Object.getPrototypeOf(this);for(;f;){const h=(a=(t=f.eventListeners)===null||t===void 0?void 0:t[e])!==null&&a!==void 0?a:[];d.push(...h),f=Object.getPrototypeOf(f)}o[e]=d,this._cache.set(ALL_LISTENERS,o)}return d}_fire(e,n){n=n||{},n.currentTarget=this,n.type=e;const t=this._getProtoListeners(e);if(t)for(var a=0;a<t.length;a++)t[a].handler.call(this,n);const o=this.eventListeners[e];if(o)for(var a=0;a<o.length;a++)o[a].handler.call(this,n)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){var n=e?e.pointerId:void 0,t=this.getStage(),a=this.getAbsolutePosition();if(t){var o=t._getPointerById(n)||t._changedPointerPositions[0]||a;DragAndDrop_1.DD._dragElements.set(this._id,{node:this,startPointerPos:o,offset:{x:o.x-a.x,y:o.y-a.y},dragStatus:"ready",pointerId:n})}}startDrag(e,n=!0){DragAndDrop_1.DD._dragElements.has(this._id)||this._createDragElement(e);const t=DragAndDrop_1.DD._dragElements.get(this._id);t.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},n)}_setDragPosition(e,n){const t=this.getStage()._getPointerById(n.pointerId);if(t){var a={x:t.x-n.offset.x,y:t.y-n.offset.y},o=this.dragBoundFunc();if(o!==void 0){const d=o.call(this,a,e);d?a=d:Util_1$c.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==a.x||this._lastPos.y!==a.y)&&(this.setAbsolutePosition(a),this._requestDraw()),this._lastPos=a}}stopDrag(e){const n=DragAndDrop_1.DD._dragElements.get(this._id);n&&(n.dragStatus="stopped"),DragAndDrop_1.DD._endDragBefore(e),DragAndDrop_1.DD._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=DragAndDrop_1.DD._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){var n=e.evt.button!==void 0,t=!n||Global_1$m.Konva.dragButtons.indexOf(e.evt.button)>=0;if(t&&!this.isDragging()){var a=!1;DragAndDrop_1.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(a=!0)}),a||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const n=DragAndDrop_1.DD._dragElements.get(this._id),t=n&&n.dragStatus==="dragging",a=n&&n.dragStatus==="ready";t?this.stopDrag():a&&DragAndDrop_1.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const t={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return Util_1$c.Util.haveIntersection(t,this.getClientRect())}static create(e,n){return Util_1$c.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){var t=Node.prototype.getClassName.call(e),a=e.children,o,d,f;n&&(e.attrs.container=n),Global_1$m.Konva[t]||(Util_1$c.Util.warn('Can not find a node with class name "'+t+'". Fallback to "Shape".'),t="Shape");const h=Global_1$m.Konva[t];if(o=new h(e.attrs),a)for(d=a.length,f=0;f<d;f++)o.add(Node._createNode(a[f]));return o}}Node$1.Node=Node;Node.prototype.nodeType="Node";Node.prototype._attrsAffectingSize=[];Node.prototype.eventListeners={};Node.prototype.on.call(Node.prototype,TRANSFORM_CHANGE_STR$1,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM)});Node.prototype.on.call(Node.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(VISIBLE)});Node.prototype.on.call(Node.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(LISTENING)});Node.prototype.on.call(Node.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY)});const addGetterSetter=Factory_1$y.Factory.addGetterSetter;addGetterSetter(Node,"zIndex");addGetterSetter(Node,"absolutePosition");addGetterSetter(Node,"position");addGetterSetter(Node,"x",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"y",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"globalCompositeOperation","source-over",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"opacity",1,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"name","",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"id","",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"rotation",0,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"scale",["x","y"]);addGetterSetter(Node,"scaleX",1,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"scaleY",1,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"skew",["x","y"]);addGetterSetter(Node,"skewX",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"skewY",0,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"offset",["x","y"]);addGetterSetter(Node,"offsetX",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"offsetY",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"dragDistance",null,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"width",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"height",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"listening",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"preventDefault",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"filters",null,function(l){return this._filterUpToDate=!1,l});addGetterSetter(Node,"visible",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"transformsEnabled","all",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"size");addGetterSetter(Node,"dragBoundFunc");addGetterSetter(Node,"draggable",!1,(0,Validators_1$x.getBooleanValidator)());Factory_1$y.Factory.backCompat(Node,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Container$2={};Object.defineProperty(Container$2,"__esModule",{value:!0});Container$2.Container=void 0;const Factory_1$x=Factory,Node_1$h=Node$1,Validators_1$w=Validators;let Container$1=class extends Node_1$h.Node{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const n=this.children||[];var t=[];return n.forEach(function(a){e(a)&&t.push(a)}),t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(var n=0;n<e.length;n++)this.add(e[n]);return this}const t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire("add",{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){var n=this._generalFind(e,!0);return n.length>0?n[0]:void 0}_generalFind(e,n){var t=[];return this._descendants(a=>{const o=a._isMatch(e);return o&&t.push(a),!!(o&&n)}),t}_descendants(e){let n=!1;const t=this.getChildren();for(const a of t){if(n=e(a),n)return!0;if(a.hasChildren()&&(n=a._descendants(e),n))return!0}return!1}toObject(){var e=Node_1$h.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){for(var n=e.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){var n=Node_1$h.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(t){n.add(t.clone())}),n}getAllIntersections(e){var n=[];return this.find("Shape").forEach(t=>{t.isVisible()&&t.intersects(e)&&n.push(t)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,t){n.index=t}),this._requestDraw()}drawScene(e,n){var t=this.getLayer(),a=e||t&&t.getCanvas(),o=a&&a.getContext(),d=this._getCanvasCache(),f=d&&d.scene,h=a&&a.isCache;if(!this.isVisible()&&!h)return this;if(f){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",a,n);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;var t=this.getLayer(),a=e||t&&t.hitCanvas,o=a&&a.getContext(),d=this._getCanvasCache(),f=d&&d.hit;if(f){o.save();var h=this.getAbsoluteTransform(n).getMatrix();o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",a,n);return this}_drawChildren(e,n,t){var a,o=n&&n.getContext(),d=this.clipWidth(),f=this.clipHeight(),h=this.clipFunc(),u=d&&f||h;const p=t===this;if(u){o.save();var _=this.getAbsoluteTransform(t),b=_.getMatrix();o.transform(b[0],b[1],b[2],b[3],b[4],b[5]),o.beginPath();let v;if(h)v=h.call(this,o,this);else{var S=this.clipX(),E=this.clipY();o.rect(S,E,d,f)}o.clip.apply(o,v),b=_.copy().invert().getMatrix(),o.transform(b[0],b[1],b[2],b[3],b[4],b[5])}var g=!p&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";g&&(o.save(),o._applyGlobalCompositeOperation(this)),(a=this.children)===null||a===void 0||a.forEach(function(v){v[e](n,t)}),g&&o.restore(),u&&o.restore()}getClientRect(e={}){var n,t=e.skipTransform,a=e.relativeTo,o,d,f,h,u={x:1/0,y:1/0,width:0,height:0},p=this;(n=this.children)===null||n===void 0||n.forEach(function(g){if(g.visible()){var v=g.getClientRect({relativeTo:p,skipShadow:e.skipShadow,skipStroke:e.skipStroke});v.width===0&&v.height===0||(o===void 0?(o=v.x,d=v.y,f=v.x+v.width,h=v.y+v.height):(o=Math.min(o,v.x),d=Math.min(d,v.y),f=Math.max(f,v.x+v.width),h=Math.max(h,v.y+v.height)))}});for(var _=this.find("Shape"),b=!1,S=0;S<_.length;S++){var E=_[S];if(E._isVisible(this)){b=!0;break}}return b&&o!==void 0?u={x:o,y:d,width:f-o,height:h-d}:u={x:0,y:0,width:0,height:0},t?u:this._transformedRect(u,a)}};Container$2.Container=Container$1;Factory_1$x.Factory.addComponentsGetterSetter(Container$1,"clip",["x","y","width","height"]);Factory_1$x.Factory.addGetterSetter(Container$1,"clipX",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipY",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipWidth",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipHeight",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipFunc");var Stage$1={},PointerEvents={};Object.defineProperty(PointerEvents,"__esModule",{value:!0});PointerEvents.releaseCapture=PointerEvents.setPointerCapture=PointerEvents.hasPointerCapture=PointerEvents.createEvent=PointerEvents.getCapturedShape=void 0;const Global_1$l=Global,Captures=new Map,SUPPORT_POINTER_EVENTS=Global_1$l.Konva._global.PointerEvent!==void 0;function getCapturedShape(l){return Captures.get(l)}PointerEvents.getCapturedShape=getCapturedShape;function createEvent(l){return{evt:l,pointerId:l.pointerId}}PointerEvents.createEvent=createEvent;function hasPointerCapture(l,e){return Captures.get(l)===e}PointerEvents.hasPointerCapture=hasPointerCapture;function setPointerCapture(l,e){releaseCapture(l),e.getStage()&&(Captures.set(l,e),SUPPORT_POINTER_EVENTS&&e._fire("gotpointercapture",createEvent(new PointerEvent("gotpointercapture"))))}PointerEvents.setPointerCapture=setPointerCapture;function releaseCapture(l,e){const n=Captures.get(l);if(!n)return;const t=n.getStage();t&&t.content,Captures.delete(l),SUPPORT_POINTER_EVENTS&&n._fire("lostpointercapture",createEvent(new PointerEvent("lostpointercapture")))}PointerEvents.releaseCapture=releaseCapture;(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Stage=l.stages=void 0;const e=Util,n=Factory,t=Container$2,a=Global,o=Canvas$1,d=DragAndDrop,f=Global,h=PointerEvents;var u="Stage",p="string",_="px",b="mouseout",S="mouseleave",E="mouseover",g="mouseenter",v="mousemove",T="mousedown",R="mouseup",x="pointermove",C="pointerdown",w="pointerup",P="pointercancel",D="lostpointercapture",N="pointerout",k="pointerleave",F="pointerover",M="pointerenter",U="contextmenu",$="touchstart",B="touchend",J="touchmove",ne="touchcancel",ie="wheel",Y=5,q=[[g,"_pointerenter"],[T,"_pointerdown"],[v,"_pointermove"],[R,"_pointerup"],[S,"_pointerleave"],[$,"_pointerdown"],[J,"_pointermove"],[B,"_pointerup"],[ne,"_pointercancel"],[E,"_pointerover"],[ie,"_wheel"],[U,"_contextmenu"],[C,"_pointerdown"],[x,"_pointermove"],[w,"_pointerup"],[P,"_pointercancel"],[D,"_lostpointercapture"]];const re={mouse:{[N]:b,[k]:S,[F]:E,[M]:g,[x]:v,[C]:T,[w]:R,[P]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[N]:"touchout",[k]:"touchleave",[F]:"touchover",[M]:"touchenter",[x]:J,[C]:$,[w]:B,[P]:ne,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[N]:N,[k]:k,[F]:F,[M]:M,[x]:x,[C]:C,[w]:w,[P]:P,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},ce=V=>V.indexOf("pointer")>=0?"pointer":V.indexOf("touch")>=0?"touch":"mouse",fe=V=>{const z=ce(V);if(z==="pointer")return a.Konva.pointerEventsEnabled&&re.pointer;if(z==="touch")return re.touch;if(z==="mouse")return re.mouse};function te(V={}){return(V.clipFunc||V.clipWidth||V.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),V}const H="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";l.stages=[];class W extends t.Container{constructor(z){super(te(z)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),l.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{te(this.attrs)}),this._checkVisibility()}_validateAdd(z){const Q=z.getType()==="Layer",ee=z.getType()==="FastLayer";Q||ee||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const z=this.visible()?"":"none";this.content.style.display=z}setContainer(z){if(typeof z===p){if(z.charAt(0)==="."){var Q=z.slice(1);z=document.getElementsByClassName(Q)[0]}else{var ee;z.charAt(0)!=="#"?ee=z:ee=z.slice(1),z=document.getElementById(ee)}if(!z)throw"Can not find container in document with id "+ee}return this._setAttr("container",z),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),z.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var z=this.children,Q=z.length,ee;for(ee=0;ee<Q;ee++)z[ee].clear();return this}clone(z){return z||(z={}),z.container=typeof document<"u"&&document.createElement("div"),t.Container.prototype.clone.call(this,z)}destroy(){super.destroy();var z=this.content;z&&e.Util._isInDocument(z)&&this.container().removeChild(z);var Q=l.stages.indexOf(this);return Q>-1&&l.stages.splice(Q,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const z=this._pointerPositions[0]||this._changedPointerPositions[0];return z?{x:z.x,y:z.y}:(e.Util.warn(H),null)}_getPointerById(z){return this._pointerPositions.find(Q=>Q.id===z)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(z){z=z||{},z.x=z.x||0,z.y=z.y||0,z.width=z.width||this.width(),z.height=z.height||this.height();var Q=new o.SceneCanvas({width:z.width,height:z.height,pixelRatio:z.pixelRatio||1}),ee=Q.getContext()._context,le=this.children;return(z.x||z.y)&&ee.translate(-1*z.x,-1*z.y),le.forEach(function(ue){if(ue.isVisible()){var he=ue._toKonvaCanvas(z);ee.drawImage(he._canvas,z.x,z.y,he.getWidth()/he.getPixelRatio(),he.getHeight()/he.getPixelRatio())}}),Q}getIntersection(z){if(!z)return null;var Q=this.children,ee=Q.length,le=ee-1,ue;for(ue=le;ue>=0;ue--){const he=Q[ue].getIntersection(z);if(he)return he}return null}_resizeDOM(){var z=this.width(),Q=this.height();this.content&&(this.content.style.width=z+_,this.content.style.height=Q+_),this.bufferCanvas.setSize(z,Q),this.bufferHitCanvas.setSize(z,Q),this.children.forEach(ee=>{ee.setSize({width:z,height:Q}),ee.draw()})}add(z,...Q){if(arguments.length>1){for(var ee=0;ee<arguments.length;ee++)this.add(arguments[ee]);return this}super.add(z);var le=this.children.length;return le>Y&&e.Util.warn("The stage has "+le+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),z.setSize({width:this.width(),height:this.height()}),z.draw(),a.Konva.isBrowser&&this.content.appendChild(z.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(z){return h.hasPointerCapture(z,this)}setPointerCapture(z){h.setPointerCapture(z,this)}releaseCapture(z){h.releaseCapture(z,this)}getLayers(){return this.children}_bindContentEvents(){a.Konva.isBrowser&&q.forEach(([z,Q])=>{this.content.addEventListener(z,ee=>{this[Q](ee)},{passive:!1})})}_pointerenter(z){this.setPointersPositions(z);const Q=fe(z.type);Q&&this._fire(Q.pointerenter,{evt:z,target:this,currentTarget:this})}_pointerover(z){this.setPointersPositions(z);const Q=fe(z.type);Q&&this._fire(Q.pointerover,{evt:z,target:this,currentTarget:this})}_getTargetShape(z){let Q=this[z+"targetShape"];return Q&&!Q.getStage()&&(Q=null),Q}_pointerleave(z){const Q=fe(z.type),ee=ce(z.type);if(Q){this.setPointersPositions(z);var le=this._getTargetShape(ee),ue=!d.DD.isDragging||a.Konva.hitOnDragEnabled;le&&ue?(le._fireAndBubble(Q.pointerout,{evt:z}),le._fireAndBubble(Q.pointerleave,{evt:z}),this._fire(Q.pointerleave,{evt:z,target:this,currentTarget:this}),this[ee+"targetShape"]=null):ue&&(this._fire(Q.pointerleave,{evt:z,target:this,currentTarget:this}),this._fire(Q.pointerout,{evt:z,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(z){const Q=fe(z.type),ee=ce(z.type);if(Q){this.setPointersPositions(z);var le=!1;this._changedPointerPositions.forEach(ue=>{var he=this.getIntersection(ue);if(d.DD.justDragged=!1,a.Konva["_"+ee+"ListenClick"]=!0,!he||!he.isListening())return;a.Konva.capturePointerEventsEnabled&&he.setPointerCapture(ue.id),this[ee+"ClickStartShape"]=he,he._fireAndBubble(Q.pointerdown,{evt:z,pointerId:ue.id}),le=!0;const ve=z.type.indexOf("touch")>=0;he.preventDefault()&&z.cancelable&&ve&&z.preventDefault()}),le||this._fire(Q.pointerdown,{evt:z,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(z){const Q=fe(z.type),ee=ce(z.type);if(!Q)return;d.DD.isDragging&&d.DD.node.preventDefault()&&z.cancelable&&z.preventDefault(),this.setPointersPositions(z);var le=!d.DD.isDragging||a.Konva.hitOnDragEnabled;if(!le)return;var ue={};let he=!1;var ve=this._getTargetShape(ee);this._changedPointerPositions.forEach(be=>{const Re=h.getCapturedShape(be.id)||this.getIntersection(be),Le=be.id,Oe={evt:z,pointerId:Le};var Ke=ve!==Re;if(Ke&&ve&&(ve._fireAndBubble(Q.pointerout,{...Oe},Re),ve._fireAndBubble(Q.pointerleave,{...Oe},Re)),Re){if(ue[Re._id])return;ue[Re._id]=!0}Re&&Re.isListening()?(he=!0,Ke&&(Re._fireAndBubble(Q.pointerover,{...Oe},ve),Re._fireAndBubble(Q.pointerenter,{...Oe},ve),this[ee+"targetShape"]=Re),Re._fireAndBubble(Q.pointermove,{...Oe})):ve&&(this._fire(Q.pointerover,{evt:z,target:this,currentTarget:this,pointerId:Le}),this[ee+"targetShape"]=null)}),he||this._fire(Q.pointermove,{evt:z,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(z){const Q=fe(z.type),ee=ce(z.type);if(!Q)return;this.setPointersPositions(z);const le=this[ee+"ClickStartShape"],ue=this[ee+"ClickEndShape"];var he={};let ve=!1;this._changedPointerPositions.forEach(be=>{const Re=h.getCapturedShape(be.id)||this.getIntersection(be);if(Re){if(Re.releaseCapture(be.id),he[Re._id])return;he[Re._id]=!0}const Le=be.id,Oe={evt:z,pointerId:Le};let Ke=!1;a.Konva["_"+ee+"InDblClickWindow"]?(Ke=!0,clearTimeout(this[ee+"DblTimeout"])):d.DD.justDragged||(a.Konva["_"+ee+"InDblClickWindow"]=!0,clearTimeout(this[ee+"DblTimeout"])),this[ee+"DblTimeout"]=setTimeout(function(){a.Konva["_"+ee+"InDblClickWindow"]=!1},a.Konva.dblClickWindow),Re&&Re.isListening()?(ve=!0,this[ee+"ClickEndShape"]=Re,Re._fireAndBubble(Q.pointerup,{...Oe}),a.Konva["_"+ee+"ListenClick"]&&le&&le===Re&&(Re._fireAndBubble(Q.pointerclick,{...Oe}),Ke&&ue&&ue===Re&&Re._fireAndBubble(Q.pointerdblclick,{...Oe}))):(this[ee+"ClickEndShape"]=null,a.Konva["_"+ee+"ListenClick"]&&this._fire(Q.pointerclick,{evt:z,target:this,currentTarget:this,pointerId:Le}),Ke&&this._fire(Q.pointerdblclick,{evt:z,target:this,currentTarget:this,pointerId:Le}))}),ve||this._fire(Q.pointerup,{evt:z,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),a.Konva["_"+ee+"ListenClick"]=!1,z.cancelable&&ee!=="touch"&&z.preventDefault()}_contextmenu(z){this.setPointersPositions(z);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(U,{evt:z}):this._fire(U,{evt:z,target:this,currentTarget:this})}_wheel(z){this.setPointersPositions(z);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(ie,{evt:z}):this._fire(ie,{evt:z,target:this,currentTarget:this})}_pointercancel(z){this.setPointersPositions(z);const Q=h.getCapturedShape(z.pointerId)||this.getIntersection(this.getPointerPosition());Q&&Q._fireAndBubble(w,h.createEvent(z)),h.releaseCapture(z.pointerId)}_lostpointercapture(z){h.releaseCapture(z.pointerId)}setPointersPositions(z){var Q=this._getContentPosition(),ee=null,le=null;z=z||window.event,z.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(z.touches,ue=>{this._pointerPositions.push({id:ue.identifier,x:(ue.clientX-Q.left)/Q.scaleX,y:(ue.clientY-Q.top)/Q.scaleY})}),Array.prototype.forEach.call(z.changedTouches||z.touches,ue=>{this._changedPointerPositions.push({id:ue.identifier,x:(ue.clientX-Q.left)/Q.scaleX,y:(ue.clientY-Q.top)/Q.scaleY})})):(ee=(z.clientX-Q.left)/Q.scaleX,le=(z.clientY-Q.top)/Q.scaleY,this.pointerPos={x:ee,y:le},this._pointerPositions=[{x:ee,y:le,id:e.Util._getFirstPointerId(z)}],this._changedPointerPositions=[{x:ee,y:le,id:e.Util._getFirstPointerId(z)}])}_setPointerPosition(z){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(z)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var z=this.content.getBoundingClientRect();return{top:z.top,left:z.left,scaleX:z.width/this.content.clientWidth||1,scaleY:z.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!a.Konva.isBrowser){var z=this.container();if(!z)throw"Stage has no container. A container is required.";z.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),z.appendChild(this.content),this._resizeDOM()}}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(z){z.batchDraw()}),this}}l.Stage=W,W.prototype.nodeType=u,(0,f._registerNode)(W),n.Factory.addGetterSetter(W,"container")})(Stage$1);var Layer$2={},Shape={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Shape=l.shapes=void 0;const e=Global,n=Util,t=Factory,a=Node$1,o=Validators,d=Global,f=PointerEvents;var h="hasShadow",u="shadowRGBA",p="patternImage",_="linearGradient",b="radialGradient";let S;function E(){return S||(S=n.Util.createCanvasElement().getContext("2d"),S)}l.shapes={};function g(k){const F=this.attrs.fillRule;F?k.fill(F):k.fill()}function v(k){k.stroke()}function T(k){k.fill()}function R(k){k.stroke()}function x(){this._clearCache(h)}function C(){this._clearCache(u)}function w(){this._clearCache(p)}function P(){this._clearCache(_)}function D(){this._clearCache(b)}class N extends a.Node{constructor(F){super(F);let M;for(;M=n.Util.getRandomColor(),!(M&&!(M in l.shapes)););this.colorKey=M,l.shapes[M]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(h,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(p,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var F=E();const M=F.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(M&&M.setTransform){const U=new n.Transform;U.translate(this.fillPatternX(),this.fillPatternY()),U.rotate(e.Konva.getAngle(this.fillPatternRotation())),U.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),U.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const $=U.getMatrix(),B=typeof DOMMatrix>"u"?{a:$[0],b:$[1],c:$[2],d:$[3],e:$[4],f:$[5]}:new DOMMatrix($);M.setTransform(B)}return M}}_getLinearGradient(){return this._getCache(_,this.__getLinearGradient)}__getLinearGradient(){var F=this.fillLinearGradientColorStops();if(F){for(var M=E(),U=this.fillLinearGradientStartPoint(),$=this.fillLinearGradientEndPoint(),B=M.createLinearGradient(U.x,U.y,$.x,$.y),J=0;J<F.length;J+=2)B.addColorStop(F[J],F[J+1]);return B}}_getRadialGradient(){return this._getCache(b,this.__getRadialGradient)}__getRadialGradient(){var F=this.fillRadialGradientColorStops();if(F){for(var M=E(),U=this.fillRadialGradientStartPoint(),$=this.fillRadialGradientEndPoint(),B=M.createRadialGradient(U.x,U.y,this.fillRadialGradientStartRadius(),$.x,$.y,this.fillRadialGradientEndRadius()),J=0;J<F.length;J+=2)B.addColorStop(F[J],F[J+1]);return B}}getShadowRGBA(){return this._getCache(u,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var F=n.Util.colorToRGBA(this.shadowColor());if(F)return"rgba("+F.r+","+F.g+","+F.b+","+F.a*(this.shadowOpacity()||1)+")"}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const F=this.hitStrokeWidth();return F==="auto"?this.hasStroke():this.strokeEnabled()&&!!F}intersects(F){var M=this.getStage();if(!M)return!1;const U=M.bufferHitCanvas;return U.getContext().clear(),this.drawHit(U,void 0,!0),U.context.getImageData(Math.round(F.x),Math.round(F.y),1,1).data[3]>0}destroy(){return a.Node.prototype.destroy.call(this),delete l.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(F){var M;if(!this.getStage()||!((M=this.attrs.perfectDrawEnabled)!==null&&M!==void 0?M:!0))return!1;const $=F||this.hasFill(),B=this.hasStroke(),J=this.getAbsoluteOpacity()!==1;if($&&B&&J)return!0;const ne=this.hasShadow(),ie=this.shadowForStrokeEnabled();return!!($&&B&&ne&&ie)}setStrokeHitEnabled(F){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),F?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var F=this.size();return{x:this._centroid?-F.width/2:0,y:this._centroid?-F.height/2:0,width:F.width,height:F.height}}getClientRect(F={}){const M=F.skipTransform,U=F.relativeTo,$=this.getSelfRect(),J=!F.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,ne=$.width+J,ie=$.height+J,Y=!F.skipShadow&&this.hasShadow(),q=Y?this.shadowOffsetX():0,re=Y?this.shadowOffsetY():0,ce=ne+Math.abs(q),fe=ie+Math.abs(re),te=Y&&this.shadowBlur()||0,H=ce+te*2,W=fe+te*2,V={width:H,height:W,x:-(J/2+te)+Math.min(q,0)+$.x,y:-(J/2+te)+Math.min(re,0)+$.y};return M?V:this._transformedRect(V,U)}drawScene(F,M){var U=this.getLayer(),$=F||U.getCanvas(),B=$.getContext(),J=this._getCanvasCache(),ne=this.getSceneFunc(),ie=this.hasShadow(),Y,q,re,ce=$.isCache,fe=M===this;if(!this.isVisible()&&!fe)return this;if(J){B.save();var te=this.getAbsoluteTransform(M).getMatrix();return B.transform(te[0],te[1],te[2],te[3],te[4],te[5]),this._drawCachedSceneCanvas(B),B.restore(),this}if(!ne)return this;if(B.save(),this._useBufferCanvas()&&!ce){Y=this.getStage(),q=Y.bufferCanvas,re=q.getContext(),re.clear(),re.save(),re._applyLineJoin(this);var H=this.getAbsoluteTransform(M).getMatrix();re.transform(H[0],H[1],H[2],H[3],H[4],H[5]),ne.call(this,re,this),re.restore();var W=q.pixelRatio;ie&&B._applyShadow(this),B._applyOpacity(this),B._applyGlobalCompositeOperation(this),B.drawImage(q._canvas,0,0,q.width/W,q.height/W)}else{if(B._applyLineJoin(this),!fe){var H=this.getAbsoluteTransform(M).getMatrix();B.transform(H[0],H[1],H[2],H[3],H[4],H[5]),B._applyOpacity(this),B._applyGlobalCompositeOperation(this)}ie&&B._applyShadow(this),ne.call(this,B,this)}return B.restore(),this}drawHit(F,M,U=!1){if(!this.shouldDrawHit(M,U))return this;var $=this.getLayer(),B=F||$.hitCanvas,J=B&&B.getContext(),ne=this.hitFunc()||this.sceneFunc(),ie=this._getCanvasCache(),Y=ie&&ie.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),Y){J.save();var q=this.getAbsoluteTransform(M).getMatrix();return J.transform(q[0],q[1],q[2],q[3],q[4],q[5]),this._drawCachedHitCanvas(J),J.restore(),this}if(!ne)return this;if(J.save(),J._applyLineJoin(this),!(this===M)){var ce=this.getAbsoluteTransform(M).getMatrix();J.transform(ce[0],ce[1],ce[2],ce[3],ce[4],ce[5])}return ne.call(this,J,this),J.restore(),this}drawHitFromCache(F=0){var M=this._getCanvasCache(),U=this._getCachedSceneCanvas(),$=M.hit,B=$.getContext(),J=$.getWidth(),ne=$.getHeight(),ie,Y,q,re,ce,fe;B.clear(),B.drawImage(U._canvas,0,0,J,ne);try{for(ie=B.getImageData(0,0,J,ne),Y=ie.data,q=Y.length,re=n.Util._hexToRgb(this.colorKey),ce=0;ce<q;ce+=4)fe=Y[ce+3],fe>F?(Y[ce]=re.r,Y[ce+1]=re.g,Y[ce+2]=re.b,Y[ce+3]=255):Y[ce+3]=0;B.putImageData(ie,0,0)}catch(te){n.Util.error("Unable to draw hit graph from cached scene canvas. "+te.message)}return this}hasPointerCapture(F){return f.hasPointerCapture(F,this)}setPointerCapture(F){f.setPointerCapture(F,this)}releaseCapture(F){f.releaseCapture(F,this)}}l.Shape=N,N.prototype._fillFunc=g,N.prototype._strokeFunc=v,N.prototype._fillFuncHit=T,N.prototype._strokeFuncHit=R,N.prototype._centroid=!1,N.prototype.nodeType="Shape",(0,d._registerNode)(N),N.prototype.eventListeners={},N.prototype.on.call(N.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",x),N.prototype.on.call(N.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",C),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",w),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",P),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",D),t.Factory.addGetterSetter(N,"stroke",void 0,(0,o.getStringOrGradientValidator)()),t.Factory.addGetterSetter(N,"strokeWidth",2,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillAfterStrokeEnabled",!1),t.Factory.addGetterSetter(N,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),t.Factory.addGetterSetter(N,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),t.Factory.addGetterSetter(N,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),t.Factory.addGetterSetter(N,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),t.Factory.addGetterSetter(N,"lineJoin"),t.Factory.addGetterSetter(N,"lineCap"),t.Factory.addGetterSetter(N,"sceneFunc"),t.Factory.addGetterSetter(N,"hitFunc"),t.Factory.addGetterSetter(N,"dash"),t.Factory.addGetterSetter(N,"dashOffset",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"shadowColor",void 0,(0,o.getStringValidator)()),t.Factory.addGetterSetter(N,"shadowBlur",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"shadowOpacity",1,(0,o.getNumberValidator)()),t.Factory.addComponentsGetterSetter(N,"shadowOffset",["x","y"]),t.Factory.addGetterSetter(N,"shadowOffsetX",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"shadowOffsetY",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillPatternImage"),t.Factory.addGetterSetter(N,"fill",void 0,(0,o.getStringOrGradientValidator)()),t.Factory.addGetterSetter(N,"fillPatternX",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillPatternY",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillLinearGradientColorStops"),t.Factory.addGetterSetter(N,"strokeLinearGradientColorStops"),t.Factory.addGetterSetter(N,"fillRadialGradientStartRadius",0),t.Factory.addGetterSetter(N,"fillRadialGradientEndRadius",0),t.Factory.addGetterSetter(N,"fillRadialGradientColorStops"),t.Factory.addGetterSetter(N,"fillPatternRepeat","repeat"),t.Factory.addGetterSetter(N,"fillEnabled",!0),t.Factory.addGetterSetter(N,"strokeEnabled",!0),t.Factory.addGetterSetter(N,"shadowEnabled",!0),t.Factory.addGetterSetter(N,"dashEnabled",!0),t.Factory.addGetterSetter(N,"strokeScaleEnabled",!0),t.Factory.addGetterSetter(N,"fillPriority","color"),t.Factory.addComponentsGetterSetter(N,"fillPatternOffset",["x","y"]),t.Factory.addGetterSetter(N,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),t.Factory.addComponentsGetterSetter(N,"fillPatternScale",["x","y"]),t.Factory.addGetterSetter(N,"fillPatternScaleX",1,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillPatternScaleY",1,(0,o.getNumberValidator)()),t.Factory.addComponentsGetterSetter(N,"fillLinearGradientStartPoint",["x","y"]),t.Factory.addComponentsGetterSetter(N,"strokeLinearGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(N,"fillLinearGradientStartPointX",0),t.Factory.addGetterSetter(N,"strokeLinearGradientStartPointX",0),t.Factory.addGetterSetter(N,"fillLinearGradientStartPointY",0),t.Factory.addGetterSetter(N,"strokeLinearGradientStartPointY",0),t.Factory.addComponentsGetterSetter(N,"fillLinearGradientEndPoint",["x","y"]),t.Factory.addComponentsGetterSetter(N,"strokeLinearGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(N,"fillLinearGradientEndPointX",0),t.Factory.addGetterSetter(N,"strokeLinearGradientEndPointX",0),t.Factory.addGetterSetter(N,"fillLinearGradientEndPointY",0),t.Factory.addGetterSetter(N,"strokeLinearGradientEndPointY",0),t.Factory.addComponentsGetterSetter(N,"fillRadialGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(N,"fillRadialGradientStartPointX",0),t.Factory.addGetterSetter(N,"fillRadialGradientStartPointY",0),t.Factory.addComponentsGetterSetter(N,"fillRadialGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(N,"fillRadialGradientEndPointX",0),t.Factory.addGetterSetter(N,"fillRadialGradientEndPointY",0),t.Factory.addGetterSetter(N,"fillPatternRotation",0),t.Factory.addGetterSetter(N,"fillRule",void 0,(0,o.getStringValidator)()),t.Factory.backCompat(N,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Shape);Object.defineProperty(Layer$2,"__esModule",{value:!0});Layer$2.Layer=void 0;const Util_1$b=Util,Container_1$1=Container$2,Node_1$g=Node$1,Factory_1$w=Factory,Canvas_1=Canvas$1,Validators_1$v=Validators,Shape_1$g=Shape,Global_1$k=Global;var HASH="#",BEFORE_DRAW="beforeDraw",DRAW="draw",INTERSECTION_OFFSETS=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],INTERSECTION_OFFSETS_LEN=INTERSECTION_OFFSETS.length;let Layer$1=class extends Container_1$1.Container{constructor(e){super(e),this.canvas=new Canvas_1.SceneCanvas,this.hitCanvas=new Canvas_1.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[e+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Node_1$g.Node.prototype.moveToTop.call(this);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var e=Node_1$g.Node.prototype.moveUp.call(this);if(!e)return!1;var n=this.getStage();return!n||!n.content?!1:(n.content.removeChild(this.getNativeCanvasElement()),this.index<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[this.index+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(Node_1$g.Node.prototype.moveDown.call(this)){var e=this.getStage();if(e){var n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Node_1$g.Node.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var e=this.getNativeCanvasElement();return Node_1$g.Node.prototype.remove.call(this),e&&e.parentNode&&Util_1$b.Util._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:n}){return this.canvas.setSize(e,n),this.hitCanvas.setSize(e,n),this._setSmoothEnabled(),this}_validateAdd(e){var n=e.getType();n!=="Group"&&n!=="Shape"&&Util_1$b.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e=e||{},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),Node_1$g.Node.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Util_1$b.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Util_1$b.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Util_1$b.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var n=1,t=!1;;){for(let a=0;a<INTERSECTION_OFFSETS_LEN;a++){const o=INTERSECTION_OFFSETS[a],d=this._getIntersection({x:e.x+o.x*n,y:e.y+o.y*n}),f=d.shape;if(f)return f;if(t=!!d.antialiased,!d.antialiased)break}if(t)n+=1;else return null}}_getIntersection(e){const n=this.hitCanvas.pixelRatio,t=this.hitCanvas.context.getImageData(Math.round(e.x*n),Math.round(e.y*n),1,1).data,a=t[3];if(a===255){const o=Util_1$b.Util._rgbToHex(t[0],t[1],t[2]),d=Shape_1$g.shapes[HASH+o];return d?{shape:d}:{antialiased:!0}}else if(a>0)return{antialiased:!0};return{}}drawScene(e,n){var t=this.getLayer(),a=e||t&&t.getCanvas();return this._fire(BEFORE_DRAW,{node:this}),this.clearBeforeDraw()&&a.getContext().clear(),Container_1$1.Container.prototype.drawScene.call(this,a,n),this._fire(DRAW,{node:this}),this}drawHit(e,n){var t=this.getLayer(),a=e||t&&t.hitCanvas;return t&&t.clearBeforeDraw()&&t.getHitCanvas().getContext().clear(),Container_1$1.Container.prototype.drawHit.call(this,a,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Util_1$b.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Util_1$b.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return Util_1$b.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Layer$2.Layer=Layer$1;Layer$1.prototype.nodeType="Layer";(0,Global_1$k._registerNode)(Layer$1);Factory_1$w.Factory.addGetterSetter(Layer$1,"imageSmoothingEnabled",!0);Factory_1$w.Factory.addGetterSetter(Layer$1,"clearBeforeDraw",!0);Factory_1$w.Factory.addGetterSetter(Layer$1,"hitGraphEnabled",!0,(0,Validators_1$v.getBooleanValidator)());var FastLayer$1={};Object.defineProperty(FastLayer$1,"__esModule",{value:!0});FastLayer$1.FastLayer=void 0;const Util_1$a=Util,Layer_1=Layer$2,Global_1$j=Global;class FastLayer extends Layer_1.Layer{constructor(e){super(e),this.listening(!1),Util_1$a.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}FastLayer$1.FastLayer=FastLayer;FastLayer.prototype.nodeType="FastLayer";(0,Global_1$j._registerNode)(FastLayer);var Group$2={};Object.defineProperty(Group$2,"__esModule",{value:!0});Group$2.Group=void 0;const Util_1$9=Util,Container_1=Container$2,Global_1$i=Global;let Group$1=class extends Container_1.Container{_validateAdd(e){var n=e.getType();n!=="Group"&&n!=="Shape"&&Util_1$9.Util.throw("You may only add groups and shapes to groups.")}};Group$2.Group=Group$1;Group$1.prototype.nodeType="Group";(0,Global_1$i._registerNode)(Group$1);var Animation$2={};Object.defineProperty(Animation$2,"__esModule",{value:!0});Animation$2.Animation=void 0;const Global_1$h=Global,Util_1$8=Util,now=function(){return Global_1$h.glob.performance&&Global_1$h.glob.performance.now?function(){return Global_1$h.glob.performance.now()}:function(){return new Date().getTime()}}();let Animation$1=class au{constructor(e,n){this.id=au.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:now(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];return e&&(n=Array.isArray(e)?e:[e]),this.layers=n,this}getLayers(){return this.layers}addLayer(e){const n=this.layers,t=n.length;for(let a=0;a<t;a++)if(n[a]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){const n=au.animations,t=n.length;for(let a=0;a<t;a++)if(n[a].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=now(),au._addAnimation(this),this}stop(){return au._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){const n=e.id,t=this.animations,a=t.length;for(let o=0;o<a;o++)if(t[o].id===n){this.animations.splice(o,1);break}}static _runFrames(){const e={},n=this.animations;for(let t=0;t<n.length;t++){const a=n[t],o=a.layers,d=a.func;a._updateFrameObject(now());const f=o.length;let h;if(d?h=d.call(a,a.frame)!==!1:h=!0,!!h)for(let u=0;u<f;u++){const p=o[u];p._id!==void 0&&(e[p._id]=p)}}for(let t in e)e.hasOwnProperty(t)&&e[t].batchDraw()}static _animationLoop(){const e=au;e.animations.length?(e._runFrames(),Util_1$8.Util.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Util_1$8.Util.requestAnimFrame(this._animationLoop))}};Animation$2.Animation=Animation$1;Animation$1.animations=[];Animation$1.animIdCounter=0;Animation$1.animRunning=!1;var Tween$1={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Easings=l.Tween=void 0;const e=Util,n=Animation$2,t=Node$1,a=Global;var o={node:1,duration:1,easing:1,onFinish:1,yoyo:1},d=1,f=2,h=3,u=0,p=["fill","stroke","shadowColor"];class _{constructor(E,g,v,T,R,x,C){this.prop=E,this.propFunc=g,this.begin=T,this._pos=T,this.duration=x,this._change=0,this.prevPos=0,this.yoyo=C,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=v,this._change=R-this.begin,this.pause()}fire(E){var g=this[E];g&&g()}setTime(E){E>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():E<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=E,this.update())}getTime(){return this._time}setPosition(E){this.prevPos=this._pos,this.propFunc(E),this._pos=E}getPosition(E){return E===void 0&&(E=this._time),this.func(E,this.begin,this._change,this.duration)}play(){this.state=f,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=h,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(E){this.pause(),this._time=E,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var E=this.getTimer()-this._startTime;this.state===f?this.setTime(E):this.state===h&&this.setTime(this.duration-E)}pause(){this.state=d,this.fire("onPause")}getTimer(){return new Date().getTime()}}class b{constructor(E){var g=this,v=E.node,T=v._id,R,x=E.easing||l.Easings.Linear,C=!!E.yoyo,w;typeof E.duration>"u"?R=.3:E.duration===0?R=.001:R=E.duration,this.node=v,this._id=u++;var P=v.getLayer()||(v instanceof a.Konva.Stage?v.getLayers():null);P||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){g.tween.onEnterFrame()},P),this.tween=new _(w,function(D){g._tweenFunc(D)},x,0,1,R*1e3,C),this._addListeners(),b.attrs[T]||(b.attrs[T]={}),b.attrs[T][this._id]||(b.attrs[T][this._id]={}),b.tweens[T]||(b.tweens[T]={});for(w in E)o[w]===void 0&&this._addAttr(w,E[w]);this.reset(),this.onFinish=E.onFinish,this.onReset=E.onReset,this.onUpdate=E.onUpdate}_addAttr(E,g){var v=this.node,T=v._id,R,x,C,w,P,D,N,k;if(C=b.tweens[T][E],C&&delete b.attrs[T][C][E],R=v.getAttr(E),e.Util._isArray(g))if(x=[],P=Math.max(g.length,R.length),E==="points"&&g.length!==R.length&&(g.length>R.length?(N=R,R=e.Util._prepareArrayForTween(R,g,v.closed())):(D=g,g=e.Util._prepareArrayForTween(g,R,v.closed()))),E.indexOf("fill")===0)for(w=0;w<P;w++)if(w%2===0)x.push(g[w]-R[w]);else{var F=e.Util.colorToRGBA(R[w]);k=e.Util.colorToRGBA(g[w]),R[w]=F,x.push({r:k.r-F.r,g:k.g-F.g,b:k.b-F.b,a:k.a-F.a})}else for(w=0;w<P;w++)x.push(g[w]-R[w]);else p.indexOf(E)!==-1?(R=e.Util.colorToRGBA(R),k=e.Util.colorToRGBA(g),x={r:k.r-R.r,g:k.g-R.g,b:k.b-R.b,a:k.a-R.a}):x=g-R;b.attrs[T][this._id][E]={start:R,diff:x,end:g,trueEnd:D,trueStart:N},b.tweens[T][E]=this._id}_tweenFunc(E){var g=this.node,v=b.attrs[g._id][this._id],T,R,x,C,w,P,D,N;for(T in v){if(R=v[T],x=R.start,C=R.diff,N=R.end,e.Util._isArray(x))if(w=[],D=Math.max(x.length,N.length),T.indexOf("fill")===0)for(P=0;P<D;P++)P%2===0?w.push((x[P]||0)+C[P]*E):w.push("rgba("+Math.round(x[P].r+C[P].r*E)+","+Math.round(x[P].g+C[P].g*E)+","+Math.round(x[P].b+C[P].b*E)+","+(x[P].a+C[P].a*E)+")");else for(P=0;P<D;P++)w.push((x[P]||0)+C[P]*E);else p.indexOf(T)!==-1?w="rgba("+Math.round(x.r+C.r*E)+","+Math.round(x.g+C.g*E)+","+Math.round(x.b+C.b*E)+","+(x.a+C.a*E)+")":w=x+C*E;g.setAttr(T,w)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var E=this.node,g=b.attrs[E._id][this._id];g.points&&g.points.trueEnd&&E.setAttr("points",g.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var E=this.node,g=b.attrs[E._id][this._id];g.points&&g.points.trueStart&&E.points(g.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(E){return this.tween.seek(E*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var E=this.node._id,g=this._id,v=b.tweens[E],T;this.pause();for(T in v)delete b.tweens[E][T];delete b.attrs[E][g]}}l.Tween=b,b.attrs={},b.tweens={},t.Node.prototype.to=function(S){var E=S.onFinish;S.node=this,S.onFinish=function(){this.destroy(),E&&E()};var g=new b(S);g.play()},l.Easings={BackEaseIn(S,E,g,v){var T=1.70158;return g*(S/=v)*S*((T+1)*S-T)+E},BackEaseOut(S,E,g,v){var T=1.70158;return g*((S=S/v-1)*S*((T+1)*S+T)+1)+E},BackEaseInOut(S,E,g,v){var T=1.70158;return(S/=v/2)<1?g/2*(S*S*(((T*=1.525)+1)*S-T))+E:g/2*((S-=2)*S*(((T*=1.525)+1)*S+T)+2)+E},ElasticEaseIn(S,E,g,v,T,R){var x=0;return S===0?E:(S/=v)===1?E+g:(R||(R=v*.3),!T||T<Math.abs(g)?(T=g,x=R/4):x=R/(2*Math.PI)*Math.asin(g/T),-(T*Math.pow(2,10*(S-=1))*Math.sin((S*v-x)*(2*Math.PI)/R))+E)},ElasticEaseOut(S,E,g,v,T,R){var x=0;return S===0?E:(S/=v)===1?E+g:(R||(R=v*.3),!T||T<Math.abs(g)?(T=g,x=R/4):x=R/(2*Math.PI)*Math.asin(g/T),T*Math.pow(2,-10*S)*Math.sin((S*v-x)*(2*Math.PI)/R)+g+E)},ElasticEaseInOut(S,E,g,v,T,R){var x=0;return S===0?E:(S/=v/2)===2?E+g:(R||(R=v*(.3*1.5)),!T||T<Math.abs(g)?(T=g,x=R/4):x=R/(2*Math.PI)*Math.asin(g/T),S<1?-.5*(T*Math.pow(2,10*(S-=1))*Math.sin((S*v-x)*(2*Math.PI)/R))+E:T*Math.pow(2,-10*(S-=1))*Math.sin((S*v-x)*(2*Math.PI)/R)*.5+g+E)},BounceEaseOut(S,E,g,v){return(S/=v)<1/2.75?g*(7.5625*S*S)+E:S<2/2.75?g*(7.5625*(S-=1.5/2.75)*S+.75)+E:S<2.5/2.75?g*(7.5625*(S-=2.25/2.75)*S+.9375)+E:g*(7.5625*(S-=2.625/2.75)*S+.984375)+E},BounceEaseIn(S,E,g,v){return g-l.Easings.BounceEaseOut(v-S,0,g,v)+E},BounceEaseInOut(S,E,g,v){return S<v/2?l.Easings.BounceEaseIn(S*2,0,g,v)*.5+E:l.Easings.BounceEaseOut(S*2-v,0,g,v)*.5+g*.5+E},EaseIn(S,E,g,v){return g*(S/=v)*S+E},EaseOut(S,E,g,v){return-g*(S/=v)*(S-2)+E},EaseInOut(S,E,g,v){return(S/=v/2)<1?g/2*S*S+E:-g/2*(--S*(S-2)-1)+E},StrongEaseIn(S,E,g,v){return g*(S/=v)*S*S*S*S+E},StrongEaseOut(S,E,g,v){return g*((S=S/v-1)*S*S*S*S+1)+E},StrongEaseInOut(S,E,g,v){return(S/=v/2)<1?g/2*S*S*S*S*S+E:g/2*((S-=2)*S*S*S*S+2)+E},Linear(S,E,g,v){return g*S/v+E}}})(Tween$1);(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Konva=void 0;const e=Global,n=Util,t=Node$1,a=Container$2,o=Stage$1,d=Layer$2,f=FastLayer$1,h=Group$2,u=DragAndDrop,p=Shape,_=Animation$2,b=Tween$1,S=Context$2,E=Canvas$1;l.Konva=n.Util._assign(e.Konva,{Util:n.Util,Transform:n.Transform,Node:t.Node,Container:a.Container,Stage:o.Stage,stages:o.stages,Layer:d.Layer,FastLayer:f.FastLayer,Group:h.Group,DD:u.DD,Shape:p.Shape,shapes:p.shapes,Animation:_.Animation,Tween:b.Tween,Easings:b.Easings,Context:S.Context,Canvas:E.Canvas}),l.default=l.Konva})(_CoreInternals);var Arc$1={};Object.defineProperty(Arc$1,"__esModule",{value:!0});Arc$1.Arc=void 0;const Factory_1$v=Factory,Shape_1$f=Shape,Global_1$g=Global,Validators_1$u=Validators,Global_2$2=Global;class Arc extends Shape_1$f.Shape{_sceneFunc(e){var n=Global_1$g.Konva.getAngle(this.angle()),t=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,n,t),e.arc(0,0,this.innerRadius(),n,0,!t),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),n=this.outerRadius(),t=this.clockwise(),a=Global_1$g.Konva.getAngle(t?360-this.angle():this.angle()),o=Math.cos(Math.min(a,Math.PI)),d=1,f=Math.sin(Math.min(Math.max(Math.PI,a),3*Math.PI/2)),h=Math.sin(Math.min(a,Math.PI/2)),u=o*(o>0?e:n),p=d*n,_=f*(f>0?e:n),b=h*(h>0?n:e);return{x:u,y:t?-1*b:_,width:p-u,height:b-_}}}Arc$1.Arc=Arc;Arc.prototype._centroid=!0;Arc.prototype.className="Arc";Arc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_2$2._registerNode)(Arc);Factory_1$v.Factory.addGetterSetter(Arc,"innerRadius",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"outerRadius",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"angle",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"clockwise",!1,(0,Validators_1$u.getBooleanValidator)());var Arrow$1={},Line$2={};Object.defineProperty(Line$2,"__esModule",{value:!0});Line$2.Line=void 0;const Factory_1$u=Factory,Shape_1$e=Shape,Validators_1$t=Validators,Global_1$f=Global;function getControlPoints(l,e,n,t,a,o,d){var f=Math.sqrt(Math.pow(n-l,2)+Math.pow(t-e,2)),h=Math.sqrt(Math.pow(a-n,2)+Math.pow(o-t,2)),u=d*f/(f+h),p=d*h/(f+h),_=n-u*(a-l),b=t-u*(o-e),S=n+p*(a-l),E=t+p*(o-e);return[_,b,S,E]}function expandPoints(l,e){var n=l.length,t=[],a,o;for(a=2;a<n-2;a+=2)o=getControlPoints(l[a-2],l[a-1],l[a],l[a+1],l[a+2],l[a+3],e),!isNaN(o[0])&&(t.push(o[0]),t.push(o[1]),t.push(l[a]),t.push(l[a+1]),t.push(o[2]),t.push(o[3]));return t}let Line$1=class extends Shape_1$e.Shape{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){var n=this.points(),t=n.length,a=this.tension(),o=this.closed(),d=this.bezier(),f,h,u;if(t){if(e.beginPath(),e.moveTo(n[0],n[1]),a!==0&&t>4){for(f=this.getTensionPoints(),h=f.length,u=o?0:4,o||e.quadraticCurveTo(f[0],f[1],f[2],f[3]);u<h-2;)e.bezierCurveTo(f[u++],f[u++],f[u++],f[u++],f[u++],f[u++]);o||e.quadraticCurveTo(f[h-2],f[h-1],n[t-2],n[t-1])}else if(d)for(u=2;u<t;)e.bezierCurveTo(n[u++],n[u++],n[u++],n[u++],n[u++],n[u++]);else for(u=2;u<t;u+=2)e.lineTo(n[u],n[u+1]);o?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():expandPoints(this.points(),this.tension())}_getTensionPointsClosed(){var e=this.points(),n=e.length,t=this.tension(),a=getControlPoints(e[n-2],e[n-1],e[0],e[1],e[2],e[3],t),o=getControlPoints(e[n-4],e[n-3],e[n-2],e[n-1],e[0],e[1],t),d=expandPoints(e,t),f=[a[2],a[3]].concat(d).concat([o[0],o[1],e[n-2],e[n-1],o[2],o[3],a[0],a[1],e[0],e[1]]);return f}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:e=this.points();for(var n=e[0],t=e[0],a=e[1],o=e[1],d,f,h=0;h<e.length/2;h++)d=e[h*2],f=e[h*2+1],n=Math.min(n,d),t=Math.max(t,d),a=Math.min(a,f),o=Math.max(o,f);return{x:n,y:a,width:t-n,height:o-a}}};Line$2.Line=Line$1;Line$1.prototype.className="Line";Line$1.prototype._attrsAffectingSize=["points","bezier","tension"];(0,Global_1$f._registerNode)(Line$1);Factory_1$u.Factory.addGetterSetter(Line$1,"closed",!1);Factory_1$u.Factory.addGetterSetter(Line$1,"bezier",!1);Factory_1$u.Factory.addGetterSetter(Line$1,"tension",0,(0,Validators_1$t.getNumberValidator)());Factory_1$u.Factory.addGetterSetter(Line$1,"points",[],(0,Validators_1$t.getNumberArrayValidator)());var Path$1={},BezierFunctions={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.t2length=l.getQuadraticArcLength=l.getCubicArcLength=l.binomialCoefficients=l.cValues=l.tValues=void 0,l.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],l.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],l.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const e=(d,f,h)=>{let u,p,_;u=h/2,p=0;for(let S=0;S<20;S++)_=u*l.tValues[20][S]+u,p+=l.cValues[20][S]*t(d,f,_);return u*p};l.getCubicArcLength=e;const n=(d,f,h)=>{h===void 0&&(h=1);const u=d[0]-2*d[1]+d[2],p=f[0]-2*f[1]+f[2],_=2*d[1]-2*d[0],b=2*f[1]-2*f[0],S=4*(u*u+p*p),E=4*(u*_+p*b),g=_*_+b*b;if(S===0)return h*Math.sqrt(Math.pow(d[2]-d[0],2)+Math.pow(f[2]-f[0],2));const v=E/(2*S),T=g/S,R=h+v,x=T-v*v,C=R*R+x>0?Math.sqrt(R*R+x):0,w=v*v+x>0?Math.sqrt(v*v+x):0,P=v+Math.sqrt(v*v+x)!==0?x*Math.log(Math.abs((R+C)/(v+w))):0;return Math.sqrt(S)/2*(R*C-v*w+P)};l.getQuadraticArcLength=n;function t(d,f,h){const u=a(1,h,d),p=a(1,h,f),_=u*u+p*p;return Math.sqrt(_)}const a=(d,f,h)=>{const u=h.length-1;let p,_;if(u===0)return 0;if(d===0){_=0;for(let b=0;b<=u;b++)_+=l.binomialCoefficients[u][b]*Math.pow(1-f,u-b)*Math.pow(f,b)*h[b];return _}else{p=new Array(u);for(let b=0;b<u;b++)p[b]=u*(h[b+1]-h[b]);return a(d-1,f,p)}},o=(d,f,h)=>{let u=1,p=d/f,_=(d-h(p))/f,b=0;for(;u>.001;){const S=h(p+_),E=Math.abs(d-S)/f;if(E<u)u=E,p+=_;else{const g=h(p-_),v=Math.abs(d-g)/f;v<u?(u=v,p-=_):_/=2}if(b++,b>500)break}return p};l.t2length=o})(BezierFunctions);Object.defineProperty(Path$1,"__esModule",{value:!0});Path$1.Path=void 0;const Factory_1$t=Factory,Shape_1$d=Shape,Global_1$e=Global,BezierFunctions_1=BezierFunctions;class Path extends Shape_1$d.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Path.parsePathData(this.data()),this.pathLength=Path.getPathLength(this.dataArray)}_sceneFunc(e){var n=this.dataArray;e.beginPath();for(var t=!1,a=0;a<n.length;a++){var o=n[a].command,d=n[a].points;switch(o){case"L":e.lineTo(d[0],d[1]);break;case"M":e.moveTo(d[0],d[1]);break;case"C":e.bezierCurveTo(d[0],d[1],d[2],d[3],d[4],d[5]);break;case"Q":e.quadraticCurveTo(d[0],d[1],d[2],d[3]);break;case"A":var f=d[0],h=d[1],u=d[2],p=d[3],_=d[4],b=d[5],S=d[6],E=d[7],g=u>p?u:p,v=u>p?1:u/p,T=u>p?p/u:1;e.translate(f,h),e.rotate(S),e.scale(v,T),e.arc(0,0,g,_,_+b,1-E),e.scale(1/v,1/T),e.rotate(-S),e.translate(-f,-h);break;case"z":t=!0,e.closePath();break}}!t&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(u){if(u.command==="A"){var p=u.points[4],_=u.points[5],b=u.points[4]+_,S=Math.PI/180;if(Math.abs(p-b)<S&&(S=Math.abs(p-b)),_<0)for(let E=p-S;E>b;E-=S){const g=Path.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],E,0);e.push(g.x,g.y)}else for(let E=p+S;E<b;E+=S){const g=Path.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],E,0);e.push(g.x,g.y)}}else if(u.command==="C")for(let E=0;E<=1;E+=.01){const g=Path.getPointOnCubicBezier(E,u.start.x,u.start.y,u.points[0],u.points[1],u.points[2],u.points[3],u.points[4],u.points[5]);e.push(g.x,g.y)}else e=e.concat(u.points)});for(var n=e[0],t=e[0],a=e[1],o=e[1],d,f,h=0;h<e.length/2;h++)d=e[h*2],f=e[h*2+1],isNaN(d)||(n=Math.min(n,d),t=Math.max(t,d)),isNaN(f)||(a=Math.min(a,f),o=Math.max(o,f));return{x:n,y:a,width:t-n,height:o-a}}getLength(){return this.pathLength}getPointAtLength(e){return Path.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,n,t,a){return Math.sqrt((t-e)*(t-e)+(a-n)*(a-n))}static getPathLength(e){let n=0;for(var t=0;t<e.length;++t)n+=e[t].pathLength;return n}static getPointAtLengthOfDataArray(e,n){var t,a=0,o=n.length;if(!o)return null;for(;a<o&&e>n[a].pathLength;)e-=n[a].pathLength,++a;if(a===o)return t=n[a-1].points.slice(-2),{x:t[0],y:t[1]};if(e<.01)return t=n[a].points.slice(0,2),{x:t[0],y:t[1]};var d=n[a],f=d.points;switch(d.command){case"L":return Path.getPointOnLine(e,d.start.x,d.start.y,f[0],f[1]);case"C":return Path.getPointOnCubicBezier((0,BezierFunctions_1.t2length)(e,Path.getPathLength(n),g=>(0,BezierFunctions_1.getCubicArcLength)([d.start.x,f[0],f[2],f[4]],[d.start.y,f[1],f[3],f[5]],g)),d.start.x,d.start.y,f[0],f[1],f[2],f[3],f[4],f[5]);case"Q":return Path.getPointOnQuadraticBezier((0,BezierFunctions_1.t2length)(e,Path.getPathLength(n),g=>(0,BezierFunctions_1.getQuadraticArcLength)([d.start.x,f[0],f[2]],[d.start.y,f[1],f[3]],g)),d.start.x,d.start.y,f[0],f[1],f[2],f[3]);case"A":var h=f[0],u=f[1],p=f[2],_=f[3],b=f[4],S=f[5],E=f[6];return b+=S*e/d.pathLength,Path.getPointOnEllipticalArc(h,u,p,_,b,E)}return null}static getPointOnLine(e,n,t,a,o,d,f){d===void 0&&(d=n),f===void 0&&(f=t);var h=(o-t)/(a-n+1e-8),u=Math.sqrt(e*e/(1+h*h));a<n&&(u*=-1);var p=h*u,_;if(a===n)_={x:d,y:f+p};else if((f-t)/(d-n+1e-8)===h)_={x:d+u,y:f+p};else{var b,S,E=this.getLineLength(n,t,a,o),g=(d-n)*(a-n)+(f-t)*(o-t);g=g/(E*E),b=n+g*(a-n),S=t+g*(o-t);var v=this.getLineLength(d,f,b,S),T=Math.sqrt(e*e-v*v);u=Math.sqrt(T*T/(1+h*h)),a<n&&(u*=-1),p=h*u,_={x:b+u,y:S+p}}return _}static getPointOnCubicBezier(e,n,t,a,o,d,f,h,u){function p(v){return v*v*v}function _(v){return 3*v*v*(1-v)}function b(v){return 3*v*(1-v)*(1-v)}function S(v){return(1-v)*(1-v)*(1-v)}var E=h*p(e)+d*_(e)+a*b(e)+n*S(e),g=u*p(e)+f*_(e)+o*b(e)+t*S(e);return{x:E,y:g}}static getPointOnQuadraticBezier(e,n,t,a,o,d,f){function h(S){return S*S}function u(S){return 2*S*(1-S)}function p(S){return(1-S)*(1-S)}var _=d*h(e)+a*u(e)+n*p(e),b=f*h(e)+o*u(e)+t*p(e);return{x:_,y:b}}static getPointOnEllipticalArc(e,n,t,a,o,d){var f=Math.cos(d),h=Math.sin(d),u={x:t*Math.cos(o),y:a*Math.sin(o)};return{x:e+(u.x*f-u.y*h),y:n+(u.x*h+u.y*f)}}static parsePathData(e){if(!e)return[];var n=e,t=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(var a=0;a<t.length;a++)n=n.replace(new RegExp(t[a],"g"),"|"+t[a]);var o=n.split("|"),d=[],f=[],h=0,u=0,p=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,_;for(a=1;a<o.length;a++){var b=o[a],S=b.charAt(0);for(b=b.slice(1),f.length=0;_=p.exec(b);)f.push(_[0]);for(var E=[],g=0,v=f.length;g<v;g++){if(f[g]==="00"){E.push(0,0);continue}var T=parseFloat(f[g]);isNaN(T)?E.push(0):E.push(T)}for(;E.length>0&&!isNaN(E[0]);){var R="",x=[],C=h,w=u,P,D,N,k,F,M,U,$,B,J;switch(S){case"l":h+=E.shift(),u+=E.shift(),R="L",x.push(h,u);break;case"L":h=E.shift(),u=E.shift(),x.push(h,u);break;case"m":var ne=E.shift(),ie=E.shift();if(h+=ne,u+=ie,R="M",d.length>2&&d[d.length-1].command==="z"){for(var Y=d.length-2;Y>=0;Y--)if(d[Y].command==="M"){h=d[Y].points[0]+ne,u=d[Y].points[1]+ie;break}}x.push(h,u),S="l";break;case"M":h=E.shift(),u=E.shift(),R="M",x.push(h,u),S="L";break;case"h":h+=E.shift(),R="L",x.push(h,u);break;case"H":h=E.shift(),R="L",x.push(h,u);break;case"v":u+=E.shift(),R="L",x.push(h,u);break;case"V":u=E.shift(),R="L",x.push(h,u);break;case"C":x.push(E.shift(),E.shift(),E.shift(),E.shift()),h=E.shift(),u=E.shift(),x.push(h,u);break;case"c":x.push(h+E.shift(),u+E.shift(),h+E.shift(),u+E.shift()),h+=E.shift(),u+=E.shift(),R="C",x.push(h,u);break;case"S":D=h,N=u,P=d[d.length-1],P.command==="C"&&(D=h+(h-P.points[2]),N=u+(u-P.points[3])),x.push(D,N,E.shift(),E.shift()),h=E.shift(),u=E.shift(),R="C",x.push(h,u);break;case"s":D=h,N=u,P=d[d.length-1],P.command==="C"&&(D=h+(h-P.points[2]),N=u+(u-P.points[3])),x.push(D,N,h+E.shift(),u+E.shift()),h+=E.shift(),u+=E.shift(),R="C",x.push(h,u);break;case"Q":x.push(E.shift(),E.shift()),h=E.shift(),u=E.shift(),x.push(h,u);break;case"q":x.push(h+E.shift(),u+E.shift()),h+=E.shift(),u+=E.shift(),R="Q",x.push(h,u);break;case"T":D=h,N=u,P=d[d.length-1],P.command==="Q"&&(D=h+(h-P.points[0]),N=u+(u-P.points[1])),h=E.shift(),u=E.shift(),R="Q",x.push(D,N,h,u);break;case"t":D=h,N=u,P=d[d.length-1],P.command==="Q"&&(D=h+(h-P.points[0]),N=u+(u-P.points[1])),h+=E.shift(),u+=E.shift(),R="Q",x.push(D,N,h,u);break;case"A":k=E.shift(),F=E.shift(),M=E.shift(),U=E.shift(),$=E.shift(),B=h,J=u,h=E.shift(),u=E.shift(),R="A",x=this.convertEndpointToCenterParameterization(B,J,h,u,U,$,k,F,M);break;case"a":k=E.shift(),F=E.shift(),M=E.shift(),U=E.shift(),$=E.shift(),B=h,J=u,h+=E.shift(),u+=E.shift(),R="A",x=this.convertEndpointToCenterParameterization(B,J,h,u,U,$,k,F,M);break}d.push({command:R||S,points:x,start:{x:C,y:w},pathLength:this.calcLength(C,w,R||S,x)})}(S==="z"||S==="Z")&&d.push({command:"z",points:[],start:void 0,pathLength:0})}return d}static calcLength(e,n,t,a){var o,d,f,h,u=Path;switch(t){case"L":return u.getLineLength(e,n,a[0],a[1]);case"C":return(0,BezierFunctions_1.getCubicArcLength)([e,a[0],a[2],a[4]],[n,a[1],a[3],a[5]],1);case"Q":return(0,BezierFunctions_1.getQuadraticArcLength)([e,a[0],a[2]],[n,a[1],a[3]],1);case"A":o=0;var p=a[4],_=a[5],b=a[4]+_,S=Math.PI/180;if(Math.abs(p-b)<S&&(S=Math.abs(p-b)),d=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],p,0),_<0)for(h=p-S;h>b;h-=S)f=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],h,0),o+=u.getLineLength(d.x,d.y,f.x,f.y),d=f;else for(h=p+S;h<b;h+=S)f=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],h,0),o+=u.getLineLength(d.x,d.y,f.x,f.y),d=f;return f=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],b,0),o+=u.getLineLength(d.x,d.y,f.x,f.y),o}return 0}static convertEndpointToCenterParameterization(e,n,t,a,o,d,f,h,u){var p=u*(Math.PI/180),_=Math.cos(p)*(e-t)/2+Math.sin(p)*(n-a)/2,b=-1*Math.sin(p)*(e-t)/2+Math.cos(p)*(n-a)/2,S=_*_/(f*f)+b*b/(h*h);S>1&&(f*=Math.sqrt(S),h*=Math.sqrt(S));var E=Math.sqrt((f*f*(h*h)-f*f*(b*b)-h*h*(_*_))/(f*f*(b*b)+h*h*(_*_)));o===d&&(E*=-1),isNaN(E)&&(E=0);var g=E*f*b/h,v=E*-h*_/f,T=(e+t)/2+Math.cos(p)*g-Math.sin(p)*v,R=(n+a)/2+Math.sin(p)*g+Math.cos(p)*v,x=function(F){return Math.sqrt(F[0]*F[0]+F[1]*F[1])},C=function(F,M){return(F[0]*M[0]+F[1]*M[1])/(x(F)*x(M))},w=function(F,M){return(F[0]*M[1]<F[1]*M[0]?-1:1)*Math.acos(C(F,M))},P=w([1,0],[(_-g)/f,(b-v)/h]),D=[(_-g)/f,(b-v)/h],N=[(-1*_-g)/f,(-1*b-v)/h],k=w(D,N);return C(D,N)<=-1&&(k=Math.PI),C(D,N)>=1&&(k=0),d===0&&k>0&&(k=k-2*Math.PI),d===1&&k<0&&(k=k+2*Math.PI),[T,R,f,h,P,k,p,d]}}Path$1.Path=Path;Path.prototype.className="Path";Path.prototype._attrsAffectingSize=["data"];(0,Global_1$e._registerNode)(Path);Factory_1$t.Factory.addGetterSetter(Path,"data");Object.defineProperty(Arrow$1,"__esModule",{value:!0});Arrow$1.Arrow=void 0;const Factory_1$s=Factory,Line_1$1=Line$2,Validators_1$s=Validators,Global_1$d=Global,Path_1$2=Path$1;class Arrow extends Line_1$1.Line{_sceneFunc(e){super._sceneFunc(e);var n=Math.PI*2,t=this.points(),a=t,o=this.tension()!==0&&t.length>4;o&&(a=this.getTensionPoints());var d=this.pointerLength(),f=t.length,h,u;if(o){const b=[a[a.length-4],a[a.length-3],a[a.length-2],a[a.length-1],t[f-2],t[f-1]],S=Path_1$2.Path.calcLength(a[a.length-4],a[a.length-3],"C",b),E=Path_1$2.Path.getPointOnQuadraticBezier(Math.min(1,1-d/S),b[0],b[1],b[2],b[3],b[4],b[5]);h=t[f-2]-E.x,u=t[f-1]-E.y}else h=t[f-2]-t[f-4],u=t[f-1]-t[f-3];var p=(Math.atan2(u,h)+n)%n,_=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(t[f-2],t[f-1]),e.rotate(p),e.moveTo(0,0),e.lineTo(-d,_/2),e.lineTo(-d,-_/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(t[0],t[1]),o?(h=(a[0]+a[2])/2-t[0],u=(a[1]+a[3])/2-t[1]):(h=t[2]-t[0],u=t[3]-t[1]),e.rotate((Math.atan2(-u,-h)+n)%n),e.moveTo(0,0),e.lineTo(-d,_/2),e.lineTo(-d,-_/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}}Arrow$1.Arrow=Arrow;Arrow.prototype.className="Arrow";(0,Global_1$d._registerNode)(Arrow);Factory_1$s.Factory.addGetterSetter(Arrow,"pointerLength",10,(0,Validators_1$s.getNumberValidator)());Factory_1$s.Factory.addGetterSetter(Arrow,"pointerWidth",10,(0,Validators_1$s.getNumberValidator)());Factory_1$s.Factory.addGetterSetter(Arrow,"pointerAtBeginning",!1);Factory_1$s.Factory.addGetterSetter(Arrow,"pointerAtEnding",!0);var Circle$1={};Object.defineProperty(Circle$1,"__esModule",{value:!0});Circle$1.Circle=void 0;const Factory_1$r=Factory,Shape_1$c=Shape,Validators_1$r=Validators,Global_1$c=Global;class Circle extends Shape_1$c.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Circle$1.Circle=Circle;Circle.prototype._centroid=!0;Circle.prototype.className="Circle";Circle.prototype._attrsAffectingSize=["radius"];(0,Global_1$c._registerNode)(Circle);Factory_1$r.Factory.addGetterSetter(Circle,"radius",0,(0,Validators_1$r.getNumberValidator)());var Ellipse$1={};Object.defineProperty(Ellipse$1,"__esModule",{value:!0});Ellipse$1.Ellipse=void 0;const Factory_1$q=Factory,Shape_1$b=Shape,Validators_1$q=Validators,Global_1$b=Global;class Ellipse extends Shape_1$b.Shape{_sceneFunc(e){var n=this.radiusX(),t=this.radiusY();e.beginPath(),e.save(),n!==t&&e.scale(1,t/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Ellipse$1.Ellipse=Ellipse;Ellipse.prototype.className="Ellipse";Ellipse.prototype._centroid=!0;Ellipse.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Global_1$b._registerNode)(Ellipse);Factory_1$q.Factory.addComponentsGetterSetter(Ellipse,"radius",["x","y"]);Factory_1$q.Factory.addGetterSetter(Ellipse,"radiusX",0,(0,Validators_1$q.getNumberValidator)());Factory_1$q.Factory.addGetterSetter(Ellipse,"radiusY",0,(0,Validators_1$q.getNumberValidator)());var Image$4={};Object.defineProperty(Image$4,"__esModule",{value:!0});Image$4.Image=void 0;const Util_1$7=Util,Factory_1$p=Factory,Shape_1$a=Shape,Global_1$a=Global,Validators_1$p=Validators;let Image$3=class Ay extends Shape_1$a.Shape{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),t=this.getHeight(),a=this.cornerRadius(),o=this.attrs.image;let d;if(o){const f=this.attrs.cropWidth,h=this.attrs.cropHeight;f&&h?d=[o,this.cropX(),this.cropY(),f,h,0,0,n,t]:d=[o,0,0,n,t]}(this.hasFill()||this.hasStroke()||a)&&(e.beginPath(),a?Util_1$7.Util.drawRoundedRectPath(e,n,t,a):e.rect(0,0,n,t),e.closePath(),e.fillStrokeShape(this)),o&&(a&&e.clip(),e.drawImage.apply(e,d))}_hitFunc(e){var n=this.width(),t=this.height(),a=this.cornerRadius();e.beginPath(),a?Util_1$7.Util.drawRoundedRectPath(e,n,t,a):e.rect(0,0,n,t),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,t=null){var a=Util_1$7.Util.createImageElement();a.onload=function(){var o=new Ay({image:a});n(o)},a.onerror=t,a.crossOrigin="Anonymous",a.src=e}};Image$4.Image=Image$3;Image$3.prototype.className="Image";(0,Global_1$a._registerNode)(Image$3);Factory_1$p.Factory.addGetterSetter(Image$3,"cornerRadius",0,(0,Validators_1$p.getNumberOrArrayOfNumbersValidator)(4));Factory_1$p.Factory.addGetterSetter(Image$3,"image");Factory_1$p.Factory.addComponentsGetterSetter(Image$3,"crop",["x","y","width","height"]);Factory_1$p.Factory.addGetterSetter(Image$3,"cropX",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropY",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropWidth",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropHeight",0,(0,Validators_1$p.getNumberValidator)());var Label$1={};Object.defineProperty(Label$1,"__esModule",{value:!0});Label$1.Tag=Label$1.Label=void 0;const Factory_1$o=Factory,Shape_1$9=Shape,Group_1$1=Group$2,Validators_1$o=Validators,Global_1$9=Global;var ATTR_CHANGE_LIST$2=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],CHANGE_KONVA$1="Change.konva",NONE$1="none",UP="up",RIGHT$1="right",DOWN="down",LEFT$1="left",attrChangeListLen$1=ATTR_CHANGE_LIST$2.length;class Label extends Group_1$1.Group{constructor(e){super(e),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var n=this,t,a=function(){n._sync()};for(t=0;t<attrChangeListLen$1;t++)e.on(ATTR_CHANGE_LIST$2[t]+CHANGE_KONVA$1,a)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var e=this.getText(),n=this.getTag(),t,a,o,d,f,h,u;if(e&&n){switch(t=e.width(),a=e.height(),o=n.pointerDirection(),d=n.pointerWidth(),u=n.pointerHeight(),f=0,h=0,o){case UP:f=t/2,h=-1*u;break;case RIGHT$1:f=t+d,h=a/2;break;case DOWN:f=t/2,h=a+u;break;case LEFT$1:f=-1*d,h=a/2;break}n.setAttrs({x:-1*f,y:-1*h,width:t,height:a}),e.setAttrs({x:-1*f,y:-1*h})}}}Label$1.Label=Label;Label.prototype.className="Label";(0,Global_1$9._registerNode)(Label);class Tag extends Shape_1$9.Shape{_sceneFunc(e){var n=this.width(),t=this.height(),a=this.pointerDirection(),o=this.pointerWidth(),d=this.pointerHeight(),f=this.cornerRadius();let h=0,u=0,p=0,_=0;typeof f=="number"?h=u=p=_=Math.min(f,n/2,t/2):(h=Math.min(f[0]||0,n/2,t/2),u=Math.min(f[1]||0,n/2,t/2),_=Math.min(f[2]||0,n/2,t/2),p=Math.min(f[3]||0,n/2,t/2)),e.beginPath(),e.moveTo(h,0),a===UP&&(e.lineTo((n-o)/2,0),e.lineTo(n/2,-1*d),e.lineTo((n+o)/2,0)),e.lineTo(n-u,0),e.arc(n-u,u,u,Math.PI*3/2,0,!1),a===RIGHT$1&&(e.lineTo(n,(t-d)/2),e.lineTo(n+o,t/2),e.lineTo(n,(t+d)/2)),e.lineTo(n,t-_),e.arc(n-_,t-_,_,0,Math.PI/2,!1),a===DOWN&&(e.lineTo((n+o)/2,t),e.lineTo(n/2,t+d),e.lineTo((n-o)/2,t)),e.lineTo(p,t),e.arc(p,t-p,p,Math.PI/2,Math.PI,!1),a===LEFT$1&&(e.lineTo(0,(t+d)/2),e.lineTo(-1*o,t/2),e.lineTo(0,(t-d)/2)),e.lineTo(0,h),e.arc(h,h,h,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){var e=0,n=0,t=this.pointerWidth(),a=this.pointerHeight(),o=this.pointerDirection(),d=this.width(),f=this.height();return o===UP?(n-=a,f+=a):o===DOWN?f+=a:o===LEFT$1?(e-=t*1.5,d+=t):o===RIGHT$1&&(d+=t*1.5),{x:e,y:n,width:d,height:f}}}Label$1.Tag=Tag;Tag.prototype.className="Tag";(0,Global_1$9._registerNode)(Tag);Factory_1$o.Factory.addGetterSetter(Tag,"pointerDirection",NONE$1);Factory_1$o.Factory.addGetterSetter(Tag,"pointerWidth",0,(0,Validators_1$o.getNumberValidator)());Factory_1$o.Factory.addGetterSetter(Tag,"pointerHeight",0,(0,Validators_1$o.getNumberValidator)());Factory_1$o.Factory.addGetterSetter(Tag,"cornerRadius",0,(0,Validators_1$o.getNumberOrArrayOfNumbersValidator)(4));var Rect$2={};Object.defineProperty(Rect$2,"__esModule",{value:!0});Rect$2.Rect=void 0;const Factory_1$n=Factory,Shape_1$8=Shape,Global_1$8=Global,Util_1$6=Util,Validators_1$n=Validators;let Rect$1=class extends Shape_1$8.Shape{_sceneFunc(e){var n=this.cornerRadius(),t=this.width(),a=this.height();e.beginPath(),n?Util_1$6.Util.drawRoundedRectPath(e,t,a,n):e.rect(0,0,t,a),e.closePath(),e.fillStrokeShape(this)}};Rect$2.Rect=Rect$1;Rect$1.prototype.className="Rect";(0,Global_1$8._registerNode)(Rect$1);Factory_1$n.Factory.addGetterSetter(Rect$1,"cornerRadius",0,(0,Validators_1$n.getNumberOrArrayOfNumbersValidator)(4));var RegularPolygon$1={};Object.defineProperty(RegularPolygon$1,"__esModule",{value:!0});RegularPolygon$1.RegularPolygon=void 0;const Factory_1$m=Factory,Shape_1$7=Shape,Validators_1$m=Validators,Global_1$7=Global;class RegularPolygon extends Shape_1$7.Shape{_sceneFunc(e){const n=this._getPoints();e.beginPath(),e.moveTo(n[0].x,n[0].y);for(var t=1;t<n.length;t++)e.lineTo(n[t].x,n[t].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,n=this.attrs.radius||0,t=[];for(var a=0;a<e;a++)t.push({x:n*Math.sin(a*2*Math.PI/e),y:-1*n*Math.cos(a*2*Math.PI/e)});return t}getSelfRect(){const e=this._getPoints();var n=e[0].x,t=e[0].y,a=e[0].x,o=e[0].y;return e.forEach(d=>{n=Math.min(n,d.x),t=Math.max(t,d.x),a=Math.min(a,d.y),o=Math.max(o,d.y)}),{x:n,y:a,width:t-n,height:o-a}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}RegularPolygon$1.RegularPolygon=RegularPolygon;RegularPolygon.prototype.className="RegularPolygon";RegularPolygon.prototype._centroid=!0;RegularPolygon.prototype._attrsAffectingSize=["radius"];(0,Global_1$7._registerNode)(RegularPolygon);Factory_1$m.Factory.addGetterSetter(RegularPolygon,"radius",0,(0,Validators_1$m.getNumberValidator)());Factory_1$m.Factory.addGetterSetter(RegularPolygon,"sides",0,(0,Validators_1$m.getNumberValidator)());var Ring$1={};Object.defineProperty(Ring$1,"__esModule",{value:!0});Ring$1.Ring=void 0;const Factory_1$l=Factory,Shape_1$6=Shape,Validators_1$l=Validators,Global_1$6=Global;var PIx2=Math.PI*2;class Ring extends Shape_1$6.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,PIx2,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),PIx2,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Ring$1.Ring=Ring;Ring.prototype.className="Ring";Ring.prototype._centroid=!0;Ring.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_1$6._registerNode)(Ring);Factory_1$l.Factory.addGetterSetter(Ring,"innerRadius",0,(0,Validators_1$l.getNumberValidator)());Factory_1$l.Factory.addGetterSetter(Ring,"outerRadius",0,(0,Validators_1$l.getNumberValidator)());var Sprite$1={};Object.defineProperty(Sprite$1,"__esModule",{value:!0});Sprite$1.Sprite=void 0;const Factory_1$k=Factory,Shape_1$5=Shape,Animation_1=Animation$2,Validators_1$k=Validators,Global_1$5=Global;class Sprite extends Shape_1$5.Shape{constructor(e){super(e),this._updated=!0,this.anim=new Animation_1.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){var n=this.animation(),t=this.frameIndex(),a=t*4,o=this.animations()[n],d=this.frameOffsets(),f=o[a+0],h=o[a+1],u=o[a+2],p=o[a+3],_=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,u,p),e.closePath(),e.fillStrokeShape(this)),_)if(d){var b=d[n],S=t*2;e.drawImage(_,f,h,u,p,b[S+0],b[S+1],u,p)}else e.drawImage(_,f,h,u,p,0,0,u,p)}_hitFunc(e){var n=this.animation(),t=this.frameIndex(),a=t*4,o=this.animations()[n],d=this.frameOffsets(),f=o[a+2],h=o[a+3];if(e.beginPath(),d){var u=d[n],p=t*2;e.rect(u[p+0],u[p+1],f,h)}else e.rect(0,0,f,h);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),n=this.animation(),t=this.animations(),a=t[n],o=a.length/4;e<o-1?this.frameIndex(e+1):this.frameIndex(0)}}Sprite$1.Sprite=Sprite;Sprite.prototype.className="Sprite";(0,Global_1$5._registerNode)(Sprite);Factory_1$k.Factory.addGetterSetter(Sprite,"animation");Factory_1$k.Factory.addGetterSetter(Sprite,"animations");Factory_1$k.Factory.addGetterSetter(Sprite,"frameOffsets");Factory_1$k.Factory.addGetterSetter(Sprite,"image");Factory_1$k.Factory.addGetterSetter(Sprite,"frameIndex",0,(0,Validators_1$k.getNumberValidator)());Factory_1$k.Factory.addGetterSetter(Sprite,"frameRate",17,(0,Validators_1$k.getNumberValidator)());Factory_1$k.Factory.backCompat(Sprite,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Star$1={};Object.defineProperty(Star$1,"__esModule",{value:!0});Star$1.Star=void 0;const Factory_1$j=Factory,Shape_1$4=Shape,Validators_1$j=Validators,Global_1$4=Global;class Star extends Shape_1$4.Shape{_sceneFunc(e){var n=this.innerRadius(),t=this.outerRadius(),a=this.numPoints();e.beginPath(),e.moveTo(0,0-t);for(var o=1;o<a*2;o++){var d=o%2===0?t:n,f=d*Math.sin(o*Math.PI/a),h=-1*d*Math.cos(o*Math.PI/a);e.lineTo(f,h)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Star$1.Star=Star;Star.prototype.className="Star";Star.prototype._centroid=!0;Star.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_1$4._registerNode)(Star);Factory_1$j.Factory.addGetterSetter(Star,"numPoints",5,(0,Validators_1$j.getNumberValidator)());Factory_1$j.Factory.addGetterSetter(Star,"innerRadius",0,(0,Validators_1$j.getNumberValidator)());Factory_1$j.Factory.addGetterSetter(Star,"outerRadius",0,(0,Validators_1$j.getNumberValidator)());var Text$2={};Object.defineProperty(Text$2,"__esModule",{value:!0});Text$2.Text=Text$2.stringToArray=void 0;const Util_1$5=Util,Factory_1$i=Factory,Shape_1$3=Shape,Validators_1$i=Validators,Global_1$3=Global;function stringToArray(l){return Array.from(l)}Text$2.stringToArray=stringToArray;var AUTO="auto",CENTER="center",INHERIT="inherit",JUSTIFY="justify",CHANGE_KONVA="Change.konva",CONTEXT_2D="2d",DASH="-",LEFT="left",TEXT="text",TEXT_UPPER="Text",TOP="top",BOTTOM="bottom",MIDDLE="middle",NORMAL$1="normal",PX_SPACE="px ",SPACE=" ",RIGHT="right",RTL="rtl",WORD="word",CHAR="char",NONE="none",ELLIPSIS="…",ATTR_CHANGE_LIST$1=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],attrChangeListLen=ATTR_CHANGE_LIST$1.length;function normalizeFontFamily(l){return l.split(",").map(e=>{e=e.trim();const n=e.indexOf(" ")>=0,t=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!t&&(e=`"${e}"`),e}).join(", ")}var dummyContext;function getDummyContext(){return dummyContext||(dummyContext=Util_1$5.Util.createCanvasElement().getContext(CONTEXT_2D),dummyContext)}function _fillFunc$1(l){l.fillText(this._partialText,this._partialTextX,this._partialTextY)}function _strokeFunc$1(l){l.setAttr("miterLimit",2),l.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function checkDefaultFill(l){return l=l||{},!l.fillLinearGradientColorStops&&!l.fillRadialGradientColorStops&&!l.fillPatternImage&&(l.fill=l.fill||"black"),l}let Text$1=class extends Shape_1$3.Shape{constructor(e){super(checkDefaultFill(e)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n<attrChangeListLen;n++)this.on(ATTR_CHANGE_LIST$1[n]+CHANGE_KONVA,this._setTextData);this._setTextData()}_sceneFunc(e){var n=this.textArr,t=n.length;if(this.text()){var a=this.padding(),o=this.fontSize(),d=this.lineHeight()*o,f=this.verticalAlign(),h=this.direction(),u=0,p=this.align(),_=this.getWidth(),b=this.letterSpacing(),S=this.fill(),E=this.textDecoration(),g=E.indexOf("underline")!==-1,v=E.indexOf("line-through")!==-1,T;h=h===INHERIT?e.direction:h;var R=0,R=d/2,x=0,C=0;for(h===RTL&&e.setAttr("direction",h),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",MIDDLE),e.setAttr("textAlign",LEFT),f===MIDDLE?u=(this.getHeight()-t*d-a*2)/2:f===BOTTOM&&(u=this.getHeight()-t*d-a*2),e.translate(a,u+a),T=0;T<t;T++){var x=0,C=0,w=n[T],P=w.text,D=w.width,N=w.lastInParagraph,k,F,M;if(e.save(),p===RIGHT?x+=_-D-a*2:p===CENTER&&(x+=(_-D-a*2)/2),g){e.save(),e.beginPath(),e.moveTo(x,R+C+Math.round(o/2)),k=P.split(" ").length-1,F=k===0,M=p===JUSTIFY&&!N?_-a*2:D,e.lineTo(x+Math.round(M),R+C+Math.round(o/2)),e.lineWidth=o/15;const ie=this._getLinearGradient();e.strokeStyle=ie||S,e.stroke(),e.restore()}if(v){e.save(),e.beginPath(),e.moveTo(x,R+C),k=P.split(" ").length-1,F=k===0,M=p===JUSTIFY&&N&&!F?_-a*2:D,e.lineTo(x+Math.round(M),R+C),e.lineWidth=o/15;const ie=this._getLinearGradient();e.strokeStyle=ie||S,e.stroke(),e.restore()}if(h!==RTL&&(b!==0||p===JUSTIFY)){k=P.split(" ").length-1;for(var U=stringToArray(P),$=0;$<U.length;$++){var B=U[$];B===" "&&!N&&p===JUSTIFY&&(x+=(_-a*2-D)/k),this._partialTextX=x,this._partialTextY=R+C,this._partialText=B,e.fillStrokeShape(this),x+=this.measureSize(B).width+b}}else b!==0&&e.setAttr("letterSpacing",`${b}px`),this._partialTextX=x,this._partialTextY=R+C,this._partialText=P,e.fillStrokeShape(this);e.restore(),t>1&&(R+=d)}}}_hitFunc(e){var n=this.getWidth(),t=this.getHeight();e.beginPath(),e.rect(0,0,n,t),e.closePath(),e.fillStrokeShape(this)}setText(e){var n=Util_1$5.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(TEXT,n),this}getWidth(){var e=this.attrs.width===AUTO||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===AUTO||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Util_1$5.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n=getDummyContext(),t=this.fontSize(),a;return n.save(),n.font=this._getContextFont(),a=n.measureText(e),n.restore(),{width:a.width,height:t}}_getContextFont(){return this.fontStyle()+SPACE+this.fontVariant()+SPACE+(this.fontSize()+PX_SPACE)+normalizeFontFamily(this.fontFamily())}_addTextLine(e){this.align()===JUSTIFY&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var n=this.letterSpacing(),t=e.length;return getDummyContext().measureText(e).width+(t?n*(t-1):0)}_setTextData(){var e=this.text().split(`
71
+ ${E&&C+1>=l.length?"glowing-animation":""}`,"data-testid":"btn-nxt",onClick:()=>{C+1<l.length?$():(N("click-ui"),F())},"aria-label":LangIsRtl()?_("comic.previous"):_("comic.next"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})}):null}const characterMs$1=75;function CartelComponent({img:l,text:e,audio:n,audioType:t,voice:a,emitEvent:o,soundActions:d,audioVolume:f,pause:h,keyboardControl:u,backgroundImageCover:p=!1,autoEnd:_=!1}){const[b,S]=React$2.useState(!1),E=k=>o({type:"translate",payload:k}),g=(l==null?void 0:l.url)||"https://min.gamelearn.io/css-resources/gamelearn/resources/conversation.jpg",v=React$2.useRef(),T=React$2.useRef(),[R]=d,{start:x,stop:C}=useTimeout();useEkho({audioType:t,voice:a,text:e,audio:n,soundActions:d,emitEvent:o,volume:f,pauseTTS:h,onError:()=>{S(!0)},onFinish:()=>{_&&w()}});const w=React$2.useCallback(()=>{R("click-ui"),o({type:"success"})},[o,R]),P=u({repeat:!1,forward:w,escape:w});React$2.useEffect(()=>P(),[P]);const D=(k,F)=>window.matchMedia("(min-width: 1280px)").matches?F:k,N=React$2.useCallback(()=>{if(p!==!0&&e&&T.current){const k=T.current.naturalWidth/T.current.naturalHeight;let F=T.current.height*k,M=T.current.height;if(F>T.current.width&&(F=T.current.width,M=T.current.width/k),v.current.style.width=`${F}px`,window.innerHeight<T.current.width)v.current.style.bottom=`${D(24,48)+D(36,100)}px`;else{const U=(window.innerHeight-M)/2+D(36,100);v.current.style.bottom=`${U}px`}}},[p,e]);return React$2.useEffect(()=>{T.current&&new ResizeObserver(()=>{D(24,48),N()}).observe(T.current)},[N]),React$2.useEffect(()=>{if(_&&!h&&(!n||b)){const k=characterMs$1*(e.length||0);x(()=>{w()},k<2400?2400:k)}return()=>{C()}},[n,b,_,w,h,x,C,e]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`cartel ${p?"cartel--cover":""}`,children:jsxRuntimeExports.jsxs("div",{className:"cartel__imagewrap",children:[jsxRuntimeExports.jsx("img",{ref:T,onLoad:N,className:"cartel__image",src:g,alt:"cartel pic"}),e?jsxRuntimeExports.jsx("div",{ref:v,className:"cartel__textwrap",children:jsxRuntimeExports.jsx("div",{className:"cartel__text",children:jsxRuntimeExports.jsx("span",{children:e})})}):null]})}),jsxRuntimeExports.jsx("div",{className:"position--absolute center right",children:jsxRuntimeExports.jsx("button",{"data-testid":"cartel-close-button",type:"button",className:"gat--btn__round",onClick:()=>w(),"aria-label":E("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})})]})}var Typist$1={exports:{}};(function(l){l.exports=function(e){var n={};function t(a){if(n[a])return n[a].exports;var o=n[a]={exports:{},id:a,loaded:!1};return e[a].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}return t.m=e,t.c=n,t.p="",t(0)}([function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0});var a=Object.assign||function(k){for(var F=1;F<arguments.length;F++){var M=arguments[F];for(var U in M)Object.prototype.hasOwnProperty.call(M,U)&&(k[U]=M[U])}return k},o=function(){function k(F,M){for(var U=0;U<M.length;U++){var $=M[U];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(F,$.key,$)}}return function(F,M,U){return M&&k(F.prototype,M),U&&k(F,U),F}}(),d=t(1),f=x(d),h=t(2),u=x(h),p=t(10),_=x(p),b=t(12),S=x(b),E=t(13),g=x(E),v=t(14),T=R(v);function R(k){if(k&&k.__esModule)return k;var F={};if(k!=null)for(var M in k)Object.prototype.hasOwnProperty.call(k,M)&&(F[M]=k[M]);return F.default=k,F}function x(k){return k&&k.__esModule?k:{default:k}}function C(k,F){if(!(k instanceof F))throw new TypeError("Cannot call a class as a function")}function w(k,F){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return F&&(typeof F=="object"||typeof F=="function")?F:k}function P(k,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof F);k.prototype=Object.create(F&&F.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),F&&(Object.setPrototypeOf?Object.setPrototypeOf(k,F):k.__proto__=F)}var D=["🔙","⏰"],N=function(k){P(F,k);function F(M){C(this,F);var U=w(this,(F.__proto__||Object.getPrototypeOf(F)).call(this,M));return U.state={textLines:[],isDone:!1},U.onTypingDone=function(){U.mounted&&(U.setState({isDone:!0}),U.props.onTypingDone())},U.delayGenerator=function($,B,J,ne){var ie=U.props.avgTypingDelay,Y=U.props.stdTypingDelay;return U.props.delayGenerator(ie,Y,{line:$,lineIdx:B,character:J,charIdx:ne,defDelayGenerator:function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ie,ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Y;return T.gaussianRnd(re,ce)}})},U.typeLine=function($,B){if(!U.mounted)return Promise.resolve();var J=$,ne=U.props.onLineTyped;return T.isBackspaceElement($)?($.props.delay>0&&(U.introducedDelay=$.props.delay),J="🔙".repeat($.props.count)):T.isDelayElement($)&&(U.introducedDelay=$.props.ms,J="⏰"),new Promise(function(ie,Y){U.setState({textLines:U.state.textLines.concat([""])},function(){T.eachPromise(J,U.typeCharacter,J,B).then(function(){return ne(J,B)}).then(ie).catch(Y)})})},U.typeCharacter=function($,B,J,ne){if(!U.mounted)return Promise.resolve();var ie=U.props.onCharacterTyped;return new Promise(function(Y){var q=U.state.textLines.slice();T.sleep(U.introducedDelay).then(function(){U.introducedDelay=null;var re=$==="🔙",ce=$==="⏰";if(ce){Y();return}if(re&&ne>0){for(var fe=ne-1,te=q[fe],H=fe;H>=0&&!(te.length>0&&!D.includes(te[0]));H--)fe=H,te=q[fe];q[fe]=te.substr(0,te.length-1)}else q[ne]+=$;U.setState({textLines:q},function(){var W=U.delayGenerator(J,ne,$,B);ie($,B),setTimeout(Y,W)})})})},U.mounted=!1,U.linesToType=[],U.introducedDelay=null,M.children&&(U.linesToType=T.extractTextFromElement(M.children)),U}return o(F,[{key:"componentDidMount",value:function(){this.mounted=!0;var U=this.props,$=U.children,B=U.startDelay;$?B>0&&typeof window<"u"?setTimeout(this.typeAllLines.bind(this),B):this.typeAllLines():this.onTypingDone()}},{key:"shouldComponentUpdate",value:function(U,$){if($.textLines.length!==this.state.textLines.length)return!0;for(var B=0;B<$.textLines.length;B++){var J=this.state.textLines[B],ne=$.textLines[B];if(J!==ne)return!0}return this.state.isDone!==$.isDone}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"typeAllLines",value:function(){var U=this,$=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.linesToType;return T.eachPromise($,this.typeLine).then(function(){return U.onTypingDone()})}},{key:"render",value:function(){var U=this.props,$=U.className,B=U.cursor,J=this.state.isDone,ne=T.cloneElementWithSpecifiedText({element:this.props.children,textLines:this.state.textLines});return f.default.createElement("div",{className:"Typist "+$},ne,f.default.createElement(_.default,a({isDone:J},B)))}}]),F}(d.Component);N.propTypes={children:u.default.node,className:u.default.string,avgTypingDelay:u.default.number,stdTypingDelay:u.default.number,startDelay:u.default.number,cursor:u.default.object,onCharacterTyped:u.default.func,onLineTyped:u.default.func,onTypingDone:u.default.func,delayGenerator:u.default.func},N.defaultProps={className:"",avgTypingDelay:70,stdTypingDelay:25,startDelay:0,cursor:{},onCharacterTyped:function(){},onLineTyped:function(){},onTypingDone:function(){},delayGenerator:T.gaussianRnd},n.default=N,N.Backspace=S.default,N.Delay=g.default},function(e,n){e.exports=React$2},function(e,n,t){if(process.env.NODE_ENV!=="production"){var a=typeof Symbol=="function"&&Symbol.for&&Symbol.for("react.element")||60103,o=function(f){return typeof f=="object"&&f!==null&&f.$$typeof===a},d=!0;e.exports=t(3)(o,d)}else e.exports=t(9)()},function(e,n,t){var a=t(4),o=t(5),d=t(6),f=t(7),h=t(8);e.exports=function(u,p){var _=typeof Symbol=="function"&&Symbol.iterator,b="@@iterator";function S(q){var re=q&&(_&&q[_]||q[b]);if(typeof re=="function")return re}var E="<<anonymous>>",g={array:x("array"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:C(),arrayOf:w,element:P(),instanceOf:D,node:M(),objectOf:k,oneOf:N,oneOfType:F,shape:U};function v(q,re){return q===re?q!==0||1/q===1/re:q!==q&&re!==re}function T(q){this.message=q,this.stack=""}T.prototype=Error.prototype;function R(q){if(process.env.NODE_ENV!=="production")var re={},ce=0;function fe(H,W,V,z,Q,ee,le){if(z=z||E,ee=ee||V,le!==f){if(p)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ue=z+":"+V;!re[ue]&&ce<3&&(d(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",ee,z),re[ue]=!0,ce++)}}return W[V]==null?H?W[V]===null?new T("The "+Q+" `"+ee+"` is marked as required "+("in `"+z+"`, but its value is `null`.")):new T("The "+Q+" `"+ee+"` is marked as required in "+("`"+z+"`, but its value is `undefined`.")):null:q(W,V,z,Q,ee)}var te=fe.bind(null,!1);return te.isRequired=fe.bind(null,!0),te}function x(q){function re(ce,fe,te,H,W,V){var z=ce[fe],Q=J(z);if(Q!==q){var ee=ne(z);return new T("Invalid "+H+" `"+W+"` of type "+("`"+ee+"` supplied to `"+te+"`, expected ")+("`"+q+"`."))}return null}return R(re)}function C(){return R(a.thatReturnsNull)}function w(q){function re(ce,fe,te,H,W){if(typeof q!="function")return new T("Property `"+W+"` of component `"+te+"` has invalid PropType notation inside arrayOf.");var V=ce[fe];if(!Array.isArray(V)){var z=J(V);return new T("Invalid "+H+" `"+W+"` of type "+("`"+z+"` supplied to `"+te+"`, expected an array."))}for(var Q=0;Q<V.length;Q++){var ee=q(V,Q,te,H,W+"["+Q+"]",f);if(ee instanceof Error)return ee}return null}return R(re)}function P(){function q(re,ce,fe,te,H){var W=re[ce];if(!u(W)){var V=J(W);return new T("Invalid "+te+" `"+H+"` of type "+("`"+V+"` supplied to `"+fe+"`, expected a single ReactElement."))}return null}return R(q)}function D(q){function re(ce,fe,te,H,W){if(!(ce[fe]instanceof q)){var V=q.name||E,z=Y(ce[fe]);return new T("Invalid "+H+" `"+W+"` of type "+("`"+z+"` supplied to `"+te+"`, expected ")+("instance of `"+V+"`."))}return null}return R(re)}function N(q){if(!Array.isArray(q))return process.env.NODE_ENV!=="production"&&d(!1,"Invalid argument supplied to oneOf, expected an instance of array."),a.thatReturnsNull;function re(ce,fe,te,H,W){for(var V=ce[fe],z=0;z<q.length;z++)if(v(V,q[z]))return null;var Q=JSON.stringify(q);return new T("Invalid "+H+" `"+W+"` of value `"+V+"` "+("supplied to `"+te+"`, expected one of "+Q+"."))}return R(re)}function k(q){function re(ce,fe,te,H,W){if(typeof q!="function")return new T("Property `"+W+"` of component `"+te+"` has invalid PropType notation inside objectOf.");var V=ce[fe],z=J(V);if(z!=="object")return new T("Invalid "+H+" `"+W+"` of type "+("`"+z+"` supplied to `"+te+"`, expected an object."));for(var Q in V)if(V.hasOwnProperty(Q)){var ee=q(V,Q,te,H,W+"."+Q,f);if(ee instanceof Error)return ee}return null}return R(re)}function F(q){if(!Array.isArray(q))return process.env.NODE_ENV!=="production"&&d(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),a.thatReturnsNull;for(var re=0;re<q.length;re++){var ce=q[re];if(typeof ce!="function")return d(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",ie(ce),re),a.thatReturnsNull}function fe(te,H,W,V,z){for(var Q=0;Q<q.length;Q++){var ee=q[Q];if(ee(te,H,W,V,z,f)==null)return null}return new T("Invalid "+V+" `"+z+"` supplied to "+("`"+W+"`."))}return R(fe)}function M(){function q(re,ce,fe,te,H){return $(re[ce])?null:new T("Invalid "+te+" `"+H+"` supplied to "+("`"+fe+"`, expected a ReactNode."))}return R(q)}function U(q){function re(ce,fe,te,H,W){var V=ce[fe],z=J(V);if(z!=="object")return new T("Invalid "+H+" `"+W+"` of type `"+z+"` "+("supplied to `"+te+"`, expected `object`."));for(var Q in q){var ee=q[Q];if(ee){var le=ee(V,Q,te,H,W+"."+Q,f);if(le)return le}}return null}return R(re)}function $(q){switch(typeof q){case"number":case"string":case"undefined":return!0;case"boolean":return!q;case"object":if(Array.isArray(q))return q.every($);if(q===null||u(q))return!0;var re=S(q);if(re){var ce=re.call(q),fe;if(re!==q.entries){for(;!(fe=ce.next()).done;)if(!$(fe.value))return!1}else for(;!(fe=ce.next()).done;){var te=fe.value;if(te&&!$(te[1]))return!1}}else return!1;return!0;default:return!1}}function B(q,re){return q==="symbol"||re["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&re instanceof Symbol}function J(q){var re=typeof q;return Array.isArray(q)?"array":q instanceof RegExp?"object":B(re,q)?"symbol":re}function ne(q){if(typeof q>"u"||q===null)return""+q;var re=J(q);if(re==="object"){if(q instanceof Date)return"date";if(q instanceof RegExp)return"regexp"}return re}function ie(q){var re=ne(q);switch(re){case"array":case"object":return"an "+re;case"boolean":case"date":case"regexp":return"a "+re;default:return re}}function Y(q){return!q.constructor||!q.constructor.name?E:q.constructor.name}return g.checkPropTypes=h,g.PropTypes=g,g}},function(e,n){function t(o){return function(){return o}}var a=function(){};a.thatReturns=t,a.thatReturnsFalse=t(!1),a.thatReturnsTrue=t(!0),a.thatReturnsNull=t(null),a.thatReturnsThis=function(){return this},a.thatReturnsArgument=function(o){return o},e.exports=a},function(e,n){var t=function(d){};process.env.NODE_ENV!=="production"&&(t=function(d){if(d===void 0)throw new Error("invariant requires an error message argument")});function a(o,d,f,h,u,p,_,b){if(t(d),!o){var S;if(d===void 0)S=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var E=[f,h,u,p,_,b],g=0;S=new Error(d.replace(/%s/g,function(){return E[g++]})),S.name="Invariant Violation"}throw S.framesToPop=1,S}}e.exports=a},function(e,n,t){var a=t(4),o=a;process.env.NODE_ENV!=="production"&&function(){var d=function(h){for(var u=arguments.length,p=Array(u>1?u-1:0),_=1;_<u;_++)p[_-1]=arguments[_];var b=0,S="Warning: "+h.replace(/%s/g,function(){return p[b++]});typeof console<"u"&&console.error(S);try{throw new Error(S)}catch{}};o=function(h,u){if(u===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(u.indexOf("Failed Composite propType: ")!==0&&!h){for(var p=arguments.length,_=Array(p>2?p-2:0),b=2;b<p;b++)_[b-2]=arguments[b];d.apply(void 0,[u].concat(_))}}}(),e.exports=o},function(e,n){var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=t},function(e,n,t){if(process.env.NODE_ENV!=="production")var a=t(5),o=t(6),d=t(7),f={};function h(u,p,_,b,S){if(process.env.NODE_ENV!=="production"){for(var E in u)if(u.hasOwnProperty(E)){var g;try{a(typeof u[E]=="function","%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",b||"React class",_,E),g=u[E](p,E,b,_,null,d)}catch(T){g=T}if(o(!g||g instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",b||"React class",_,E,typeof g),g instanceof Error&&!(g.message in f)){f[g.message]=!0;var v=S?S():"";o(!1,"Failed %s type: %s%s",_,g.message,v??"")}}}}e.exports=h},function(e,n,t){var a=t(4),o=t(5),d=t(7);e.exports=function(){function f(p,_,b,S,E,g){g!==d&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}f.isRequired=f;function h(){return f}var u={array:f,bool:f,func:f,number:f,object:f,string:f,symbol:f,any:f,arrayOf:h,element:f,instanceOf:h,node:f,objectOf:h,oneOf:h,oneOfType:h,shape:h};return u.checkPropTypes=a,u.PropTypes=u,u}},function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function E(g,v){for(var T=0;T<v.length;T++){var R=v[T];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(g,R.key,R)}}return function(g,v,T){return v&&E(g.prototype,v),T&&E(g,T),g}}(),o=t(1),d=u(o),f=t(2),h=u(f);t(11);function u(E){return E&&E.__esModule?E:{default:E}}function p(E,g){if(!(E instanceof g))throw new TypeError("Cannot call a class as a function")}function _(E,g){if(!E)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g&&(typeof g=="object"||typeof g=="function")?g:E}function b(E,g){if(typeof g!="function"&&g!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof g);E.prototype=Object.create(g&&g.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),g&&(Object.setPrototypeOf?Object.setPrototypeOf(E,g):E.__proto__=g)}var S=function(E){b(g,E);function g(v){p(this,g);var T=_(this,(g.__proto__||Object.getPrototypeOf(g)).call(this,v));return T._isReRenderingCursor=!1,T.state={shouldRender:T.props.show},T}return a(g,[{key:"componentWillReceiveProps",value:function(T){var R=this,x=!this.props.isDone&&T.isDone&&this.props.hideWhenDone;x&&setTimeout(function(){return R.setState({shouldRender:!1})},this.props.hideWhenDoneDelay)}},{key:"componentDidUpdate",value:function(){var T=this.props,R=T.show,x=T.isDone;R&&(x||this._isReRenderingCursor||this._reRenderCursor())}},{key:"_reRenderCursor",value:function(){var T=this;this._isReRenderingCursor=!0,this.setState({shouldRender:!1},function(){T.setState({shouldRender:!0},function(){T._isReRenderingCursor=!1})})}},{key:"render",value:function(){if(this.state.shouldRender){var T=this.props.blink?" Cursor--blinking":"";return d.default.createElement("span",{className:"Cursor"+T},this.props.element)}return null}}]),g}(o.Component);S.propTypes={blink:h.default.bool,show:h.default.bool,element:h.default.node,hideWhenDone:h.default.bool,hideWhenDoneDelay:h.default.number,isDone:h.default.bool},S.defaultProps={blink:!0,show:!0,element:"|",hideWhenDone:!1,hideWhenDoneDelay:1e3,isDone:!1},n.default=S},function(e,n){},function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0});var a=t(1),o=h(a),d=t(2),f=h(d);function h(p){return p&&p.__esModule?p:{default:p}}var u=function(){return o.default.createElement("noscript",null)};u.componentName="Backspace",u.propTypes={count:f.default.number,delay:f.default.number},u.defaultProps={count:1,delay:0},n.default=u},function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0});var a=t(1),o=h(a),d=t(2),f=h(d);function h(p){return p&&p.__esModule?p:{default:p}}var u=function(){return o.default.createElement("noscript",null)};u.componentName="Delay",u.propTypes={ms:f.default.number.isRequired},n.default=u},function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.sleep=void 0;var a=function(){function R(x,C){var w=[],P=!0,D=!1,N=void 0;try{for(var k=x[Symbol.iterator](),F;!(P=(F=k.next()).done)&&(w.push(F.value),!(C&&w.length===C));P=!0);}catch(M){D=!0,N=M}finally{try{!P&&k.return&&k.return()}finally{if(D)throw N}}return w}return function(x,C){if(Array.isArray(x))return x;if(Symbol.iterator in Object(x))return R(x,C);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();n.gaussianRnd=u,n.eachPromise=p,n.exclude=_,n.isBackspaceElement=b,n.isDelayElement=S,n.extractTextFromElement=E,n.cloneElement=g,n.cloneElementWithSpecifiedText=T;var o=t(1),d=f(o);function f(R){return R&&R.__esModule?R:{default:R}}function h(R){if(Array.isArray(R)){for(var x=0,C=Array(R.length);x<R.length;x++)C[x]=R[x];return C}else return Array.from(R)}n.sleep=function(x){return new Promise(function(C){return x!=null?setTimeout(C,x):C()})};function u(R,x){for(var C=12,w=0,P=0;P<C;P++)w+=Math.random();return w-=C/2,Math.round(w*x)+R}function p(R,x){for(var C=arguments.length,w=Array(C>2?C-2:0),P=2;P<C;P++)w[P-2]=arguments[P];var D=function(k,F,M){return k.then(function(){return x.apply(void 0,[F,M].concat(w))})};return Array.from(R).reduce(D,Promise.resolve())}function _(R,x){var C={};for(var w in R)x.indexOf(w)===-1&&(C[w]=R[w]);return C}function b(R){return R&&R.type&&R.type.componentName==="Backspace"}function S(R){return R&&R.type&&R.type.componentName==="Delay"}function E(R){for(var x=R?[R]:[],C=[];x.length>0;){var w=x.pop();if(d.default.isValidElement(w))b(w)||S(w)?C.unshift(w):d.default.Children.forEach(w.props.children,function(U){x.push(U)});else if(Array.isArray(w)){var P=!0,D=!1,N=void 0;try{for(var k=w[Symbol.iterator](),F;!(P=(F=k.next()).done);P=!0){var M=F.value;x.push(M)}}catch(U){D=!0,N=U}finally{try{!P&&k.return&&k.return()}finally{if(D)throw N}}}else C.unshift(w)}return C}function g(R,x){var C=R.type,w=_(R.props,["children"]),P=new Date().getUTCMilliseconds(),D=P+Math.random()+Math.random();return w.key="Typist-element-"+C+"-"+D,d.default.createElement.apply(d.default,[C,w].concat(h(x)))}function v(R,x,C){if(C>=x.length)return[null,C];var w=C,P=function(M){var U=v(M,x,w),$=a(U,2),B=$[0],J=$[1];return w=J,B},D=d.default.isValidElement(R)&&!(b(R)||S(R));if(D){var N=d.default.Children.map(R.props.children,P)||[];return[g(R,N),w]}if(Array.isArray(R)){var k=R.map(P);return[k,w]}return[x[w],w+1]}function T(R){var x=R.element,C=R.textLines;if(x)return v(x,C,0)[0]}}])})(Typist$1);var TypistExports=Typist$1.exports;const Typist=getDefaultExportFromCjs(TypistExports),languages={js:["var rows = prompt('How many rows for your multiplication table?');","var cols = prompt('How many columns for your multiplication table?');"," ","if(rows == '' || rows == null)"," rows = 10;"," ","if(cols== '' || cols== null)"," cols = 10;"," ","createTable(rows, cols);"," ","function createTable(rows, cols)","{"," var j=1;"," var output = '<table border='1' width='500' cellspacing='0'cellpadding='5'>';"," "," for(i=1;i<=rows;i++)"," {"," output = output + '<tr>';"," while(j<=cols)"," {"," output = output + '<td>' + i*j + '</td>';"," j = j+1;"," }"," output = output + '</tr>';"," j = 1;"," }"," "," output = output + '</table>';"," document.write(output);","}"],lua:["-- Ensure that that the element at i is in the right position,","-- and return a closure which can be used for continuing the sort."," ","function quicksorter(i, vec, low, high)"," if low >= high then"," return quicksorter"," else -- low < high"," -- partition the vector and initialize the child closures"," local middle = partition(vec, low, high)"," local left, right = quicksorter"," ","-- Create the promise"," local function self(i, vec, low, high)"," if i < middle then"," left = left(i, vec, low, middle-1)"," return self"," elseif i > middle then"," right = right(i, vec, middle+1, high)"," return self"," end"," end"," ","-- Force the promise until i is in the right position"," return self(i, vec, low, high)"," end","end"," ","function lazysort(vec, low, high)"," local sorter = quicksorter"," return function(i)"," sorter = sorter(i, vec, low, high)"," return vec[i]"," end","end"],python:["#ask the user to enter four pieces of information"," ","firstname = input('Enter your first name: ')","surname = input('Enter your surname: ')","email = input('Enter your email: ')","yearsteaching = input('Enter the number of years teaching: ')"," ","file = open('staff.csv','r') #opens the file in read mode","found=False #sets whether the user is found to False"," ","for line in file: #reads each line in the file"," staff = line.split(',') #splits the line into the list called staff"," if staff[2] == email: #checks if the email entered is in the list"," found=True #if it is changes found to True"," ","file.close() #closes the file"," ","if found==True: #after the loop checks if the user is found"," print('Staff member already exists in the file') #displays on screen","else:"," #if the email was not in the file"," writefile=open('staff.csv','a') #open the file in append mode"," writefile.write(firstname + ',' + surname + ',' + email + ',' + yearsteaching) #write the new information to the file"," writefile.close() #close the file"," print('Staff member added to file')"]},themes={theme1:{bg:1,color:1,typo:2},theme2:{bg:3,color:2,typo:3},theme3:{bg:5,color:4,typo:1},theme4:{bg:1,color:3,typo:2},theme5:{bg:2,color:5,typo:1},theme6:{bg:5,color:6,typo:2},theme7:{bg:1,color:7,typo:3}};function ProgressBar({progress:l,type:e}){const n=languages[e];if(n){const t=n.reduce((d,f)=>(d.length?d.length:d)+f.length),a=Math.floor(l*100/t),o=a===100?"puzzle--hacker__percentage percentage--label":"puzzle--hacker__percentage";return jsxRuntimeExports.jsx("div",{className:"puzzle--hacker__progress",children:jsxRuntimeExports.jsx("span",{className:"puzzle--hacker__progress--item",style:{width:`${Math.floor(l*100/t)}%`},children:jsxRuntimeExports.jsxs("span",{className:o,children:[a,"%"]})})})}return null}function Code({codeContainer:l}){const e=l,n=e.split("<br>");return n.length>0?n.map((t,a)=>{const o=t.replace(/ /g," ");return jsxRuntimeExports.jsx("p",{children:o},`line_${0+a}`)}):jsxRuntimeExports.jsx("p",{children:e})}function HackerPuzzleComponent({emitEvent:l,soundActions:e,info:n,themeNumber:t,type:a,writingSpeed:o,disableExit:d,setResolveAction:f}){const h=B=>l({type:"translate",payload:B}),[u]=e,{solution:p}=n,b=themes[`theme${t||1}`],[S,E]=React$2.useState(""),[g,v]=React$2.useState(0),[T,R]=React$2.useState(0),[x,C]=React$2.useState(!1),[w,P]=React$2.useState({start:0,end:0}),D=React$2.useRef(),N=React$2.useRef(),k=h("puzzle.hacker.congratulations"),F=(B,J)=>B>J.length?J.length:B,M=()=>{u("click-ui");const{rewards:B}=p.right;l({type:"addPoints",complex:!0,finish:!0,payload:B}),l({type:"passPuzzle"})};React$2.useEffect(()=>{D.current.focus(),x&&d(!0)},[x]),React$2.useEffect(()=>{f(B=>{u("score"),C(!0),l({type:"hidePuzzleButtons",payload:!1}),B()})},[f]);const U=()=>{if(languages[a]&&!x){N.current&&(N.current.scrollTop=D.current.scrollHeight);const B=languages[a],J=B[g],ne=B.reduce((Y,q)=>(Y.length?Y.length:Y)+q.length),ie=o>0?o:Math.floor(ne/50)+g;if(J){const Y=J.split(""),q=F(w.end,Y),re=Y.slice(w.start,q),ce=S+re.join("");R(T+re.join("").length),E(ce),q===Y.length?g+1>=B.length?(u("score"),C(!0)):(v(g+1),E(`${S+re.join("")}<br>`),P({start:0,end:F(ie,Y)})):P({start:q,end:F(q+ie,Y)})}}},$=B=>{B.preventDefault(),U()};return jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,"data-testid":"hacker",ref:D,onKeyDown:$,onTouchStart:$,className:`puzzle--hacker__container background-hacker-${b.bg}`,children:[jsxRuntimeExports.jsx("div",{className:"puzzle--hacker__header",children:jsxRuntimeExports.jsx("span",{className:"title",children:"Console"})}),jsxRuntimeExports.jsxs("div",{className:`puzzle--hacker__body color-hacker-${b.color} typography-hacker-${b.typo}`,children:[jsxRuntimeExports.jsxs("div",{className:"puzzle--hacker__code",ref:N,children:[jsxRuntimeExports.jsx(Code,{codeContainer:S}),x?jsxRuntimeExports.jsxs(Typist,{avgTypingDelay:110,onCharacterTyped:()=>{N.current&&(N.current.scrollTop=D.current.scrollHeight)},cursor:{hideWhenDone:!0},className:"puzzle--hacker__result",children:[jsxRuntimeExports.jsx(Typist.Delay,{ms:300}),p.right.desc?`// ${p.right.desc}`:`${k}`]}):null]}),jsxRuntimeExports.jsx(ProgressBar,{type:a,progress:T})]}),x?jsxRuntimeExports.jsx("div",{className:"position--absolute bottom center",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary gat--btn__cracker",onClick:M,children:h("screens.continue")})}):null]})}HackerPuzzleComponent.defaultProps={type:"",writingSpeed:0,context:{},info:{},themeNumber:1};const imagenPorDefecto="https://min.gamelearn.io/css-resources/gamelearn/resources/puzzle-login-low.png";function LoginPuzzleComponent({emitEvent:l,soundActions:e,info:n,user:t,login:a,password:o,image:d,setResolveAction:f,nodeId:h}){var q;const u=re=>l({type:"translate",payload:re}),p=`login-puzzle_${h}`,_=LangIsRtl(),[b,S]=React$2.useState(""),[E,g]=React$2.useState(""),[v,T]=React$2.useState(!1),[R,x]=React$2.useState(""),[C,w]=React$2.useState(""),[P,D]=React$2.useState(!1),[N,k]=React$2.useState(!1),[F,M]=React$2.useState(!1),[U]=e,[$,B]=React$2.useState([]),J=((q=d.img)==null?void 0:q.url)||imagenPorDefecto,ne=()=>{const{rewards:re}=n.solution.right,ce=[...$,...re];l({type:"addPoints",complex:!0,finish:!0,payload:ce}),l({type:"passPuzzle"})},ie=()=>{U("click-ui");const re={login:!0,password:!1};a&&(re.login=t===b),re.password=o===E,re.login&&re.password?(w("success"),D(!0),k(!1),U("score"),setTimeout(()=>{ne()},2e3)):(B([...$,...n.solution.wrong.rewards]),U("fail"),w("failed"),k(!0),l({type:"failPuzzle"}))},Y=re=>{let ce="";if(re.length>=0){for(let fe=0;fe<re.length;fe+=1)ce+="•";x(ce)}};return React$2.useEffect(()=>{f(()=>{const re=[...$,...n.resolve.rewards];M(!0),setTimeout(()=>{l({type:"hidePuzzleButtons",payload:!1}),l({type:"puzzleAction",action:"resolve",payload:{element:p,rewards:re,finish:!0}})},2e3)})},[$,n.resolve.rewards,l,f,p]),jsxRuntimeExports.jsx("div",{className:"puzzle--layer",style:{backgroundImage:`url("${J}")`},children:jsxRuntimeExports.jsxs("div",{className:`puzzle--login ${t?"puzzle--login--withuser":""}`,children:[jsxRuntimeExports.jsx("span",{className:"icon-login-puzzle",children:" "}),jsxRuntimeExports.jsx("span",{className:"puzzle--login__title",children:u("puzzle.initSession")}),jsxRuntimeExports.jsxs("div",{children:[a&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--login__label",children:u("puzzle.user")}),jsxRuntimeExports.jsxs("div",{dir:"auto",className:"puzzle--login__group",children:[F?jsxRuntimeExports.jsx("input",{dir:_?"rtl":"auto",disabled:P,"data-testid":"username",className:"puzzle--login__input success",type:"text",placeholder:t,value:t}):jsxRuntimeExports.jsx("input",{dir:_?"rtl":"auto",disabled:P,"data-testid":"username",className:`puzzle--login__input ${C}`,type:"text",placeholder:u("puzzle.user"),onChange:re=>{S(re.target.value),w(""),k(!1)}}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check",children:" "})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--login__label",children:jsxRuntimeExports.jsx("span",{children:u("puzzle.password")})}),jsxRuntimeExports.jsxs("div",{dir:"auto",className:"puzzle--login__group",children:[F?jsxRuntimeExports.jsx("input",{dir:_?"rtl":"auto",disabled:!0,"data-testid":"password",className:"puzzle--login__input puzzle--login__input--fakepassword success",type:"text",placeholder:o,value:o,style:{opacity:1}}):jsxRuntimeExports.jsx("input",{dir:_?"rtl":"auto",disabled:P,"data-testid":"password",className:`puzzle--login__input puzzle--login__input--fakepassword ${C}`,type:"text",placeholder:u("puzzle.password"),onFocus:()=>{T(!0)},onBlur:()=>{T(!1)},onChange:re=>{g(re.target.value),Y(re.target.value),w(""),k(!1)}}),F?null:jsxRuntimeExports.jsx("div",{dir:_?"rtl":"auto",className:`login-fakepassword${v?" login-fakepassword--focus":""}${R.length?" login-fakepassword--fill":""} ${C||""}`,children:E?R:u("puzzle.password")}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check",children:" "})]})]})]}),jsxRuntimeExports.jsx("button",{type:"button",className:`gat--btn gat--btn__primary ${E.length!==0&&!P?"":"disabled"}`,onClick:ie,children:u("puzzle.loginIn")}),!F&&N&&n.solution.wrong.desc!==""&&jsxRuntimeExports.jsx("div",{className:"puzzle--login__label--error",children:n.solution.wrong.desc})]})})}function FeedbackComponent$1({text:l,success:e,playSound:n,additionalStyle:t,functionOnClose:a,secondText:o,translate:d,shortText:f,hasTimeout:h,delay:u,timeExpired:p,keyboardControl:_}){const[b,S]=React$2.useState();React$2.useEffect(()=>{let T;return n&&n(e?"score":"fail"),l&&!f&&(T=setTimeout(()=>{S(!0)},1e3)),()=>{T&&clearTimeout(T)}},[n,e,f,l]),React$2.useEffect(()=>{let T;return h&&a&&(T=setTimeout(a,u)),()=>{T&&clearTimeout(T)}},[u,a,h]);const E=()=>e?"success":"failed",g=()=>e?"icon-correct-thumb":p?"icon-times-up":"icon-incorrect-thumb",v=_({disabled:!(l&&a&&b),repeat:!1,forward:a,close:a});return React$2.useEffect(()=>v(),[v]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{"data-testid":"feedback-layer",className:`feedback-layer ${b?"feedback-layer--withexplain":""}`,children:[jsxRuntimeExports.jsxs("div",{className:`feedback-layer__header ${f?"feedback-layer__header--in-shortText":""} ${t||""} ${E()}`,children:[o&&jsxRuntimeExports.jsxs("span",{className:"puzzle--terminal__visor--file",children:[jsxRuntimeExports.jsx("span",{className:`puzzle--terminal__icon ${t||""}`}),jsxRuntimeExports.jsx("span",{children:o})]}),jsxRuntimeExports.jsx("span",{className:"feedback-layer__maintitle",children:!l||!f?jsxRuntimeExports.jsx("div",{title:d(`tooltip.${e?"correct":"incorrect"}`),className:`${g()}`}):l}),f&&jsxRuntimeExports.jsx("button",{type:"button",className:"feedback-layer__closeX",onClick:()=>a(),"aria-label":d("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})]}),!f&&l!==""&&jsxRuntimeExports.jsx("div",{className:"feedback-layer__explainwrap",children:jsxRuntimeExports.jsxs("div",{className:"feedback-layer__explain",children:[jsxRuntimeExports.jsx("div",{dir:"auto",children:HTMLReactParser$1(l)}),l&&a&&b&&jsxRuntimeExports.jsx("button",{type:"button","data-testid":"close-feedback",className:"gat--btn__navigation",onClick:()=>a(),"aria-label":d("storylines.misc.closePiece"),style:{display:"flex",margin:"auto",marginTop:"24px"},children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})})]})})}FeedbackComponent$1.defaultProps={text:"",hasTimeout:!1,delay:3e3,success:!1};function KeyboardPuzzleComponent({emitEvent:l,image:e,password:n,keyboard:t,info:a,disableExit:o,soundActions:d,setResolveAction:f,nodeId:h,keyboardControl:u,styles:p="default-theme"}){var ie,Y;const[_,b]=React$2.useState(""),[S,E]=React$2.useState(""),[g,v]=React$2.useState(!1),[T,R]=React$2.useState(""),[x,C]=React$2.useState(!1),[w,P]=React$2.useState([]),D=q=>l({type:"translate",payload:q}),N=`keyboard-puzzle_${h}`,[k]=d,F=React$2.useCallback(q=>{v(!1),C(!1),l({type:"hidePuzzleButtons",payload:!1}),l({type:"addPoints",complex:!0,finish:!0,payload:q})},[l]),M=()=>{if(g){const{rewards:q}=a.solution.right,re=[...w,...q];k("score"),F(re)}else l({type:"hidePuzzleButtons",payload:!1}),v(!1),o(!1),C(!1);R("")},U=q=>{q===n?(o(!1),b("success"),k("score"),l({type:"passPuzzle"}),v(!0),C(!0),a.solution.right.desc?R(a.solution.right.desc):setTimeout(()=>{const{rewards:re}=a.solution.right,ce=[...w,...re];F(ce)},3e3)):(C(!0),b("failed"),k("fail"),l({type:"failPuzzle"}),v(!1),P([...w,...a.solution.wrong.rewards]),l({type:"hidePuzzleButtons",payload:!1}),b(""),E(""),C(!0),a.solution.wrong.desc?R(a.solution.wrong.desc):setTimeout(()=>{M()},3e3))};React$2.useEffect(()=>{f(()=>{o(!1),k("score"),b("success"),v(!0),R(a.solution.right.desc),E(n);const q=[...w,...a.resolve.rewards];setTimeout(()=>{v(!1),C(!1),l({type:"hidePuzzleButtons",payload:!1}),l({type:"puzzleAction",action:"resolve",payload:{element:N,rewards:q,finish:!0}})},2e3)})},[f,o,a.solution.right.desc,k,a.resolve.rewards,w,n,l,N]);const $=(q,re)=>{const ce=t[q][re];k("click-ui"),S.length<n.length+1&&(E(S+ce),S.length+1===n.length&&U(S+ce))},B=()=>{k("click-ui"),E(S.substring(0,S.length-1))},ne={backgroundImage:`url("${((ie=e.img)==null?void 0:ie.url)||""}")`,backgroudPosition:"center center"};return jsxRuntimeExports.jsxs("div",{className:`puzzle-keyboard puzzle-keyboard--${p}`,style:(Y=e.img)!=null&&Y.url?ne:null,children:[jsxRuntimeExports.jsx("div",{className:"puzzle-keyboard__header",children:jsxRuntimeExports.jsxs("div",{className:"puzzle-keyboard__digits",children:[n.split("").map((q,re)=>jsxRuntimeExports.jsx("div",{className:`puzzle-keyboard__digit ${_}`,children:S.split("")[re]?S.split("")[re]:""},`${q+re}`)),_!==""?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:_==="success"?jsxRuntimeExports.jsx("span",{className:"puzzle-keyboard__positionatedToDigits icon-mini-check-circle"}):jsxRuntimeExports.jsx("span",{className:"puzzle-keyboard__positionatedToDigits icon-mini-error-circle"})}):jsxRuntimeExports.jsx("button",{type:"button",onClick:B,className:"puzzle-keyboard__positionatedToDigits puzzle-keyboard__delete","aria-label":D("puzzles.keyboard-puzzle.deleteButton"),children:jsxRuntimeExports.jsx("span",{className:"icon-delete-key-2023"})})]})}),jsxRuntimeExports.jsxs("div",{className:"puzzle-keyboard__keypad",children:[p==="scifi-theme"&&jsxRuntimeExports.jsx("div",{"aria-hidden":!0,className:"puzzle-keyboard__scifi-notch",children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{fill:"none",fillRule:"evenodd",children:[jsxRuntimeExports.jsxs("g",{transform:"translate(3 3)",children:[jsxRuntimeExports.jsx("circle",{fill:"#1E282F",cx:"5",cy:"5",r:"5"}),jsxRuntimeExports.jsx("path",{d:"M1.48 8.55a5 5 0 1 0 7.008-7.133",fillOpacity:".096",fill:"#1DDDD8"}),jsxRuntimeExports.jsx("circle",{fill:"#1DDDD8",opacity:".359",cx:"3",cy:"3",r:"2"})]}),jsxRuntimeExports.jsx("circle",{stroke:"#1E282F",cx:"8",cy:"8",r:"7.5"})]})})})}),jsxRuntimeExports.jsx("div",{className:`keyboard-keys keyboard-keys--${p}`,children:t.map((q,re)=>(Array.isArray(q)?q:Object.values(q)).map((ce,fe)=>jsxRuntimeExports.jsx("button",{className:`keyboard-key keyboard-key--${p} ${ce==="*"?"keyboard-key--star":""}`,type:"button",onClick:()=>$(re,fe),children:jsxRuntimeExports.jsx("div",{children:ce})},ce)))}),p==="scifi-theme"&&jsxRuntimeExports.jsx("hr",{"aria-hidden":!0,className:"puzzle-keyboard__scifi-line"})]}),x&&jsxRuntimeExports.jsx(FeedbackComponent$1,{translate:D,text:T,success:g,functionOnClose:M,keyboardControl:u})]})}var lib$1={exports:{}},_FullInternals={},_CoreInternals={},Global={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l._registerNode=l.Konva=l.glob=void 0;const e=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}l.glob=typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},l.Konva={_global:l.glob,version:"9.3.0",isBrowser:n(),isUnminified:/param/.test((function(a){}).toString()),dblClickWindow:400,getAngle(a){return l.Konva.angleDeg?a*e:a},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return l.Konva.DD.isDragging},isDragReady(){return!!l.Konva.DD.node},releaseCanvasOnDestroy:!0,document:l.glob.document,_injectGlobal(a){l.glob.Konva=a}};const t=a=>{l.Konva[a.prototype.getClassName()]=a};l._registerNode=t,l.Konva._injectGlobal(l.Konva)})(Global);var Util={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Util=l.Transform=void 0;const e=Global;class n{constructor(C=[1,0,0,1,0,0]){this.dirty=!1,this.m=C&&C.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(C){C.m[0]=this.m[0],C.m[1]=this.m[1],C.m[2]=this.m[2],C.m[3]=this.m[3],C.m[4]=this.m[4],C.m[5]=this.m[5]}point(C){var w=this.m;return{x:w[0]*C.x+w[2]*C.y+w[4],y:w[1]*C.x+w[3]*C.y+w[5]}}translate(C,w){return this.m[4]+=this.m[0]*C+this.m[2]*w,this.m[5]+=this.m[1]*C+this.m[3]*w,this}scale(C,w){return this.m[0]*=C,this.m[1]*=C,this.m[2]*=w,this.m[3]*=w,this}rotate(C){var w=Math.cos(C),P=Math.sin(C),D=this.m[0]*w+this.m[2]*P,N=this.m[1]*w+this.m[3]*P,k=this.m[0]*-P+this.m[2]*w,F=this.m[1]*-P+this.m[3]*w;return this.m[0]=D,this.m[1]=N,this.m[2]=k,this.m[3]=F,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(C,w){var P=this.m[0]+this.m[2]*w,D=this.m[1]+this.m[3]*w,N=this.m[2]+this.m[0]*C,k=this.m[3]+this.m[1]*C;return this.m[0]=P,this.m[1]=D,this.m[2]=N,this.m[3]=k,this}multiply(C){var w=this.m[0]*C.m[0]+this.m[2]*C.m[1],P=this.m[1]*C.m[0]+this.m[3]*C.m[1],D=this.m[0]*C.m[2]+this.m[2]*C.m[3],N=this.m[1]*C.m[2]+this.m[3]*C.m[3],k=this.m[0]*C.m[4]+this.m[2]*C.m[5]+this.m[4],F=this.m[1]*C.m[4]+this.m[3]*C.m[5]+this.m[5];return this.m[0]=w,this.m[1]=P,this.m[2]=D,this.m[3]=N,this.m[4]=k,this.m[5]=F,this}invert(){var C=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),w=this.m[3]*C,P=-this.m[1]*C,D=-this.m[2]*C,N=this.m[0]*C,k=C*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),F=C*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=w,this.m[1]=P,this.m[2]=D,this.m[3]=N,this.m[4]=k,this.m[5]=F,this}getMatrix(){return this.m}decompose(){var C=this.m[0],w=this.m[1],P=this.m[2],D=this.m[3],N=this.m[4],k=this.m[5],F=C*D-w*P;let M={x:N,y:k,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(C!=0||w!=0){var U=Math.sqrt(C*C+w*w);M.rotation=w>0?Math.acos(C/U):-Math.acos(C/U),M.scaleX=U,M.scaleY=F/U,M.skewX=(C*P+w*D)/F,M.skewY=0}else if(P!=0||D!=0){var $=Math.sqrt(P*P+D*D);M.rotation=Math.PI/2-(D>0?Math.acos(-P/$):-Math.acos(P/$)),M.scaleX=F/$,M.scaleY=$,M.skewX=0,M.skewY=(C*P+w*D)/F}return M.rotation=l.Util._getRotation(M.rotation),M}}l.Transform=n;var t="[object Array]",a="[object Number]",o="[object String]",d="[object Boolean]",f=Math.PI/180,h=180/Math.PI,u="#",p="",_="0",b="Konva warning: ",S="Konva error: ",E="rgb(",g={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},v=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,T=[];const R=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(x){setTimeout(x,60)};l.Util={_isElement(x){return!!(x&&x.nodeType==1)},_isFunction(x){return!!(x&&x.constructor&&x.call&&x.apply)},_isPlainObject(x){return!!x&&x.constructor===Object},_isArray(x){return Object.prototype.toString.call(x)===t},_isNumber(x){return Object.prototype.toString.call(x)===a&&!isNaN(x)&&isFinite(x)},_isString(x){return Object.prototype.toString.call(x)===o},_isBoolean(x){return Object.prototype.toString.call(x)===d},isObject(x){return x instanceof Object},isValidSelector(x){if(typeof x!="string")return!1;var C=x[0];return C==="#"||C==="."||C===C.toUpperCase()},_sign(x){return x===0||x>0?1:-1},requestAnimFrame(x){T.push(x),T.length===1&&R(function(){const C=T;T=[],C.forEach(function(w){w()})})},createCanvasElement(){var x=document.createElement("canvas");try{x.style=x.style||{}}catch{}return x},createImageElement(){return document.createElement("img")},_isInDocument(x){for(;x=x.parentNode;)if(x==document)return!0;return!1},_urlToImage(x,C){var w=l.Util.createImageElement();w.onload=function(){C(w)},w.src=x},_rgbToHex(x,C,w){return((1<<24)+(x<<16)+(C<<8)+w).toString(16).slice(1)},_hexToRgb(x){x=x.replace(u,p);var C=parseInt(x,16);return{r:C>>16&255,g:C>>8&255,b:C&255}},getRandomColor(){for(var x=(Math.random()*16777215<<0).toString(16);x.length<6;)x=_+x;return u+x},getRGB(x){var C;return x in g?(C=g[x],{r:C[0],g:C[1],b:C[2]}):x[0]===u?this._hexToRgb(x.substring(1)):x.substr(0,4)===E?(C=v.exec(x.replace(/ /g,"")),{r:parseInt(C[1],10),g:parseInt(C[2],10),b:parseInt(C[3],10)}):{r:0,g:0,b:0}},colorToRGBA(x){return x=x||"black",l.Util._namedColorToRBA(x)||l.Util._hex3ColorToRGBA(x)||l.Util._hex4ColorToRGBA(x)||l.Util._hex6ColorToRGBA(x)||l.Util._hex8ColorToRGBA(x)||l.Util._rgbColorToRGBA(x)||l.Util._rgbaColorToRGBA(x)||l.Util._hslColorToRGBA(x)},_namedColorToRBA(x){var C=g[x.toLowerCase()];return C?{r:C[0],g:C[1],b:C[2],a:1}:null},_rgbColorToRGBA(x){if(x.indexOf("rgb(")===0){x=x.match(/rgb\(([^)]+)\)/)[1];var C=x.split(/ *, */).map(Number);return{r:C[0],g:C[1],b:C[2],a:1}}},_rgbaColorToRGBA(x){if(x.indexOf("rgba(")===0){x=x.match(/rgba\(([^)]+)\)/)[1];var C=x.split(/ *, */).map((w,P)=>w.slice(-1)==="%"?P===3?parseInt(w)/100:parseInt(w)/100*255:Number(w));return{r:C[0],g:C[1],b:C[2],a:C[3]}}},_hex8ColorToRGBA(x){if(x[0]==="#"&&x.length===9)return{r:parseInt(x.slice(1,3),16),g:parseInt(x.slice(3,5),16),b:parseInt(x.slice(5,7),16),a:parseInt(x.slice(7,9),16)/255}},_hex6ColorToRGBA(x){if(x[0]==="#"&&x.length===7)return{r:parseInt(x.slice(1,3),16),g:parseInt(x.slice(3,5),16),b:parseInt(x.slice(5,7),16),a:1}},_hex4ColorToRGBA(x){if(x[0]==="#"&&x.length===5)return{r:parseInt(x[1]+x[1],16),g:parseInt(x[2]+x[2],16),b:parseInt(x[3]+x[3],16),a:parseInt(x[4]+x[4],16)/255}},_hex3ColorToRGBA(x){if(x[0]==="#"&&x.length===4)return{r:parseInt(x[1]+x[1],16),g:parseInt(x[2]+x[2],16),b:parseInt(x[3]+x[3],16),a:1}},_hslColorToRGBA(x){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(x)){const[C,...w]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(x),P=Number(w[0])/360,D=Number(w[1])/100,N=Number(w[2])/100;let k,F,M;if(D===0)return M=N*255,{r:Math.round(M),g:Math.round(M),b:Math.round(M),a:1};N<.5?k=N*(1+D):k=N+D-N*D;const U=2*N-k,$=[0,0,0];for(let B=0;B<3;B++)F=P+1/3*-(B-1),F<0&&F++,F>1&&F--,6*F<1?M=U+(k-U)*6*F:2*F<1?M=k:3*F<2?M=U+(k-U)*(2/3-F)*6:M=U,$[B]=M*255;return{r:Math.round($[0]),g:Math.round($[1]),b:Math.round($[2]),a:1}}},haveIntersection(x,C){return!(C.x>x.x+x.width||C.x+C.width<x.x||C.y>x.y+x.height||C.y+C.height<x.y)},cloneObject(x){var C={};for(var w in x)this._isPlainObject(x[w])?C[w]=this.cloneObject(x[w]):this._isArray(x[w])?C[w]=this.cloneArray(x[w]):C[w]=x[w];return C},cloneArray(x){return x.slice(0)},degToRad(x){return x*f},radToDeg(x){return x*h},_degToRad(x){return l.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),l.Util.degToRad(x)},_radToDeg(x){return l.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),l.Util.radToDeg(x)},_getRotation(x){return e.Konva.angleDeg?l.Util.radToDeg(x):x},_capitalize(x){return x.charAt(0).toUpperCase()+x.slice(1)},throw(x){throw new Error(S+x)},error(x){console.error(S+x)},warn(x){e.Konva.showWarnings&&console.warn(b+x)},each(x,C){for(var w in x)C(w,x[w])},_inRange(x,C,w){return C<=x&&x<w},_getProjectionToSegment(x,C,w,P,D,N){var k,F,M,U=(x-w)*(x-w)+(C-P)*(C-P);if(U==0)k=x,F=C,M=(D-w)*(D-w)+(N-P)*(N-P);else{var $=((D-x)*(w-x)+(N-C)*(P-C))/U;$<0?(k=x,F=C,M=(x-D)*(x-D)+(C-N)*(C-N)):$>1?(k=w,F=P,M=(w-D)*(w-D)+(P-N)*(P-N)):(k=x+$*(w-x),F=C+$*(P-C),M=(k-D)*(k-D)+(F-N)*(F-N))}return[k,F,M]},_getProjectionToLine(x,C,w){var P=l.Util.cloneObject(x),D=Number.MAX_VALUE;return C.forEach(function(N,k){if(!(!w&&k===C.length-1)){var F=C[(k+1)%C.length],M=l.Util._getProjectionToSegment(N.x,N.y,F.x,F.y,x.x,x.y),U=M[0],$=M[1],B=M[2];B<D&&(P.x=U,P.y=$,D=B)}}),P},_prepareArrayForTween(x,C,w){var P,D=[],N=[];if(x.length>C.length){var k=C;C=x,x=k}for(P=0;P<x.length;P+=2)D.push({x:x[P],y:x[P+1]});for(P=0;P<C.length;P+=2)N.push({x:C[P],y:C[P+1]});var F=[];return N.forEach(function(M){var U=l.Util._getProjectionToLine(M,D,w);F.push(U.x),F.push(U.y)}),F},_prepareToStringify(x){var C;x.visitedByCircularReferenceRemoval=!0;for(var w in x)if(x.hasOwnProperty(w)&&x[w]&&typeof x[w]=="object"){if(C=Object.getOwnPropertyDescriptor(x,w),x[w].visitedByCircularReferenceRemoval||l.Util._isElement(x[w]))if(C.configurable)delete x[w];else return null;else if(l.Util._prepareToStringify(x[w])===null)if(C.configurable)delete x[w];else return null}return delete x.visitedByCircularReferenceRemoval,x},_assign(x,C){for(var w in C)x[w]=C[w];return x},_getFirstPointerId(x){return x.touches?x.changedTouches[0].identifier:x.pointerId||999},releaseCanvas(...x){e.Konva.releaseCanvasOnDestroy&&x.forEach(C=>{C.width=0,C.height=0})},drawRoundedRectPath(x,C,w,P){let D=0,N=0,k=0,F=0;typeof P=="number"?D=N=k=F=Math.min(P,C/2,w/2):(D=Math.min(P[0]||0,C/2,w/2),N=Math.min(P[1]||0,C/2,w/2),F=Math.min(P[2]||0,C/2,w/2),k=Math.min(P[3]||0,C/2,w/2)),x.moveTo(D,0),x.lineTo(C-N,0),x.arc(C-N,N,N,Math.PI*3/2,0,!1),x.lineTo(C,w-F),x.arc(C-F,w-F,F,0,Math.PI/2,!1),x.lineTo(k,w),x.arc(k,w-k,k,Math.PI/2,Math.PI,!1),x.lineTo(0,D),x.arc(D,D,D,Math.PI,Math.PI*3/2,!1)}}})(Util);var Node$1={},Factory={},Validators={};Object.defineProperty(Validators,"__esModule",{value:!0});Validators.getComponentValidator=Validators.getBooleanValidator=Validators.getNumberArrayValidator=Validators.getFunctionValidator=Validators.getStringOrGradientValidator=Validators.getStringValidator=Validators.getNumberOrAutoValidator=Validators.getNumberOrArrayOfNumbersValidator=Validators.getNumberValidator=Validators.alphaComponent=Validators.RGBComponent=void 0;const Global_1$p=Global,Util_1$f=Util;function _formatValue(l){return Util_1$f.Util._isString(l)?'"'+l+'"':Object.prototype.toString.call(l)==="[object Number]"||Util_1$f.Util._isBoolean(l)?l:Object.prototype.toString.call(l)}function RGBComponent(l){return l>255?255:l<0?0:Math.round(l)}Validators.RGBComponent=RGBComponent;function alphaComponent(l){return l>1?1:l<1e-4?1e-4:l}Validators.alphaComponent=alphaComponent;function getNumberValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){return Util_1$f.Util._isNumber(l)||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),l}}Validators.getNumberValidator=getNumberValidator;function getNumberOrArrayOfNumbersValidator(l){if(Global_1$p.Konva.isUnminified)return function(e,n){let t=Util_1$f.Util._isNumber(e),a=Util_1$f.Util._isArray(e)&&e.length==l;return!t&&!a&&Util_1$f.Util.warn(_formatValue(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+l+")"),e}}Validators.getNumberOrArrayOfNumbersValidator=getNumberOrArrayOfNumbersValidator;function getNumberOrAutoValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){var n=Util_1$f.Util._isNumber(l),t=l==="auto";return n||t||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),l}}Validators.getNumberOrAutoValidator=getNumberOrAutoValidator;function getStringValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){return Util_1$f.Util._isString(l)||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),l}}Validators.getStringValidator=getStringValidator;function getStringOrGradientValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){const n=Util_1$f.Util._isString(l),t=Object.prototype.toString.call(l)==="[object CanvasGradient]"||l&&l.addColorStop;return n||t||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),l}}Validators.getStringOrGradientValidator=getStringOrGradientValidator;function getFunctionValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){return Util_1$f.Util._isFunction(l)||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),l}}Validators.getFunctionValidator=getFunctionValidator;function getNumberArrayValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&l instanceof n||(Util_1$f.Util._isArray(l)?l.forEach(function(t){Util_1$f.Util._isNumber(t)||Util_1$f.Util.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")}):Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),l}}Validators.getNumberArrayValidator=getNumberArrayValidator;function getBooleanValidator(){if(Global_1$p.Konva.isUnminified)return function(l,e){var n=l===!0||l===!1;return n||Util_1$f.Util.warn(_formatValue(l)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),l}}Validators.getBooleanValidator=getBooleanValidator;function getComponentValidator(l){if(Global_1$p.Konva.isUnminified)return function(e,n){return e==null||Util_1$f.Util.isObject(e)||Util_1$f.Util.warn(_formatValue(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+l),e}}Validators.getComponentValidator=getComponentValidator;(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Factory=void 0;const e=Util,n=Validators;var t="get",a="set";l.Factory={addGetterSetter(o,d,f,h,u){l.Factory.addGetter(o,d,f),l.Factory.addSetter(o,d,h,u),l.Factory.addOverloadedGetterSetter(o,d)},addGetter(o,d,f){var h=t+e.Util._capitalize(d);o.prototype[h]=o.prototype[h]||function(){var u=this.attrs[d];return u===void 0?f:u}},addSetter(o,d,f,h){var u=a+e.Util._capitalize(d);o.prototype[u]||l.Factory.overWriteSetter(o,d,f,h)},overWriteSetter(o,d,f,h){var u=a+e.Util._capitalize(d);o.prototype[u]=function(p){return f&&p!==void 0&&p!==null&&(p=f.call(this,p,d)),this._setAttr(d,p),h&&h.call(this),this}},addComponentsGetterSetter(o,d,f,h,u){var p=f.length,_=e.Util._capitalize,b=t+_(d),S=a+_(d),E,g;o.prototype[b]=function(){var T={};for(E=0;E<p;E++)g=f[E],T[g]=this.getAttr(d+_(g));return T};var v=(0,n.getComponentValidator)(f);o.prototype[S]=function(T){var R=this.attrs[d],x;h&&(T=h.call(this,T)),v&&v.call(this,T,d);for(x in T)T.hasOwnProperty(x)&&this._setAttr(d+_(x),T[x]);return T||f.forEach(C=>{this._setAttr(d+_(C),void 0)}),this._fireChangeEvent(d,R,T),u&&u.call(this),this},l.Factory.addOverloadedGetterSetter(o,d)},addOverloadedGetterSetter(o,d){var f=e.Util._capitalize(d),h=a+f,u=t+f;o.prototype[d]=function(){return arguments.length?(this[h](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,d,f,h){e.Util.error("Adding deprecated "+d);var u=t+e.Util._capitalize(d),p=d+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){e.Util.error(p);var _=this.attrs[d];return _===void 0?f:_},l.Factory.addSetter(o,d,h,function(){e.Util.error(p)}),l.Factory.addOverloadedGetterSetter(o,d)},backCompat(o,d){e.Util.each(d,function(f,h){var u=o.prototype[h],p=t+e.Util._capitalize(f),_=a+e.Util._capitalize(f);function b(){u.apply(this,arguments),e.Util.error('"'+f+'" method is deprecated and will be removed soon. Use ""'+h+'" instead.')}o.prototype[f]=b,o.prototype[p]=b,o.prototype[_]=b})},afterSetFilter(){this._filterUpToDate=!1}}})(Factory);var Canvas$1={},Context$2={};Object.defineProperty(Context$2,"__esModule",{value:!0});Context$2.HitContext=Context$2.SceneContext=Context$2.Context=void 0;const Util_1$e=Util,Global_1$o=Global;function simplifyArray(l){var e=[],n=l.length,t=Util_1$e.Util,a,o;for(a=0;a<n;a++)o=l[a],t._isNumber(o)?o=Math.round(o*1e3)/1e3:t._isString(o)||(o=o+""),e.push(o);return e}var COMMA=",",OPEN_PAREN="(",CLOSE_PAREN=")",OPEN_PAREN_BRACKET="([",CLOSE_BRACKET_PAREN="])",SEMICOLON=";",DOUBLE_PAREN="()",EQUALS="=",CONTEXT_METHODS=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],CONTEXT_PROPERTIES=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const traceArrMax=100;let Context$1=class{constructor(e){this.canvas=e,Global_1$o.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,n){var t=this.traceArr,a=t.length,o="",d,f,h,u;for(d=0;d<a;d++)f=t[d],h=f.method,h?(u=f.args,o+=h,e?o+=DOUBLE_PAREN:Util_1$e.Util._isArray(u[0])?o+=OPEN_PAREN_BRACKET+u.join(COMMA)+CLOSE_BRACKET_PAREN:(n&&(u=u.map(p=>typeof p=="number"?Math.floor(p):p)),o+=OPEN_PAREN+u.join(COMMA)+CLOSE_PAREN)):(o+=f.property,e||(o+=EQUALS+f.val)),o+=SEMICOLON;return o}clearTrace(){this.traceArr=[]}_trace(e){var n=this.traceArr,t;n.push(e),t=n.length,t>=traceArrMax&&n.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){const n=e.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(e){var n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){const n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,t,a,o,d){this._context.arc(e,n,t,a,o,d)}arcTo(e,n,t,a,o){this._context.arcTo(e,n,t,a,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,t,a,o,d){this._context.bezierCurveTo(e,n,t,a,o,d)}clearRect(e,n,t,a){this._context.clearRect(e,n,t,a)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){var t=arguments;if(t.length===2)return this._context.createImageData(e,n);if(t.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,t,a){return this._context.createLinearGradient(e,n,t,a)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,t,a,o,d){return this._context.createRadialGradient(e,n,t,a,o,d)}drawImage(e,n,t,a,o,d,f,h,u){var p=arguments,_=this._context;p.length===3?_.drawImage(e,n,t):p.length===5?_.drawImage(e,n,t,a,o):p.length===9&&_.drawImage(e,n,t,a,o,d,f,h,u)}ellipse(e,n,t,a,o,d,f,h){this._context.ellipse(e,n,t,a,o,d,f,h)}isPointInPath(e,n,t,a){return t?this._context.isPointInPath(t,e,n,a):this._context.isPointInPath(e,n,a)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,t,a){this._context.fillRect(e,n,t,a)}strokeRect(e,n,t,a){this._context.strokeRect(e,n,t,a)}fillText(e,n,t,a){a?this._context.fillText(e,n,t,a):this._context.fillText(e,n,t)}measureText(e){return this._context.measureText(e)}getImageData(e,n,t,a){return this._context.getImageData(e,n,t,a)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,t,a){this._context.rect(e,n,t,a)}putImageData(e,n,t){this._context.putImageData(e,n,t)}quadraticCurveTo(e,n,t,a){this._context.quadraticCurveTo(e,n,t,a)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,t,a,o,d){this._context.setTransform(e,n,t,a,o,d)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,t,a){this._context.strokeText(e,n,t,a)}transform(e,n,t,a,o,d){this._context.transform(e,n,t,a,o,d)}translate(e,n){this._context.translate(e,n)}_enableTrace(){var e=this,n=CONTEXT_METHODS.length,t=this.setAttr,a,o,d=function(f){var h=e[f],u;e[f]=function(){return o=simplifyArray(Array.prototype.slice.call(arguments,0)),u=h.apply(e,arguments),e._trace({method:f,args:o}),u}};for(a=0;a<n;a++)d(CONTEXT_METHODS[a]);e.setAttr=function(){t.apply(e,arguments);var f=arguments[0],h=arguments[1];(f==="shadowOffsetX"||f==="shadowOffsetY"||f==="shadowBlur")&&(h=h/this.canvas.getPixelRatio()),e._trace({property:f,val:h})}}_applyGlobalCompositeOperation(e){const n=e.attrs.globalCompositeOperation;var t=!n||n==="source-over";t||this.setAttr("globalCompositeOperation",n)}};Context$2.Context=Context$1;CONTEXT_PROPERTIES.forEach(function(l){Object.defineProperty(Context$1.prototype,l,{get(){return this._context[l]},set(e){this._context[l]=e}})});class SceneContext extends Context$1{constructor(e,{willReadFrequently:n=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:n})}_fillColor(e){var n=e.fill();this.setAttr("fillStyle",n),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){var n=e._getLinearGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fillRadialGradient(e){const n=e._getRadialGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fill(e){const n=e.fill(),t=e.getFillPriority();if(n&&t==="color"){this._fillColor(e);return}const a=e.getFillPatternImage();if(a&&t==="pattern"){this._fillPattern(e);return}const o=e.getFillLinearGradientColorStops();if(o&&t==="linear-gradient"){this._fillLinearGradient(e);return}const d=e.getFillRadialGradientColorStops();if(d&&t==="radial-gradient"){this._fillRadialGradient(e);return}n?this._fillColor(e):a?this._fillPattern(e):o?this._fillLinearGradient(e):d&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const n=e.getStrokeLinearGradientStartPoint(),t=e.getStrokeLinearGradientEndPoint(),a=e.getStrokeLinearGradientColorStops(),o=this.createLinearGradient(n.x,n.y,t.x,t.y);if(a){for(var d=0;d<a.length;d+=2)o.addColorStop(a[d],a[d+1]);this.setAttr("strokeStyle",o)}}_stroke(e){var n=e.dash(),t=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!t){this.save();var a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}this._applyLineCap(e),n&&e.dashEnabled()&&(this.setLineDash(n),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");var o=e.getStrokeLinearGradientColorStops();o?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),t||this.restore()}}_applyShadow(e){var n,t,a,o=(n=e.getShadowRGBA())!==null&&n!==void 0?n:"black",d=(t=e.getShadowBlur())!==null&&t!==void 0?t:5,f=(a=e.getShadowOffset())!==null&&a!==void 0?a:{x:0,y:0},h=e.getAbsoluteScale(),u=this.canvas.getPixelRatio(),p=h.x*u,_=h.y*u;this.setAttr("shadowColor",o),this.setAttr("shadowBlur",d*Math.min(Math.abs(p),Math.abs(_))),this.setAttr("shadowOffsetX",f.x*p),this.setAttr("shadowOffsetY",f.y*_)}}Context$2.SceneContext=SceneContext;class HitContext extends Context$1{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const o=e.getStrokeScaleEnabled();if(!o){this.save();var n=this.getCanvas().getPixelRatio();this.setTransform(n,0,0,n,0,0)}this._applyLineCap(e);var t=e.hitStrokeWidth(),a=t==="auto"?e.strokeWidth():t;this.setAttr("lineWidth",a),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),o||this.restore()}}}Context$2.HitContext=HitContext;Object.defineProperty(Canvas$1,"__esModule",{value:!0});Canvas$1.HitCanvas=Canvas$1.SceneCanvas=Canvas$1.Canvas=void 0;const Util_1$d=Util,Context_1=Context$2,Global_1$n=Global,Factory_1$z=Factory,Validators_1$y=Validators;var _pixelRatio;function getDevicePixelRatio(){if(_pixelRatio)return _pixelRatio;var l=Util_1$d.Util.createCanvasElement(),e=l.getContext("2d");return _pixelRatio=function(){var n=Global_1$n.Konva._global.devicePixelRatio||1,t=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return n/t}(),Util_1$d.Util.releaseCanvas(l),_pixelRatio}class Canvas{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var n=e||{},t=n.pixelRatio||Global_1$n.Konva.pixelRatio||getDevicePixelRatio();this.pixelRatio=t,this._canvas=Util_1$d.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){var n=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/n,this.getHeight()/n)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";var n=this.pixelRatio,t=this.getContext()._context;t.scale(n,n)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";var n=this.pixelRatio,t=this.getContext()._context;t.scale(n,n)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,n){this.setWidth(e||0),this.setHeight(n||0)}toDataURL(e,n){try{return this._canvas.toDataURL(e,n)}catch{try{return this._canvas.toDataURL()}catch(a){return Util_1$d.Util.error("Unable to get data URL. "+a.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}Canvas$1.Canvas=Canvas;Factory_1$z.Factory.addGetterSetter(Canvas,"pixelRatio",void 0,(0,Validators_1$y.getNumberValidator)());class SceneCanvas extends Canvas{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new Context_1.SceneContext(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}Canvas$1.SceneCanvas=SceneCanvas;class HitCanvas extends Canvas{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new Context_1.HitContext(this),this.setSize(e.width,e.height)}}Canvas$1.HitCanvas=HitCanvas;var DragAndDrop={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.DD=void 0;const e=Global,n=Util;l.DD={get isDragging(){var t=!1;return l.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){var t;return l.DD._dragElements.forEach(a=>{t=a.node}),t},_dragElements:new Map,_drag(t){const a=[];l.DD._dragElements.forEach((o,d)=>{const{node:f}=o,h=f.getStage();h.setPointersPositions(t),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(t));const u=h._changedPointerPositions.find(b=>b.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var p=f.dragDistance(),_=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(_<p||(f.startDrag({evt:t}),!f.isDragging()))return}f._setDragPosition(t,o),a.push(f)}}),a.forEach(o=>{o.fire("dragmove",{type:"dragmove",target:o,evt:t},!0)})},_endDragBefore(t){const a=[];l.DD._dragElements.forEach(o=>{const{node:d}=o,f=d.getStage();if(t&&f.setPointersPositions(t),!f._changedPointerPositions.find(p=>p.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(l.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof e.Konva.Stage&&o.node;u&&a.indexOf(u)===-1&&a.push(u)}),a.forEach(o=>{o.draw()})},_endDragAfter(t){l.DD._dragElements.forEach((a,o)=>{a.dragStatus==="stopped"&&a.node.fire("dragend",{type:"dragend",target:a.node,evt:t},!0),a.dragStatus!=="dragging"&&l.DD._dragElements.delete(o)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",l.DD._endDragBefore,!0),window.addEventListener("touchend",l.DD._endDragBefore,!0),window.addEventListener("mousemove",l.DD._drag),window.addEventListener("touchmove",l.DD._drag),window.addEventListener("mouseup",l.DD._endDragAfter,!1),window.addEventListener("touchend",l.DD._endDragAfter,!1))})(DragAndDrop);Object.defineProperty(Node$1,"__esModule",{value:!0});Node$1.Node=void 0;const Util_1$c=Util,Factory_1$y=Factory,Canvas_1$1=Canvas$1,Global_1$m=Global,DragAndDrop_1=DragAndDrop,Validators_1$x=Validators;var ABSOLUTE_OPACITY="absoluteOpacity",ALL_LISTENERS="allEventListeners",ABSOLUTE_TRANSFORM="absoluteTransform",ABSOLUTE_SCALE="absoluteScale",CANVAS="canvas",CHANGE="Change",CHILDREN="children",KONVA="konva",LISTENING="listening",MOUSEENTER="mouseenter",MOUSELEAVE="mouseleave",SET="set",SHAPE="Shape",SPACE$1=" ",STAGE="stage",TRANSFORM="transform",UPPER_STAGE="Stage",VISIBLE="visible",TRANSFORM_CHANGE_STR$1=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(SPACE$1);let idCounter=1;class Node{constructor(e){this._id=idCounter++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===TRANSFORM||e===ABSOLUTE_TRANSFORM)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){var t=this._cache.get(e),a=e===TRANSFORM||e===ABSOLUTE_TRANSFORM,o=t===void 0||a&&t.dirty===!0;return o&&(t=n.call(this),this._cache.set(e,t)),t}_calculate(e,n,t){if(!this._attachedDepsListeners.get(e)){const a=n.map(o=>o+"Change.konva").join(SPACE$1);this.on(a,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,t)}_getCanvasCache(){return this._cache.get(CANVAS)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===ABSOLUTE_TRANSFORM&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(CANVAS)){const{scene:e,filter:n,hit:t}=this._cache.get(CANVAS);Util_1$c.Util.releaseCanvas(e,n,t),this._cache.delete(CANVAS)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var n=e||{},t={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(t=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var a=Math.ceil(n.width||t.width),o=Math.ceil(n.height||t.height),d=n.pixelRatio,f=n.x===void 0?Math.floor(t.x):n.x,h=n.y===void 0?Math.floor(t.y):n.y,u=n.offset||0,p=n.drawBorder||!1,_=n.hitCanvasPixelRatio||1;if(!a||!o){Util_1$c.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}a+=u*2+1,o+=u*2+1,f-=u,h-=u;var b=new Canvas_1$1.SceneCanvas({pixelRatio:d,width:a,height:o}),S=new Canvas_1$1.SceneCanvas({pixelRatio:d,width:0,height:0,willReadFrequently:!0}),E=new Canvas_1$1.HitCanvas({pixelRatio:_,width:a,height:o}),g=b.getContext(),v=E.getContext();return E.isCache=!0,b.isCache=!0,this._cache.delete(CANVAS),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(b.getContext()._context.imageSmoothingEnabled=!1,S.getContext()._context.imageSmoothingEnabled=!1),g.save(),v.save(),g.translate(-f,-h),v.translate(-f,-h),this._isUnderCache=!0,this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY),this._clearSelfAndDescendantCache(ABSOLUTE_SCALE),this.drawScene(b,this),this.drawHit(E,this),this._isUnderCache=!1,g.restore(),v.restore(),p&&(g.save(),g.beginPath(),g.rect(0,0,a,o),g.closePath(),g.setAttr("strokeStyle","red"),g.setAttr("lineWidth",5),g.stroke(),g.restore()),this._cache.set(CANVAS,{scene:b,filter:S,hit:E,x:f,y:h}),this._requestDraw(),this}isCached(){return this._cache.has(CANVAS)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){var t=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],a=1/0,o=1/0,d=-1/0,f=-1/0,h=this.getAbsoluteTransform(n);return t.forEach(function(u){var p=h.point(u);a===void 0&&(a=d=p.x,o=f=p.y),a=Math.min(a,p.x),o=Math.min(o,p.y),d=Math.max(d,p.x),f=Math.max(f,p.y)}),{x:a,y:o,width:d-a,height:f-o}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);var t=this._getCachedSceneCanvas(),a=t.pixelRatio;e.drawImage(t._canvas,0,0,t.width/a,t.height/a),e.restore()}_drawCachedHitCanvas(e){var n=this._getCanvasCache(),t=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(t._canvas,0,0,t.width/t.pixelRatio,t.height/t.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e=this.filters(),n=this._getCanvasCache(),t=n.scene,a=n.filter,o=a.getContext(),d,f,h,u;if(e){if(!this._filterUpToDate){var p=t.pixelRatio;a.setSize(t.width/t.pixelRatio,t.height/t.pixelRatio);try{for(d=e.length,o.clear(),o.drawImage(t._canvas,0,0,t.getWidth()/p,t.getHeight()/p),f=o.getImageData(0,0,a.getWidth(),a.getHeight()),h=0;h<d;h++){if(u=e[h],typeof u!="function"){Util_1$c.Util.error("Filter should be type of function, but got "+typeof u+" instead. Please check correct filters");continue}u.call(this,f),o.putImageData(f,0,0)}}catch(_){Util_1$c.Util.error("Unable to apply filter. "+_.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return a}return t}on(e,n){if(this._cache&&this._cache.delete(ALL_LISTENERS),arguments.length===3)return this._delegate.apply(this,arguments);var t=e.split(SPACE$1),a=t.length,o,d,f,h,u;for(o=0;o<a;o++)d=t[o],f=d.split("."),h=f[0],u=f[1]||"",this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:u,handler:n});return this}off(e,n){var t=(e||"").split(SPACE$1),a=t.length,o,d,f,h,u,p;if(this._cache&&this._cache.delete(ALL_LISTENERS),!e)for(d in this.eventListeners)this._off(d);for(o=0;o<a;o++)if(f=t[o],h=f.split("."),u=h[0],p=h[1],u)this.eventListeners[u]&&this._off(u,p,n);else for(d in this.eventListeners)this._off(d,p,n);return this}dispatchEvent(e){var n={target:this,type:e.type,evt:e};return this.fire(e.type,n),this}addEventListener(e,n){return this.on(e,function(t){n.call(this,t.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,n,t){var a=this;this.on(e,function(o){for(var d=o.target.findAncestors(n,!0,a),f=0;f<d.length;f++)o=Util_1$c.Util.cloneObject(o),o.currentTarget=d[f],t.call(d[f],o)})}remove(){return this.isDragging()&&this.stopDrag(),DragAndDrop_1.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY),this._clearSelfAndDescendantCache(ABSOLUTE_SCALE),this._clearSelfAndDescendantCache(STAGE),this._clearSelfAndDescendantCache(VISIBLE),this._clearSelfAndDescendantCache(LISTENING)}_remove(){this._clearCaches();var e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){var n="get"+Util_1$c.Util._capitalize(e);return Util_1$c.Util._isFunction(this[n])?this[n]():this.attrs[e]}getAncestors(){for(var e=this.getParent(),n=[];e;)n.push(e),e=e.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{var n,t;if(!e)return this;for(n in e)n!==CHILDREN&&(t=SET+Util_1$c.Util._capitalize(n),Util_1$c.Util._isFunction(this[t])?this[t](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(LISTENING,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return t&&t!==e&&this!==e?t._isListening(e):!0}isVisible(){return this._getCache(VISIBLE,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return t&&t!==e&&this!==e?t._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);var t=this.getLayer(),a=!1;DragAndDrop_1.DD._dragElements.forEach(d=>{d.dragStatus==="dragging"&&(d.node.nodeType==="Stage"||d.node.getLayer()===t)&&(a=!0)});var o=!n&&!Global_1$m.Konva.hitOnDragEnabled&&a;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),n=this,t=0,a,o,d,f;function h(p){for(a=[],o=p.length,d=0;d<o;d++)f=p[d],t++,f.nodeType!==SHAPE&&(a=a.concat(f.getChildren().slice())),f._id===n._id&&(d=o);a.length>0&&a[0].getDepth()<=e&&h(a)}const u=this.getStage();return n.nodeType!==UPPER_STAGE&&u&&h(u.getChildren()),t}getDepth(){for(var e=0,n=this.parent;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;var n=e.getPointerPosition();if(!n)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(n)}getAbsolutePosition(e){let n=!1,t=this.parent;for(;t;){if(t.isCached()){n=!0;break}t=t.parent}n&&!e&&(e=!0);var a=this.getAbsoluteTransform(e).getMatrix(),o=new Util_1$c.Transform,d=this.offset();return o.m=a.slice(),o.translate(d.x,d.y),o.getTranslation()}setAbsolutePosition(e){const{x:n,y:t,...a}=this._clearTransform();this.attrs.x=n,this.attrs.y=t,this._clearCache(TRANSFORM);var o=this._getAbsoluteTransform().copy();return o.invert(),o.translate(e.x,e.y),e={x:this.attrs.x+o.getTranslation().x,y:this.attrs.y+o.getTranslation().y},this._setTransform(a),this.setPosition({x:e.x,y:e.y}),this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM),this}_setTransform(e){var n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var n=e.x,t=e.y,a=this.x(),o=this.y();return n!==void 0&&(a+=n),t!==void 0&&(o+=t),this.setPosition({x:a,y:o}),this}_eachAncestorReverse(e,n){var t=[],a=this.getParent(),o,d;if(!(n&&n._id===this._id)){for(t.unshift(this);a&&(!n||a._id!==n._id);)t.unshift(a),a=a.parent;for(o=t.length,d=0;d<o;d++)e(t[d])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Util_1$c.Util.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(ABSOLUTE_OPACITY,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},n=this.getAttrs(),t,a,o,d,f;e.attrs={};for(t in n)a=n[t],f=Util_1$c.Util.isObject(a)&&!Util_1$c.Util._isPlainObject(a)&&!Util_1$c.Util._isArray(a),!f&&(o=typeof this[t]=="function"&&this[t],delete n[t],d=o?o.call(this):null,n[t]=a,d!==a&&(e.attrs[t]=a));return e.className=this.getClassName(),Util_1$c.Util._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,t){var a=[];n&&this._isMatch(e)&&a.push(this);for(var o=this.parent;o;){if(o===t)return a;o._isMatch(e)&&a.push(o),o=o.parent}return a}isAncestorOf(e){return!1}findAncestor(e,n,t){return this.findAncestors(e,n,t)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);var n=e.replace(/ /g,"").split(","),t=n.length,a,o;for(a=0;a<t;a++)if(o=n[a],Util_1$c.Util.isValidSelector(o)||(Util_1$c.Util.warn('Selector "'+o+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Util_1$c.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Util_1$c.Util.warn("Konva is awesome, right?")),o.charAt(0)==="#"){if(this.id()===o.slice(1))return!0}else if(o.charAt(0)==="."){if(this.hasName(o.slice(1)))return!0}else if(this.className===o||this.nodeType===o)return!0;return!1}getLayer(){var e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(STAGE,this._getStage)}_getStage(){var e=this.getParent();return e?e.getStage():null}fire(e,n={},t){return n.target=n.target||this,t?this._fireAndBubble(e,n):this._fire(e,n),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(ABSOLUTE_TRANSFORM,this._getAbsoluteTransform)}_getAbsoluteTransform(e){var n;if(e)return n=new Util_1$c.Transform,this._eachAncestorReverse(function(a){var o=a.transformsEnabled();o==="all"?n.multiply(a.getTransform()):o==="position"&&n.translate(a.x()-a.offsetX(),a.y()-a.offsetY())},e),n;n=this._cache.get(ABSOLUTE_TRANSFORM)||new Util_1$c.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();var t=this.transformsEnabled();if(t==="all")n.multiply(this.getTransform());else if(t==="position"){const a=this.attrs.x||0,o=this.attrs.y||0,d=this.attrs.offsetX||0,f=this.attrs.offsetY||0;n.translate(a-d,o-f)}return n.dirty=!1,n}getAbsoluteScale(e){for(var n=this;n;)n._isUnderCache&&(e=n),n=n.getParent();const a=this.getAbsoluteTransform(e).decompose();return{x:a.scaleX,y:a.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(TRANSFORM,this._getTransform)}_getTransform(){var e,n,t=this._cache.get(TRANSFORM)||new Util_1$c.Transform;t.reset();var a=this.x(),o=this.y(),d=Global_1$m.Konva.getAngle(this.rotation()),f=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,h=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,u=this.attrs.skewX||0,p=this.attrs.skewY||0,_=this.attrs.offsetX||0,b=this.attrs.offsetY||0;return(a!==0||o!==0)&&t.translate(a,o),d!==0&&t.rotate(d),(u!==0||p!==0)&&t.skew(u,p),(f!==1||h!==1)&&t.scale(f,h),(_!==0||b!==0)&&t.translate(-1*_,-1*b),t.dirty=!1,t}clone(e){var n=Util_1$c.Util.cloneObject(this.attrs),t,a,o,d,f;for(t in e)n[t]=e[t];var h=new this.constructor(n);for(t in this.eventListeners)for(a=this.eventListeners[t],o=a.length,d=0;d<o;d++)f=a[d],f.name.indexOf(KONVA)<0&&(h.eventListeners[t]||(h.eventListeners[t]=[]),h.eventListeners[t].push(f));return h}_toKonvaCanvas(e){e=e||{};var n=this.getClientRect(),t=this.getStage(),a=e.x!==void 0?e.x:Math.floor(n.x),o=e.y!==void 0?e.y:Math.floor(n.y),d=e.pixelRatio||1,f=new Canvas_1$1.SceneCanvas({width:e.width||Math.ceil(n.width)||(t?t.width():0),height:e.height||Math.ceil(n.height)||(t?t.height():0),pixelRatio:d}),h=f.getContext();return e.imageSmoothingEnabled===!1&&(h._context.imageSmoothingEnabled=!1),h.save(),(a||o)&&h.translate(-1*a,-1*o),this.drawScene(f),h.restore(),f}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};var n=e.mimeType||null,t=e.quality||null,a=this._toKonvaCanvas(e).toDataURL(n,t);return e.callback&&e.callback(a),a}toImage(e){return new Promise((n,t)=>{try{const a=e==null?void 0:e.callback;a&&delete e.callback,Util_1$c.Util._urlToImage(this.toDataURL(e),function(o){n(o),a==null||a(o)})}catch(a){t(a)}})}toBlob(e){return new Promise((n,t)=>{try{const a=e==null?void 0:e.callback;a&&delete e.callback,this.toCanvas(e).toBlob(o=>{n(o),a==null||a(o)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(a){t(a)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Global_1$m.Konva.dragDistance}_off(e,n,t){var a=this.eventListeners[e],o,d,f;for(o=0;o<a.length;o++)if(d=a[o].name,f=a[o].handler,(d!=="konva"||n==="konva")&&(!n||d===n)&&(!t||t===f)){if(a.splice(o,1),a.length===0){delete this.eventListeners[e];break}o--}}_fireChangeEvent(e,n,t){this._fire(e+CHANGE,{oldVal:n,newVal:t})}addName(e){if(!this.hasName(e)){var n=this.name(),t=n?n+" "+e:e;this.name(t)}return this}hasName(e){if(!e)return!1;const n=this.name();if(!n)return!1;var t=(n||"").split(/\s/g);return t.indexOf(e)!==-1}removeName(e){var n=(this.name()||"").split(/\s/g),t=n.indexOf(e);return t!==-1&&(n.splice(t,1),this.name(n.join(" "))),this}setAttr(e,n){var t=this[SET+Util_1$c.Util._capitalize(e)];return Util_1$c.Util._isFunction(t)?t.call(this,n):this._setAttr(e,n),this}_requestDraw(){if(Global_1$m.Konva.autoDrawEnabled){const e=this.getLayer()||this.getStage();e==null||e.batchDraw()}}_setAttr(e,n){var t=this.attrs[e];t===n&&!Util_1$c.Util.isObject(n)||(n==null?delete this.attrs[e]:this.attrs[e]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(e,t,n),this._requestDraw())}_setComponentAttr(e,n,t){var a;t!==void 0&&(a=this.attrs[e],a||(this.attrs[e]=this.getAttr(e)),this.attrs[e][n]=t,this._fireChangeEvent(e,a,t))}_fireAndBubble(e,n,t){n&&this.nodeType===SHAPE&&(n.target=this);var a=(e===MOUSEENTER||e===MOUSELEAVE)&&(t&&(this===t||this.isAncestorOf&&this.isAncestorOf(t))||this.nodeType==="Stage"&&!t);if(!a){this._fire(e,n);var o=(e===MOUSEENTER||e===MOUSELEAVE)&&t&&t.isAncestorOf&&t.isAncestorOf(this)&&!t.isAncestorOf(this.parent);(n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!o&&(t&&t.parent?this._fireAndBubble.call(this.parent,e,n,t):this._fireAndBubble.call(this.parent,e,n))}}_getProtoListeners(e){var n,t,a;const o=(n=this._cache.get(ALL_LISTENERS))!==null&&n!==void 0?n:{};let d=o==null?void 0:o[e];if(d===void 0){d=[];let f=Object.getPrototypeOf(this);for(;f;){const h=(a=(t=f.eventListeners)===null||t===void 0?void 0:t[e])!==null&&a!==void 0?a:[];d.push(...h),f=Object.getPrototypeOf(f)}o[e]=d,this._cache.set(ALL_LISTENERS,o)}return d}_fire(e,n){n=n||{},n.currentTarget=this,n.type=e;const t=this._getProtoListeners(e);if(t)for(var a=0;a<t.length;a++)t[a].handler.call(this,n);const o=this.eventListeners[e];if(o)for(var a=0;a<o.length;a++)o[a].handler.call(this,n)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){var n=e?e.pointerId:void 0,t=this.getStage(),a=this.getAbsolutePosition();if(t){var o=t._getPointerById(n)||t._changedPointerPositions[0]||a;DragAndDrop_1.DD._dragElements.set(this._id,{node:this,startPointerPos:o,offset:{x:o.x-a.x,y:o.y-a.y},dragStatus:"ready",pointerId:n})}}startDrag(e,n=!0){DragAndDrop_1.DD._dragElements.has(this._id)||this._createDragElement(e);const t=DragAndDrop_1.DD._dragElements.get(this._id);t.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},n)}_setDragPosition(e,n){const t=this.getStage()._getPointerById(n.pointerId);if(t){var a={x:t.x-n.offset.x,y:t.y-n.offset.y},o=this.dragBoundFunc();if(o!==void 0){const d=o.call(this,a,e);d?a=d:Util_1$c.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==a.x||this._lastPos.y!==a.y)&&(this.setAbsolutePosition(a),this._requestDraw()),this._lastPos=a}}stopDrag(e){const n=DragAndDrop_1.DD._dragElements.get(this._id);n&&(n.dragStatus="stopped"),DragAndDrop_1.DD._endDragBefore(e),DragAndDrop_1.DD._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=DragAndDrop_1.DD._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){var n=e.evt.button!==void 0,t=!n||Global_1$m.Konva.dragButtons.indexOf(e.evt.button)>=0;if(t&&!this.isDragging()){var a=!1;DragAndDrop_1.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(a=!0)}),a||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const n=DragAndDrop_1.DD._dragElements.get(this._id),t=n&&n.dragStatus==="dragging",a=n&&n.dragStatus==="ready";t?this.stopDrag():a&&DragAndDrop_1.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const t={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return Util_1$c.Util.haveIntersection(t,this.getClientRect())}static create(e,n){return Util_1$c.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){var t=Node.prototype.getClassName.call(e),a=e.children,o,d,f;n&&(e.attrs.container=n),Global_1$m.Konva[t]||(Util_1$c.Util.warn('Can not find a node with class name "'+t+'". Fallback to "Shape".'),t="Shape");const h=Global_1$m.Konva[t];if(o=new h(e.attrs),a)for(d=a.length,f=0;f<d;f++)o.add(Node._createNode(a[f]));return o}}Node$1.Node=Node;Node.prototype.nodeType="Node";Node.prototype._attrsAffectingSize=[];Node.prototype.eventListeners={};Node.prototype.on.call(Node.prototype,TRANSFORM_CHANGE_STR$1,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM)});Node.prototype.on.call(Node.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(VISIBLE)});Node.prototype.on.call(Node.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(LISTENING)});Node.prototype.on.call(Node.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY)});const addGetterSetter=Factory_1$y.Factory.addGetterSetter;addGetterSetter(Node,"zIndex");addGetterSetter(Node,"absolutePosition");addGetterSetter(Node,"position");addGetterSetter(Node,"x",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"y",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"globalCompositeOperation","source-over",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"opacity",1,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"name","",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"id","",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"rotation",0,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"scale",["x","y"]);addGetterSetter(Node,"scaleX",1,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"scaleY",1,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"skew",["x","y"]);addGetterSetter(Node,"skewX",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"skewY",0,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"offset",["x","y"]);addGetterSetter(Node,"offsetX",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"offsetY",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"dragDistance",null,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"width",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"height",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"listening",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"preventDefault",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"filters",null,function(l){return this._filterUpToDate=!1,l});addGetterSetter(Node,"visible",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"transformsEnabled","all",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"size");addGetterSetter(Node,"dragBoundFunc");addGetterSetter(Node,"draggable",!1,(0,Validators_1$x.getBooleanValidator)());Factory_1$y.Factory.backCompat(Node,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Container$2={};Object.defineProperty(Container$2,"__esModule",{value:!0});Container$2.Container=void 0;const Factory_1$x=Factory,Node_1$h=Node$1,Validators_1$w=Validators;let Container$1=class extends Node_1$h.Node{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const n=this.children||[];var t=[];return n.forEach(function(a){e(a)&&t.push(a)}),t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(var n=0;n<e.length;n++)this.add(e[n]);return this}const t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire("add",{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){var n=this._generalFind(e,!0);return n.length>0?n[0]:void 0}_generalFind(e,n){var t=[];return this._descendants(a=>{const o=a._isMatch(e);return o&&t.push(a),!!(o&&n)}),t}_descendants(e){let n=!1;const t=this.getChildren();for(const a of t){if(n=e(a),n)return!0;if(a.hasChildren()&&(n=a._descendants(e),n))return!0}return!1}toObject(){var e=Node_1$h.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){for(var n=e.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){var n=Node_1$h.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(t){n.add(t.clone())}),n}getAllIntersections(e){var n=[];return this.find("Shape").forEach(t=>{t.isVisible()&&t.intersects(e)&&n.push(t)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,t){n.index=t}),this._requestDraw()}drawScene(e,n){var t=this.getLayer(),a=e||t&&t.getCanvas(),o=a&&a.getContext(),d=this._getCanvasCache(),f=d&&d.scene,h=a&&a.isCache;if(!this.isVisible()&&!h)return this;if(f){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",a,n);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;var t=this.getLayer(),a=e||t&&t.hitCanvas,o=a&&a.getContext(),d=this._getCanvasCache(),f=d&&d.hit;if(f){o.save();var h=this.getAbsoluteTransform(n).getMatrix();o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",a,n);return this}_drawChildren(e,n,t){var a,o=n&&n.getContext(),d=this.clipWidth(),f=this.clipHeight(),h=this.clipFunc(),u=d&&f||h;const p=t===this;if(u){o.save();var _=this.getAbsoluteTransform(t),b=_.getMatrix();o.transform(b[0],b[1],b[2],b[3],b[4],b[5]),o.beginPath();let v;if(h)v=h.call(this,o,this);else{var S=this.clipX(),E=this.clipY();o.rect(S,E,d,f)}o.clip.apply(o,v),b=_.copy().invert().getMatrix(),o.transform(b[0],b[1],b[2],b[3],b[4],b[5])}var g=!p&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";g&&(o.save(),o._applyGlobalCompositeOperation(this)),(a=this.children)===null||a===void 0||a.forEach(function(v){v[e](n,t)}),g&&o.restore(),u&&o.restore()}getClientRect(e={}){var n,t=e.skipTransform,a=e.relativeTo,o,d,f,h,u={x:1/0,y:1/0,width:0,height:0},p=this;(n=this.children)===null||n===void 0||n.forEach(function(g){if(g.visible()){var v=g.getClientRect({relativeTo:p,skipShadow:e.skipShadow,skipStroke:e.skipStroke});v.width===0&&v.height===0||(o===void 0?(o=v.x,d=v.y,f=v.x+v.width,h=v.y+v.height):(o=Math.min(o,v.x),d=Math.min(d,v.y),f=Math.max(f,v.x+v.width),h=Math.max(h,v.y+v.height)))}});for(var _=this.find("Shape"),b=!1,S=0;S<_.length;S++){var E=_[S];if(E._isVisible(this)){b=!0;break}}return b&&o!==void 0?u={x:o,y:d,width:f-o,height:h-d}:u={x:0,y:0,width:0,height:0},t?u:this._transformedRect(u,a)}};Container$2.Container=Container$1;Factory_1$x.Factory.addComponentsGetterSetter(Container$1,"clip",["x","y","width","height"]);Factory_1$x.Factory.addGetterSetter(Container$1,"clipX",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipY",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipWidth",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipHeight",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipFunc");var Stage$1={},PointerEvents={};Object.defineProperty(PointerEvents,"__esModule",{value:!0});PointerEvents.releaseCapture=PointerEvents.setPointerCapture=PointerEvents.hasPointerCapture=PointerEvents.createEvent=PointerEvents.getCapturedShape=void 0;const Global_1$l=Global,Captures=new Map,SUPPORT_POINTER_EVENTS=Global_1$l.Konva._global.PointerEvent!==void 0;function getCapturedShape(l){return Captures.get(l)}PointerEvents.getCapturedShape=getCapturedShape;function createEvent(l){return{evt:l,pointerId:l.pointerId}}PointerEvents.createEvent=createEvent;function hasPointerCapture(l,e){return Captures.get(l)===e}PointerEvents.hasPointerCapture=hasPointerCapture;function setPointerCapture(l,e){releaseCapture(l),e.getStage()&&(Captures.set(l,e),SUPPORT_POINTER_EVENTS&&e._fire("gotpointercapture",createEvent(new PointerEvent("gotpointercapture"))))}PointerEvents.setPointerCapture=setPointerCapture;function releaseCapture(l,e){const n=Captures.get(l);if(!n)return;const t=n.getStage();t&&t.content,Captures.delete(l),SUPPORT_POINTER_EVENTS&&n._fire("lostpointercapture",createEvent(new PointerEvent("lostpointercapture")))}PointerEvents.releaseCapture=releaseCapture;(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Stage=l.stages=void 0;const e=Util,n=Factory,t=Container$2,a=Global,o=Canvas$1,d=DragAndDrop,f=Global,h=PointerEvents;var u="Stage",p="string",_="px",b="mouseout",S="mouseleave",E="mouseover",g="mouseenter",v="mousemove",T="mousedown",R="mouseup",x="pointermove",C="pointerdown",w="pointerup",P="pointercancel",D="lostpointercapture",N="pointerout",k="pointerleave",F="pointerover",M="pointerenter",U="contextmenu",$="touchstart",B="touchend",J="touchmove",ne="touchcancel",ie="wheel",Y=5,q=[[g,"_pointerenter"],[T,"_pointerdown"],[v,"_pointermove"],[R,"_pointerup"],[S,"_pointerleave"],[$,"_pointerdown"],[J,"_pointermove"],[B,"_pointerup"],[ne,"_pointercancel"],[E,"_pointerover"],[ie,"_wheel"],[U,"_contextmenu"],[C,"_pointerdown"],[x,"_pointermove"],[w,"_pointerup"],[P,"_pointercancel"],[D,"_lostpointercapture"]];const re={mouse:{[N]:b,[k]:S,[F]:E,[M]:g,[x]:v,[C]:T,[w]:R,[P]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[N]:"touchout",[k]:"touchleave",[F]:"touchover",[M]:"touchenter",[x]:J,[C]:$,[w]:B,[P]:ne,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[N]:N,[k]:k,[F]:F,[M]:M,[x]:x,[C]:C,[w]:w,[P]:P,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},ce=V=>V.indexOf("pointer")>=0?"pointer":V.indexOf("touch")>=0?"touch":"mouse",fe=V=>{const z=ce(V);if(z==="pointer")return a.Konva.pointerEventsEnabled&&re.pointer;if(z==="touch")return re.touch;if(z==="mouse")return re.mouse};function te(V={}){return(V.clipFunc||V.clipWidth||V.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),V}const H="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";l.stages=[];class W extends t.Container{constructor(z){super(te(z)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),l.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{te(this.attrs)}),this._checkVisibility()}_validateAdd(z){const Q=z.getType()==="Layer",ee=z.getType()==="FastLayer";Q||ee||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const z=this.visible()?"":"none";this.content.style.display=z}setContainer(z){if(typeof z===p){if(z.charAt(0)==="."){var Q=z.slice(1);z=document.getElementsByClassName(Q)[0]}else{var ee;z.charAt(0)!=="#"?ee=z:ee=z.slice(1),z=document.getElementById(ee)}if(!z)throw"Can not find container in document with id "+ee}return this._setAttr("container",z),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),z.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var z=this.children,Q=z.length,ee;for(ee=0;ee<Q;ee++)z[ee].clear();return this}clone(z){return z||(z={}),z.container=typeof document<"u"&&document.createElement("div"),t.Container.prototype.clone.call(this,z)}destroy(){super.destroy();var z=this.content;z&&e.Util._isInDocument(z)&&this.container().removeChild(z);var Q=l.stages.indexOf(this);return Q>-1&&l.stages.splice(Q,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const z=this._pointerPositions[0]||this._changedPointerPositions[0];return z?{x:z.x,y:z.y}:(e.Util.warn(H),null)}_getPointerById(z){return this._pointerPositions.find(Q=>Q.id===z)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(z){z=z||{},z.x=z.x||0,z.y=z.y||0,z.width=z.width||this.width(),z.height=z.height||this.height();var Q=new o.SceneCanvas({width:z.width,height:z.height,pixelRatio:z.pixelRatio||1}),ee=Q.getContext()._context,le=this.children;return(z.x||z.y)&&ee.translate(-1*z.x,-1*z.y),le.forEach(function(ue){if(ue.isVisible()){var he=ue._toKonvaCanvas(z);ee.drawImage(he._canvas,z.x,z.y,he.getWidth()/he.getPixelRatio(),he.getHeight()/he.getPixelRatio())}}),Q}getIntersection(z){if(!z)return null;var Q=this.children,ee=Q.length,le=ee-1,ue;for(ue=le;ue>=0;ue--){const he=Q[ue].getIntersection(z);if(he)return he}return null}_resizeDOM(){var z=this.width(),Q=this.height();this.content&&(this.content.style.width=z+_,this.content.style.height=Q+_),this.bufferCanvas.setSize(z,Q),this.bufferHitCanvas.setSize(z,Q),this.children.forEach(ee=>{ee.setSize({width:z,height:Q}),ee.draw()})}add(z,...Q){if(arguments.length>1){for(var ee=0;ee<arguments.length;ee++)this.add(arguments[ee]);return this}super.add(z);var le=this.children.length;return le>Y&&e.Util.warn("The stage has "+le+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),z.setSize({width:this.width(),height:this.height()}),z.draw(),a.Konva.isBrowser&&this.content.appendChild(z.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(z){return h.hasPointerCapture(z,this)}setPointerCapture(z){h.setPointerCapture(z,this)}releaseCapture(z){h.releaseCapture(z,this)}getLayers(){return this.children}_bindContentEvents(){a.Konva.isBrowser&&q.forEach(([z,Q])=>{this.content.addEventListener(z,ee=>{this[Q](ee)},{passive:!1})})}_pointerenter(z){this.setPointersPositions(z);const Q=fe(z.type);Q&&this._fire(Q.pointerenter,{evt:z,target:this,currentTarget:this})}_pointerover(z){this.setPointersPositions(z);const Q=fe(z.type);Q&&this._fire(Q.pointerover,{evt:z,target:this,currentTarget:this})}_getTargetShape(z){let Q=this[z+"targetShape"];return Q&&!Q.getStage()&&(Q=null),Q}_pointerleave(z){const Q=fe(z.type),ee=ce(z.type);if(Q){this.setPointersPositions(z);var le=this._getTargetShape(ee),ue=!d.DD.isDragging||a.Konva.hitOnDragEnabled;le&&ue?(le._fireAndBubble(Q.pointerout,{evt:z}),le._fireAndBubble(Q.pointerleave,{evt:z}),this._fire(Q.pointerleave,{evt:z,target:this,currentTarget:this}),this[ee+"targetShape"]=null):ue&&(this._fire(Q.pointerleave,{evt:z,target:this,currentTarget:this}),this._fire(Q.pointerout,{evt:z,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(z){const Q=fe(z.type),ee=ce(z.type);if(Q){this.setPointersPositions(z);var le=!1;this._changedPointerPositions.forEach(ue=>{var he=this.getIntersection(ue);if(d.DD.justDragged=!1,a.Konva["_"+ee+"ListenClick"]=!0,!he||!he.isListening())return;a.Konva.capturePointerEventsEnabled&&he.setPointerCapture(ue.id),this[ee+"ClickStartShape"]=he,he._fireAndBubble(Q.pointerdown,{evt:z,pointerId:ue.id}),le=!0;const ve=z.type.indexOf("touch")>=0;he.preventDefault()&&z.cancelable&&ve&&z.preventDefault()}),le||this._fire(Q.pointerdown,{evt:z,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(z){const Q=fe(z.type),ee=ce(z.type);if(!Q)return;d.DD.isDragging&&d.DD.node.preventDefault()&&z.cancelable&&z.preventDefault(),this.setPointersPositions(z);var le=!d.DD.isDragging||a.Konva.hitOnDragEnabled;if(!le)return;var ue={};let he=!1;var ve=this._getTargetShape(ee);this._changedPointerPositions.forEach(be=>{const Re=h.getCapturedShape(be.id)||this.getIntersection(be),Le=be.id,Oe={evt:z,pointerId:Le};var Ke=ve!==Re;if(Ke&&ve&&(ve._fireAndBubble(Q.pointerout,{...Oe},Re),ve._fireAndBubble(Q.pointerleave,{...Oe},Re)),Re){if(ue[Re._id])return;ue[Re._id]=!0}Re&&Re.isListening()?(he=!0,Ke&&(Re._fireAndBubble(Q.pointerover,{...Oe},ve),Re._fireAndBubble(Q.pointerenter,{...Oe},ve),this[ee+"targetShape"]=Re),Re._fireAndBubble(Q.pointermove,{...Oe})):ve&&(this._fire(Q.pointerover,{evt:z,target:this,currentTarget:this,pointerId:Le}),this[ee+"targetShape"]=null)}),he||this._fire(Q.pointermove,{evt:z,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(z){const Q=fe(z.type),ee=ce(z.type);if(!Q)return;this.setPointersPositions(z);const le=this[ee+"ClickStartShape"],ue=this[ee+"ClickEndShape"];var he={};let ve=!1;this._changedPointerPositions.forEach(be=>{const Re=h.getCapturedShape(be.id)||this.getIntersection(be);if(Re){if(Re.releaseCapture(be.id),he[Re._id])return;he[Re._id]=!0}const Le=be.id,Oe={evt:z,pointerId:Le};let Ke=!1;a.Konva["_"+ee+"InDblClickWindow"]?(Ke=!0,clearTimeout(this[ee+"DblTimeout"])):d.DD.justDragged||(a.Konva["_"+ee+"InDblClickWindow"]=!0,clearTimeout(this[ee+"DblTimeout"])),this[ee+"DblTimeout"]=setTimeout(function(){a.Konva["_"+ee+"InDblClickWindow"]=!1},a.Konva.dblClickWindow),Re&&Re.isListening()?(ve=!0,this[ee+"ClickEndShape"]=Re,Re._fireAndBubble(Q.pointerup,{...Oe}),a.Konva["_"+ee+"ListenClick"]&&le&&le===Re&&(Re._fireAndBubble(Q.pointerclick,{...Oe}),Ke&&ue&&ue===Re&&Re._fireAndBubble(Q.pointerdblclick,{...Oe}))):(this[ee+"ClickEndShape"]=null,a.Konva["_"+ee+"ListenClick"]&&this._fire(Q.pointerclick,{evt:z,target:this,currentTarget:this,pointerId:Le}),Ke&&this._fire(Q.pointerdblclick,{evt:z,target:this,currentTarget:this,pointerId:Le}))}),ve||this._fire(Q.pointerup,{evt:z,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),a.Konva["_"+ee+"ListenClick"]=!1,z.cancelable&&ee!=="touch"&&z.preventDefault()}_contextmenu(z){this.setPointersPositions(z);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(U,{evt:z}):this._fire(U,{evt:z,target:this,currentTarget:this})}_wheel(z){this.setPointersPositions(z);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(ie,{evt:z}):this._fire(ie,{evt:z,target:this,currentTarget:this})}_pointercancel(z){this.setPointersPositions(z);const Q=h.getCapturedShape(z.pointerId)||this.getIntersection(this.getPointerPosition());Q&&Q._fireAndBubble(w,h.createEvent(z)),h.releaseCapture(z.pointerId)}_lostpointercapture(z){h.releaseCapture(z.pointerId)}setPointersPositions(z){var Q=this._getContentPosition(),ee=null,le=null;z=z||window.event,z.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(z.touches,ue=>{this._pointerPositions.push({id:ue.identifier,x:(ue.clientX-Q.left)/Q.scaleX,y:(ue.clientY-Q.top)/Q.scaleY})}),Array.prototype.forEach.call(z.changedTouches||z.touches,ue=>{this._changedPointerPositions.push({id:ue.identifier,x:(ue.clientX-Q.left)/Q.scaleX,y:(ue.clientY-Q.top)/Q.scaleY})})):(ee=(z.clientX-Q.left)/Q.scaleX,le=(z.clientY-Q.top)/Q.scaleY,this.pointerPos={x:ee,y:le},this._pointerPositions=[{x:ee,y:le,id:e.Util._getFirstPointerId(z)}],this._changedPointerPositions=[{x:ee,y:le,id:e.Util._getFirstPointerId(z)}])}_setPointerPosition(z){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(z)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var z=this.content.getBoundingClientRect();return{top:z.top,left:z.left,scaleX:z.width/this.content.clientWidth||1,scaleY:z.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!a.Konva.isBrowser){var z=this.container();if(!z)throw"Stage has no container. A container is required.";z.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),z.appendChild(this.content),this._resizeDOM()}}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(z){z.batchDraw()}),this}}l.Stage=W,W.prototype.nodeType=u,(0,f._registerNode)(W),n.Factory.addGetterSetter(W,"container")})(Stage$1);var Layer$2={},Shape={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Shape=l.shapes=void 0;const e=Global,n=Util,t=Factory,a=Node$1,o=Validators,d=Global,f=PointerEvents;var h="hasShadow",u="shadowRGBA",p="patternImage",_="linearGradient",b="radialGradient";let S;function E(){return S||(S=n.Util.createCanvasElement().getContext("2d"),S)}l.shapes={};function g(k){const F=this.attrs.fillRule;F?k.fill(F):k.fill()}function v(k){k.stroke()}function T(k){k.fill()}function R(k){k.stroke()}function x(){this._clearCache(h)}function C(){this._clearCache(u)}function w(){this._clearCache(p)}function P(){this._clearCache(_)}function D(){this._clearCache(b)}class N extends a.Node{constructor(F){super(F);let M;for(;M=n.Util.getRandomColor(),!(M&&!(M in l.shapes)););this.colorKey=M,l.shapes[M]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(h,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(p,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var F=E();const M=F.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(M&&M.setTransform){const U=new n.Transform;U.translate(this.fillPatternX(),this.fillPatternY()),U.rotate(e.Konva.getAngle(this.fillPatternRotation())),U.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),U.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const $=U.getMatrix(),B=typeof DOMMatrix>"u"?{a:$[0],b:$[1],c:$[2],d:$[3],e:$[4],f:$[5]}:new DOMMatrix($);M.setTransform(B)}return M}}_getLinearGradient(){return this._getCache(_,this.__getLinearGradient)}__getLinearGradient(){var F=this.fillLinearGradientColorStops();if(F){for(var M=E(),U=this.fillLinearGradientStartPoint(),$=this.fillLinearGradientEndPoint(),B=M.createLinearGradient(U.x,U.y,$.x,$.y),J=0;J<F.length;J+=2)B.addColorStop(F[J],F[J+1]);return B}}_getRadialGradient(){return this._getCache(b,this.__getRadialGradient)}__getRadialGradient(){var F=this.fillRadialGradientColorStops();if(F){for(var M=E(),U=this.fillRadialGradientStartPoint(),$=this.fillRadialGradientEndPoint(),B=M.createRadialGradient(U.x,U.y,this.fillRadialGradientStartRadius(),$.x,$.y,this.fillRadialGradientEndRadius()),J=0;J<F.length;J+=2)B.addColorStop(F[J],F[J+1]);return B}}getShadowRGBA(){return this._getCache(u,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var F=n.Util.colorToRGBA(this.shadowColor());if(F)return"rgba("+F.r+","+F.g+","+F.b+","+F.a*(this.shadowOpacity()||1)+")"}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const F=this.hitStrokeWidth();return F==="auto"?this.hasStroke():this.strokeEnabled()&&!!F}intersects(F){var M=this.getStage();if(!M)return!1;const U=M.bufferHitCanvas;return U.getContext().clear(),this.drawHit(U,void 0,!0),U.context.getImageData(Math.round(F.x),Math.round(F.y),1,1).data[3]>0}destroy(){return a.Node.prototype.destroy.call(this),delete l.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(F){var M;if(!this.getStage()||!((M=this.attrs.perfectDrawEnabled)!==null&&M!==void 0?M:!0))return!1;const $=F||this.hasFill(),B=this.hasStroke(),J=this.getAbsoluteOpacity()!==1;if($&&B&&J)return!0;const ne=this.hasShadow(),ie=this.shadowForStrokeEnabled();return!!($&&B&&ne&&ie)}setStrokeHitEnabled(F){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),F?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var F=this.size();return{x:this._centroid?-F.width/2:0,y:this._centroid?-F.height/2:0,width:F.width,height:F.height}}getClientRect(F={}){const M=F.skipTransform,U=F.relativeTo,$=this.getSelfRect(),J=!F.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,ne=$.width+J,ie=$.height+J,Y=!F.skipShadow&&this.hasShadow(),q=Y?this.shadowOffsetX():0,re=Y?this.shadowOffsetY():0,ce=ne+Math.abs(q),fe=ie+Math.abs(re),te=Y&&this.shadowBlur()||0,H=ce+te*2,W=fe+te*2,V={width:H,height:W,x:-(J/2+te)+Math.min(q,0)+$.x,y:-(J/2+te)+Math.min(re,0)+$.y};return M?V:this._transformedRect(V,U)}drawScene(F,M){var U=this.getLayer(),$=F||U.getCanvas(),B=$.getContext(),J=this._getCanvasCache(),ne=this.getSceneFunc(),ie=this.hasShadow(),Y,q,re,ce=$.isCache,fe=M===this;if(!this.isVisible()&&!fe)return this;if(J){B.save();var te=this.getAbsoluteTransform(M).getMatrix();return B.transform(te[0],te[1],te[2],te[3],te[4],te[5]),this._drawCachedSceneCanvas(B),B.restore(),this}if(!ne)return this;if(B.save(),this._useBufferCanvas()&&!ce){Y=this.getStage(),q=Y.bufferCanvas,re=q.getContext(),re.clear(),re.save(),re._applyLineJoin(this);var H=this.getAbsoluteTransform(M).getMatrix();re.transform(H[0],H[1],H[2],H[3],H[4],H[5]),ne.call(this,re,this),re.restore();var W=q.pixelRatio;ie&&B._applyShadow(this),B._applyOpacity(this),B._applyGlobalCompositeOperation(this),B.drawImage(q._canvas,0,0,q.width/W,q.height/W)}else{if(B._applyLineJoin(this),!fe){var H=this.getAbsoluteTransform(M).getMatrix();B.transform(H[0],H[1],H[2],H[3],H[4],H[5]),B._applyOpacity(this),B._applyGlobalCompositeOperation(this)}ie&&B._applyShadow(this),ne.call(this,B,this)}return B.restore(),this}drawHit(F,M,U=!1){if(!this.shouldDrawHit(M,U))return this;var $=this.getLayer(),B=F||$.hitCanvas,J=B&&B.getContext(),ne=this.hitFunc()||this.sceneFunc(),ie=this._getCanvasCache(),Y=ie&&ie.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),Y){J.save();var q=this.getAbsoluteTransform(M).getMatrix();return J.transform(q[0],q[1],q[2],q[3],q[4],q[5]),this._drawCachedHitCanvas(J),J.restore(),this}if(!ne)return this;if(J.save(),J._applyLineJoin(this),!(this===M)){var ce=this.getAbsoluteTransform(M).getMatrix();J.transform(ce[0],ce[1],ce[2],ce[3],ce[4],ce[5])}return ne.call(this,J,this),J.restore(),this}drawHitFromCache(F=0){var M=this._getCanvasCache(),U=this._getCachedSceneCanvas(),$=M.hit,B=$.getContext(),J=$.getWidth(),ne=$.getHeight(),ie,Y,q,re,ce,fe;B.clear(),B.drawImage(U._canvas,0,0,J,ne);try{for(ie=B.getImageData(0,0,J,ne),Y=ie.data,q=Y.length,re=n.Util._hexToRgb(this.colorKey),ce=0;ce<q;ce+=4)fe=Y[ce+3],fe>F?(Y[ce]=re.r,Y[ce+1]=re.g,Y[ce+2]=re.b,Y[ce+3]=255):Y[ce+3]=0;B.putImageData(ie,0,0)}catch(te){n.Util.error("Unable to draw hit graph from cached scene canvas. "+te.message)}return this}hasPointerCapture(F){return f.hasPointerCapture(F,this)}setPointerCapture(F){f.setPointerCapture(F,this)}releaseCapture(F){f.releaseCapture(F,this)}}l.Shape=N,N.prototype._fillFunc=g,N.prototype._strokeFunc=v,N.prototype._fillFuncHit=T,N.prototype._strokeFuncHit=R,N.prototype._centroid=!1,N.prototype.nodeType="Shape",(0,d._registerNode)(N),N.prototype.eventListeners={},N.prototype.on.call(N.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",x),N.prototype.on.call(N.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",C),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",w),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",P),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",D),t.Factory.addGetterSetter(N,"stroke",void 0,(0,o.getStringOrGradientValidator)()),t.Factory.addGetterSetter(N,"strokeWidth",2,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillAfterStrokeEnabled",!1),t.Factory.addGetterSetter(N,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),t.Factory.addGetterSetter(N,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),t.Factory.addGetterSetter(N,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),t.Factory.addGetterSetter(N,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),t.Factory.addGetterSetter(N,"lineJoin"),t.Factory.addGetterSetter(N,"lineCap"),t.Factory.addGetterSetter(N,"sceneFunc"),t.Factory.addGetterSetter(N,"hitFunc"),t.Factory.addGetterSetter(N,"dash"),t.Factory.addGetterSetter(N,"dashOffset",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"shadowColor",void 0,(0,o.getStringValidator)()),t.Factory.addGetterSetter(N,"shadowBlur",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"shadowOpacity",1,(0,o.getNumberValidator)()),t.Factory.addComponentsGetterSetter(N,"shadowOffset",["x","y"]),t.Factory.addGetterSetter(N,"shadowOffsetX",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"shadowOffsetY",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillPatternImage"),t.Factory.addGetterSetter(N,"fill",void 0,(0,o.getStringOrGradientValidator)()),t.Factory.addGetterSetter(N,"fillPatternX",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillPatternY",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillLinearGradientColorStops"),t.Factory.addGetterSetter(N,"strokeLinearGradientColorStops"),t.Factory.addGetterSetter(N,"fillRadialGradientStartRadius",0),t.Factory.addGetterSetter(N,"fillRadialGradientEndRadius",0),t.Factory.addGetterSetter(N,"fillRadialGradientColorStops"),t.Factory.addGetterSetter(N,"fillPatternRepeat","repeat"),t.Factory.addGetterSetter(N,"fillEnabled",!0),t.Factory.addGetterSetter(N,"strokeEnabled",!0),t.Factory.addGetterSetter(N,"shadowEnabled",!0),t.Factory.addGetterSetter(N,"dashEnabled",!0),t.Factory.addGetterSetter(N,"strokeScaleEnabled",!0),t.Factory.addGetterSetter(N,"fillPriority","color"),t.Factory.addComponentsGetterSetter(N,"fillPatternOffset",["x","y"]),t.Factory.addGetterSetter(N,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),t.Factory.addComponentsGetterSetter(N,"fillPatternScale",["x","y"]),t.Factory.addGetterSetter(N,"fillPatternScaleX",1,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(N,"fillPatternScaleY",1,(0,o.getNumberValidator)()),t.Factory.addComponentsGetterSetter(N,"fillLinearGradientStartPoint",["x","y"]),t.Factory.addComponentsGetterSetter(N,"strokeLinearGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(N,"fillLinearGradientStartPointX",0),t.Factory.addGetterSetter(N,"strokeLinearGradientStartPointX",0),t.Factory.addGetterSetter(N,"fillLinearGradientStartPointY",0),t.Factory.addGetterSetter(N,"strokeLinearGradientStartPointY",0),t.Factory.addComponentsGetterSetter(N,"fillLinearGradientEndPoint",["x","y"]),t.Factory.addComponentsGetterSetter(N,"strokeLinearGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(N,"fillLinearGradientEndPointX",0),t.Factory.addGetterSetter(N,"strokeLinearGradientEndPointX",0),t.Factory.addGetterSetter(N,"fillLinearGradientEndPointY",0),t.Factory.addGetterSetter(N,"strokeLinearGradientEndPointY",0),t.Factory.addComponentsGetterSetter(N,"fillRadialGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(N,"fillRadialGradientStartPointX",0),t.Factory.addGetterSetter(N,"fillRadialGradientStartPointY",0),t.Factory.addComponentsGetterSetter(N,"fillRadialGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(N,"fillRadialGradientEndPointX",0),t.Factory.addGetterSetter(N,"fillRadialGradientEndPointY",0),t.Factory.addGetterSetter(N,"fillPatternRotation",0),t.Factory.addGetterSetter(N,"fillRule",void 0,(0,o.getStringValidator)()),t.Factory.backCompat(N,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Shape);Object.defineProperty(Layer$2,"__esModule",{value:!0});Layer$2.Layer=void 0;const Util_1$b=Util,Container_1$1=Container$2,Node_1$g=Node$1,Factory_1$w=Factory,Canvas_1=Canvas$1,Validators_1$v=Validators,Shape_1$g=Shape,Global_1$k=Global;var HASH="#",BEFORE_DRAW="beforeDraw",DRAW="draw",INTERSECTION_OFFSETS=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],INTERSECTION_OFFSETS_LEN=INTERSECTION_OFFSETS.length;let Layer$1=class extends Container_1$1.Container{constructor(e){super(e),this.canvas=new Canvas_1.SceneCanvas,this.hitCanvas=new Canvas_1.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[e+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Node_1$g.Node.prototype.moveToTop.call(this);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var e=Node_1$g.Node.prototype.moveUp.call(this);if(!e)return!1;var n=this.getStage();return!n||!n.content?!1:(n.content.removeChild(this.getNativeCanvasElement()),this.index<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[this.index+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(Node_1$g.Node.prototype.moveDown.call(this)){var e=this.getStage();if(e){var n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Node_1$g.Node.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var e=this.getNativeCanvasElement();return Node_1$g.Node.prototype.remove.call(this),e&&e.parentNode&&Util_1$b.Util._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:n}){return this.canvas.setSize(e,n),this.hitCanvas.setSize(e,n),this._setSmoothEnabled(),this}_validateAdd(e){var n=e.getType();n!=="Group"&&n!=="Shape"&&Util_1$b.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e=e||{},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),Node_1$g.Node.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Util_1$b.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Util_1$b.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Util_1$b.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var n=1,t=!1;;){for(let a=0;a<INTERSECTION_OFFSETS_LEN;a++){const o=INTERSECTION_OFFSETS[a],d=this._getIntersection({x:e.x+o.x*n,y:e.y+o.y*n}),f=d.shape;if(f)return f;if(t=!!d.antialiased,!d.antialiased)break}if(t)n+=1;else return null}}_getIntersection(e){const n=this.hitCanvas.pixelRatio,t=this.hitCanvas.context.getImageData(Math.round(e.x*n),Math.round(e.y*n),1,1).data,a=t[3];if(a===255){const o=Util_1$b.Util._rgbToHex(t[0],t[1],t[2]),d=Shape_1$g.shapes[HASH+o];return d?{shape:d}:{antialiased:!0}}else if(a>0)return{antialiased:!0};return{}}drawScene(e,n){var t=this.getLayer(),a=e||t&&t.getCanvas();return this._fire(BEFORE_DRAW,{node:this}),this.clearBeforeDraw()&&a.getContext().clear(),Container_1$1.Container.prototype.drawScene.call(this,a,n),this._fire(DRAW,{node:this}),this}drawHit(e,n){var t=this.getLayer(),a=e||t&&t.hitCanvas;return t&&t.clearBeforeDraw()&&t.getHitCanvas().getContext().clear(),Container_1$1.Container.prototype.drawHit.call(this,a,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Util_1$b.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Util_1$b.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return Util_1$b.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Layer$2.Layer=Layer$1;Layer$1.prototype.nodeType="Layer";(0,Global_1$k._registerNode)(Layer$1);Factory_1$w.Factory.addGetterSetter(Layer$1,"imageSmoothingEnabled",!0);Factory_1$w.Factory.addGetterSetter(Layer$1,"clearBeforeDraw",!0);Factory_1$w.Factory.addGetterSetter(Layer$1,"hitGraphEnabled",!0,(0,Validators_1$v.getBooleanValidator)());var FastLayer$1={};Object.defineProperty(FastLayer$1,"__esModule",{value:!0});FastLayer$1.FastLayer=void 0;const Util_1$a=Util,Layer_1=Layer$2,Global_1$j=Global;class FastLayer extends Layer_1.Layer{constructor(e){super(e),this.listening(!1),Util_1$a.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}FastLayer$1.FastLayer=FastLayer;FastLayer.prototype.nodeType="FastLayer";(0,Global_1$j._registerNode)(FastLayer);var Group$2={};Object.defineProperty(Group$2,"__esModule",{value:!0});Group$2.Group=void 0;const Util_1$9=Util,Container_1=Container$2,Global_1$i=Global;let Group$1=class extends Container_1.Container{_validateAdd(e){var n=e.getType();n!=="Group"&&n!=="Shape"&&Util_1$9.Util.throw("You may only add groups and shapes to groups.")}};Group$2.Group=Group$1;Group$1.prototype.nodeType="Group";(0,Global_1$i._registerNode)(Group$1);var Animation$3={};Object.defineProperty(Animation$3,"__esModule",{value:!0});Animation$3.Animation=void 0;const Global_1$h=Global,Util_1$8=Util,now=function(){return Global_1$h.glob.performance&&Global_1$h.glob.performance.now?function(){return Global_1$h.glob.performance.now()}:function(){return new Date().getTime()}}();let Animation$2=class au{constructor(e,n){this.id=au.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:now(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];return e&&(n=Array.isArray(e)?e:[e]),this.layers=n,this}getLayers(){return this.layers}addLayer(e){const n=this.layers,t=n.length;for(let a=0;a<t;a++)if(n[a]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){const n=au.animations,t=n.length;for(let a=0;a<t;a++)if(n[a].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=now(),au._addAnimation(this),this}stop(){return au._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){const n=e.id,t=this.animations,a=t.length;for(let o=0;o<a;o++)if(t[o].id===n){this.animations.splice(o,1);break}}static _runFrames(){const e={},n=this.animations;for(let t=0;t<n.length;t++){const a=n[t],o=a.layers,d=a.func;a._updateFrameObject(now());const f=o.length;let h;if(d?h=d.call(a,a.frame)!==!1:h=!0,!!h)for(let u=0;u<f;u++){const p=o[u];p._id!==void 0&&(e[p._id]=p)}}for(let t in e)e.hasOwnProperty(t)&&e[t].batchDraw()}static _animationLoop(){const e=au;e.animations.length?(e._runFrames(),Util_1$8.Util.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Util_1$8.Util.requestAnimFrame(this._animationLoop))}};Animation$3.Animation=Animation$2;Animation$2.animations=[];Animation$2.animIdCounter=0;Animation$2.animRunning=!1;var Tween$1={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Easings=l.Tween=void 0;const e=Util,n=Animation$3,t=Node$1,a=Global;var o={node:1,duration:1,easing:1,onFinish:1,yoyo:1},d=1,f=2,h=3,u=0,p=["fill","stroke","shadowColor"];class _{constructor(E,g,v,T,R,x,C){this.prop=E,this.propFunc=g,this.begin=T,this._pos=T,this.duration=x,this._change=0,this.prevPos=0,this.yoyo=C,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=v,this._change=R-this.begin,this.pause()}fire(E){var g=this[E];g&&g()}setTime(E){E>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():E<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=E,this.update())}getTime(){return this._time}setPosition(E){this.prevPos=this._pos,this.propFunc(E),this._pos=E}getPosition(E){return E===void 0&&(E=this._time),this.func(E,this.begin,this._change,this.duration)}play(){this.state=f,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=h,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(E){this.pause(),this._time=E,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var E=this.getTimer()-this._startTime;this.state===f?this.setTime(E):this.state===h&&this.setTime(this.duration-E)}pause(){this.state=d,this.fire("onPause")}getTimer(){return new Date().getTime()}}class b{constructor(E){var g=this,v=E.node,T=v._id,R,x=E.easing||l.Easings.Linear,C=!!E.yoyo,w;typeof E.duration>"u"?R=.3:E.duration===0?R=.001:R=E.duration,this.node=v,this._id=u++;var P=v.getLayer()||(v instanceof a.Konva.Stage?v.getLayers():null);P||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){g.tween.onEnterFrame()},P),this.tween=new _(w,function(D){g._tweenFunc(D)},x,0,1,R*1e3,C),this._addListeners(),b.attrs[T]||(b.attrs[T]={}),b.attrs[T][this._id]||(b.attrs[T][this._id]={}),b.tweens[T]||(b.tweens[T]={});for(w in E)o[w]===void 0&&this._addAttr(w,E[w]);this.reset(),this.onFinish=E.onFinish,this.onReset=E.onReset,this.onUpdate=E.onUpdate}_addAttr(E,g){var v=this.node,T=v._id,R,x,C,w,P,D,N,k;if(C=b.tweens[T][E],C&&delete b.attrs[T][C][E],R=v.getAttr(E),e.Util._isArray(g))if(x=[],P=Math.max(g.length,R.length),E==="points"&&g.length!==R.length&&(g.length>R.length?(N=R,R=e.Util._prepareArrayForTween(R,g,v.closed())):(D=g,g=e.Util._prepareArrayForTween(g,R,v.closed()))),E.indexOf("fill")===0)for(w=0;w<P;w++)if(w%2===0)x.push(g[w]-R[w]);else{var F=e.Util.colorToRGBA(R[w]);k=e.Util.colorToRGBA(g[w]),R[w]=F,x.push({r:k.r-F.r,g:k.g-F.g,b:k.b-F.b,a:k.a-F.a})}else for(w=0;w<P;w++)x.push(g[w]-R[w]);else p.indexOf(E)!==-1?(R=e.Util.colorToRGBA(R),k=e.Util.colorToRGBA(g),x={r:k.r-R.r,g:k.g-R.g,b:k.b-R.b,a:k.a-R.a}):x=g-R;b.attrs[T][this._id][E]={start:R,diff:x,end:g,trueEnd:D,trueStart:N},b.tweens[T][E]=this._id}_tweenFunc(E){var g=this.node,v=b.attrs[g._id][this._id],T,R,x,C,w,P,D,N;for(T in v){if(R=v[T],x=R.start,C=R.diff,N=R.end,e.Util._isArray(x))if(w=[],D=Math.max(x.length,N.length),T.indexOf("fill")===0)for(P=0;P<D;P++)P%2===0?w.push((x[P]||0)+C[P]*E):w.push("rgba("+Math.round(x[P].r+C[P].r*E)+","+Math.round(x[P].g+C[P].g*E)+","+Math.round(x[P].b+C[P].b*E)+","+(x[P].a+C[P].a*E)+")");else for(P=0;P<D;P++)w.push((x[P]||0)+C[P]*E);else p.indexOf(T)!==-1?w="rgba("+Math.round(x.r+C.r*E)+","+Math.round(x.g+C.g*E)+","+Math.round(x.b+C.b*E)+","+(x.a+C.a*E)+")":w=x+C*E;g.setAttr(T,w)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var E=this.node,g=b.attrs[E._id][this._id];g.points&&g.points.trueEnd&&E.setAttr("points",g.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var E=this.node,g=b.attrs[E._id][this._id];g.points&&g.points.trueStart&&E.points(g.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(E){return this.tween.seek(E*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var E=this.node._id,g=this._id,v=b.tweens[E],T;this.pause();for(T in v)delete b.tweens[E][T];delete b.attrs[E][g]}}l.Tween=b,b.attrs={},b.tweens={},t.Node.prototype.to=function(S){var E=S.onFinish;S.node=this,S.onFinish=function(){this.destroy(),E&&E()};var g=new b(S);g.play()},l.Easings={BackEaseIn(S,E,g,v){var T=1.70158;return g*(S/=v)*S*((T+1)*S-T)+E},BackEaseOut(S,E,g,v){var T=1.70158;return g*((S=S/v-1)*S*((T+1)*S+T)+1)+E},BackEaseInOut(S,E,g,v){var T=1.70158;return(S/=v/2)<1?g/2*(S*S*(((T*=1.525)+1)*S-T))+E:g/2*((S-=2)*S*(((T*=1.525)+1)*S+T)+2)+E},ElasticEaseIn(S,E,g,v,T,R){var x=0;return S===0?E:(S/=v)===1?E+g:(R||(R=v*.3),!T||T<Math.abs(g)?(T=g,x=R/4):x=R/(2*Math.PI)*Math.asin(g/T),-(T*Math.pow(2,10*(S-=1))*Math.sin((S*v-x)*(2*Math.PI)/R))+E)},ElasticEaseOut(S,E,g,v,T,R){var x=0;return S===0?E:(S/=v)===1?E+g:(R||(R=v*.3),!T||T<Math.abs(g)?(T=g,x=R/4):x=R/(2*Math.PI)*Math.asin(g/T),T*Math.pow(2,-10*S)*Math.sin((S*v-x)*(2*Math.PI)/R)+g+E)},ElasticEaseInOut(S,E,g,v,T,R){var x=0;return S===0?E:(S/=v/2)===2?E+g:(R||(R=v*(.3*1.5)),!T||T<Math.abs(g)?(T=g,x=R/4):x=R/(2*Math.PI)*Math.asin(g/T),S<1?-.5*(T*Math.pow(2,10*(S-=1))*Math.sin((S*v-x)*(2*Math.PI)/R))+E:T*Math.pow(2,-10*(S-=1))*Math.sin((S*v-x)*(2*Math.PI)/R)*.5+g+E)},BounceEaseOut(S,E,g,v){return(S/=v)<1/2.75?g*(7.5625*S*S)+E:S<2/2.75?g*(7.5625*(S-=1.5/2.75)*S+.75)+E:S<2.5/2.75?g*(7.5625*(S-=2.25/2.75)*S+.9375)+E:g*(7.5625*(S-=2.625/2.75)*S+.984375)+E},BounceEaseIn(S,E,g,v){return g-l.Easings.BounceEaseOut(v-S,0,g,v)+E},BounceEaseInOut(S,E,g,v){return S<v/2?l.Easings.BounceEaseIn(S*2,0,g,v)*.5+E:l.Easings.BounceEaseOut(S*2-v,0,g,v)*.5+g*.5+E},EaseIn(S,E,g,v){return g*(S/=v)*S+E},EaseOut(S,E,g,v){return-g*(S/=v)*(S-2)+E},EaseInOut(S,E,g,v){return(S/=v/2)<1?g/2*S*S+E:-g/2*(--S*(S-2)-1)+E},StrongEaseIn(S,E,g,v){return g*(S/=v)*S*S*S*S+E},StrongEaseOut(S,E,g,v){return g*((S=S/v-1)*S*S*S*S+1)+E},StrongEaseInOut(S,E,g,v){return(S/=v/2)<1?g/2*S*S*S*S*S+E:g/2*((S-=2)*S*S*S*S+2)+E},Linear(S,E,g,v){return g*S/v+E}}})(Tween$1);(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Konva=void 0;const e=Global,n=Util,t=Node$1,a=Container$2,o=Stage$1,d=Layer$2,f=FastLayer$1,h=Group$2,u=DragAndDrop,p=Shape,_=Animation$3,b=Tween$1,S=Context$2,E=Canvas$1;l.Konva=n.Util._assign(e.Konva,{Util:n.Util,Transform:n.Transform,Node:t.Node,Container:a.Container,Stage:o.Stage,stages:o.stages,Layer:d.Layer,FastLayer:f.FastLayer,Group:h.Group,DD:u.DD,Shape:p.Shape,shapes:p.shapes,Animation:_.Animation,Tween:b.Tween,Easings:b.Easings,Context:S.Context,Canvas:E.Canvas}),l.default=l.Konva})(_CoreInternals);var Arc$1={};Object.defineProperty(Arc$1,"__esModule",{value:!0});Arc$1.Arc=void 0;const Factory_1$v=Factory,Shape_1$f=Shape,Global_1$g=Global,Validators_1$u=Validators,Global_2$2=Global;class Arc extends Shape_1$f.Shape{_sceneFunc(e){var n=Global_1$g.Konva.getAngle(this.angle()),t=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,n,t),e.arc(0,0,this.innerRadius(),n,0,!t),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),n=this.outerRadius(),t=this.clockwise(),a=Global_1$g.Konva.getAngle(t?360-this.angle():this.angle()),o=Math.cos(Math.min(a,Math.PI)),d=1,f=Math.sin(Math.min(Math.max(Math.PI,a),3*Math.PI/2)),h=Math.sin(Math.min(a,Math.PI/2)),u=o*(o>0?e:n),p=d*n,_=f*(f>0?e:n),b=h*(h>0?n:e);return{x:u,y:t?-1*b:_,width:p-u,height:b-_}}}Arc$1.Arc=Arc;Arc.prototype._centroid=!0;Arc.prototype.className="Arc";Arc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_2$2._registerNode)(Arc);Factory_1$v.Factory.addGetterSetter(Arc,"innerRadius",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"outerRadius",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"angle",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"clockwise",!1,(0,Validators_1$u.getBooleanValidator)());var Arrow$1={},Line$2={};Object.defineProperty(Line$2,"__esModule",{value:!0});Line$2.Line=void 0;const Factory_1$u=Factory,Shape_1$e=Shape,Validators_1$t=Validators,Global_1$f=Global;function getControlPoints(l,e,n,t,a,o,d){var f=Math.sqrt(Math.pow(n-l,2)+Math.pow(t-e,2)),h=Math.sqrt(Math.pow(a-n,2)+Math.pow(o-t,2)),u=d*f/(f+h),p=d*h/(f+h),_=n-u*(a-l),b=t-u*(o-e),S=n+p*(a-l),E=t+p*(o-e);return[_,b,S,E]}function expandPoints(l,e){var n=l.length,t=[],a,o;for(a=2;a<n-2;a+=2)o=getControlPoints(l[a-2],l[a-1],l[a],l[a+1],l[a+2],l[a+3],e),!isNaN(o[0])&&(t.push(o[0]),t.push(o[1]),t.push(l[a]),t.push(l[a+1]),t.push(o[2]),t.push(o[3]));return t}let Line$1=class extends Shape_1$e.Shape{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){var n=this.points(),t=n.length,a=this.tension(),o=this.closed(),d=this.bezier(),f,h,u;if(t){if(e.beginPath(),e.moveTo(n[0],n[1]),a!==0&&t>4){for(f=this.getTensionPoints(),h=f.length,u=o?0:4,o||e.quadraticCurveTo(f[0],f[1],f[2],f[3]);u<h-2;)e.bezierCurveTo(f[u++],f[u++],f[u++],f[u++],f[u++],f[u++]);o||e.quadraticCurveTo(f[h-2],f[h-1],n[t-2],n[t-1])}else if(d)for(u=2;u<t;)e.bezierCurveTo(n[u++],n[u++],n[u++],n[u++],n[u++],n[u++]);else for(u=2;u<t;u+=2)e.lineTo(n[u],n[u+1]);o?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():expandPoints(this.points(),this.tension())}_getTensionPointsClosed(){var e=this.points(),n=e.length,t=this.tension(),a=getControlPoints(e[n-2],e[n-1],e[0],e[1],e[2],e[3],t),o=getControlPoints(e[n-4],e[n-3],e[n-2],e[n-1],e[0],e[1],t),d=expandPoints(e,t),f=[a[2],a[3]].concat(d).concat([o[0],o[1],e[n-2],e[n-1],o[2],o[3],a[0],a[1],e[0],e[1]]);return f}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:e=this.points();for(var n=e[0],t=e[0],a=e[1],o=e[1],d,f,h=0;h<e.length/2;h++)d=e[h*2],f=e[h*2+1],n=Math.min(n,d),t=Math.max(t,d),a=Math.min(a,f),o=Math.max(o,f);return{x:n,y:a,width:t-n,height:o-a}}};Line$2.Line=Line$1;Line$1.prototype.className="Line";Line$1.prototype._attrsAffectingSize=["points","bezier","tension"];(0,Global_1$f._registerNode)(Line$1);Factory_1$u.Factory.addGetterSetter(Line$1,"closed",!1);Factory_1$u.Factory.addGetterSetter(Line$1,"bezier",!1);Factory_1$u.Factory.addGetterSetter(Line$1,"tension",0,(0,Validators_1$t.getNumberValidator)());Factory_1$u.Factory.addGetterSetter(Line$1,"points",[],(0,Validators_1$t.getNumberArrayValidator)());var Path$1={},BezierFunctions={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.t2length=l.getQuadraticArcLength=l.getCubicArcLength=l.binomialCoefficients=l.cValues=l.tValues=void 0,l.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],l.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],l.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const e=(d,f,h)=>{let u,p,_;u=h/2,p=0;for(let S=0;S<20;S++)_=u*l.tValues[20][S]+u,p+=l.cValues[20][S]*t(d,f,_);return u*p};l.getCubicArcLength=e;const n=(d,f,h)=>{h===void 0&&(h=1);const u=d[0]-2*d[1]+d[2],p=f[0]-2*f[1]+f[2],_=2*d[1]-2*d[0],b=2*f[1]-2*f[0],S=4*(u*u+p*p),E=4*(u*_+p*b),g=_*_+b*b;if(S===0)return h*Math.sqrt(Math.pow(d[2]-d[0],2)+Math.pow(f[2]-f[0],2));const v=E/(2*S),T=g/S,R=h+v,x=T-v*v,C=R*R+x>0?Math.sqrt(R*R+x):0,w=v*v+x>0?Math.sqrt(v*v+x):0,P=v+Math.sqrt(v*v+x)!==0?x*Math.log(Math.abs((R+C)/(v+w))):0;return Math.sqrt(S)/2*(R*C-v*w+P)};l.getQuadraticArcLength=n;function t(d,f,h){const u=a(1,h,d),p=a(1,h,f),_=u*u+p*p;return Math.sqrt(_)}const a=(d,f,h)=>{const u=h.length-1;let p,_;if(u===0)return 0;if(d===0){_=0;for(let b=0;b<=u;b++)_+=l.binomialCoefficients[u][b]*Math.pow(1-f,u-b)*Math.pow(f,b)*h[b];return _}else{p=new Array(u);for(let b=0;b<u;b++)p[b]=u*(h[b+1]-h[b]);return a(d-1,f,p)}},o=(d,f,h)=>{let u=1,p=d/f,_=(d-h(p))/f,b=0;for(;u>.001;){const S=h(p+_),E=Math.abs(d-S)/f;if(E<u)u=E,p+=_;else{const g=h(p-_),v=Math.abs(d-g)/f;v<u?(u=v,p-=_):_/=2}if(b++,b>500)break}return p};l.t2length=o})(BezierFunctions);Object.defineProperty(Path$1,"__esModule",{value:!0});Path$1.Path=void 0;const Factory_1$t=Factory,Shape_1$d=Shape,Global_1$e=Global,BezierFunctions_1=BezierFunctions;class Path extends Shape_1$d.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Path.parsePathData(this.data()),this.pathLength=Path.getPathLength(this.dataArray)}_sceneFunc(e){var n=this.dataArray;e.beginPath();for(var t=!1,a=0;a<n.length;a++){var o=n[a].command,d=n[a].points;switch(o){case"L":e.lineTo(d[0],d[1]);break;case"M":e.moveTo(d[0],d[1]);break;case"C":e.bezierCurveTo(d[0],d[1],d[2],d[3],d[4],d[5]);break;case"Q":e.quadraticCurveTo(d[0],d[1],d[2],d[3]);break;case"A":var f=d[0],h=d[1],u=d[2],p=d[3],_=d[4],b=d[5],S=d[6],E=d[7],g=u>p?u:p,v=u>p?1:u/p,T=u>p?p/u:1;e.translate(f,h),e.rotate(S),e.scale(v,T),e.arc(0,0,g,_,_+b,1-E),e.scale(1/v,1/T),e.rotate(-S),e.translate(-f,-h);break;case"z":t=!0,e.closePath();break}}!t&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(u){if(u.command==="A"){var p=u.points[4],_=u.points[5],b=u.points[4]+_,S=Math.PI/180;if(Math.abs(p-b)<S&&(S=Math.abs(p-b)),_<0)for(let E=p-S;E>b;E-=S){const g=Path.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],E,0);e.push(g.x,g.y)}else for(let E=p+S;E<b;E+=S){const g=Path.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],E,0);e.push(g.x,g.y)}}else if(u.command==="C")for(let E=0;E<=1;E+=.01){const g=Path.getPointOnCubicBezier(E,u.start.x,u.start.y,u.points[0],u.points[1],u.points[2],u.points[3],u.points[4],u.points[5]);e.push(g.x,g.y)}else e=e.concat(u.points)});for(var n=e[0],t=e[0],a=e[1],o=e[1],d,f,h=0;h<e.length/2;h++)d=e[h*2],f=e[h*2+1],isNaN(d)||(n=Math.min(n,d),t=Math.max(t,d)),isNaN(f)||(a=Math.min(a,f),o=Math.max(o,f));return{x:n,y:a,width:t-n,height:o-a}}getLength(){return this.pathLength}getPointAtLength(e){return Path.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,n,t,a){return Math.sqrt((t-e)*(t-e)+(a-n)*(a-n))}static getPathLength(e){let n=0;for(var t=0;t<e.length;++t)n+=e[t].pathLength;return n}static getPointAtLengthOfDataArray(e,n){var t,a=0,o=n.length;if(!o)return null;for(;a<o&&e>n[a].pathLength;)e-=n[a].pathLength,++a;if(a===o)return t=n[a-1].points.slice(-2),{x:t[0],y:t[1]};if(e<.01)return t=n[a].points.slice(0,2),{x:t[0],y:t[1]};var d=n[a],f=d.points;switch(d.command){case"L":return Path.getPointOnLine(e,d.start.x,d.start.y,f[0],f[1]);case"C":return Path.getPointOnCubicBezier((0,BezierFunctions_1.t2length)(e,Path.getPathLength(n),g=>(0,BezierFunctions_1.getCubicArcLength)([d.start.x,f[0],f[2],f[4]],[d.start.y,f[1],f[3],f[5]],g)),d.start.x,d.start.y,f[0],f[1],f[2],f[3],f[4],f[5]);case"Q":return Path.getPointOnQuadraticBezier((0,BezierFunctions_1.t2length)(e,Path.getPathLength(n),g=>(0,BezierFunctions_1.getQuadraticArcLength)([d.start.x,f[0],f[2]],[d.start.y,f[1],f[3]],g)),d.start.x,d.start.y,f[0],f[1],f[2],f[3]);case"A":var h=f[0],u=f[1],p=f[2],_=f[3],b=f[4],S=f[5],E=f[6];return b+=S*e/d.pathLength,Path.getPointOnEllipticalArc(h,u,p,_,b,E)}return null}static getPointOnLine(e,n,t,a,o,d,f){d===void 0&&(d=n),f===void 0&&(f=t);var h=(o-t)/(a-n+1e-8),u=Math.sqrt(e*e/(1+h*h));a<n&&(u*=-1);var p=h*u,_;if(a===n)_={x:d,y:f+p};else if((f-t)/(d-n+1e-8)===h)_={x:d+u,y:f+p};else{var b,S,E=this.getLineLength(n,t,a,o),g=(d-n)*(a-n)+(f-t)*(o-t);g=g/(E*E),b=n+g*(a-n),S=t+g*(o-t);var v=this.getLineLength(d,f,b,S),T=Math.sqrt(e*e-v*v);u=Math.sqrt(T*T/(1+h*h)),a<n&&(u*=-1),p=h*u,_={x:b+u,y:S+p}}return _}static getPointOnCubicBezier(e,n,t,a,o,d,f,h,u){function p(v){return v*v*v}function _(v){return 3*v*v*(1-v)}function b(v){return 3*v*(1-v)*(1-v)}function S(v){return(1-v)*(1-v)*(1-v)}var E=h*p(e)+d*_(e)+a*b(e)+n*S(e),g=u*p(e)+f*_(e)+o*b(e)+t*S(e);return{x:E,y:g}}static getPointOnQuadraticBezier(e,n,t,a,o,d,f){function h(S){return S*S}function u(S){return 2*S*(1-S)}function p(S){return(1-S)*(1-S)}var _=d*h(e)+a*u(e)+n*p(e),b=f*h(e)+o*u(e)+t*p(e);return{x:_,y:b}}static getPointOnEllipticalArc(e,n,t,a,o,d){var f=Math.cos(d),h=Math.sin(d),u={x:t*Math.cos(o),y:a*Math.sin(o)};return{x:e+(u.x*f-u.y*h),y:n+(u.x*h+u.y*f)}}static parsePathData(e){if(!e)return[];var n=e,t=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(var a=0;a<t.length;a++)n=n.replace(new RegExp(t[a],"g"),"|"+t[a]);var o=n.split("|"),d=[],f=[],h=0,u=0,p=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,_;for(a=1;a<o.length;a++){var b=o[a],S=b.charAt(0);for(b=b.slice(1),f.length=0;_=p.exec(b);)f.push(_[0]);for(var E=[],g=0,v=f.length;g<v;g++){if(f[g]==="00"){E.push(0,0);continue}var T=parseFloat(f[g]);isNaN(T)?E.push(0):E.push(T)}for(;E.length>0&&!isNaN(E[0]);){var R="",x=[],C=h,w=u,P,D,N,k,F,M,U,$,B,J;switch(S){case"l":h+=E.shift(),u+=E.shift(),R="L",x.push(h,u);break;case"L":h=E.shift(),u=E.shift(),x.push(h,u);break;case"m":var ne=E.shift(),ie=E.shift();if(h+=ne,u+=ie,R="M",d.length>2&&d[d.length-1].command==="z"){for(var Y=d.length-2;Y>=0;Y--)if(d[Y].command==="M"){h=d[Y].points[0]+ne,u=d[Y].points[1]+ie;break}}x.push(h,u),S="l";break;case"M":h=E.shift(),u=E.shift(),R="M",x.push(h,u),S="L";break;case"h":h+=E.shift(),R="L",x.push(h,u);break;case"H":h=E.shift(),R="L",x.push(h,u);break;case"v":u+=E.shift(),R="L",x.push(h,u);break;case"V":u=E.shift(),R="L",x.push(h,u);break;case"C":x.push(E.shift(),E.shift(),E.shift(),E.shift()),h=E.shift(),u=E.shift(),x.push(h,u);break;case"c":x.push(h+E.shift(),u+E.shift(),h+E.shift(),u+E.shift()),h+=E.shift(),u+=E.shift(),R="C",x.push(h,u);break;case"S":D=h,N=u,P=d[d.length-1],P.command==="C"&&(D=h+(h-P.points[2]),N=u+(u-P.points[3])),x.push(D,N,E.shift(),E.shift()),h=E.shift(),u=E.shift(),R="C",x.push(h,u);break;case"s":D=h,N=u,P=d[d.length-1],P.command==="C"&&(D=h+(h-P.points[2]),N=u+(u-P.points[3])),x.push(D,N,h+E.shift(),u+E.shift()),h+=E.shift(),u+=E.shift(),R="C",x.push(h,u);break;case"Q":x.push(E.shift(),E.shift()),h=E.shift(),u=E.shift(),x.push(h,u);break;case"q":x.push(h+E.shift(),u+E.shift()),h+=E.shift(),u+=E.shift(),R="Q",x.push(h,u);break;case"T":D=h,N=u,P=d[d.length-1],P.command==="Q"&&(D=h+(h-P.points[0]),N=u+(u-P.points[1])),h=E.shift(),u=E.shift(),R="Q",x.push(D,N,h,u);break;case"t":D=h,N=u,P=d[d.length-1],P.command==="Q"&&(D=h+(h-P.points[0]),N=u+(u-P.points[1])),h+=E.shift(),u+=E.shift(),R="Q",x.push(D,N,h,u);break;case"A":k=E.shift(),F=E.shift(),M=E.shift(),U=E.shift(),$=E.shift(),B=h,J=u,h=E.shift(),u=E.shift(),R="A",x=this.convertEndpointToCenterParameterization(B,J,h,u,U,$,k,F,M);break;case"a":k=E.shift(),F=E.shift(),M=E.shift(),U=E.shift(),$=E.shift(),B=h,J=u,h+=E.shift(),u+=E.shift(),R="A",x=this.convertEndpointToCenterParameterization(B,J,h,u,U,$,k,F,M);break}d.push({command:R||S,points:x,start:{x:C,y:w},pathLength:this.calcLength(C,w,R||S,x)})}(S==="z"||S==="Z")&&d.push({command:"z",points:[],start:void 0,pathLength:0})}return d}static calcLength(e,n,t,a){var o,d,f,h,u=Path;switch(t){case"L":return u.getLineLength(e,n,a[0],a[1]);case"C":return(0,BezierFunctions_1.getCubicArcLength)([e,a[0],a[2],a[4]],[n,a[1],a[3],a[5]],1);case"Q":return(0,BezierFunctions_1.getQuadraticArcLength)([e,a[0],a[2]],[n,a[1],a[3]],1);case"A":o=0;var p=a[4],_=a[5],b=a[4]+_,S=Math.PI/180;if(Math.abs(p-b)<S&&(S=Math.abs(p-b)),d=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],p,0),_<0)for(h=p-S;h>b;h-=S)f=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],h,0),o+=u.getLineLength(d.x,d.y,f.x,f.y),d=f;else for(h=p+S;h<b;h+=S)f=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],h,0),o+=u.getLineLength(d.x,d.y,f.x,f.y),d=f;return f=u.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],b,0),o+=u.getLineLength(d.x,d.y,f.x,f.y),o}return 0}static convertEndpointToCenterParameterization(e,n,t,a,o,d,f,h,u){var p=u*(Math.PI/180),_=Math.cos(p)*(e-t)/2+Math.sin(p)*(n-a)/2,b=-1*Math.sin(p)*(e-t)/2+Math.cos(p)*(n-a)/2,S=_*_/(f*f)+b*b/(h*h);S>1&&(f*=Math.sqrt(S),h*=Math.sqrt(S));var E=Math.sqrt((f*f*(h*h)-f*f*(b*b)-h*h*(_*_))/(f*f*(b*b)+h*h*(_*_)));o===d&&(E*=-1),isNaN(E)&&(E=0);var g=E*f*b/h,v=E*-h*_/f,T=(e+t)/2+Math.cos(p)*g-Math.sin(p)*v,R=(n+a)/2+Math.sin(p)*g+Math.cos(p)*v,x=function(F){return Math.sqrt(F[0]*F[0]+F[1]*F[1])},C=function(F,M){return(F[0]*M[0]+F[1]*M[1])/(x(F)*x(M))},w=function(F,M){return(F[0]*M[1]<F[1]*M[0]?-1:1)*Math.acos(C(F,M))},P=w([1,0],[(_-g)/f,(b-v)/h]),D=[(_-g)/f,(b-v)/h],N=[(-1*_-g)/f,(-1*b-v)/h],k=w(D,N);return C(D,N)<=-1&&(k=Math.PI),C(D,N)>=1&&(k=0),d===0&&k>0&&(k=k-2*Math.PI),d===1&&k<0&&(k=k+2*Math.PI),[T,R,f,h,P,k,p,d]}}Path$1.Path=Path;Path.prototype.className="Path";Path.prototype._attrsAffectingSize=["data"];(0,Global_1$e._registerNode)(Path);Factory_1$t.Factory.addGetterSetter(Path,"data");Object.defineProperty(Arrow$1,"__esModule",{value:!0});Arrow$1.Arrow=void 0;const Factory_1$s=Factory,Line_1$1=Line$2,Validators_1$s=Validators,Global_1$d=Global,Path_1$2=Path$1;class Arrow extends Line_1$1.Line{_sceneFunc(e){super._sceneFunc(e);var n=Math.PI*2,t=this.points(),a=t,o=this.tension()!==0&&t.length>4;o&&(a=this.getTensionPoints());var d=this.pointerLength(),f=t.length,h,u;if(o){const b=[a[a.length-4],a[a.length-3],a[a.length-2],a[a.length-1],t[f-2],t[f-1]],S=Path_1$2.Path.calcLength(a[a.length-4],a[a.length-3],"C",b),E=Path_1$2.Path.getPointOnQuadraticBezier(Math.min(1,1-d/S),b[0],b[1],b[2],b[3],b[4],b[5]);h=t[f-2]-E.x,u=t[f-1]-E.y}else h=t[f-2]-t[f-4],u=t[f-1]-t[f-3];var p=(Math.atan2(u,h)+n)%n,_=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(t[f-2],t[f-1]),e.rotate(p),e.moveTo(0,0),e.lineTo(-d,_/2),e.lineTo(-d,-_/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(t[0],t[1]),o?(h=(a[0]+a[2])/2-t[0],u=(a[1]+a[3])/2-t[1]):(h=t[2]-t[0],u=t[3]-t[1]),e.rotate((Math.atan2(-u,-h)+n)%n),e.moveTo(0,0),e.lineTo(-d,_/2),e.lineTo(-d,-_/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}}Arrow$1.Arrow=Arrow;Arrow.prototype.className="Arrow";(0,Global_1$d._registerNode)(Arrow);Factory_1$s.Factory.addGetterSetter(Arrow,"pointerLength",10,(0,Validators_1$s.getNumberValidator)());Factory_1$s.Factory.addGetterSetter(Arrow,"pointerWidth",10,(0,Validators_1$s.getNumberValidator)());Factory_1$s.Factory.addGetterSetter(Arrow,"pointerAtBeginning",!1);Factory_1$s.Factory.addGetterSetter(Arrow,"pointerAtEnding",!0);var Circle$1={};Object.defineProperty(Circle$1,"__esModule",{value:!0});Circle$1.Circle=void 0;const Factory_1$r=Factory,Shape_1$c=Shape,Validators_1$r=Validators,Global_1$c=Global;class Circle extends Shape_1$c.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Circle$1.Circle=Circle;Circle.prototype._centroid=!0;Circle.prototype.className="Circle";Circle.prototype._attrsAffectingSize=["radius"];(0,Global_1$c._registerNode)(Circle);Factory_1$r.Factory.addGetterSetter(Circle,"radius",0,(0,Validators_1$r.getNumberValidator)());var Ellipse$1={};Object.defineProperty(Ellipse$1,"__esModule",{value:!0});Ellipse$1.Ellipse=void 0;const Factory_1$q=Factory,Shape_1$b=Shape,Validators_1$q=Validators,Global_1$b=Global;class Ellipse extends Shape_1$b.Shape{_sceneFunc(e){var n=this.radiusX(),t=this.radiusY();e.beginPath(),e.save(),n!==t&&e.scale(1,t/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Ellipse$1.Ellipse=Ellipse;Ellipse.prototype.className="Ellipse";Ellipse.prototype._centroid=!0;Ellipse.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Global_1$b._registerNode)(Ellipse);Factory_1$q.Factory.addComponentsGetterSetter(Ellipse,"radius",["x","y"]);Factory_1$q.Factory.addGetterSetter(Ellipse,"radiusX",0,(0,Validators_1$q.getNumberValidator)());Factory_1$q.Factory.addGetterSetter(Ellipse,"radiusY",0,(0,Validators_1$q.getNumberValidator)());var Image$4={};Object.defineProperty(Image$4,"__esModule",{value:!0});Image$4.Image=void 0;const Util_1$7=Util,Factory_1$p=Factory,Shape_1$a=Shape,Global_1$a=Global,Validators_1$p=Validators;let Image$3=class Ay extends Shape_1$a.Shape{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),t=this.getHeight(),a=this.cornerRadius(),o=this.attrs.image;let d;if(o){const f=this.attrs.cropWidth,h=this.attrs.cropHeight;f&&h?d=[o,this.cropX(),this.cropY(),f,h,0,0,n,t]:d=[o,0,0,n,t]}(this.hasFill()||this.hasStroke()||a)&&(e.beginPath(),a?Util_1$7.Util.drawRoundedRectPath(e,n,t,a):e.rect(0,0,n,t),e.closePath(),e.fillStrokeShape(this)),o&&(a&&e.clip(),e.drawImage.apply(e,d))}_hitFunc(e){var n=this.width(),t=this.height(),a=this.cornerRadius();e.beginPath(),a?Util_1$7.Util.drawRoundedRectPath(e,n,t,a):e.rect(0,0,n,t),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,t=null){var a=Util_1$7.Util.createImageElement();a.onload=function(){var o=new Ay({image:a});n(o)},a.onerror=t,a.crossOrigin="Anonymous",a.src=e}};Image$4.Image=Image$3;Image$3.prototype.className="Image";(0,Global_1$a._registerNode)(Image$3);Factory_1$p.Factory.addGetterSetter(Image$3,"cornerRadius",0,(0,Validators_1$p.getNumberOrArrayOfNumbersValidator)(4));Factory_1$p.Factory.addGetterSetter(Image$3,"image");Factory_1$p.Factory.addComponentsGetterSetter(Image$3,"crop",["x","y","width","height"]);Factory_1$p.Factory.addGetterSetter(Image$3,"cropX",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropY",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropWidth",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropHeight",0,(0,Validators_1$p.getNumberValidator)());var Label$1={};Object.defineProperty(Label$1,"__esModule",{value:!0});Label$1.Tag=Label$1.Label=void 0;const Factory_1$o=Factory,Shape_1$9=Shape,Group_1$1=Group$2,Validators_1$o=Validators,Global_1$9=Global;var ATTR_CHANGE_LIST$2=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],CHANGE_KONVA$1="Change.konva",NONE$1="none",UP="up",RIGHT$1="right",DOWN="down",LEFT$1="left",attrChangeListLen$1=ATTR_CHANGE_LIST$2.length;class Label extends Group_1$1.Group{constructor(e){super(e),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var n=this,t,a=function(){n._sync()};for(t=0;t<attrChangeListLen$1;t++)e.on(ATTR_CHANGE_LIST$2[t]+CHANGE_KONVA$1,a)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var e=this.getText(),n=this.getTag(),t,a,o,d,f,h,u;if(e&&n){switch(t=e.width(),a=e.height(),o=n.pointerDirection(),d=n.pointerWidth(),u=n.pointerHeight(),f=0,h=0,o){case UP:f=t/2,h=-1*u;break;case RIGHT$1:f=t+d,h=a/2;break;case DOWN:f=t/2,h=a+u;break;case LEFT$1:f=-1*d,h=a/2;break}n.setAttrs({x:-1*f,y:-1*h,width:t,height:a}),e.setAttrs({x:-1*f,y:-1*h})}}}Label$1.Label=Label;Label.prototype.className="Label";(0,Global_1$9._registerNode)(Label);class Tag extends Shape_1$9.Shape{_sceneFunc(e){var n=this.width(),t=this.height(),a=this.pointerDirection(),o=this.pointerWidth(),d=this.pointerHeight(),f=this.cornerRadius();let h=0,u=0,p=0,_=0;typeof f=="number"?h=u=p=_=Math.min(f,n/2,t/2):(h=Math.min(f[0]||0,n/2,t/2),u=Math.min(f[1]||0,n/2,t/2),_=Math.min(f[2]||0,n/2,t/2),p=Math.min(f[3]||0,n/2,t/2)),e.beginPath(),e.moveTo(h,0),a===UP&&(e.lineTo((n-o)/2,0),e.lineTo(n/2,-1*d),e.lineTo((n+o)/2,0)),e.lineTo(n-u,0),e.arc(n-u,u,u,Math.PI*3/2,0,!1),a===RIGHT$1&&(e.lineTo(n,(t-d)/2),e.lineTo(n+o,t/2),e.lineTo(n,(t+d)/2)),e.lineTo(n,t-_),e.arc(n-_,t-_,_,0,Math.PI/2,!1),a===DOWN&&(e.lineTo((n+o)/2,t),e.lineTo(n/2,t+d),e.lineTo((n-o)/2,t)),e.lineTo(p,t),e.arc(p,t-p,p,Math.PI/2,Math.PI,!1),a===LEFT$1&&(e.lineTo(0,(t+d)/2),e.lineTo(-1*o,t/2),e.lineTo(0,(t-d)/2)),e.lineTo(0,h),e.arc(h,h,h,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){var e=0,n=0,t=this.pointerWidth(),a=this.pointerHeight(),o=this.pointerDirection(),d=this.width(),f=this.height();return o===UP?(n-=a,f+=a):o===DOWN?f+=a:o===LEFT$1?(e-=t*1.5,d+=t):o===RIGHT$1&&(d+=t*1.5),{x:e,y:n,width:d,height:f}}}Label$1.Tag=Tag;Tag.prototype.className="Tag";(0,Global_1$9._registerNode)(Tag);Factory_1$o.Factory.addGetterSetter(Tag,"pointerDirection",NONE$1);Factory_1$o.Factory.addGetterSetter(Tag,"pointerWidth",0,(0,Validators_1$o.getNumberValidator)());Factory_1$o.Factory.addGetterSetter(Tag,"pointerHeight",0,(0,Validators_1$o.getNumberValidator)());Factory_1$o.Factory.addGetterSetter(Tag,"cornerRadius",0,(0,Validators_1$o.getNumberOrArrayOfNumbersValidator)(4));var Rect$2={};Object.defineProperty(Rect$2,"__esModule",{value:!0});Rect$2.Rect=void 0;const Factory_1$n=Factory,Shape_1$8=Shape,Global_1$8=Global,Util_1$6=Util,Validators_1$n=Validators;let Rect$1=class extends Shape_1$8.Shape{_sceneFunc(e){var n=this.cornerRadius(),t=this.width(),a=this.height();e.beginPath(),n?Util_1$6.Util.drawRoundedRectPath(e,t,a,n):e.rect(0,0,t,a),e.closePath(),e.fillStrokeShape(this)}};Rect$2.Rect=Rect$1;Rect$1.prototype.className="Rect";(0,Global_1$8._registerNode)(Rect$1);Factory_1$n.Factory.addGetterSetter(Rect$1,"cornerRadius",0,(0,Validators_1$n.getNumberOrArrayOfNumbersValidator)(4));var RegularPolygon$1={};Object.defineProperty(RegularPolygon$1,"__esModule",{value:!0});RegularPolygon$1.RegularPolygon=void 0;const Factory_1$m=Factory,Shape_1$7=Shape,Validators_1$m=Validators,Global_1$7=Global;class RegularPolygon extends Shape_1$7.Shape{_sceneFunc(e){const n=this._getPoints();e.beginPath(),e.moveTo(n[0].x,n[0].y);for(var t=1;t<n.length;t++)e.lineTo(n[t].x,n[t].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,n=this.attrs.radius||0,t=[];for(var a=0;a<e;a++)t.push({x:n*Math.sin(a*2*Math.PI/e),y:-1*n*Math.cos(a*2*Math.PI/e)});return t}getSelfRect(){const e=this._getPoints();var n=e[0].x,t=e[0].y,a=e[0].x,o=e[0].y;return e.forEach(d=>{n=Math.min(n,d.x),t=Math.max(t,d.x),a=Math.min(a,d.y),o=Math.max(o,d.y)}),{x:n,y:a,width:t-n,height:o-a}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}RegularPolygon$1.RegularPolygon=RegularPolygon;RegularPolygon.prototype.className="RegularPolygon";RegularPolygon.prototype._centroid=!0;RegularPolygon.prototype._attrsAffectingSize=["radius"];(0,Global_1$7._registerNode)(RegularPolygon);Factory_1$m.Factory.addGetterSetter(RegularPolygon,"radius",0,(0,Validators_1$m.getNumberValidator)());Factory_1$m.Factory.addGetterSetter(RegularPolygon,"sides",0,(0,Validators_1$m.getNumberValidator)());var Ring$1={};Object.defineProperty(Ring$1,"__esModule",{value:!0});Ring$1.Ring=void 0;const Factory_1$l=Factory,Shape_1$6=Shape,Validators_1$l=Validators,Global_1$6=Global;var PIx2=Math.PI*2;class Ring extends Shape_1$6.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,PIx2,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),PIx2,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Ring$1.Ring=Ring;Ring.prototype.className="Ring";Ring.prototype._centroid=!0;Ring.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_1$6._registerNode)(Ring);Factory_1$l.Factory.addGetterSetter(Ring,"innerRadius",0,(0,Validators_1$l.getNumberValidator)());Factory_1$l.Factory.addGetterSetter(Ring,"outerRadius",0,(0,Validators_1$l.getNumberValidator)());var Sprite$1={};Object.defineProperty(Sprite$1,"__esModule",{value:!0});Sprite$1.Sprite=void 0;const Factory_1$k=Factory,Shape_1$5=Shape,Animation_1=Animation$3,Validators_1$k=Validators,Global_1$5=Global;class Sprite extends Shape_1$5.Shape{constructor(e){super(e),this._updated=!0,this.anim=new Animation_1.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){var n=this.animation(),t=this.frameIndex(),a=t*4,o=this.animations()[n],d=this.frameOffsets(),f=o[a+0],h=o[a+1],u=o[a+2],p=o[a+3],_=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,u,p),e.closePath(),e.fillStrokeShape(this)),_)if(d){var b=d[n],S=t*2;e.drawImage(_,f,h,u,p,b[S+0],b[S+1],u,p)}else e.drawImage(_,f,h,u,p,0,0,u,p)}_hitFunc(e){var n=this.animation(),t=this.frameIndex(),a=t*4,o=this.animations()[n],d=this.frameOffsets(),f=o[a+2],h=o[a+3];if(e.beginPath(),d){var u=d[n],p=t*2;e.rect(u[p+0],u[p+1],f,h)}else e.rect(0,0,f,h);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),n=this.animation(),t=this.animations(),a=t[n],o=a.length/4;e<o-1?this.frameIndex(e+1):this.frameIndex(0)}}Sprite$1.Sprite=Sprite;Sprite.prototype.className="Sprite";(0,Global_1$5._registerNode)(Sprite);Factory_1$k.Factory.addGetterSetter(Sprite,"animation");Factory_1$k.Factory.addGetterSetter(Sprite,"animations");Factory_1$k.Factory.addGetterSetter(Sprite,"frameOffsets");Factory_1$k.Factory.addGetterSetter(Sprite,"image");Factory_1$k.Factory.addGetterSetter(Sprite,"frameIndex",0,(0,Validators_1$k.getNumberValidator)());Factory_1$k.Factory.addGetterSetter(Sprite,"frameRate",17,(0,Validators_1$k.getNumberValidator)());Factory_1$k.Factory.backCompat(Sprite,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Star$1={};Object.defineProperty(Star$1,"__esModule",{value:!0});Star$1.Star=void 0;const Factory_1$j=Factory,Shape_1$4=Shape,Validators_1$j=Validators,Global_1$4=Global;class Star extends Shape_1$4.Shape{_sceneFunc(e){var n=this.innerRadius(),t=this.outerRadius(),a=this.numPoints();e.beginPath(),e.moveTo(0,0-t);for(var o=1;o<a*2;o++){var d=o%2===0?t:n,f=d*Math.sin(o*Math.PI/a),h=-1*d*Math.cos(o*Math.PI/a);e.lineTo(f,h)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Star$1.Star=Star;Star.prototype.className="Star";Star.prototype._centroid=!0;Star.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_1$4._registerNode)(Star);Factory_1$j.Factory.addGetterSetter(Star,"numPoints",5,(0,Validators_1$j.getNumberValidator)());Factory_1$j.Factory.addGetterSetter(Star,"innerRadius",0,(0,Validators_1$j.getNumberValidator)());Factory_1$j.Factory.addGetterSetter(Star,"outerRadius",0,(0,Validators_1$j.getNumberValidator)());var Text$2={};Object.defineProperty(Text$2,"__esModule",{value:!0});Text$2.Text=Text$2.stringToArray=void 0;const Util_1$5=Util,Factory_1$i=Factory,Shape_1$3=Shape,Validators_1$i=Validators,Global_1$3=Global;function stringToArray(l){return Array.from(l)}Text$2.stringToArray=stringToArray;var AUTO="auto",CENTER="center",INHERIT="inherit",JUSTIFY="justify",CHANGE_KONVA="Change.konva",CONTEXT_2D="2d",DASH="-",LEFT="left",TEXT="text",TEXT_UPPER="Text",TOP="top",BOTTOM="bottom",MIDDLE="middle",NORMAL$1="normal",PX_SPACE="px ",SPACE=" ",RIGHT="right",RTL="rtl",WORD="word",CHAR="char",NONE="none",ELLIPSIS="…",ATTR_CHANGE_LIST$1=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],attrChangeListLen=ATTR_CHANGE_LIST$1.length;function normalizeFontFamily(l){return l.split(",").map(e=>{e=e.trim();const n=e.indexOf(" ")>=0,t=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!t&&(e=`"${e}"`),e}).join(", ")}var dummyContext;function getDummyContext(){return dummyContext||(dummyContext=Util_1$5.Util.createCanvasElement().getContext(CONTEXT_2D),dummyContext)}function _fillFunc$1(l){l.fillText(this._partialText,this._partialTextX,this._partialTextY)}function _strokeFunc$1(l){l.setAttr("miterLimit",2),l.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function checkDefaultFill(l){return l=l||{},!l.fillLinearGradientColorStops&&!l.fillRadialGradientColorStops&&!l.fillPatternImage&&(l.fill=l.fill||"black"),l}let Text$1=class extends Shape_1$3.Shape{constructor(e){super(checkDefaultFill(e)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n<attrChangeListLen;n++)this.on(ATTR_CHANGE_LIST$1[n]+CHANGE_KONVA,this._setTextData);this._setTextData()}_sceneFunc(e){var n=this.textArr,t=n.length;if(this.text()){var a=this.padding(),o=this.fontSize(),d=this.lineHeight()*o,f=this.verticalAlign(),h=this.direction(),u=0,p=this.align(),_=this.getWidth(),b=this.letterSpacing(),S=this.fill(),E=this.textDecoration(),g=E.indexOf("underline")!==-1,v=E.indexOf("line-through")!==-1,T;h=h===INHERIT?e.direction:h;var R=0,R=d/2,x=0,C=0;for(h===RTL&&e.setAttr("direction",h),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",MIDDLE),e.setAttr("textAlign",LEFT),f===MIDDLE?u=(this.getHeight()-t*d-a*2)/2:f===BOTTOM&&(u=this.getHeight()-t*d-a*2),e.translate(a,u+a),T=0;T<t;T++){var x=0,C=0,w=n[T],P=w.text,D=w.width,N=w.lastInParagraph,k,F,M;if(e.save(),p===RIGHT?x+=_-D-a*2:p===CENTER&&(x+=(_-D-a*2)/2),g){e.save(),e.beginPath(),e.moveTo(x,R+C+Math.round(o/2)),k=P.split(" ").length-1,F=k===0,M=p===JUSTIFY&&!N?_-a*2:D,e.lineTo(x+Math.round(M),R+C+Math.round(o/2)),e.lineWidth=o/15;const ie=this._getLinearGradient();e.strokeStyle=ie||S,e.stroke(),e.restore()}if(v){e.save(),e.beginPath(),e.moveTo(x,R+C),k=P.split(" ").length-1,F=k===0,M=p===JUSTIFY&&N&&!F?_-a*2:D,e.lineTo(x+Math.round(M),R+C),e.lineWidth=o/15;const ie=this._getLinearGradient();e.strokeStyle=ie||S,e.stroke(),e.restore()}if(h!==RTL&&(b!==0||p===JUSTIFY)){k=P.split(" ").length-1;for(var U=stringToArray(P),$=0;$<U.length;$++){var B=U[$];B===" "&&!N&&p===JUSTIFY&&(x+=(_-a*2-D)/k),this._partialTextX=x,this._partialTextY=R+C,this._partialText=B,e.fillStrokeShape(this),x+=this.measureSize(B).width+b}}else b!==0&&e.setAttr("letterSpacing",`${b}px`),this._partialTextX=x,this._partialTextY=R+C,this._partialText=P,e.fillStrokeShape(this);e.restore(),t>1&&(R+=d)}}}_hitFunc(e){var n=this.getWidth(),t=this.getHeight();e.beginPath(),e.rect(0,0,n,t),e.closePath(),e.fillStrokeShape(this)}setText(e){var n=Util_1$5.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(TEXT,n),this}getWidth(){var e=this.attrs.width===AUTO||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===AUTO||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Util_1$5.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n=getDummyContext(),t=this.fontSize(),a;return n.save(),n.font=this._getContextFont(),a=n.measureText(e),n.restore(),{width:a.width,height:t}}_getContextFont(){return this.fontStyle()+SPACE+this.fontVariant()+SPACE+(this.fontSize()+PX_SPACE)+normalizeFontFamily(this.fontFamily())}_addTextLine(e){this.align()===JUSTIFY&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var n=this.letterSpacing(),t=e.length;return getDummyContext().measureText(e).width+(t?n*(t-1):0)}_setTextData(){var e=this.text().split(`
72
72
  `),n=+this.fontSize(),t=0,a=this.lineHeight()*n,o=this.attrs.width,d=this.attrs.height,f=o!==AUTO&&o!==void 0,h=d!==AUTO&&d!==void 0,u=this.padding(),p=o-u*2,_=d-u*2,b=0,S=this.wrap(),E=S!==NONE,g=S!==CHAR&&E,v=this.ellipsis();this.textArr=[],getDummyContext().font=this._getContextFont();for(var T=v?this._getTextWidth(ELLIPSIS):0,R=0,x=e.length;R<x;++R){var C=e[R],w=this._getTextWidth(C);if(f&&w>p)for(;C.length>0;){for(var P=0,D=C.length,N="",k=0;P<D;){var F=P+D>>>1,M=C.slice(0,F+1),U=this._getTextWidth(M)+T;U<=p?(P=F+1,N=M,k=U):D=F}if(N){if(g){var $,B=C[N.length],J=B===SPACE||B===DASH;J&&k<=p?$=N.length:$=Math.max(N.lastIndexOf(SPACE),N.lastIndexOf(DASH))+1,$>0&&(P=$,N=N.slice(0,P),k=this._getTextWidth(N))}N=N.trimRight(),this._addTextLine(N),t=Math.max(t,k),b+=a;var ne=this._shouldHandleEllipsis(b);if(ne){this._tryToAddEllipsisToLastLine();break}if(C=C.slice(P),C=C.trimLeft(),C.length>0&&(w=this._getTextWidth(C),w<=p)){this._addTextLine(C),b+=a,t=Math.max(t,w);break}}else break}else this._addTextLine(C),b+=a,t=Math.max(t,w),this._shouldHandleEllipsis(b)&&R<x-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),h&&b+a>_)break}this.textHeight=n,this.textWidth=t}_shouldHandleEllipsis(e){var n=+this.fontSize(),t=this.lineHeight()*n,a=this.attrs.height,o=a!==AUTO&&a!==void 0,d=this.padding(),f=a-d*2,h=this.wrap(),u=h!==NONE;return!u||o&&e+t>f}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,n=e!==AUTO&&e!==void 0,t=this.padding(),a=e-t*2,o=this.ellipsis(),d=this.textArr[this.textArr.length-1];if(!(!d||!o)){if(n){var f=this._getTextWidth(d.text+ELLIPSIS)<a;f||(d.text=d.text.slice(0,d.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(d.text+ELLIPSIS)}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,n=this.hasShadow();return e&&n?!0:super._useBufferCanvas()}};Text$2.Text=Text$1;Text$1.prototype._fillFunc=_fillFunc$1;Text$1.prototype._strokeFunc=_strokeFunc$1;Text$1.prototype.className=TEXT_UPPER;Text$1.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];(0,Global_1$3._registerNode)(Text$1);Factory_1$i.Factory.overWriteSetter(Text$1,"width",(0,Validators_1$i.getNumberOrAutoValidator)());Factory_1$i.Factory.overWriteSetter(Text$1,"height",(0,Validators_1$i.getNumberOrAutoValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"direction",INHERIT);Factory_1$i.Factory.addGetterSetter(Text$1,"fontFamily","Arial");Factory_1$i.Factory.addGetterSetter(Text$1,"fontSize",12,(0,Validators_1$i.getNumberValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"fontStyle",NORMAL$1);Factory_1$i.Factory.addGetterSetter(Text$1,"fontVariant",NORMAL$1);Factory_1$i.Factory.addGetterSetter(Text$1,"padding",0,(0,Validators_1$i.getNumberValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"align",LEFT);Factory_1$i.Factory.addGetterSetter(Text$1,"verticalAlign",TOP);Factory_1$i.Factory.addGetterSetter(Text$1,"lineHeight",1,(0,Validators_1$i.getNumberValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"wrap",WORD);Factory_1$i.Factory.addGetterSetter(Text$1,"ellipsis",!1,(0,Validators_1$i.getBooleanValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"letterSpacing",0,(0,Validators_1$i.getNumberValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"text","",(0,Validators_1$i.getStringValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"textDecoration","");var TextPath$1={};Object.defineProperty(TextPath$1,"__esModule",{value:!0});TextPath$1.TextPath=void 0;const Util_1$4=Util,Factory_1$h=Factory,Shape_1$2=Shape,Path_1$1=Path$1,Text_1$1=Text$2,Validators_1$h=Validators,Global_1$2=Global;var EMPTY_STRING="",NORMAL="normal";function _fillFunc(l){l.fillText(this.partialText,0,0)}function _strokeFunc(l){l.strokeText(this.partialText,0,0)}class TextPath extends Shape_1$2.Shape{constructor(e){super(e),this.dummyCanvas=Util_1$4.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return Path_1$1.Path.getPathLength(this.dataArray)}_getPointAtLength(e){if(!this.attrs.data)return null;const n=this.pathLength;return e-1>n?null:Path_1$1.Path.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Path_1$1.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();var n=this.textDecoration(),t=this.fill(),a=this.fontSize(),o=this.glyphInfo;n==="underline"&&e.beginPath();for(var d=0;d<o.length;d++){e.save();var f=o[d].p0;e.translate(f.x,f.y),e.rotate(o[d].rotation),this.partialText=o[d].text,e.fillStrokeShape(this),n==="underline"&&(d===0&&e.moveTo(0,a/2+1),e.lineTo(a,a/2+1)),e.restore()}n==="underline"&&(e.strokeStyle=t,e.lineWidth=a/20,e.stroke()),e.restore()}_hitFunc(e){e.beginPath();var n=this.glyphInfo;if(n.length>=1){var t=n[0].p0;e.moveTo(t.x,t.y)}for(var a=0;a<n.length;a++){var o=n[a].p1;e.lineTo(o.x,o.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Util_1$4.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Text_1$1.Text.prototype.setText.call(this,e)}_getContextFont(){return Text_1$1.Text.prototype._getContextFont.call(this)}_getTextSize(e){var n=this.dummyCanvas,t=n.getContext("2d");t.save(),t.font=this._getContextFont();var a=t.measureText(e);return t.restore(),{width:a.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:e,height:n}=this._getTextSize(this.attrs.text);if(this.textWidth=e,this.textHeight=n,this.glyphInfo=[],!this.attrs.data)return null;const t=this.letterSpacing(),a=this.align(),o=this.kerningFunc(),d=Math.max(this.textWidth+((this.attrs.text||"").length-1)*t,0);let f=0;a==="center"&&(f=Math.max(0,this.pathLength/2-d/2)),a==="right"&&(f=Math.max(0,this.pathLength-d));const h=(0,Text_1$1.stringToArray)(this.text());let u=f;for(var p=0;p<h.length;p++){const _=this._getPointAtLength(u);if(!_)return;let b=this._getTextSize(h[p]).width+t;if(h[p]===" "&&a==="justify"){const R=this.text().split(" ").length-1;b+=(this.pathLength-d)/R}const S=this._getPointAtLength(u+b);if(!S)return;const E=Path_1$1.Path.getLineLength(_.x,_.y,S.x,S.y);let g=0;if(o)try{g=o(h[p-1],h[p])*this.fontSize()}catch{g=0}_.x+=g,S.x+=g,this.textWidth+=g;const v=Path_1$1.Path.getPointOnLine(g+E/2,_.x,_.y,S.x,S.y),T=Math.atan2(S.y-_.y,S.x-_.x);this.glyphInfo.push({transposeX:v.x,transposeY:v.y,text:h[p],rotation:T,p0:_,p1:S}),u+=b}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var e=[];this.glyphInfo.forEach(function(p){e.push(p.p0.x),e.push(p.p0.y),e.push(p.p1.x),e.push(p.p1.y)});for(var n=e[0]||0,t=e[0]||0,a=e[1]||0,o=e[1]||0,d,f,h=0;h<e.length/2;h++)d=e[h*2],f=e[h*2+1],n=Math.min(n,d),t=Math.max(t,d),a=Math.min(a,f),o=Math.max(o,f);var u=this.fontSize();return{x:n-u/2,y:a-u/2,width:t-n+u,height:o-a+u}}destroy(){return Util_1$4.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}TextPath$1.TextPath=TextPath;TextPath.prototype._fillFunc=_fillFunc;TextPath.prototype._strokeFunc=_strokeFunc;TextPath.prototype._fillFuncHit=_fillFunc;TextPath.prototype._strokeFuncHit=_strokeFunc;TextPath.prototype.className="TextPath";TextPath.prototype._attrsAffectingSize=["text","fontSize","data"];(0,Global_1$2._registerNode)(TextPath);Factory_1$h.Factory.addGetterSetter(TextPath,"data");Factory_1$h.Factory.addGetterSetter(TextPath,"fontFamily","Arial");Factory_1$h.Factory.addGetterSetter(TextPath,"fontSize",12,(0,Validators_1$h.getNumberValidator)());Factory_1$h.Factory.addGetterSetter(TextPath,"fontStyle",NORMAL);Factory_1$h.Factory.addGetterSetter(TextPath,"align","left");Factory_1$h.Factory.addGetterSetter(TextPath,"letterSpacing",0,(0,Validators_1$h.getNumberValidator)());Factory_1$h.Factory.addGetterSetter(TextPath,"textBaseline","middle");Factory_1$h.Factory.addGetterSetter(TextPath,"fontVariant",NORMAL);Factory_1$h.Factory.addGetterSetter(TextPath,"text",EMPTY_STRING);Factory_1$h.Factory.addGetterSetter(TextPath,"textDecoration",null);Factory_1$h.Factory.addGetterSetter(TextPath,"kerningFunc",null);var Transformer$1={};Object.defineProperty(Transformer$1,"__esModule",{value:!0});Transformer$1.Transformer=void 0;const Util_1$3=Util,Factory_1$g=Factory,Node_1$f=Node$1,Shape_1$1=Shape,Rect_1$1=Rect$2,Group_1=Group$2,Global_1$1=Global,Validators_1$g=Validators,Global_2$1=Global;var EVENTS_NAME="tr-konva",ATTR_CHANGE_LIST=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(l=>l+`.${EVENTS_NAME}`).join(" "),NODES_RECT="nodesRect",TRANSFORM_CHANGE_STR=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],ANGLES={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const TOUCH_DEVICE="ontouchstart"in Global_1$1.Konva._global;function getCursor(l,e,n){if(l==="rotater")return n;e+=Util_1$3.Util.degToRad(ANGLES[l]||0);var t=(Util_1$3.Util.radToDeg(e)%360+360)%360;return Util_1$3.Util._inRange(t,315+22.5,360)||Util_1$3.Util._inRange(t,0,22.5)?"ns-resize":Util_1$3.Util._inRange(t,45-22.5,45+22.5)?"nesw-resize":Util_1$3.Util._inRange(t,90-22.5,90+22.5)?"ew-resize":Util_1$3.Util._inRange(t,135-22.5,135+22.5)?"nwse-resize":Util_1$3.Util._inRange(t,180-22.5,180+22.5)?"ns-resize":Util_1$3.Util._inRange(t,225-22.5,225+22.5)?"nesw-resize":Util_1$3.Util._inRange(t,270-22.5,270+22.5)?"ew-resize":Util_1$3.Util._inRange(t,315-22.5,315+22.5)?"nwse-resize":(Util_1$3.Util.error("Transformer has unknown angle for cursor detection: "+t),"pointer")}var ANCHORS_NAMES=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],MAX_SAFE_INTEGER=1e8;function getCenter(l){return{x:l.x+l.width/2*Math.cos(l.rotation)+l.height/2*Math.sin(-l.rotation),y:l.y+l.height/2*Math.cos(l.rotation)+l.width/2*Math.sin(l.rotation)}}function rotateAroundPoint(l,e,n){const t=n.x+(l.x-n.x)*Math.cos(e)-(l.y-n.y)*Math.sin(e),a=n.y+(l.x-n.x)*Math.sin(e)+(l.y-n.y)*Math.cos(e);return{...l,rotation:l.rotation+e,x:t,y:a}}function rotateAroundCenter(l,e){const n=getCenter(l);return rotateAroundPoint(l,e,n)}function getSnap(l,e,n){let t=e;for(let a=0;a<l.length;a++){const o=Global_1$1.Konva.getAngle(l[a]),d=Math.abs(o-e)%(Math.PI*2);Math.min(d,Math.PI*2-d)<n&&(t=o)}return t}class Transformer extends Group_1.Group{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(ATTR_CHANGE_LIST,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Util_1$3.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return EVENTS_NAME+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const n=e.filter(a=>a.isAncestorOf(this)?(Util_1$3.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=e=n,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(a=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},d=a._attrsAffectingSize.map(f=>f+"Change."+this._getEventNamespace()).join(" ");a.on(d,o),a.on(TRANSFORM_CHANGE_STR.map(f=>f+`.${this._getEventNamespace()}`).join(" "),o),a.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(a)}),this._resetTransformCache();var t=!!this.findOne(".top-left");return t&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,t=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(t,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,t=>{if(!n)return;const a=e.getAbsolutePosition(),o=a.x-n.x,d=a.y-n.y;this.nodes().forEach(f=>{if(f===e||f.isDragging())return;const h=f.getAbsolutePosition();f.setAbsolutePosition({x:h.x+o,y:h.y+d}),f.startDrag(t)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(NODES_RECT),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(NODES_RECT,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),t){var a=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(t),d=e.getAbsolutePosition(t),f=a.x*o.x-e.offsetX()*o.x,h=a.y*o.y-e.offsetY()*o.y;const u=(Global_1$1.Konva.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),p={x:d.x+f*Math.cos(u)+h*Math.sin(-u),y:d.y+h*Math.cos(u)+f*Math.sin(u),width:a.width*o.x,height:a.height*o.y,rotation:u};return rotateAroundPoint(p,-Global_1$1.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-MAX_SAFE_INTEGER,y:-MAX_SAFE_INTEGER,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const p=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var _=[{x:p.x,y:p.y},{x:p.x+p.width,y:p.y},{x:p.x+p.width,y:p.y+p.height},{x:p.x,y:p.y+p.height}],b=u.getAbsoluteTransform();_.forEach(function(S){var E=b.point(S);n.push(E)})});const t=new Util_1$3.Transform;t.rotate(-Global_1$1.Konva.getAngle(this.rotation()));var a=1/0,o=1/0,d=-1/0,f=-1/0;n.forEach(function(u){var p=t.point(u);a===void 0&&(a=d=p.x,o=f=p.y),a=Math.min(a,p.x),o=Math.min(o,p.y),d=Math.max(d,p.x),f=Math.max(f,p.y)}),t.invert();const h=t.point({x:a,y:o});return{x:h.x,y:h.y,width:d-a,height:f-o,rotation:Global_1$1.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),ANCHORS_NAMES.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){var n=new Rect_1$1.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:TOUCH_DEVICE?10:"auto"}),t=this;n.on("mousedown touchstart",function(a){t._handleMouseDown(a)}),n.on("dragstart",a=>{n.stopDrag(),a.cancelBubble=!0}),n.on("dragend",a=>{a.cancelBubble=!0}),n.on("mouseenter",()=>{var a=Global_1$1.Konva.getAngle(this.rotation()),o=this.rotateAnchorCursor(),d=getCursor(e,a,o);n.getStage().content&&(n.getStage().content.style.cursor=d),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var e=new Shape_1$1.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n,t){var a=t.getParent(),o=a.padding();n.beginPath(),n.rect(-o,-o,t.width()+o*2,t.height()+o*2),n.moveTo(t.width()/2,-o),a.rotateEnabled()&&a.rotateLineVisible()&&n.lineTo(t.width()/2,-a.rotateAnchorOffset()*Util_1$3.Util._sign(t.height())-o),n.fillStrokeShape(t)},hitFunc:(n,t)=>{if(this.shouldOverdrawWholeArea()){var a=this.padding();n.beginPath(),n.rect(-a,-a,t.width()+a*2,t.height()+a*2),n.fillStrokeShape(t)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var n=this._getNodeRect(),t=n.width,a=n.height,o=Math.sqrt(Math.pow(t,2)+Math.pow(a,2));this.sin=Math.abs(a/o),this.cos=Math.abs(t/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var d=e.target.getAbsolutePosition(),f=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:f.x-d.x,y:f.y-d.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(h=>{h._fire("transformstart",{evt:e.evt,target:h})})}_handleMouseMove(e){var n,t,a,o=this.findOne("."+this._movingAnchorName),d=o.getStage();d.setPointersPositions(e);const f=d.getPointerPosition();let h={x:f.x-this._anchorDragOffset.x,y:f.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(h=this.anchorDragBoundFunc()(u,h,e)),o.setAbsolutePosition(h);const p=o.getAbsolutePosition();if(!(u.x===p.x&&u.y===p.y)){if(this._movingAnchorName==="rotater"){var _=this._getNodeRect();n=o.x()-_.width/2,t=-o.y()+_.height/2;let $=Math.atan2(-t,n)+Math.PI/2;_.height<0&&($-=Math.PI);var b=Global_1$1.Konva.getAngle(this.rotation());const B=b+$,J=Global_1$1.Konva.getAngle(this.rotationSnapTolerance()),ie=getSnap(this.rotationSnaps(),B,J)-_.rotation,Y=rotateAroundCenter(_,ie);this._fitNodesInto(Y,e);return}var S=this.shiftBehavior(),E;S==="inverted"?E=this.keepRatio()&&!e.shiftKey:S==="none"?E=this.keepRatio():E=this.keepRatio()||e.shiftKey;var x=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(E){var g=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};a=Math.sqrt(Math.pow(g.x-o.x(),2)+Math.pow(g.y-o.y(),2));var v=this.findOne(".top-left").x()>g.x?-1:1,T=this.findOne(".top-left").y()>g.y?-1:1;n=a*this.cos*v,t=a*this.sin*T,this.findOne(".top-left").x(g.x-n),this.findOne(".top-left").y(g.y-t)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(E){var g=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};a=Math.sqrt(Math.pow(o.x()-g.x,2)+Math.pow(g.y-o.y(),2));var v=this.findOne(".top-right").x()<g.x?-1:1,T=this.findOne(".top-right").y()>g.y?-1:1;n=a*this.cos*v,t=a*this.sin*T,this.findOne(".top-right").x(g.x+n),this.findOne(".top-right").y(g.y-t)}var R=o.position();this.findOne(".top-left").y(R.y),this.findOne(".bottom-right").x(R.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(E){var g=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};a=Math.sqrt(Math.pow(g.x-o.x(),2)+Math.pow(o.y()-g.y,2));var v=g.x<o.x()?-1:1,T=o.y()<g.y?-1:1;n=a*this.cos*v,t=a*this.sin*T,o.x(g.x-n),o.y(g.y+t)}R=o.position(),this.findOne(".top-left").x(R.x),this.findOne(".bottom-right").y(R.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(E){var g=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};a=Math.sqrt(Math.pow(o.x()-g.x,2)+Math.pow(o.y()-g.y,2));var v=this.findOne(".bottom-right").x()<g.x?-1:1,T=this.findOne(".bottom-right").y()<g.y?-1:1;n=a*this.cos*v,t=a*this.sin*T,this.findOne(".bottom-right").x(g.x+n),this.findOne(".bottom-right").y(g.y+t)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var x=this.centeredScaling()||e.altKey;if(x){var C=this.findOne(".top-left"),w=this.findOne(".bottom-right"),P=C.x(),D=C.y(),N=this.getWidth()-w.x(),k=this.getHeight()-w.y();w.move({x:-P,y:-D}),C.move({x:N,y:k})}var F=this.findOne(".top-left").getAbsolutePosition();n=F.x,t=F.y;var M=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),U=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:n,y:t,width:M,height:U,rotation:Global_1$1.Konva.getAngle(this.rotation())},e)}}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var n=this.getNode();this._fire("transformend",{evt:e,target:n}),n&&this._nodes.forEach(t=>{t._fire("transformend",{evt:e,target:t})}),this._movingAnchorName=null}}_fitNodesInto(e,n){var t=this._getNodeRect();const a=1;if(Util_1$3.Util._inRange(e.width,-this.padding()*2-a,a)){this.update();return}if(Util_1$3.Util._inRange(e.height,-this.padding()*2-a,a)){this.update();return}var o=new Util_1$3.Transform;if(o.rotate(Global_1$1.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const b=o.point({x:-this.padding()*2,y:0});e.x+=b.x,e.y+=b.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=b.x,this._anchorDragOffset.y-=b.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const b=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=b.x,this._anchorDragOffset.y-=b.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const b=o.point({x:0,y:-this.padding()*2});e.x+=b.x,e.y+=b.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=b.x,this._anchorDragOffset.y-=b.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const b=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=b.x,this._anchorDragOffset.y-=b.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const b=this.boundBoxFunc()(t,e);b?e=b:Util_1$3.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const d=1e7,f=new Util_1$3.Transform;f.translate(t.x,t.y),f.rotate(t.rotation),f.scale(t.width/d,t.height/d);const h=new Util_1$3.Transform,u=e.width/d,p=e.height/d;this.flipEnabled()===!1?(h.translate(e.x,e.y),h.rotate(e.rotation),h.translate(e.width<0?e.width:0,e.height<0?e.height:0),h.scale(Math.abs(u),Math.abs(p))):(h.translate(e.x,e.y),h.rotate(e.rotation),h.scale(u,p));const _=h.multiply(f.invert());this._nodes.forEach(b=>{var S;const E=b.getParent().getAbsoluteTransform(),g=b.getTransform().copy();g.translate(b.offsetX(),b.offsetY());const v=new Util_1$3.Transform;v.multiply(E.copy().invert()).multiply(_).multiply(E).multiply(g);const T=v.decompose();b.setAttrs(T),this._fire("transform",{evt:n,target:b}),b._fire("transform",{evt:n,target:b}),(S=b.getLayer())===null||S===void 0||S.batchDraw()}),this.rotation(Util_1$3.Util._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e,n=this._getNodeRect();this.rotation(Util_1$3.Util._getRotation(n.rotation));var t=n.width,a=n.height,o=this.enabledAnchors(),d=this.resizeEnabled(),f=this.padding(),h=this.anchorSize();const u=this.find("._anchor");u.forEach(_=>{_.setAttrs({width:h,height:h,offsetX:h/2,offsetY:h/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:h/2+f,offsetY:h/2+f,visible:d&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:t/2,y:0,offsetY:h/2+f,visible:d&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:t,y:0,offsetX:h/2-f,offsetY:h/2+f,visible:d&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:a/2,offsetX:h/2+f,visible:d&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:t,y:a/2,offsetX:h/2-f,visible:d&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:a,offsetX:h/2+f,offsetY:h/2-f,visible:d&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:t/2,y:a,offsetY:h/2-f,visible:d&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:t,y:a,offsetX:h/2-f,offsetY:h/2-f,visible:d&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:t/2,y:-this.rotateAnchorOffset()*Util_1$3.Util._sign(a)-f,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:t,height:a,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const p=this.anchorStyleFunc();p&&u.forEach(_=>{p(_)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Group_1.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Node_1$f.Node.prototype.toObject.call(this)}clone(e){var n=Node_1$f.Node.prototype.clone.call(this,e);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}Transformer$1.Transformer=Transformer;function validateAnchors(l){return l instanceof Array||Util_1$3.Util.warn("enabledAnchors value should be an array"),l instanceof Array&&l.forEach(function(e){ANCHORS_NAMES.indexOf(e)===-1&&Util_1$3.Util.warn("Unknown anchor name: "+e+". Available names are: "+ANCHORS_NAMES.join(", "))}),l||[]}Transformer.prototype.className="Transformer";(0,Global_2$1._registerNode)(Transformer);Factory_1$g.Factory.addGetterSetter(Transformer,"enabledAnchors",ANCHORS_NAMES,validateAnchors);Factory_1$g.Factory.addGetterSetter(Transformer,"flipEnabled",!0,(0,Validators_1$g.getBooleanValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"resizeEnabled",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"anchorSize",10,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"rotateEnabled",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"rotateLineVisible",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"rotationSnaps",[]);Factory_1$g.Factory.addGetterSetter(Transformer,"rotateAnchorOffset",50,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"rotateAnchorCursor","crosshair");Factory_1$g.Factory.addGetterSetter(Transformer,"rotationSnapTolerance",5,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"borderEnabled",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"anchorStroke","rgb(0, 161, 255)");Factory_1$g.Factory.addGetterSetter(Transformer,"anchorStrokeWidth",1,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"anchorFill","white");Factory_1$g.Factory.addGetterSetter(Transformer,"anchorCornerRadius",0,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"borderStroke","rgb(0, 161, 255)");Factory_1$g.Factory.addGetterSetter(Transformer,"borderStrokeWidth",1,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"borderDash");Factory_1$g.Factory.addGetterSetter(Transformer,"keepRatio",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"shiftBehavior","default");Factory_1$g.Factory.addGetterSetter(Transformer,"centeredScaling",!1);Factory_1$g.Factory.addGetterSetter(Transformer,"ignoreStroke",!1);Factory_1$g.Factory.addGetterSetter(Transformer,"padding",0,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"node");Factory_1$g.Factory.addGetterSetter(Transformer,"nodes");Factory_1$g.Factory.addGetterSetter(Transformer,"boundBoxFunc");Factory_1$g.Factory.addGetterSetter(Transformer,"anchorDragBoundFunc");Factory_1$g.Factory.addGetterSetter(Transformer,"anchorStyleFunc");Factory_1$g.Factory.addGetterSetter(Transformer,"shouldOverdrawWholeArea",!1);Factory_1$g.Factory.addGetterSetter(Transformer,"useSingleNodeRotation",!0);Factory_1$g.Factory.backCompat(Transformer,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Wedge$1={};Object.defineProperty(Wedge$1,"__esModule",{value:!0});Wedge$1.Wedge=void 0;const Factory_1$f=Factory,Shape_1=Shape,Global_1=Global,Validators_1$f=Validators,Global_2=Global;class Wedge extends Shape_1.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Global_1.Konva.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Wedge$1.Wedge=Wedge;Wedge.prototype.className="Wedge";Wedge.prototype._centroid=!0;Wedge.prototype._attrsAffectingSize=["radius"];(0,Global_2._registerNode)(Wedge);Factory_1$f.Factory.addGetterSetter(Wedge,"radius",0,(0,Validators_1$f.getNumberValidator)());Factory_1$f.Factory.addGetterSetter(Wedge,"angle",0,(0,Validators_1$f.getNumberValidator)());Factory_1$f.Factory.addGetterSetter(Wedge,"clockwise",!1);Factory_1$f.Factory.backCompat(Wedge,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var Blur$1={};Object.defineProperty(Blur$1,"__esModule",{value:!0});Blur$1.Blur=void 0;const Factory_1$e=Factory,Node_1$e=Node$1,Validators_1$e=Validators;function BlurStack(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var mul_table=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],shg_table=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function filterGaussBlurRGBA(l,e){var n=l.data,t=l.width,a=l.height,o,d,f,h,u,p,_,b,S,E,g,v,T,R,x,C,w,P,D,N,k,F,M,U,$=e+e+1,B=t-1,J=a-1,ne=e+1,ie=ne*(ne+1)/2,Y=new BlurStack,q=null,re=Y,ce=null,fe=null,te=mul_table[e],H=shg_table[e];for(f=1;f<$;f++)re=re.next=new BlurStack,f===ne&&(q=re);for(re.next=Y,_=p=0,d=0;d<a;d++){for(C=w=P=D=b=S=E=g=0,v=ne*(N=n[p]),T=ne*(k=n[p+1]),R=ne*(F=n[p+2]),x=ne*(M=n[p+3]),b+=ie*N,S+=ie*k,E+=ie*F,g+=ie*M,re=Y,f=0;f<ne;f++)re.r=N,re.g=k,re.b=F,re.a=M,re=re.next;for(f=1;f<ne;f++)h=p+((B<f?B:f)<<2),b+=(re.r=N=n[h])*(U=ne-f),S+=(re.g=k=n[h+1])*U,E+=(re.b=F=n[h+2])*U,g+=(re.a=M=n[h+3])*U,C+=N,w+=k,P+=F,D+=M,re=re.next;for(ce=Y,fe=q,o=0;o<t;o++)n[p+3]=M=g*te>>H,M!==0?(M=255/M,n[p]=(b*te>>H)*M,n[p+1]=(S*te>>H)*M,n[p+2]=(E*te>>H)*M):n[p]=n[p+1]=n[p+2]=0,b-=v,S-=T,E-=R,g-=x,v-=ce.r,T-=ce.g,R-=ce.b,x-=ce.a,h=_+((h=o+e+1)<B?h:B)<<2,C+=ce.r=n[h],w+=ce.g=n[h+1],P+=ce.b=n[h+2],D+=ce.a=n[h+3],b+=C,S+=w,E+=P,g+=D,ce=ce.next,v+=N=fe.r,T+=k=fe.g,R+=F=fe.b,x+=M=fe.a,C-=N,w-=k,P-=F,D-=M,fe=fe.next,p+=4;_+=t}for(o=0;o<t;o++){for(w=P=D=C=S=E=g=b=0,p=o<<2,v=ne*(N=n[p]),T=ne*(k=n[p+1]),R=ne*(F=n[p+2]),x=ne*(M=n[p+3]),b+=ie*N,S+=ie*k,E+=ie*F,g+=ie*M,re=Y,f=0;f<ne;f++)re.r=N,re.g=k,re.b=F,re.a=M,re=re.next;for(u=t,f=1;f<=e;f++)p=u+o<<2,b+=(re.r=N=n[p])*(U=ne-f),S+=(re.g=k=n[p+1])*U,E+=(re.b=F=n[p+2])*U,g+=(re.a=M=n[p+3])*U,C+=N,w+=k,P+=F,D+=M,re=re.next,f<J&&(u+=t);for(p=o,ce=Y,fe=q,d=0;d<a;d++)h=p<<2,n[h+3]=M=g*te>>H,M>0?(M=255/M,n[h]=(b*te>>H)*M,n[h+1]=(S*te>>H)*M,n[h+2]=(E*te>>H)*M):n[h]=n[h+1]=n[h+2]=0,b-=v,S-=T,E-=R,g-=x,v-=ce.r,T-=ce.g,R-=ce.b,x-=ce.a,h=o+((h=d+ne)<J?h:J)*t<<2,b+=C+=ce.r=n[h],S+=w+=ce.g=n[h+1],E+=P+=ce.b=n[h+2],g+=D+=ce.a=n[h+3],ce=ce.next,v+=N=fe.r,T+=k=fe.g,R+=F=fe.b,x+=M=fe.a,C-=N,w-=k,P-=F,D-=M,fe=fe.next,p+=t}}const Blur=function l(e){var n=Math.round(this.blurRadius());n>0&&filterGaussBlurRGBA(e,n)};Blur$1.Blur=Blur;Factory_1$e.Factory.addGetterSetter(Node_1$e.Node,"blurRadius",0,(0,Validators_1$e.getNumberValidator)(),Factory_1$e.Factory.afterSetFilter);var Brighten$1={};Object.defineProperty(Brighten$1,"__esModule",{value:!0});Brighten$1.Brighten=void 0;const Factory_1$d=Factory,Node_1$d=Node$1,Validators_1$d=Validators,Brighten=function(l){var e=this.brightness()*255,n=l.data,t=n.length,a;for(a=0;a<t;a+=4)n[a]+=e,n[a+1]+=e,n[a+2]+=e};Brighten$1.Brighten=Brighten;Factory_1$d.Factory.addGetterSetter(Node_1$d.Node,"brightness",0,(0,Validators_1$d.getNumberValidator)(),Factory_1$d.Factory.afterSetFilter);var Contrast$1={};Object.defineProperty(Contrast$1,"__esModule",{value:!0});Contrast$1.Contrast=void 0;const Factory_1$c=Factory,Node_1$c=Node$1,Validators_1$c=Validators,Contrast=function(l){var e=Math.pow((this.contrast()+100)/100,2),n=l.data,t=n.length,a=150,o=150,d=150,f;for(f=0;f<t;f+=4)a=n[f],o=n[f+1],d=n[f+2],a/=255,a-=.5,a*=e,a+=.5,a*=255,o/=255,o-=.5,o*=e,o+=.5,o*=255,d/=255,d-=.5,d*=e,d+=.5,d*=255,a=a<0?0:a>255?255:a,o=o<0?0:o>255?255:o,d=d<0?0:d>255?255:d,n[f]=a,n[f+1]=o,n[f+2]=d};Contrast$1.Contrast=Contrast;Factory_1$c.Factory.addGetterSetter(Node_1$c.Node,"contrast",0,(0,Validators_1$c.getNumberValidator)(),Factory_1$c.Factory.afterSetFilter);var Emboss$1={};Object.defineProperty(Emboss$1,"__esModule",{value:!0});Emboss$1.Emboss=void 0;const Factory_1$b=Factory,Node_1$b=Node$1,Util_1$2=Util,Validators_1$b=Validators,Emboss=function(l){var e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,t=this.embossDirection(),a=this.embossBlend(),o=0,d=0,f=l.data,h=l.width,u=l.height,p=h*4,_=u;switch(t){case"top-left":o=-1,d=-1;break;case"top":o=-1,d=0;break;case"top-right":o=-1,d=1;break;case"right":o=0,d=1;break;case"bottom-right":o=1,d=1;break;case"bottom":o=1,d=0;break;case"bottom-left":o=1,d=-1;break;case"left":o=0,d=-1;break;default:Util_1$2.Util.error("Unknown emboss direction: "+t)}do{var b=(_-1)*p,S=o;_+S<1&&(S=0),_+S>u&&(S=0);var E=(_-1+S)*h*4,g=h;do{var v=b+(g-1)*4,T=d;g+T<1&&(T=0),g+T>h&&(T=0);var R=E+(g-1+T)*4,x=f[v]-f[R],C=f[v+1]-f[R+1],w=f[v+2]-f[R+2],P=x,D=P>0?P:-P,N=C>0?C:-C,k=w>0?w:-w;if(N>D&&(P=C),k>D&&(P=w),P*=e,a){var F=f[v]+P,M=f[v+1]+P,U=f[v+2]+P;f[v]=F>255?255:F<0?0:F,f[v+1]=M>255?255:M<0?0:M,f[v+2]=U>255?255:U<0?0:U}else{var $=n-P;$<0?$=0:$>255&&($=255),f[v]=f[v+1]=f[v+2]=$}}while(--g)}while(--_)};Emboss$1.Emboss=Emboss;Factory_1$b.Factory.addGetterSetter(Node_1$b.Node,"embossStrength",.5,(0,Validators_1$b.getNumberValidator)(),Factory_1$b.Factory.afterSetFilter);Factory_1$b.Factory.addGetterSetter(Node_1$b.Node,"embossWhiteLevel",.5,(0,Validators_1$b.getNumberValidator)(),Factory_1$b.Factory.afterSetFilter);Factory_1$b.Factory.addGetterSetter(Node_1$b.Node,"embossDirection","top-left",null,Factory_1$b.Factory.afterSetFilter);Factory_1$b.Factory.addGetterSetter(Node_1$b.Node,"embossBlend",!1,null,Factory_1$b.Factory.afterSetFilter);var Enhance$1={};Object.defineProperty(Enhance$1,"__esModule",{value:!0});Enhance$1.Enhance=void 0;const Factory_1$a=Factory,Node_1$a=Node$1,Validators_1$a=Validators;function remap(l,e,n,t,a){var o=n-e,d=a-t,f;return o===0?t+d/2:d===0?t:(f=(l-e)/o,f=d*f+t,f)}const Enhance=function(l){var e=l.data,n=e.length,t=e[0],a=t,o,d=e[1],f=d,h,u=e[2],p=u,_,b,S=this.enhance();if(S!==0){for(b=0;b<n;b+=4)o=e[b+0],o<t?t=o:o>a&&(a=o),h=e[b+1],h<d?d=h:h>f&&(f=h),_=e[b+2],_<u?u=_:_>p&&(p=_);a===t&&(a=255,t=0),f===d&&(f=255,d=0),p===u&&(p=255,u=0);var E,g,v,T,R,x,C,w,P;for(S>0?(g=a+S*(255-a),v=t-S*(t-0),R=f+S*(255-f),x=d-S*(d-0),w=p+S*(255-p),P=u-S*(u-0)):(E=(a+t)*.5,g=a+S*(a-E),v=t+S*(t-E),T=(f+d)*.5,R=f+S*(f-T),x=d+S*(d-T),C=(p+u)*.5,w=p+S*(p-C),P=u+S*(u-C)),b=0;b<n;b+=4)e[b+0]=remap(e[b+0],t,a,v,g),e[b+1]=remap(e[b+1],d,f,x,R),e[b+2]=remap(e[b+2],u,p,P,w)}};Enhance$1.Enhance=Enhance;Factory_1$a.Factory.addGetterSetter(Node_1$a.Node,"enhance",0,(0,Validators_1$a.getNumberValidator)(),Factory_1$a.Factory.afterSetFilter);var Grayscale$1={};Object.defineProperty(Grayscale$1,"__esModule",{value:!0});Grayscale$1.Grayscale=void 0;const Grayscale=function(l){var e=l.data,n=e.length,t,a;for(t=0;t<n;t+=4)a=.34*e[t]+.5*e[t+1]+.16*e[t+2],e[t]=a,e[t+1]=a,e[t+2]=a};Grayscale$1.Grayscale=Grayscale;var HSL$1={};Object.defineProperty(HSL$1,"__esModule",{value:!0});HSL$1.HSL=void 0;const Factory_1$9=Factory,Node_1$9=Node$1,Validators_1$9=Validators;Factory_1$9.Factory.addGetterSetter(Node_1$9.Node,"hue",0,(0,Validators_1$9.getNumberValidator)(),Factory_1$9.Factory.afterSetFilter);Factory_1$9.Factory.addGetterSetter(Node_1$9.Node,"saturation",0,(0,Validators_1$9.getNumberValidator)(),Factory_1$9.Factory.afterSetFilter);Factory_1$9.Factory.addGetterSetter(Node_1$9.Node,"luminance",0,(0,Validators_1$9.getNumberValidator)(),Factory_1$9.Factory.afterSetFilter);const HSL=function(l){var e=l.data,n=e.length,t=1,a=Math.pow(2,this.saturation()),o=Math.abs(this.hue()+360)%360,d=this.luminance()*127,f,h=t*a*Math.cos(o*Math.PI/180),u=t*a*Math.sin(o*Math.PI/180),p=.299*t+.701*h+.167*u,_=.587*t-.587*h+.33*u,b=.114*t-.114*h-.497*u,S=.299*t-.299*h-.328*u,E=.587*t+.413*h+.035*u,g=.114*t-.114*h+.293*u,v=.299*t-.3*h+1.25*u,T=.587*t-.586*h-1.05*u,R=.114*t+.886*h-.2*u,x,C,w,P;for(f=0;f<n;f+=4)x=e[f+0],C=e[f+1],w=e[f+2],P=e[f+3],e[f+0]=p*x+_*C+b*w+d,e[f+1]=S*x+E*C+g*w+d,e[f+2]=v*x+T*C+R*w+d,e[f+3]=P};HSL$1.HSL=HSL;var HSV$1={};Object.defineProperty(HSV$1,"__esModule",{value:!0});HSV$1.HSV=void 0;const Factory_1$8=Factory,Node_1$8=Node$1,Validators_1$8=Validators,HSV=function(l){var e=l.data,n=e.length,t=Math.pow(2,this.value()),a=Math.pow(2,this.saturation()),o=Math.abs(this.hue()+360)%360,d,f=t*a*Math.cos(o*Math.PI/180),h=t*a*Math.sin(o*Math.PI/180),u=.299*t+.701*f+.167*h,p=.587*t-.587*f+.33*h,_=.114*t-.114*f-.497*h,b=.299*t-.299*f-.328*h,S=.587*t+.413*f+.035*h,E=.114*t-.114*f+.293*h,g=.299*t-.3*f+1.25*h,v=.587*t-.586*f-1.05*h,T=.114*t+.886*f-.2*h,R,x,C,w;for(d=0;d<n;d+=4)R=e[d+0],x=e[d+1],C=e[d+2],w=e[d+3],e[d+0]=u*R+p*x+_*C,e[d+1]=b*R+S*x+E*C,e[d+2]=g*R+v*x+T*C,e[d+3]=w};HSV$1.HSV=HSV;Factory_1$8.Factory.addGetterSetter(Node_1$8.Node,"hue",0,(0,Validators_1$8.getNumberValidator)(),Factory_1$8.Factory.afterSetFilter);Factory_1$8.Factory.addGetterSetter(Node_1$8.Node,"saturation",0,(0,Validators_1$8.getNumberValidator)(),Factory_1$8.Factory.afterSetFilter);Factory_1$8.Factory.addGetterSetter(Node_1$8.Node,"value",0,(0,Validators_1$8.getNumberValidator)(),Factory_1$8.Factory.afterSetFilter);var Invert$1={};Object.defineProperty(Invert$1,"__esModule",{value:!0});Invert$1.Invert=void 0;const Invert=function(l){var e=l.data,n=e.length,t;for(t=0;t<n;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]};Invert$1.Invert=Invert;var Kaleidoscope$1={};Object.defineProperty(Kaleidoscope$1,"__esModule",{value:!0});Kaleidoscope$1.Kaleidoscope=void 0;const Factory_1$7=Factory,Node_1$7=Node$1,Util_1$1=Util,Validators_1$7=Validators;var ToPolar=function(l,e,n){var t=l.data,a=e.data,o=l.width,d=l.height,f=n.polarCenterX||o/2,h=n.polarCenterY||d/2,u,p,_,b=0,S=0,E=0,g=0,v,T=Math.sqrt(f*f+h*h);p=o-f,_=d-h,v=Math.sqrt(p*p+_*_),T=v>T?v:T;var R=d,x=o,C,w,P=360/x*Math.PI/180,D,N;for(w=0;w<x;w+=1)for(D=Math.sin(w*P),N=Math.cos(w*P),C=0;C<R;C+=1)p=Math.floor(f+T*C/R*N),_=Math.floor(h+T*C/R*D),u=(_*o+p)*4,b=t[u+0],S=t[u+1],E=t[u+2],g=t[u+3],u=(w+C*o)*4,a[u+0]=b,a[u+1]=S,a[u+2]=E,a[u+3]=g},FromPolar=function(l,e,n){var t=l.data,a=e.data,o=l.width,d=l.height,f=n.polarCenterX||o/2,h=n.polarCenterY||d/2,u,p,_,b,S,E=0,g=0,v=0,T=0,R,x=Math.sqrt(f*f+h*h);p=o-f,_=d-h,R=Math.sqrt(p*p+_*_),x=R>x?R:x;var C=d,w=o,P,D,N=n.polarRotation||0,k,F;for(p=0;p<o;p+=1)for(_=0;_<d;_+=1)b=p-f,S=_-h,P=Math.sqrt(b*b+S*S)*C/x,D=(Math.atan2(S,b)*180/Math.PI+360+N)%360,D=D*w/360,k=Math.floor(D),F=Math.floor(P),u=(F*o+k)*4,E=t[u+0],g=t[u+1],v=t[u+2],T=t[u+3],u=(_*o+p)*4,a[u+0]=E,a[u+1]=g,a[u+2]=v,a[u+3]=T};const Kaleidoscope=function(l){var e=l.width,n=l.height,t,a,o,d,f,h,u,p,_,b,S=Math.round(this.kaleidoscopePower()),E=Math.round(this.kaleidoscopeAngle()),g=Math.floor(e*(E%360)/360);if(!(S<1)){var v=Util_1$1.Util.createCanvasElement();v.width=e,v.height=n;var T=v.getContext("2d").getImageData(0,0,e,n);Util_1$1.Util.releaseCanvas(v),ToPolar(l,T,{polarCenterX:e/2,polarCenterY:n/2});for(var R=e/Math.pow(2,S);R<=8;)R=R*2,S-=1;R=Math.ceil(R);var x=R,C=0,w=x,P=1;for(g+R>e&&(C=x,w=0,P=-1),a=0;a<n;a+=1)for(t=C;t!==w;t+=P)o=Math.round(t+g)%e,_=(e*a+o)*4,f=T.data[_+0],h=T.data[_+1],u=T.data[_+2],p=T.data[_+3],b=(e*a+t)*4,T.data[b+0]=f,T.data[b+1]=h,T.data[b+2]=u,T.data[b+3]=p;for(a=0;a<n;a+=1)for(x=Math.floor(R),d=0;d<S;d+=1){for(t=0;t<x+1;t+=1)_=(e*a+t)*4,f=T.data[_+0],h=T.data[_+1],u=T.data[_+2],p=T.data[_+3],b=(e*a+x*2-t-1)*4,T.data[b+0]=f,T.data[b+1]=h,T.data[b+2]=u,T.data[b+3]=p;x*=2}FromPolar(T,l,{polarRotation:0})}};Kaleidoscope$1.Kaleidoscope=Kaleidoscope;Factory_1$7.Factory.addGetterSetter(Node_1$7.Node,"kaleidoscopePower",2,(0,Validators_1$7.getNumberValidator)(),Factory_1$7.Factory.afterSetFilter);Factory_1$7.Factory.addGetterSetter(Node_1$7.Node,"kaleidoscopeAngle",0,(0,Validators_1$7.getNumberValidator)(),Factory_1$7.Factory.afterSetFilter);var Mask$1={};Object.defineProperty(Mask$1,"__esModule",{value:!0});Mask$1.Mask=void 0;const Factory_1$6=Factory,Node_1$6=Node$1,Validators_1$6=Validators;function pixelAt(l,e,n){var t=(n*l.width+e)*4,a=[];return a.push(l.data[t++],l.data[t++],l.data[t++],l.data[t++]),a}function rgbDistance(l,e){return Math.sqrt(Math.pow(l[0]-e[0],2)+Math.pow(l[1]-e[1],2)+Math.pow(l[2]-e[2],2))}function rgbMean(l){for(var e=[0,0,0],n=0;n<l.length;n++)e[0]+=l[n][0],e[1]+=l[n][1],e[2]+=l[n][2];return e[0]/=l.length,e[1]/=l.length,e[2]/=l.length,e}function backgroundMask(l,e){var n=pixelAt(l,0,0),t=pixelAt(l,l.width-1,0),a=pixelAt(l,0,l.height-1),o=pixelAt(l,l.width-1,l.height-1),d=e||10;if(rgbDistance(n,t)<d&&rgbDistance(t,o)<d&&rgbDistance(o,a)<d&&rgbDistance(a,n)<d){for(var f=rgbMean([t,n,o,a]),h=[],u=0;u<l.width*l.height;u++){var p=rgbDistance(f,[l.data[u*4],l.data[u*4+1],l.data[u*4+2]]);h[u]=p<d?0:255}return h}}function applyMask(l,e){for(var n=0;n<l.width*l.height;n++)l.data[4*n+3]=e[n]}function erodeMask(l,e,n){for(var t=[1,1,1,1,0,1,1,1,1],a=Math.round(Math.sqrt(t.length)),o=Math.floor(a/2),d=[],f=0;f<n;f++)for(var h=0;h<e;h++){for(var u=f*e+h,p=0,_=0;_<a;_++)for(var b=0;b<a;b++){var S=f+_-o,E=h+b-o;if(S>=0&&S<n&&E>=0&&E<e){var g=S*e+E,v=t[_*a+b];p+=l[g]*v}}d[u]=p===255*8?255:0}return d}function dilateMask(l,e,n){for(var t=[1,1,1,1,1,1,1,1,1],a=Math.round(Math.sqrt(t.length)),o=Math.floor(a/2),d=[],f=0;f<n;f++)for(var h=0;h<e;h++){for(var u=f*e+h,p=0,_=0;_<a;_++)for(var b=0;b<a;b++){var S=f+_-o,E=h+b-o;if(S>=0&&S<n&&E>=0&&E<e){var g=S*e+E,v=t[_*a+b];p+=l[g]*v}}d[u]=p>=255*4?255:0}return d}function smoothEdgeMask(l,e,n){for(var t=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],a=Math.round(Math.sqrt(t.length)),o=Math.floor(a/2),d=[],f=0;f<n;f++)for(var h=0;h<e;h++){for(var u=f*e+h,p=0,_=0;_<a;_++)for(var b=0;b<a;b++){var S=f+_-o,E=h+b-o;if(S>=0&&S<n&&E>=0&&E<e){var g=S*e+E,v=t[_*a+b];p+=l[g]*v}}d[u]=p}return d}const Mask=function(l){var e=this.threshold(),n=backgroundMask(l,e);return n&&(n=erodeMask(n,l.width,l.height),n=dilateMask(n,l.width,l.height),n=smoothEdgeMask(n,l.width,l.height),applyMask(l,n)),l};Mask$1.Mask=Mask;Factory_1$6.Factory.addGetterSetter(Node_1$6.Node,"threshold",0,(0,Validators_1$6.getNumberValidator)(),Factory_1$6.Factory.afterSetFilter);var Noise$1={};Object.defineProperty(Noise$1,"__esModule",{value:!0});Noise$1.Noise=void 0;const Factory_1$5=Factory,Node_1$5=Node$1,Validators_1$5=Validators,Noise=function(l){var e=this.noise()*255,n=l.data,t=n.length,a=e/2,o;for(o=0;o<t;o+=4)n[o+0]+=a-2*a*Math.random(),n[o+1]+=a-2*a*Math.random(),n[o+2]+=a-2*a*Math.random()};Noise$1.Noise=Noise;Factory_1$5.Factory.addGetterSetter(Node_1$5.Node,"noise",.2,(0,Validators_1$5.getNumberValidator)(),Factory_1$5.Factory.afterSetFilter);var Pixelate$1={};Object.defineProperty(Pixelate$1,"__esModule",{value:!0});Pixelate$1.Pixelate=void 0;const Factory_1$4=Factory,Util_1=Util,Node_1$4=Node$1,Validators_1$4=Validators,Pixelate=function(l){var e=Math.ceil(this.pixelSize()),n=l.width,t=l.height,a,o,d,f,h,u,p,_=Math.ceil(n/e),b=Math.ceil(t/e),S,E,g,v,T,R,x,C=l.data;if(e<=0){Util_1.Util.error("pixelSize value can not be <= 0");return}for(T=0;T<_;T+=1)for(R=0;R<b;R+=1){for(f=0,h=0,u=0,p=0,S=T*e,E=S+e,g=R*e,v=g+e,x=0,a=S;a<E;a+=1)if(!(a>=n))for(o=g;o<v;o+=1)o>=t||(d=(n*o+a)*4,f+=C[d+0],h+=C[d+1],u+=C[d+2],p+=C[d+3],x+=1);for(f=f/x,h=h/x,u=u/x,p=p/x,a=S;a<E;a+=1)if(!(a>=n))for(o=g;o<v;o+=1)o>=t||(d=(n*o+a)*4,C[d+0]=f,C[d+1]=h,C[d+2]=u,C[d+3]=p)}};Pixelate$1.Pixelate=Pixelate;Factory_1$4.Factory.addGetterSetter(Node_1$4.Node,"pixelSize",8,(0,Validators_1$4.getNumberValidator)(),Factory_1$4.Factory.afterSetFilter);var Posterize$1={};Object.defineProperty(Posterize$1,"__esModule",{value:!0});Posterize$1.Posterize=void 0;const Factory_1$3=Factory,Node_1$3=Node$1,Validators_1$3=Validators,Posterize=function(l){var e=Math.round(this.levels()*254)+1,n=l.data,t=n.length,a=255/e,o;for(o=0;o<t;o+=1)n[o]=Math.floor(n[o]/a)*a};Posterize$1.Posterize=Posterize;Factory_1$3.Factory.addGetterSetter(Node_1$3.Node,"levels",.5,(0,Validators_1$3.getNumberValidator)(),Factory_1$3.Factory.afterSetFilter);var RGB$1={};Object.defineProperty(RGB$1,"__esModule",{value:!0});RGB$1.RGB=void 0;const Factory_1$2=Factory,Node_1$2=Node$1,Validators_1$2=Validators,RGB=function(l){var e=l.data,n=e.length,t=this.red(),a=this.green(),o=this.blue(),d,f;for(d=0;d<n;d+=4)f=(.34*e[d]+.5*e[d+1]+.16*e[d+2])/255,e[d]=f*t,e[d+1]=f*a,e[d+2]=f*o,e[d+3]=e[d+3]};RGB$1.RGB=RGB;Factory_1$2.Factory.addGetterSetter(Node_1$2.Node,"red",0,function(l){return this._filterUpToDate=!1,l>255?255:l<0?0:Math.round(l)});Factory_1$2.Factory.addGetterSetter(Node_1$2.Node,"green",0,function(l){return this._filterUpToDate=!1,l>255?255:l<0?0:Math.round(l)});Factory_1$2.Factory.addGetterSetter(Node_1$2.Node,"blue",0,Validators_1$2.RGBComponent,Factory_1$2.Factory.afterSetFilter);var RGBA$1={};Object.defineProperty(RGBA$1,"__esModule",{value:!0});RGBA$1.RGBA=void 0;const Factory_1$1=Factory,Node_1$1=Node$1,Validators_1$1=Validators,RGBA=function(l){var e=l.data,n=e.length,t=this.red(),a=this.green(),o=this.blue(),d=this.alpha(),f,h;for(f=0;f<n;f+=4)h=1-d,e[f]=t*d+e[f]*h,e[f+1]=a*d+e[f+1]*h,e[f+2]=o*d+e[f+2]*h};RGBA$1.RGBA=RGBA;Factory_1$1.Factory.addGetterSetter(Node_1$1.Node,"red",0,function(l){return this._filterUpToDate=!1,l>255?255:l<0?0:Math.round(l)});Factory_1$1.Factory.addGetterSetter(Node_1$1.Node,"green",0,function(l){return this._filterUpToDate=!1,l>255?255:l<0?0:Math.round(l)});Factory_1$1.Factory.addGetterSetter(Node_1$1.Node,"blue",0,Validators_1$1.RGBComponent,Factory_1$1.Factory.afterSetFilter);Factory_1$1.Factory.addGetterSetter(Node_1$1.Node,"alpha",1,function(l){return this._filterUpToDate=!1,l>1?1:l<0?0:l});var Sepia$1={};Object.defineProperty(Sepia$1,"__esModule",{value:!0});Sepia$1.Sepia=void 0;const Sepia=function(l){var e=l.data,n=e.length,t,a,o,d;for(t=0;t<n;t+=4)a=e[t+0],o=e[t+1],d=e[t+2],e[t+0]=Math.min(255,a*.393+o*.769+d*.189),e[t+1]=Math.min(255,a*.349+o*.686+d*.168),e[t+2]=Math.min(255,a*.272+o*.534+d*.131)};Sepia$1.Sepia=Sepia;var Solarize$1={};Object.defineProperty(Solarize$1,"__esModule",{value:!0});Solarize$1.Solarize=void 0;const Solarize=function(l){var e=l.data,n=l.width,t=l.height,a=n*4,o=t;do{var d=(o-1)*a,f=n;do{var h=d+(f-1)*4,u=e[h],p=e[h+1],_=e[h+2];u>127&&(u=255-u),p>127&&(p=255-p),_>127&&(_=255-_),e[h]=u,e[h+1]=p,e[h+2]=_}while(--f)}while(--o)};Solarize$1.Solarize=Solarize;var Threshold$1={};Object.defineProperty(Threshold$1,"__esModule",{value:!0});Threshold$1.Threshold=void 0;const Factory_1=Factory,Node_1=Node$1,Validators_1=Validators,Threshold=function(l){var e=this.threshold()*255,n=l.data,t=n.length,a;for(a=0;a<t;a+=1)n[a]=n[a]<e?0:255};Threshold$1.Threshold=Threshold;Factory_1.Factory.addGetterSetter(Node_1.Node,"threshold",.5,(0,Validators_1.getNumberValidator)(),Factory_1.Factory.afterSetFilter);Object.defineProperty(_FullInternals,"__esModule",{value:!0});_FullInternals.Konva=void 0;const _CoreInternals_1=_CoreInternals,Arc_1=Arc$1,Arrow_1=Arrow$1,Circle_1=Circle$1,Ellipse_1=Ellipse$1,Image_1=Image$4,Label_1=Label$1,Line_1=Line$2,Path_1=Path$1,Rect_1=Rect$2,RegularPolygon_1=RegularPolygon$1,Ring_1=Ring$1,Sprite_1=Sprite$1,Star_1=Star$1,Text_1=Text$2,TextPath_1=TextPath$1,Transformer_1=Transformer$1,Wedge_1=Wedge$1,Blur_1=Blur$1,Brighten_1=Brighten$1,Contrast_1=Contrast$1,Emboss_1=Emboss$1,Enhance_1=Enhance$1,Grayscale_1=Grayscale$1,HSL_1=HSL$1,HSV_1=HSV$1,Invert_1=Invert$1,Kaleidoscope_1=Kaleidoscope$1,Mask_1=Mask$1,Noise_1=Noise$1,Pixelate_1=Pixelate$1,Posterize_1=Posterize$1,RGB_1=RGB$1,RGBA_1=RGBA$1,Sepia_1=Sepia$1,Solarize_1=Solarize$1,Threshold_1=Threshold$1;_FullInternals.Konva=_CoreInternals_1.Konva.Util._assign(_CoreInternals_1.Konva,{Arc:Arc_1.Arc,Arrow:Arrow_1.Arrow,Circle:Circle_1.Circle,Ellipse:Ellipse_1.Ellipse,Image:Image_1.Image,Label:Label_1.Label,Tag:Label_1.Tag,Line:Line_1.Line,Path:Path_1.Path,Rect:Rect_1.Rect,RegularPolygon:RegularPolygon_1.RegularPolygon,Ring:Ring_1.Ring,Sprite:Sprite_1.Sprite,Star:Star_1.Star,Text:Text_1.Text,TextPath:TextPath_1.TextPath,Transformer:Transformer_1.Transformer,Wedge:Wedge_1.Wedge,Filters:{Blur:Blur_1.Blur,Brighten:Brighten_1.Brighten,Contrast:Contrast_1.Contrast,Emboss:Emboss_1.Emboss,Enhance:Enhance_1.Enhance,Grayscale:Grayscale_1.Grayscale,HSL:HSL_1.HSL,HSV:HSV_1.HSV,Invert:Invert_1.Invert,Kaleidoscope:Kaleidoscope_1.Kaleidoscope,Mask:Mask_1.Mask,Noise:Noise_1.Noise,Pixelate:Pixelate_1.Pixelate,Posterize:Posterize_1.Posterize,RGB:RGB_1.RGB,RGBA:RGBA_1.RGBA,Sepia:Sepia_1.Sepia,Solarize:Solarize_1.Solarize,Threshold:Threshold_1.Threshold}});var lib=lib$1.exports;Object.defineProperty(lib,"__esModule",{value:!0});const _FullInternals_1=_FullInternals;lib$1.exports=_FullInternals_1.Konva;var Core={exports:{}};(function(l,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Konva=void 0;var n=_CoreInternals;Object.defineProperty(e,"Konva",{enumerable:!0,get:function(){return n.Konva}});const t=_CoreInternals;l.exports=t.Konva})(Core,Core.exports);var CoreExports=Core.exports;const Konva=getDefaultExportFromCjs(CoreExports);var reactReconciler={exports:{}},scheduler={exports:{}},scheduler_production_min={};/**
73
73
  * @license React
74
74
  * scheduler.production.min.js
@@ -258,7 +258,7 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
258
258
  * Subject to the terms at https://gsap.com/standard-license or for
259
259
  * Club GSAP members, the agreement issued with that membership.
260
260
  * @author: Jack Doyle, jack@greensock.com
261
- */var _config={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},_defaults={duration:.5,overwrite:!1,delay:0},_suppressOverwrites,_reverting$1,_context,_bigNum$1=1e8,_tinyNum=1/_bigNum$1,_2PI=Math.PI*2,_HALF_PI=_2PI/4,_gsID=0,_sqrt=Math.sqrt,_cos=Math.cos,_sin=Math.sin,_isString=function l(e){return typeof e=="string"},_isFunction=function l(e){return typeof e=="function"},_isNumber=function l(e){return typeof e=="number"},_isUndefined=function l(e){return typeof e>"u"},_isObject=function l(e){return typeof e=="object"},_isNotFalse=function l(e){return e!==!1},_windowExists$1=function l(){return typeof window<"u"},_isFuncOrString=function l(e){return _isFunction(e)||_isString(e)},_isTypedArray=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},_isArray=Array.isArray,_strictNumExp=/(?:-?\.?\d|\.)+/gi,_numExp=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,_numWithUnitExp=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,_complexStringNumExp=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,_relExp=/[+-]=-?[.\d]+/,_delimitedValueExp=/[^,'"\[\]\s]+/gi,_unitExp=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,_globalTimeline,_win$1,_coreInitted,_doc$1,_globals={},_installScope={},_coreReady,_install=function l(e){return(_installScope=_merge(e,_globals))&&gsap},_missingPlugin=function l(e,n){return console.warn("Invalid property",e,"set to",n,"Missing plugin? gsap.registerPlugin()")},_warn=function l(e,n){return!n&&console.warn(e)},_addGlobal=function l(e,n){return e&&(_globals[e]=n)&&_installScope&&(_installScope[e]=n)||_globals},_emptyFunc=function l(){return 0},_startAtRevertConfig={suppressEvents:!0,isStart:!0,kill:!1},_revertConfigNoKill={suppressEvents:!0,kill:!1},_revertConfig={suppressEvents:!0},_reservedProps={},_lazyTweens=[],_lazyLookup={},_lastRenderedFrame,_plugins={},_effects={},_nextGCFrame=30,_harnessPlugins=[],_callbackNames="",_harness=function l(e){var n=e[0],t,a;if(_isObject(n)||_isFunction(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(a=_harnessPlugins.length;a--&&!_harnessPlugins[a].targetTest(n););t=_harnessPlugins[a]}for(a=e.length;a--;)e[a]&&(e[a]._gsap||(e[a]._gsap=new GSCache(e[a],t)))||e.splice(a,1);return e},_getCache=function l(e){return e._gsap||_harness(toArray(e))[0]._gsap},_getProperty=function l(e,n,t){return(t=e[n])&&_isFunction(t)?e[n]():_isUndefined(t)&&e.getAttribute&&e.getAttribute(n)||t},_forEachName=function l(e,n){return(e=e.split(",")).forEach(n)||e},_round=function l(e){return Math.round(e*1e5)/1e5||0},_roundPrecise=function l(e){return Math.round(e*1e7)/1e7||0},_parseRelative=function l(e,n){var t=n.charAt(0),a=parseFloat(n.substr(2));return e=parseFloat(e),t==="+"?e+a:t==="-"?e-a:t==="*"?e*a:e/a},_arrayContainsAny=function l(e,n){for(var t=n.length,a=0;e.indexOf(n[a])<0&&++a<t;);return a<t},_lazyRender=function l(){var e=_lazyTweens.length,n=_lazyTweens.slice(0),t,a;for(_lazyLookup={},_lazyTweens.length=0,t=0;t<e;t++)a=n[t],a&&a._lazy&&(a.render(a._lazy[0],a._lazy[1],!0)._lazy=0)},_lazySafeRender=function l(e,n,t,a){_lazyTweens.length&&!_reverting$1&&_lazyRender(),e.render(n,t,a||_reverting$1&&n<0&&(e._initted||e._startAt)),_lazyTweens.length&&!_reverting$1&&_lazyRender()},_numericIfPossible=function l(e){var n=parseFloat(e);return(n||n===0)&&(e+"").match(_delimitedValueExp).length<2?n:_isString(e)?e.trim():e},_passThrough=function l(e){return e},_setDefaults=function l(e,n){for(var t in n)t in e||(e[t]=n[t]);return e},_setKeyframeDefaults=function l(e){return function(n,t){for(var a in t)a in n||a==="duration"&&e||a==="ease"||(n[a]=t[a])}},_merge=function l(e,n){for(var t in n)e[t]=n[t];return e},_mergeDeep=function l(e,n){for(var t in n)t!=="__proto__"&&t!=="constructor"&&t!=="prototype"&&(e[t]=_isObject(n[t])?l(e[t]||(e[t]={}),n[t]):n[t]);return e},_copyExcluding=function l(e,n){var t={},a;for(a in e)a in n||(t[a]=e[a]);return t},_inheritDefaults=function l(e){var n=e.parent||_globalTimeline,t=e.keyframes?_setKeyframeDefaults(_isArray(e.keyframes)):_setDefaults;if(_isNotFalse(e.inherit))for(;n;)t(e,n.vars.defaults),n=n.parent||n._dp;return e},_arraysMatch=function l(e,n){for(var t=e.length,a=t===n.length;a&&t--&&e[t]===n[t];);return t<0},_addLinkedListItem=function l(e,n,t,a,o){t===void 0&&(t="_first"),a===void 0&&(a="_last");var d=e[a],f;if(o)for(f=n[o];d&&d[o]>f;)d=d._prev;return d?(n._next=d._next,d._next=n):(n._next=e[t],e[t]=n),n._next?n._next._prev=n:e[a]=n,n._prev=d,n.parent=n._dp=e,n},_removeLinkedListItem=function l(e,n,t,a){t===void 0&&(t="_first"),a===void 0&&(a="_last");var o=n._prev,d=n._next;o?o._next=d:e[t]===n&&(e[t]=d),d?d._prev=o:e[a]===n&&(e[a]=o),n._next=n._prev=n.parent=null},_removeFromParent=function l(e,n){e.parent&&(!n||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},_uncache=function l(e,n){if(e&&(!n||n._end>e._dur||n._start<0))for(var t=e;t;)t._dirty=1,t=t.parent;return e},_recacheAncestors=function l(e){for(var n=e.parent;n&&n.parent;)n._dirty=1,n.totalDuration(),n=n.parent;return e},_rewindStartAt=function l(e,n,t,a){return e._startAt&&(_reverting$1?e._startAt.revert(_revertConfigNoKill):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(n,!0,a))},_hasNoPausedAncestors=function l(e){return!e||e._ts&&l(e.parent)},_elapsedCycleDuration=function l(e){return e._repeat?_animationCycle(e._tTime,e=e.duration()+e._rDelay)*e:0},_animationCycle=function l(e,n){var t=Math.floor(e/=n);return e&&t===e?t-1:t},_parentToChildTotalTime=function l(e,n){return(e-n._start)*n._ts+(n._ts>=0?0:n._dirty?n.totalDuration():n._tDur)},_setEnd=function l(e){return e._end=_roundPrecise(e._start+(e._tDur/Math.abs(e._ts||e._rts||_tinyNum)||0))},_alignPlayhead=function l(e,n){var t=e._dp;return t&&t.smoothChildTiming&&e._ts&&(e._start=_roundPrecise(t._time-(e._ts>0?n/e._ts:((e._dirty?e.totalDuration():e._tDur)-n)/-e._ts)),_setEnd(e),t._dirty||_uncache(t,e)),e},_postAddChecks=function l(e,n){var t;if((n._time||!n._dur&&n._initted||n._start<e._time&&(n._dur||!n.add))&&(t=_parentToChildTotalTime(e.rawTime(),n),(!n._dur||_clamp(0,n.totalDuration(),t)-n._tTime>_tinyNum)&&n.render(t,!0)),_uncache(e,n)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(t=e;t._dp;)t.rawTime()>=0&&t.totalTime(t._tTime),t=t._dp;e._zTime=-_tinyNum}},_addToTimeline=function l(e,n,t,a){return n.parent&&_removeFromParent(n),n._start=_roundPrecise((_isNumber(t)?t:t||e!==_globalTimeline?_parsePosition(e,t,n):e._time)+n._delay),n._end=_roundPrecise(n._start+(n.totalDuration()/Math.abs(n.timeScale())||0)),_addLinkedListItem(e,n,"_first","_last",e._sort?"_start":0),_isFromOrFromStart(n)||(e._recent=n),a||_postAddChecks(e,n),e._ts<0&&_alignPlayhead(e,e._tTime),e},_scrollTrigger=function l(e,n){return(_globals.ScrollTrigger||_missingPlugin("scrollTrigger",n))&&_globals.ScrollTrigger.create(n,e)},_attemptInitTween=function l(e,n,t,a,o){if(_initTween(e,n,o),!e._initted)return 1;if(!t&&e._pt&&!_reverting$1&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&_lastRenderedFrame!==_ticker.frame)return _lazyTweens.push(e),e._lazy=[o,a],1},_parentPlayheadIsBeforeStart=function l(e){var n=e.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||l(n))},_isFromOrFromStart=function l(e){var n=e.data;return n==="isFromStart"||n==="isStart"},_renderZeroDurationTween=function l(e,n,t,a){var o=e.ratio,d=n<0||!n&&(!e._start&&_parentPlayheadIsBeforeStart(e)&&!(!e._initted&&_isFromOrFromStart(e))||(e._ts<0||e._dp._ts<0)&&!_isFromOrFromStart(e))?0:1,f=e._rDelay,h=0,u,p,_;if(f&&e._repeat&&(h=_clamp(0,e._tDur,n),p=_animationCycle(h,f),e._yoyo&&p&1&&(d=1-d),p!==_animationCycle(e._tTime,f)&&(o=1-d,e.vars.repeatRefresh&&e._initted&&e.invalidate())),d!==o||_reverting$1||a||e._zTime===_tinyNum||!n&&e._zTime){if(!e._initted&&_attemptInitTween(e,n,a,t,h))return;for(_=e._zTime,e._zTime=n||(t?_tinyNum:0),t||(t=n&&!_),e.ratio=d,e._from&&(d=1-d),e._time=0,e._tTime=h,u=e._pt;u;)u.r(d,u.d),u=u._next;n<0&&_rewindStartAt(e,n,t,!0),e._onUpdate&&!t&&_callback(e,"onUpdate"),h&&e._repeat&&!t&&e.parent&&_callback(e,"onRepeat"),(n>=e._tDur||n<0)&&e.ratio===d&&(d&&_removeFromParent(e,1),!t&&!_reverting$1&&(_callback(e,d?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=n)},_findNextPauseTween=function l(e,n,t){var a;if(t>n)for(a=e._first;a&&a._start<=t;){if(a.data==="isPause"&&a._start>n)return a;a=a._next}else for(a=e._last;a&&a._start>=t;){if(a.data==="isPause"&&a._start<n)return a;a=a._prev}},_setDuration=function l(e,n,t,a){var o=e._repeat,d=_roundPrecise(n)||0,f=e._tTime/e._tDur;return f&&!a&&(e._time*=d/e._dur),e._dur=d,e._tDur=o?o<0?1e10:_roundPrecise(d*(o+1)+e._rDelay*o):d,f>0&&!a&&_alignPlayhead(e,e._tTime=e._tDur*f),e.parent&&_setEnd(e),t||_uncache(e.parent,e),e},_onUpdateTotalDuration=function l(e){return e instanceof Timeline?_uncache(e):_setDuration(e,e._dur)},_zeroPosition={_start:0,endTime:_emptyFunc,totalDuration:_emptyFunc},_parsePosition=function l(e,n,t){var a=e.labels,o=e._recent||_zeroPosition,d=e.duration()>=_bigNum$1?o.endTime(!1):e._dur,f,h,u;return _isString(n)&&(isNaN(n)||n in a)?(h=n.charAt(0),u=n.substr(-1)==="%",f=n.indexOf("="),h==="<"||h===">"?(f>=0&&(n=n.replace(/=/,"")),(h==="<"?o._start:o.endTime(o._repeat>=0))+(parseFloat(n.substr(1))||0)*(u?(f<0?o:t).totalDuration()/100:1)):f<0?(n in a||(a[n]=d),a[n]):(h=parseFloat(n.charAt(f-1)+n.substr(f+1)),u&&t&&(h=h/100*(_isArray(t)?t[0]:t).totalDuration()),f>1?l(e,n.substr(0,f-1),t)+h:d+h)):n==null?d:+n},_createTweenType=function l(e,n,t){var a=_isNumber(n[1]),o=(a?2:1)+(e<2?0:1),d=n[o],f,h;if(a&&(d.duration=n[1]),d.parent=t,e){for(f=d,h=t;h&&!("immediateRender"in f);)f=h.vars.defaults||{},h=_isNotFalse(h.vars.inherit)&&h.parent;d.immediateRender=_isNotFalse(f.immediateRender),e<2?d.runBackwards=1:d.startAt=n[o-1]}return new Tween(n[0],d,n[o+1])},_conditionalReturn=function l(e,n){return e||e===0?n(e):n},_clamp=function l(e,n,t){return t<e?e:t>n?n:t},getUnit=function l(e,n){return!_isString(e)||!(n=_unitExp.exec(e))?"":n[1]},clamp=function l(e,n,t){return _conditionalReturn(t,function(a){return _clamp(e,n,a)})},_slice=[].slice,_isArrayLike=function l(e,n){return e&&_isObject(e)&&"length"in e&&(!n&&!e.length||e.length-1 in e&&_isObject(e[0]))&&!e.nodeType&&e!==_win$1},_flatten=function l(e,n,t){return t===void 0&&(t=[]),e.forEach(function(a){var o;return _isString(a)&&!n||_isArrayLike(a,1)?(o=t).push.apply(o,toArray(a)):t.push(a)})||t},toArray=function l(e,n,t){return _context&&!n&&_context.selector?_context.selector(e):_isString(e)&&!t&&(_coreInitted||!_wake())?_slice.call((n||_doc$1).querySelectorAll(e),0):_isArray(e)?_flatten(e,t):_isArrayLike(e)?_slice.call(e,0):e?[e]:[]},selector=function l(e){return e=toArray(e)[0]||_warn("Invalid scope")||{},function(n){var t=e.current||e.nativeElement||e;return toArray(n,t.querySelectorAll?t:t===e?_warn("Invalid scope")||_doc$1.createElement("div"):e)}},shuffle=function l(e){return e.sort(function(){return .5-Math.random()})},distribute=function l(e){if(_isFunction(e))return e;var n=_isObject(e)?e:{each:e},t=_parseEase(n.ease),a=n.from||0,o=parseFloat(n.base)||0,d={},f=a>0&&a<1,h=isNaN(a)||f,u=n.axis,p=a,_=a;return _isString(a)?p=_={center:.5,edges:.5,end:1}[a]||0:!f&&h&&(p=a[0],_=a[1]),function(b,S,E){var g=(E||n).length,v=d[g],T,R,x,C,w,P,D,N,k;if(!v){if(k=n.grid==="auto"?0:(n.grid||[1,_bigNum$1])[1],!k){for(D=-_bigNum$1;D<(D=E[k++].getBoundingClientRect().left)&&k<g;);k<g&&k--}for(v=d[g]=[],T=h?Math.min(k,g)*p-.5:a%k,R=k===_bigNum$1?0:h?g*_/k-.5:a/k|0,D=0,N=_bigNum$1,P=0;P<g;P++)x=P%k-T,C=R-(P/k|0),v[P]=w=u?Math.abs(u==="y"?C:x):_sqrt(x*x+C*C),w>D&&(D=w),w<N&&(N=w);a==="random"&&shuffle(v),v.max=D-N,v.min=N,v.v=g=(parseFloat(n.amount)||parseFloat(n.each)*(k>g?g-1:u?u==="y"?g/k:k:Math.max(k,g/k))||0)*(a==="edges"?-1:1),v.b=g<0?o-g:o,v.u=getUnit(n.amount||n.each)||0,t=t&&g<0?_invertEase(t):t}return g=(v[b]-v.min)/v.max||0,_roundPrecise(v.b+(t?t(g):g)*v.v)+v.u}},_roundModifier=function l(e){var n=Math.pow(10,((e+"").split(".")[1]||"").length);return function(t){var a=_roundPrecise(Math.round(parseFloat(t)/e)*e*n);return(a-a%1)/n+(_isNumber(t)?0:getUnit(t))}},snap=function l(e,n){var t=_isArray(e),a,o;return!t&&_isObject(e)&&(a=t=e.radius||_bigNum$1,e.values?(e=toArray(e.values),(o=!_isNumber(e[0]))&&(a*=a)):e=_roundModifier(e.increment)),_conditionalReturn(n,t?_isFunction(e)?function(d){return o=e(d),Math.abs(o-d)<=a?o:d}:function(d){for(var f=parseFloat(o?d.x:d),h=parseFloat(o?d.y:0),u=_bigNum$1,p=0,_=e.length,b,S;_--;)o?(b=e[_].x-f,S=e[_].y-h,b=b*b+S*S):b=Math.abs(e[_]-f),b<u&&(u=b,p=_);return p=!a||u<=a?e[p]:d,o||p===d||_isNumber(d)?p:p+getUnit(d)}:_roundModifier(e))},random=function l(e,n,t,a){return _conditionalReturn(_isArray(e)?!n:t===!0?!!(t=0):!a,function(){return _isArray(e)?e[~~(Math.random()*e.length)]:(t=t||1e-5)&&(a=t<1?Math.pow(10,(t+"").length-2):1)&&Math.floor(Math.round((e-t/2+Math.random()*(n-e+t*.99))/t)*t*a)/a})},pipe=function l(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return function(a){return n.reduce(function(o,d){return d(o)},a)}},unitize=function l(e,n){return function(t){return e(parseFloat(t))+(n||getUnit(t))}},normalize=function l(e,n,t){return mapRange(e,n,0,1,t)},_wrapArray=function l(e,n,t){return _conditionalReturn(t,function(a){return e[~~n(a)]})},wrap=function l(e,n,t){var a=n-e;return _isArray(e)?_wrapArray(e,l(0,e.length),n):_conditionalReturn(t,function(o){return(a+(o-e)%a)%a+e})},wrapYoyo=function l(e,n,t){var a=n-e,o=a*2;return _isArray(e)?_wrapArray(e,l(0,e.length-1),n):_conditionalReturn(t,function(d){return d=(o+(d-e)%o)%o||0,e+(d>a?o-d:d)})},_replaceRandom=function l(e){for(var n=0,t="",a,o,d,f;~(a=e.indexOf("random(",n));)d=e.indexOf(")",a),f=e.charAt(a+7)==="[",o=e.substr(a+7,d-a-7).match(f?_delimitedValueExp:_strictNumExp),t+=e.substr(n,a-n)+random(f?o:+o[0],f?0:+o[1],+o[2]||1e-5),n=d+1;return t+e.substr(n,e.length-n)},mapRange=function l(e,n,t,a,o){var d=n-e,f=a-t;return _conditionalReturn(o,function(h){return t+((h-e)/d*f||0)})},interpolate=function l(e,n,t,a){var o=isNaN(e+n)?0:function(S){return(1-S)*e+S*n};if(!o){var d=_isString(e),f={},h,u,p,_,b;if(t===!0&&(a=1)&&(t=null),d)e={p:e},n={p:n};else if(_isArray(e)&&!_isArray(n)){for(p=[],_=e.length,b=_-2,u=1;u<_;u++)p.push(l(e[u-1],e[u]));_--,o=function(E){E*=_;var g=Math.min(b,~~E);return p[g](E-g)},t=n}else a||(e=_merge(_isArray(e)?[]:{},e));if(!p){for(h in n)_addPropTween.call(f,e,h,"get",n[h]);o=function(E){return _renderPropTweens(E,f)||(d?e.p:e)}}}return _conditionalReturn(t,o)},_getLabelInDirection=function l(e,n,t){var a=e.labels,o=_bigNum$1,d,f,h;for(d in a)f=a[d]-n,f<0==!!t&&f&&o>(f=Math.abs(f))&&(h=d,o=f);return h},_callback=function l(e,n,t){var a=e.vars,o=a[n],d=_context,f=e._ctx,h,u,p;if(o)return h=a[n+"Params"],u=a.callbackScope||e,t&&_lazyTweens.length&&_lazyRender(),f&&(_context=f),p=h?o.apply(u,h):o.call(u),_context=d,p},_interrupt=function l(e){return _removeFromParent(e),e.scrollTrigger&&e.scrollTrigger.kill(!!_reverting$1),e.progress()<1&&_callback(e,"onInterrupt"),e},_quickTween,_registerPluginQueue=[],_createPlugin=function l(e){if(_windowExists$1()&&e){e=!e.name&&e.default||e;var n=e.name,t=_isFunction(e),a=n&&!t&&e.init?function(){this._props=[]}:e,o={init:_emptyFunc,render:_renderPropTweens,add:_addPropTween,kill:_killPropTweensOf,modifier:_addPluginModifier,rawVars:0},d={targetTest:0,get:0,getSetter:_getSetter,aliases:{},register:0};if(_wake(),e!==a){if(_plugins[n])return;_setDefaults(a,_setDefaults(_copyExcluding(e,o),d)),_merge(a.prototype,_merge(o,_copyExcluding(e,d))),_plugins[a.prop=n]=a,e.targetTest&&(_harnessPlugins.push(a),_reservedProps[n]=1),n=(n==="css"?"CSS":n.charAt(0).toUpperCase()+n.substr(1))+"Plugin"}_addGlobal(n,a),e.register&&e.register(gsap,a,PropTween)}else e&&_registerPluginQueue.push(e)},_255=255,_colorLookup={aqua:[0,_255,_255],lime:[0,_255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,_255],navy:[0,0,128],white:[_255,_255,_255],olive:[128,128,0],yellow:[_255,_255,0],orange:[_255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[_255,0,0],pink:[_255,192,203],cyan:[0,_255,_255],transparent:[_255,_255,_255,0]},_hue=function l(e,n,t){return e+=e<0?1:e>1?-1:0,(e*6<1?n+(t-n)*e*6:e<.5?t:e*3<2?n+(t-n)*(2/3-e)*6:n)*_255+.5|0},splitColor=function l(e,n,t){var a=e?_isNumber(e)?[e>>16,e>>8&_255,e&_255]:0:_colorLookup.black,o,d,f,h,u,p,_,b,S,E;if(!a){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),_colorLookup[e])a=_colorLookup[e];else if(e.charAt(0)==="#"){if(e.length<6&&(o=e.charAt(1),d=e.charAt(2),f=e.charAt(3),e="#"+o+o+d+d+f+f+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return a=parseInt(e.substr(1,6),16),[a>>16,a>>8&_255,a&_255,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),a=[e>>16,e>>8&_255,e&_255]}else if(e.substr(0,3)==="hsl"){if(a=E=e.match(_strictNumExp),!n)h=+a[0]%360/360,u=+a[1]/100,p=+a[2]/100,d=p<=.5?p*(u+1):p+u-p*u,o=p*2-d,a.length>3&&(a[3]*=1),a[0]=_hue(h+1/3,o,d),a[1]=_hue(h,o,d),a[2]=_hue(h-1/3,o,d);else if(~e.indexOf("="))return a=e.match(_numExp),t&&a.length<4&&(a[3]=1),a}else a=e.match(_strictNumExp)||_colorLookup.transparent;a=a.map(Number)}return n&&!E&&(o=a[0]/_255,d=a[1]/_255,f=a[2]/_255,_=Math.max(o,d,f),b=Math.min(o,d,f),p=(_+b)/2,_===b?h=u=0:(S=_-b,u=p>.5?S/(2-_-b):S/(_+b),h=_===o?(d-f)/S+(d<f?6:0):_===d?(f-o)/S+2:(o-d)/S+4,h*=60),a[0]=~~(h+.5),a[1]=~~(u*100+.5),a[2]=~~(p*100+.5)),t&&a.length<4&&(a[3]=1),a},_colorOrderData=function l(e){var n=[],t=[],a=-1;return e.split(_colorExp).forEach(function(o){var d=o.match(_numWithUnitExp)||[];n.push.apply(n,d),t.push(a+=d.length+1)}),n.c=t,n},_formatColors=function l(e,n,t){var a="",o=(e+a).match(_colorExp),d=n?"hsla(":"rgba(",f=0,h,u,p,_;if(!o)return e;if(o=o.map(function(b){return(b=splitColor(b,n,1))&&d+(n?b[0]+","+b[1]+"%,"+b[2]+"%,"+b[3]:b.join(","))+")"}),t&&(p=_colorOrderData(e),h=t.c,h.join(a)!==p.c.join(a)))for(u=e.replace(_colorExp,"1").split(_numWithUnitExp),_=u.length-1;f<_;f++)a+=u[f]+(~h.indexOf(f)?o.shift()||d+"0,0,0,0)":(p.length?p:o.length?o:t).shift());if(!u)for(u=e.split(_colorExp),_=u.length-1;f<_;f++)a+=u[f]+o[f];return a+u[_]},_colorExp=function(){var l="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",e;for(e in _colorLookup)l+="|"+e+"\\b";return new RegExp(l+")","gi")}(),_hslExp=/hsl[a]?\(/,_colorStringFilter=function l(e){var n=e.join(" "),t;if(_colorExp.lastIndex=0,_colorExp.test(n))return t=_hslExp.test(n),e[1]=_formatColors(e[1],t),e[0]=_formatColors(e[0],t,_colorOrderData(e[1])),!0},_tickerActive,_ticker=function(){var l=Date.now,e=500,n=33,t=l(),a=t,o=1e3/240,d=o,f=[],h,u,p,_,b,S,E=function g(v){var T=l()-a,R=v===!0,x,C,w,P;if(T>e&&(t+=T-n),a+=T,w=a-t,x=w-d,(x>0||R)&&(P=++_.frame,b=w-_.time*1e3,_.time=w=w/1e3,d+=x+(x>=o?4:o-x),C=1),R||(h=u(g)),C)for(S=0;S<f.length;S++)f[S](w,b,P,v)};return _={time:0,frame:0,tick:function(){E(!0)},deltaRatio:function(v){return b/(1e3/(v||60))},wake:function(){_coreReady&&(!_coreInitted&&_windowExists$1()&&(_win$1=_coreInitted=window,_doc$1=_win$1.document||{},_globals.gsap=gsap,(_win$1.gsapVersions||(_win$1.gsapVersions=[])).push(gsap.version),_install(_installScope||_win$1.GreenSockGlobals||!_win$1.gsap&&_win$1||{}),p=_win$1.requestAnimationFrame,_registerPluginQueue.forEach(_createPlugin)),h&&_.sleep(),u=p||function(v){return setTimeout(v,d-_.time*1e3+1|0)},_tickerActive=1,E(2))},sleep:function(){(p?_win$1.cancelAnimationFrame:clearTimeout)(h),_tickerActive=0,u=_emptyFunc},lagSmoothing:function(v,T){e=v||1/0,n=Math.min(T||33,e)},fps:function(v){o=1e3/(v||240),d=_.time*1e3+o},add:function(v,T,R){var x=T?function(C,w,P,D){v(C,w,P,D),_.remove(x)}:v;return _.remove(v),f[R?"unshift":"push"](x),_wake(),x},remove:function(v,T){~(T=f.indexOf(v))&&f.splice(T,1)&&S>=T&&S--},_listeners:f},_}(),_wake=function l(){return!_tickerActive&&_ticker.wake()},_easeMap={},_customEaseExp=/^[\d.\-M][\d.\-,\s]/,_quotesExp=/["']/g,_parseObjectInString=function l(e){for(var n={},t=e.substr(1,e.length-3).split(":"),a=t[0],o=1,d=t.length,f,h,u;o<d;o++)h=t[o],f=o!==d-1?h.lastIndexOf(","):h.length,u=h.substr(0,f),n[a]=isNaN(u)?u.replace(_quotesExp,"").trim():+u,a=h.substr(f+1).trim();return n},_valueInParentheses=function l(e){var n=e.indexOf("(")+1,t=e.indexOf(")"),a=e.indexOf("(",n);return e.substring(n,~a&&a<t?e.indexOf(")",t+1):t)},_configEaseFromString=function l(e){var n=(e+"").split("("),t=_easeMap[n[0]];return t&&n.length>1&&t.config?t.config.apply(null,~e.indexOf("{")?[_parseObjectInString(n[1])]:_valueInParentheses(e).split(",").map(_numericIfPossible)):_easeMap._CE&&_customEaseExp.test(e)?_easeMap._CE("",e):t},_invertEase=function l(e){return function(n){return 1-e(1-n)}},_propagateYoyoEase=function l(e,n){for(var t=e._first,a;t;)t instanceof Timeline?l(t,n):t.vars.yoyoEase&&(!t._yoyo||!t._repeat)&&t._yoyo!==n&&(t.timeline?l(t.timeline,n):(a=t._ease,t._ease=t._yEase,t._yEase=a,t._yoyo=n)),t=t._next},_parseEase=function l(e,n){return e&&(_isFunction(e)?e:_easeMap[e]||_configEaseFromString(e))||n},_insertEase=function l(e,n,t,a){t===void 0&&(t=function(h){return 1-n(1-h)}),a===void 0&&(a=function(h){return h<.5?n(h*2)/2:1-n((1-h)*2)/2});var o={easeIn:n,easeOut:t,easeInOut:a},d;return _forEachName(e,function(f){_easeMap[f]=_globals[f]=o,_easeMap[d=f.toLowerCase()]=t;for(var h in o)_easeMap[d+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=_easeMap[f+"."+h]=o[h]}),o},_easeInOutFromOut=function l(e){return function(n){return n<.5?(1-e(1-n*2))/2:.5+e((n-.5)*2)/2}},_configElastic=function l(e,n,t){var a=n>=1?n:1,o=(t||(e?.3:.45))/(n<1?n:1),d=o/_2PI*(Math.asin(1/a)||0),f=function(p){return p===1?1:a*Math.pow(2,-10*p)*_sin((p-d)*o)+1},h=e==="out"?f:e==="in"?function(u){return 1-f(1-u)}:_easeInOutFromOut(f);return o=_2PI/o,h.config=function(u,p){return l(e,u,p)},h},_configBack=function l(e,n){n===void 0&&(n=1.70158);var t=function(d){return d?--d*d*((n+1)*d+n)+1:0},a=e==="out"?t:e==="in"?function(o){return 1-t(1-o)}:_easeInOutFromOut(t);return a.config=function(o){return l(e,o)},a};_forEachName("Linear,Quad,Cubic,Quart,Quint,Strong",function(l,e){var n=e<5?e+1:e;_insertEase(l+",Power"+(n-1),e?function(t){return Math.pow(t,n)}:function(t){return t},function(t){return 1-Math.pow(1-t,n)},function(t){return t<.5?Math.pow(t*2,n)/2:1-Math.pow((1-t)*2,n)/2})});_easeMap.Linear.easeNone=_easeMap.none=_easeMap.Linear.easeIn;_insertEase("Elastic",_configElastic("in"),_configElastic("out"),_configElastic());(function(l,e){var n=1/e,t=2*n,a=2.5*n,o=function(f){return f<n?l*f*f:f<t?l*Math.pow(f-1.5/e,2)+.75:f<a?l*(f-=2.25/e)*f+.9375:l*Math.pow(f-2.625/e,2)+.984375};_insertEase("Bounce",function(d){return 1-o(1-d)},o)})(7.5625,2.75);_insertEase("Expo",function(l){return l?Math.pow(2,10*(l-1)):0});_insertEase("Circ",function(l){return-(_sqrt(1-l*l)-1)});_insertEase("Sine",function(l){return l===1?1:-_cos(l*_HALF_PI)+1});_insertEase("Back",_configBack("in"),_configBack("out"),_configBack());_easeMap.SteppedEase=_easeMap.steps=_globals.SteppedEase={config:function l(e,n){e===void 0&&(e=1);var t=1/e,a=e+(n?0:1),o=n?1:0,d=1-_tinyNum;return function(f){return((a*_clamp(0,d,f)|0)+o)*t}}};_defaults.ease=_easeMap["quad.out"];_forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(l){return _callbackNames+=l+","+l+"Params,"});var GSCache=function l(e,n){this.id=_gsID++,e._gsap=this,this.target=e,this.harness=n,this.get=n?n.get:_getProperty,this.set=n?n.getSetter:_getSetter},Animation=function(){function l(n){this.vars=n,this._delay=+n.delay||0,(this._repeat=n.repeat===1/0?-2:n.repeat||0)&&(this._rDelay=n.repeatDelay||0,this._yoyo=!!n.yoyo||!!n.yoyoEase),this._ts=1,_setDuration(this,+n.duration,1,1),this.data=n.data,_context&&(this._ctx=_context,_context.data.push(this)),_tickerActive||_ticker.wake()}var e=l.prototype;return e.delay=function(t){return t||t===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+t-this._delay),this._delay=t,this):this._delay},e.duration=function(t){return arguments.length?this.totalDuration(this._repeat>0?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},e.totalDuration=function(t){return arguments.length?(this._dirty=0,_setDuration(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(t,a){if(_wake(),!arguments.length)return this._tTime;var o=this._dp;if(o&&o.smoothChildTiming&&this._ts){for(_alignPlayhead(this,t),!o._dp||o.parent||_postAddChecks(o,this);o&&o.parent;)o.parent._time!==o._start+(o._ts>=0?o._tTime/o._ts:(o.totalDuration()-o._tTime)/-o._ts)&&o.totalTime(o._tTime,!0),o=o.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&t<this._tDur||this._ts<0&&t>0||!this._tDur&&!t)&&_addToTimeline(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!a||this._initted&&Math.abs(this._zTime)===_tinyNum||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),_lazySafeRender(this,t,a)),this},e.time=function(t,a){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+_elapsedCycleDuration(this))%(this._dur+this._rDelay)||(t?this._dur:0),a):this._time},e.totalProgress=function(t,a){return arguments.length?this.totalTime(this.totalDuration()*t,a):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},e.progress=function(t,a){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-t:t)+_elapsedCycleDuration(this),a):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(t,a){var o=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*o,a):this._repeat?_animationCycle(this._tTime,o)+1:1},e.timeScale=function(t,a){if(!arguments.length)return this._rts===-_tinyNum?0:this._rts;if(this._rts===t)return this;var o=this.parent&&this._ts?_parentToChildTotalTime(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||t===-_tinyNum?0:this._rts,this.totalTime(_clamp(-Math.abs(this._delay),this._tDur,o),a!==!1),_setEnd(this),_recacheAncestors(this)},e.paused=function(t){return arguments.length?(this._ps!==t&&(this._ps=t,t?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(_wake(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==_tinyNum&&(this._tTime-=_tinyNum)))),this):this._ps},e.startTime=function(t){if(arguments.length){this._start=t;var a=this.parent||this._dp;return a&&(a._sort||!this.parent)&&_addToTimeline(a,this,t-this._delay),this}return this._start},e.endTime=function(t){return this._start+(_isNotFalse(t)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(t){var a=this.parent||this._dp;return a?t&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?_parentToChildTotalTime(a.rawTime(t),this):this._tTime:this._tTime},e.revert=function(t){t===void 0&&(t=_revertConfig);var a=_reverting$1;return _reverting$1=t,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(t),this.totalTime(-.01,t.suppressEvents)),this.data!=="nested"&&t.kill!==!1&&this.kill(),_reverting$1=a,this},e.globalTime=function(t){for(var a=this,o=arguments.length?t:a.rawTime();a;)o=a._start+o/(Math.abs(a._ts)||1),a=a._dp;return!this.parent&&this._sat?this._sat.globalTime(t):o},e.repeat=function(t){return arguments.length?(this._repeat=t===1/0?-2:t,_onUpdateTotalDuration(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(t){if(arguments.length){var a=this._time;return this._rDelay=t,_onUpdateTotalDuration(this),a?this.time(a):this}return this._rDelay},e.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},e.seek=function(t,a){return this.totalTime(_parsePosition(this,t),_isNotFalse(a))},e.restart=function(t,a){return this.play().totalTime(t?-this._delay:0,_isNotFalse(a))},e.play=function(t,a){return t!=null&&this.seek(t,a),this.reversed(!1).paused(!1)},e.reverse=function(t,a){return t!=null&&this.seek(t||this.totalDuration(),a),this.reversed(!0).paused(!1)},e.pause=function(t,a){return t!=null&&this.seek(t,a),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-_tinyNum:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-_tinyNum,this},e.isActive=function(){var t=this.parent||this._dp,a=this._start,o;return!!(!t||this._ts&&this._initted&&t.isActive()&&(o=t.rawTime(!0))>=a&&o<this.endTime(!0)-_tinyNum)},e.eventCallback=function(t,a,o){var d=this.vars;return arguments.length>1?(a?(d[t]=a,o&&(d[t+"Params"]=o),t==="onUpdate"&&(this._onUpdate=a)):delete d[t],this):d[t]},e.then=function(t){var a=this;return new Promise(function(o){var d=_isFunction(t)?t:_passThrough,f=function(){var u=a.then;a.then=null,_isFunction(d)&&(d=d(a))&&(d.then||d===a)&&(a.then=u),o(d),a.then=u};a._initted&&a.totalProgress()===1&&a._ts>=0||!a._tTime&&a._ts<0?f():a._prom=f})},e.kill=function(){_interrupt(this)},l}();_setDefaults(Animation.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-_tinyNum,_prom:0,_ps:!1,_rts:1});var Timeline=function(l){_inheritsLoose(e,l);function e(t,a){var o;return t===void 0&&(t={}),o=l.call(this,t)||this,o.labels={},o.smoothChildTiming=!!t.smoothChildTiming,o.autoRemoveChildren=!!t.autoRemoveChildren,o._sort=_isNotFalse(t.sortChildren),_globalTimeline&&_addToTimeline(t.parent||_globalTimeline,_assertThisInitialized(o),a),t.reversed&&o.reverse(),t.paused&&o.paused(!0),t.scrollTrigger&&_scrollTrigger(_assertThisInitialized(o),t.scrollTrigger),o}var n=e.prototype;return n.to=function(a,o,d){return _createTweenType(0,arguments,this),this},n.from=function(a,o,d){return _createTweenType(1,arguments,this),this},n.fromTo=function(a,o,d,f){return _createTweenType(2,arguments,this),this},n.set=function(a,o,d){return o.duration=0,o.parent=this,_inheritDefaults(o).repeatDelay||(o.repeat=0),o.immediateRender=!!o.immediateRender,new Tween(a,o,_parsePosition(this,d),1),this},n.call=function(a,o,d){return _addToTimeline(this,Tween.delayedCall(0,a,o),d)},n.staggerTo=function(a,o,d,f,h,u,p){return d.duration=o,d.stagger=d.stagger||f,d.onComplete=u,d.onCompleteParams=p,d.parent=this,new Tween(a,d,_parsePosition(this,h)),this},n.staggerFrom=function(a,o,d,f,h,u,p){return d.runBackwards=1,_inheritDefaults(d).immediateRender=_isNotFalse(d.immediateRender),this.staggerTo(a,o,d,f,h,u,p)},n.staggerFromTo=function(a,o,d,f,h,u,p,_){return f.startAt=d,_inheritDefaults(f).immediateRender=_isNotFalse(f.immediateRender),this.staggerTo(a,o,f,h,u,p,_)},n.render=function(a,o,d){var f=this._time,h=this._dirty?this.totalDuration():this._tDur,u=this._dur,p=a<=0?0:_roundPrecise(a),_=this._zTime<0!=a<0&&(this._initted||!u),b,S,E,g,v,T,R,x,C,w,P,D;if(this!==_globalTimeline&&p>h&&a>=0&&(p=h),p!==this._tTime||d||_){if(f!==this._time&&u&&(p+=this._time-f,a+=this._time-f),b=p,C=this._start,x=this._ts,T=!x,_&&(u||(f=this._zTime),(a||!o)&&(this._zTime=a)),this._repeat){if(P=this._yoyo,v=u+this._rDelay,this._repeat<-1&&a<0)return this.totalTime(v*100+a,o,d);if(b=_roundPrecise(p%v),p===h?(g=this._repeat,b=u):(g=~~(p/v),g&&g===p/v&&(b=u,g--),b>u&&(b=u)),w=_animationCycle(this._tTime,v),!f&&this._tTime&&w!==g&&this._tTime-w*v-this._dur<=0&&(w=g),P&&g&1&&(b=u-b,D=1),g!==w&&!this._lock){var N=P&&w&1,k=N===(P&&g&1);if(g<w&&(N=!N),f=N?0:p%u?u:p,this._lock=1,this.render(f||(D?0:_roundPrecise(g*v)),o,!u)._lock=0,this._tTime=p,!o&&this.parent&&_callback(this,"onRepeat"),this.vars.repeatRefresh&&!D&&(this.invalidate()._lock=1),f&&f!==this._time||T!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(u=this._dur,h=this._tDur,k&&(this._lock=2,f=N?u:-1e-4,this.render(f,!0),this.vars.repeatRefresh&&!D&&this.invalidate()),this._lock=0,!this._ts&&!T)return this;_propagateYoyoEase(this,D)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(R=_findNextPauseTween(this,_roundPrecise(f),_roundPrecise(b)),R&&(p-=b-(b=R._start))),this._tTime=p,this._time=b,this._act=!x,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=a,f=0),!f&&b&&!o&&!g&&(_callback(this,"onStart"),this._tTime!==p))return this;if(b>=f&&a>=0)for(S=this._first;S;){if(E=S._next,(S._act||b>=S._start)&&S._ts&&R!==S){if(S.parent!==this)return this.render(a,o,d);if(S.render(S._ts>0?(b-S._start)*S._ts:(S._dirty?S.totalDuration():S._tDur)+(b-S._start)*S._ts,o,d),b!==this._time||!this._ts&&!T){R=0,E&&(p+=this._zTime=-_tinyNum);break}}S=E}else{S=this._last;for(var F=a<0?a:b;S;){if(E=S._prev,(S._act||F<=S._end)&&S._ts&&R!==S){if(S.parent!==this)return this.render(a,o,d);if(S.render(S._ts>0?(F-S._start)*S._ts:(S._dirty?S.totalDuration():S._tDur)+(F-S._start)*S._ts,o,d||_reverting$1&&(S._initted||S._startAt)),b!==this._time||!this._ts&&!T){R=0,E&&(p+=this._zTime=F?-_tinyNum:_tinyNum);break}}S=E}}if(R&&!o&&(this.pause(),R.render(b>=f?0:-_tinyNum)._zTime=b>=f?1:-1,this._ts))return this._start=C,_setEnd(this),this.render(a,o,d);this._onUpdate&&!o&&_callback(this,"onUpdate",!0),(p===h&&this._tTime>=this.totalDuration()||!p&&f)&&(C===this._start||Math.abs(x)!==Math.abs(this._ts))&&(this._lock||((a||!u)&&(p===h&&this._ts>0||!p&&this._ts<0)&&_removeFromParent(this,1),!o&&!(a<0&&!f)&&(p||f||!h)&&(_callback(this,p===h&&a>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(p<h&&this.timeScale()>0)&&this._prom())))}return this},n.add=function(a,o){var d=this;if(_isNumber(o)||(o=_parsePosition(this,o,a)),!(a instanceof Animation)){if(_isArray(a))return a.forEach(function(f){return d.add(f,o)}),this;if(_isString(a))return this.addLabel(a,o);if(_isFunction(a))a=Tween.delayedCall(0,a);else return this}return this!==a?_addToTimeline(this,a,o):this},n.getChildren=function(a,o,d,f){a===void 0&&(a=!0),o===void 0&&(o=!0),d===void 0&&(d=!0),f===void 0&&(f=-_bigNum$1);for(var h=[],u=this._first;u;)u._start>=f&&(u instanceof Tween?o&&h.push(u):(d&&h.push(u),a&&h.push.apply(h,u.getChildren(!0,o,d)))),u=u._next;return h},n.getById=function(a){for(var o=this.getChildren(1,1,1),d=o.length;d--;)if(o[d].vars.id===a)return o[d]},n.remove=function(a){return _isString(a)?this.removeLabel(a):_isFunction(a)?this.killTweensOf(a):(_removeLinkedListItem(this,a),a===this._recent&&(this._recent=this._last),_uncache(this))},n.totalTime=function(a,o){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=_roundPrecise(_ticker.time-(this._ts>0?a/this._ts:(this.totalDuration()-a)/-this._ts))),l.prototype.totalTime.call(this,a,o),this._forcing=0,this):this._tTime},n.addLabel=function(a,o){return this.labels[a]=_parsePosition(this,o),this},n.removeLabel=function(a){return delete this.labels[a],this},n.addPause=function(a,o,d){var f=Tween.delayedCall(0,o||_emptyFunc,d);return f.data="isPause",this._hasPause=1,_addToTimeline(this,f,_parsePosition(this,a))},n.removePause=function(a){var o=this._first;for(a=_parsePosition(this,a);o;)o._start===a&&o.data==="isPause"&&_removeFromParent(o),o=o._next},n.killTweensOf=function(a,o,d){for(var f=this.getTweensOf(a,d),h=f.length;h--;)_overwritingTween!==f[h]&&f[h].kill(a,o);return this},n.getTweensOf=function(a,o){for(var d=[],f=toArray(a),h=this._first,u=_isNumber(o),p;h;)h instanceof Tween?_arrayContainsAny(h._targets,f)&&(u?(!_overwritingTween||h._initted&&h._ts)&&h.globalTime(0)<=o&&h.globalTime(h.totalDuration())>o:!o||h.isActive())&&d.push(h):(p=h.getTweensOf(f,o)).length&&d.push.apply(d,p),h=h._next;return d},n.tweenTo=function(a,o){o=o||{};var d=this,f=_parsePosition(d,a),h=o,u=h.startAt,p=h.onStart,_=h.onStartParams,b=h.immediateRender,S,E=Tween.to(d,_setDefaults({ease:o.ease||"none",lazy:!1,immediateRender:!1,time:f,overwrite:"auto",duration:o.duration||Math.abs((f-(u&&"time"in u?u.time:d._time))/d.timeScale())||_tinyNum,onStart:function(){if(d.pause(),!S){var v=o.duration||Math.abs((f-(u&&"time"in u?u.time:d._time))/d.timeScale());E._dur!==v&&_setDuration(E,v,0,1).render(E._time,!0,!0),S=1}p&&p.apply(E,_||[])}},o));return b?E.render(0):E},n.tweenFromTo=function(a,o,d){return this.tweenTo(o,_setDefaults({startAt:{time:_parsePosition(this,a)}},d))},n.recent=function(){return this._recent},n.nextLabel=function(a){return a===void 0&&(a=this._time),_getLabelInDirection(this,_parsePosition(this,a))},n.previousLabel=function(a){return a===void 0&&(a=this._time),_getLabelInDirection(this,_parsePosition(this,a),1)},n.currentLabel=function(a){return arguments.length?this.seek(a,!0):this.previousLabel(this._time+_tinyNum)},n.shiftChildren=function(a,o,d){d===void 0&&(d=0);for(var f=this._first,h=this.labels,u;f;)f._start>=d&&(f._start+=a,f._end+=a),f=f._next;if(o)for(u in h)h[u]>=d&&(h[u]+=a);return _uncache(this)},n.invalidate=function(a){var o=this._first;for(this._lock=0;o;)o.invalidate(a),o=o._next;return l.prototype.invalidate.call(this,a)},n.clear=function(a){a===void 0&&(a=!0);for(var o=this._first,d;o;)d=o._next,this.remove(o),o=d;return this._dp&&(this._time=this._tTime=this._pTime=0),a&&(this.labels={}),_uncache(this)},n.totalDuration=function(a){var o=0,d=this,f=d._last,h=_bigNum$1,u,p,_;if(arguments.length)return d.timeScale((d._repeat<0?d.duration():d.totalDuration())/(d.reversed()?-a:a));if(d._dirty){for(_=d.parent;f;)u=f._prev,f._dirty&&f.totalDuration(),p=f._start,p>h&&d._sort&&f._ts&&!d._lock?(d._lock=1,_addToTimeline(d,f,p-f._delay,1)._lock=0):h=p,p<0&&f._ts&&(o-=p,(!_&&!d._dp||_&&_.smoothChildTiming)&&(d._start+=p/d._ts,d._time-=p,d._tTime-=p),d.shiftChildren(-p,!1,-1/0),h=0),f._end>o&&f._ts&&(o=f._end),f=u;_setDuration(d,d===_globalTimeline&&d._time>o?d._time:o,1,1),d._dirty=0}return d._tDur},e.updateRoot=function(a){if(_globalTimeline._ts&&(_lazySafeRender(_globalTimeline,_parentToChildTotalTime(a,_globalTimeline)),_lastRenderedFrame=_ticker.frame),_ticker.frame>=_nextGCFrame){_nextGCFrame+=_config.autoSleep||120;var o=_globalTimeline._first;if((!o||!o._ts)&&_config.autoSleep&&_ticker._listeners.length<2){for(;o&&!o._ts;)o=o._next;o||_ticker.sleep()}}},e}(Animation);_setDefaults(Timeline.prototype,{_lock:0,_hasPause:0,_forcing:0});var _addComplexStringPropTween=function l(e,n,t,a,o,d,f){var h=new PropTween(this._pt,e,n,0,1,_renderComplexString,null,o),u=0,p=0,_,b,S,E,g,v,T,R;for(h.b=t,h.e=a,t+="",a+="",(T=~a.indexOf("random("))&&(a=_replaceRandom(a)),d&&(R=[t,a],d(R,e,n),t=R[0],a=R[1]),b=t.match(_complexStringNumExp)||[];_=_complexStringNumExp.exec(a);)E=_[0],g=a.substring(u,_.index),S?S=(S+1)%5:g.substr(-5)==="rgba("&&(S=1),E!==b[p++]&&(v=parseFloat(b[p-1])||0,h._pt={_next:h._pt,p:g||p===1?g:",",s:v,c:E.charAt(1)==="="?_parseRelative(v,E)-v:parseFloat(E)-v,m:S&&S<4?Math.round:0},u=_complexStringNumExp.lastIndex);return h.c=u<a.length?a.substring(u,a.length):"",h.fp=f,(_relExp.test(a)||T)&&(h.e=0),this._pt=h,h},_addPropTween=function l(e,n,t,a,o,d,f,h,u,p){_isFunction(a)&&(a=a(o||0,e,d));var _=e[n],b=t!=="get"?t:_isFunction(_)?u?e[n.indexOf("set")||!_isFunction(e["get"+n.substr(3)])?n:"get"+n.substr(3)](u):e[n]():_,S=_isFunction(_)?u?_setterFuncWithParam:_setterFunc:_setterPlain,E;if(_isString(a)&&(~a.indexOf("random(")&&(a=_replaceRandom(a)),a.charAt(1)==="="&&(E=_parseRelative(b,a)+(getUnit(b)||0),(E||E===0)&&(a=E))),!p||b!==a||_forceAllPropTweens)return!isNaN(b*a)&&a!==""?(E=new PropTween(this._pt,e,n,+b||0,a-(b||0),typeof _=="boolean"?_renderBoolean:_renderPlain,0,S),u&&(E.fp=u),f&&E.modifier(f,this,e),this._pt=E):(!_&&!(n in e)&&_missingPlugin(n,a),_addComplexStringPropTween.call(this,e,n,b,a,S,h||_config.stringFilter,u))},_processVars=function l(e,n,t,a,o){if(_isFunction(e)&&(e=_parseFuncOrString(e,o,n,t,a)),!_isObject(e)||e.style&&e.nodeType||_isArray(e)||_isTypedArray(e))return _isString(e)?_parseFuncOrString(e,o,n,t,a):e;var d={},f;for(f in e)d[f]=_parseFuncOrString(e[f],o,n,t,a);return d},_checkPlugin=function l(e,n,t,a,o,d){var f,h,u,p;if(_plugins[e]&&(f=new _plugins[e]).init(o,f.rawVars?n[e]:_processVars(n[e],a,o,d,t),t,a,d)!==!1&&(t._pt=h=new PropTween(t._pt,o,e,0,1,f.render,f,0,f.priority),t!==_quickTween))for(u=t._ptLookup[t._targets.indexOf(o)],p=f._props.length;p--;)u[f._props[p]]=h;return f},_overwritingTween,_forceAllPropTweens,_initTween=function l(e,n,t){var a=e.vars,o=a.ease,d=a.startAt,f=a.immediateRender,h=a.lazy,u=a.onUpdate,p=a.runBackwards,_=a.yoyoEase,b=a.keyframes,S=a.autoRevert,E=e._dur,g=e._startAt,v=e._targets,T=e.parent,R=T&&T.data==="nested"?T.vars.targets:v,x=e._overwrite==="auto"&&!_suppressOverwrites,C=e.timeline,w,P,D,N,k,F,M,U,$,B,J,ne,ie;if(C&&(!b||!o)&&(o="none"),e._ease=_parseEase(o,_defaults.ease),e._yEase=_?_invertEase(_parseEase(_===!0?o:_,_defaults.ease)):0,_&&e._yoyo&&!e._repeat&&(_=e._yEase,e._yEase=e._ease,e._ease=_),e._from=!C&&!!a.runBackwards,!C||b&&!a.stagger){if(U=v[0]?_getCache(v[0]).harness:0,ne=U&&a[U.prop],w=_copyExcluding(a,_reservedProps),g&&(g._zTime<0&&g.progress(1),n<0&&p&&f&&!S?g.render(-1,!0):g.revert(p&&E?_revertConfigNoKill:_startAtRevertConfig),g._lazy=0),d){if(_removeFromParent(e._startAt=Tween.set(v,_setDefaults({data:"isStart",overwrite:!1,parent:T,immediateRender:!0,lazy:!g&&_isNotFalse(h),startAt:null,delay:0,onUpdate:u&&function(){return _callback(e,"onUpdate")},stagger:0},d))),e._startAt._dp=0,e._startAt._sat=e,n<0&&(_reverting$1||!f&&!S)&&e._startAt.revert(_revertConfigNoKill),f&&E&&n<=0&&t<=0){n&&(e._zTime=n);return}}else if(p&&E&&!g){if(n&&(f=!1),D=_setDefaults({overwrite:!1,data:"isFromStart",lazy:f&&!g&&_isNotFalse(h),immediateRender:f,stagger:0,parent:T},w),ne&&(D[U.prop]=ne),_removeFromParent(e._startAt=Tween.set(v,D)),e._startAt._dp=0,e._startAt._sat=e,n<0&&(_reverting$1?e._startAt.revert(_revertConfigNoKill):e._startAt.render(-1,!0)),e._zTime=n,!f)l(e._startAt,_tinyNum,_tinyNum);else if(!n)return}for(e._pt=e._ptCache=0,h=E&&_isNotFalse(h)||h&&!E,P=0;P<v.length;P++){if(k=v[P],M=k._gsap||_harness(v)[P]._gsap,e._ptLookup[P]=B={},_lazyLookup[M.id]&&_lazyTweens.length&&_lazyRender(),J=R===v?P:R.indexOf(k),U&&($=new U).init(k,ne||w,e,J,R)!==!1&&(e._pt=N=new PropTween(e._pt,k,$.name,0,1,$.render,$,0,$.priority),$._props.forEach(function(Y){B[Y]=N}),$.priority&&(F=1)),!U||ne)for(D in w)_plugins[D]&&($=_checkPlugin(D,w,e,J,k,R))?$.priority&&(F=1):B[D]=N=_addPropTween.call(e,k,D,"get",w[D],J,R,0,a.stringFilter);e._op&&e._op[P]&&e.kill(k,e._op[P]),x&&e._pt&&(_overwritingTween=e,_globalTimeline.killTweensOf(k,B,e.globalTime(n)),ie=!e.parent,_overwritingTween=0),e._pt&&h&&(_lazyLookup[M.id]=1)}F&&_sortPropTweensByPriority(e),e._onInit&&e._onInit(e)}e._onUpdate=u,e._initted=(!e._op||e._pt)&&!ie,b&&n<=0&&C.render(_bigNum$1,!0,!0)},_updatePropTweens=function l(e,n,t,a,o,d,f,h){var u=(e._pt&&e._ptCache||(e._ptCache={}))[n],p,_,b,S;if(!u)for(u=e._ptCache[n]=[],b=e._ptLookup,S=e._targets.length;S--;){if(p=b[S][n],p&&p.d&&p.d._pt)for(p=p.d._pt;p&&p.p!==n&&p.fp!==n;)p=p._next;if(!p)return _forceAllPropTweens=1,e.vars[n]="+=0",_initTween(e,f),_forceAllPropTweens=0,h?_warn(n+" not eligible for reset"):1;u.push(p)}for(S=u.length;S--;)_=u[S],p=_._pt||_,p.s=(a||a===0)&&!o?a:p.s+(a||0)+d*p.c,p.c=t-p.s,_.e&&(_.e=_round(t)+getUnit(_.e)),_.b&&(_.b=p.s+getUnit(_.b))},_addAliasesToVars=function l(e,n){var t=e[0]?_getCache(e[0]).harness:0,a=t&&t.aliases,o,d,f,h;if(!a)return n;o=_merge({},n);for(d in a)if(d in o)for(h=a[d].split(","),f=h.length;f--;)o[h[f]]=o[d];return o},_parseKeyframe=function l(e,n,t,a){var o=n.ease||a||"power1.inOut",d,f;if(_isArray(n))f=t[e]||(t[e]=[]),n.forEach(function(h,u){return f.push({t:u/(n.length-1)*100,v:h,e:o})});else for(d in n)f=t[d]||(t[d]=[]),d==="ease"||f.push({t:parseFloat(e),v:n[d],e:o})},_parseFuncOrString=function l(e,n,t,a,o){return _isFunction(e)?e.call(n,t,a,o):_isString(e)&&~e.indexOf("random(")?_replaceRandom(e):e},_staggerTweenProps=_callbackNames+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",_staggerPropsToSkip={};_forEachName(_staggerTweenProps+",id,stagger,delay,duration,paused,scrollTrigger",function(l){return _staggerPropsToSkip[l]=1});var Tween=function(l){_inheritsLoose(e,l);function e(t,a,o,d){var f;typeof a=="number"&&(o.duration=a,a=o,o=null),f=l.call(this,d?a:_inheritDefaults(a))||this;var h=f.vars,u=h.duration,p=h.delay,_=h.immediateRender,b=h.stagger,S=h.overwrite,E=h.keyframes,g=h.defaults,v=h.scrollTrigger,T=h.yoyoEase,R=a.parent||_globalTimeline,x=(_isArray(t)||_isTypedArray(t)?_isNumber(t[0]):"length"in a)?[t]:toArray(t),C,w,P,D,N,k,F,M;if(f._targets=x.length?_harness(x):_warn("GSAP target "+t+" not found. https://gsap.com",!_config.nullTargetWarn)||[],f._ptLookup=[],f._overwrite=S,E||b||_isFuncOrString(u)||_isFuncOrString(p)){if(a=f.vars,C=f.timeline=new Timeline({data:"nested",defaults:g||{},targets:R&&R.data==="nested"?R.vars.targets:x}),C.kill(),C.parent=C._dp=_assertThisInitialized(f),C._start=0,b||_isFuncOrString(u)||_isFuncOrString(p)){if(D=x.length,F=b&&distribute(b),_isObject(b))for(N in b)~_staggerTweenProps.indexOf(N)&&(M||(M={}),M[N]=b[N]);for(w=0;w<D;w++)P=_copyExcluding(a,_staggerPropsToSkip),P.stagger=0,T&&(P.yoyoEase=T),M&&_merge(P,M),k=x[w],P.duration=+_parseFuncOrString(u,_assertThisInitialized(f),w,k,x),P.delay=(+_parseFuncOrString(p,_assertThisInitialized(f),w,k,x)||0)-f._delay,!b&&D===1&&P.delay&&(f._delay=p=P.delay,f._start+=p,P.delay=0),C.to(k,P,F?F(w,k,x):0),C._ease=_easeMap.none;C.duration()?u=p=0:f.timeline=0}else if(E){_inheritDefaults(_setDefaults(C.vars.defaults,{ease:"none"})),C._ease=_parseEase(E.ease||a.ease||"none");var U=0,$,B,J;if(_isArray(E))E.forEach(function(ne){return C.to(x,ne,">")}),C.duration();else{P={};for(N in E)N==="ease"||N==="easeEach"||_parseKeyframe(N,E[N],P,E.easeEach);for(N in P)for($=P[N].sort(function(ne,ie){return ne.t-ie.t}),U=0,w=0;w<$.length;w++)B=$[w],J={ease:B.e,duration:(B.t-(w?$[w-1].t:0))/100*u},J[N]=B.v,C.to(x,J,U),U+=J.duration;C.duration()<u&&C.to({},{duration:u-C.duration()})}}u||f.duration(u=C.duration())}else f.timeline=0;return S===!0&&!_suppressOverwrites&&(_overwritingTween=_assertThisInitialized(f),_globalTimeline.killTweensOf(x),_overwritingTween=0),_addToTimeline(R,_assertThisInitialized(f),o),a.reversed&&f.reverse(),a.paused&&f.paused(!0),(_||!u&&!E&&f._start===_roundPrecise(R._time)&&_isNotFalse(_)&&_hasNoPausedAncestors(_assertThisInitialized(f))&&R.data!=="nested")&&(f._tTime=-_tinyNum,f.render(Math.max(0,-p)||0)),v&&_scrollTrigger(_assertThisInitialized(f),v),f}var n=e.prototype;return n.render=function(a,o,d){var f=this._time,h=this._tDur,u=this._dur,p=a<0,_=a>h-_tinyNum&&!p?h:a<_tinyNum?0:a,b,S,E,g,v,T,R,x,C;if(!u)_renderZeroDurationTween(this,a,o,d);else if(_!==this._tTime||!a||d||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==p){if(b=_,x=this.timeline,this._repeat){if(g=u+this._rDelay,this._repeat<-1&&p)return this.totalTime(g*100+a,o,d);if(b=_roundPrecise(_%g),_===h?(E=this._repeat,b=u):(E=~~(_/g),E&&E===_roundPrecise(_/g)&&(b=u,E--),b>u&&(b=u)),T=this._yoyo&&E&1,T&&(C=this._yEase,b=u-b),v=_animationCycle(this._tTime,g),b===f&&!d&&this._initted&&E===v)return this._tTime=_,this;E!==v&&(x&&this._yEase&&_propagateYoyoEase(x,T),this.vars.repeatRefresh&&!T&&!this._lock&&this._time!==u&&this._initted&&(this._lock=d=1,this.render(_roundPrecise(g*E),!0).invalidate()._lock=0))}if(!this._initted){if(_attemptInitTween(this,p?a:b,d,o,_))return this._tTime=0,this;if(f!==this._time&&!(d&&this.vars.repeatRefresh&&E!==v))return this;if(u!==this._dur)return this.render(a,o,d)}if(this._tTime=_,this._time=b,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=R=(C||this._ease)(b/u),this._from&&(this.ratio=R=1-R),b&&!f&&!o&&!E&&(_callback(this,"onStart"),this._tTime!==_))return this;for(S=this._pt;S;)S.r(R,S.d),S=S._next;x&&x.render(a<0?a:!b&&T?-_tinyNum:x._dur*x._ease(b/this._dur),o,d)||this._startAt&&(this._zTime=a),this._onUpdate&&!o&&(p&&_rewindStartAt(this,a,o,d),_callback(this,"onUpdate")),this._repeat&&E!==v&&this.vars.onRepeat&&!o&&this.parent&&_callback(this,"onRepeat"),(_===this._tDur||!_)&&this._tTime===_&&(p&&!this._onUpdate&&_rewindStartAt(this,a,!0,!0),(a||!u)&&(_===this._tDur&&this._ts>0||!_&&this._ts<0)&&_removeFromParent(this,1),!o&&!(p&&!f)&&(_||f||T)&&(_callback(this,_===h?"onComplete":"onReverseComplete",!0),this._prom&&!(_<h&&this.timeScale()>0)&&this._prom()))}return this},n.targets=function(){return this._targets},n.invalidate=function(a){return(!a||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(a),l.prototype.invalidate.call(this,a)},n.resetTo=function(a,o,d,f,h){_tickerActive||_ticker.wake(),this._ts||this.play();var u=Math.min(this._dur,(this._dp._time-this._start)*this._ts),p;return this._initted||_initTween(this,u),p=this._ease(u/this._dur),_updatePropTweens(this,a,o,d,f,p,u,h)?this.resetTo(a,o,d,f,1):(_alignPlayhead(this,0),this.parent||_addLinkedListItem(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},n.kill=function(a,o){if(o===void 0&&(o="all"),!a&&(!o||o==="all"))return this._lazy=this._pt=0,this.parent?_interrupt(this):this;if(this.timeline){var d=this.timeline.totalDuration();return this.timeline.killTweensOf(a,o,_overwritingTween&&_overwritingTween.vars.overwrite!==!0)._first||_interrupt(this),this.parent&&d!==this.timeline.totalDuration()&&_setDuration(this,this._dur*this.timeline._tDur/d,0,1),this}var f=this._targets,h=a?toArray(a):f,u=this._ptLookup,p=this._pt,_,b,S,E,g,v,T;if((!o||o==="all")&&_arraysMatch(f,h))return o==="all"&&(this._pt=0),_interrupt(this);for(_=this._op=this._op||[],o!=="all"&&(_isString(o)&&(g={},_forEachName(o,function(R){return g[R]=1}),o=g),o=_addAliasesToVars(f,o)),T=f.length;T--;)if(~h.indexOf(f[T])){b=u[T],o==="all"?(_[T]=o,E=b,S={}):(S=_[T]=_[T]||{},E=o);for(g in E)v=b&&b[g],v&&((!("kill"in v.d)||v.d.kill(g)===!0)&&_removeLinkedListItem(this,v,"_pt"),delete b[g]),S!=="all"&&(S[g]=1)}return this._initted&&!this._pt&&p&&_interrupt(this),this},e.to=function(a,o){return new e(a,o,arguments[2])},e.from=function(a,o){return _createTweenType(1,arguments)},e.delayedCall=function(a,o,d,f){return new e(o,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:a,onComplete:o,onReverseComplete:o,onCompleteParams:d,onReverseCompleteParams:d,callbackScope:f})},e.fromTo=function(a,o,d){return _createTweenType(2,arguments)},e.set=function(a,o){return o.duration=0,o.repeatDelay||(o.repeat=0),new e(a,o)},e.killTweensOf=function(a,o,d){return _globalTimeline.killTweensOf(a,o,d)},e}(Animation);_setDefaults(Tween.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});_forEachName("staggerTo,staggerFrom,staggerFromTo",function(l){Tween[l]=function(){var e=new Timeline,n=_slice.call(arguments,0);return n.splice(l==="staggerFromTo"?5:4,0,0),e[l].apply(e,n)}});var _setterPlain=function l(e,n,t){return e[n]=t},_setterFunc=function l(e,n,t){return e[n](t)},_setterFuncWithParam=function l(e,n,t,a){return e[n](a.fp,t)},_setterAttribute=function l(e,n,t){return e.setAttribute(n,t)},_getSetter=function l(e,n){return _isFunction(e[n])?_setterFunc:_isUndefined(e[n])&&e.setAttribute?_setterAttribute:_setterPlain},_renderPlain=function l(e,n){return n.set(n.t,n.p,Math.round((n.s+n.c*e)*1e6)/1e6,n)},_renderBoolean=function l(e,n){return n.set(n.t,n.p,!!(n.s+n.c*e),n)},_renderComplexString=function l(e,n){var t=n._pt,a="";if(!e&&n.b)a=n.b;else if(e===1&&n.e)a=n.e;else{for(;t;)a=t.p+(t.m?t.m(t.s+t.c*e):Math.round((t.s+t.c*e)*1e4)/1e4)+a,t=t._next;a+=n.c}n.set(n.t,n.p,a,n)},_renderPropTweens=function l(e,n){for(var t=n._pt;t;)t.r(e,t.d),t=t._next},_addPluginModifier=function l(e,n,t,a){for(var o=this._pt,d;o;)d=o._next,o.p===a&&o.modifier(e,n,t),o=d},_killPropTweensOf=function l(e){for(var n=this._pt,t,a;n;)a=n._next,n.p===e&&!n.op||n.op===e?_removeLinkedListItem(this,n,"_pt"):n.dep||(t=1),n=a;return!t},_setterWithModifier=function l(e,n,t,a){a.mSet(e,n,a.m.call(a.tween,t,a.mt),a)},_sortPropTweensByPriority=function l(e){for(var n=e._pt,t,a,o,d;n;){for(t=n._next,a=o;a&&a.pr>n.pr;)a=a._next;(n._prev=a?a._prev:d)?n._prev._next=n:o=n,(n._next=a)?a._prev=n:d=n,n=t}e._pt=o},PropTween=function(){function l(n,t,a,o,d,f,h,u,p){this.t=t,this.s=o,this.c=d,this.p=a,this.r=f||_renderPlain,this.d=h||this,this.set=u||_setterPlain,this.pr=p||0,this._next=n,n&&(n._prev=this)}var e=l.prototype;return e.modifier=function(t,a,o){this.mSet=this.mSet||this.set,this.set=_setterWithModifier,this.m=t,this.mt=o,this.tween=a},l}();_forEachName(_callbackNames+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(l){return _reservedProps[l]=1});_globals.TweenMax=_globals.TweenLite=Tween;_globals.TimelineLite=_globals.TimelineMax=Timeline;_globalTimeline=new Timeline({sortChildren:!1,defaults:_defaults,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});_config.stringFilter=_colorStringFilter;var _media=[],_listeners={},_emptyArray=[],_lastMediaTime=0,_contextID=0,_dispatch=function l(e){return(_listeners[e]||_emptyArray).map(function(n){return n()})},_onMediaChange=function l(){var e=Date.now(),n=[];e-_lastMediaTime>2&&(_dispatch("matchMediaInit"),_media.forEach(function(t){var a=t.queries,o=t.conditions,d,f,h,u;for(f in a)d=_win$1.matchMedia(a[f]).matches,d&&(h=1),d!==o[f]&&(o[f]=d,u=1);u&&(t.revert(),h&&n.push(t))}),_dispatch("matchMediaRevert"),n.forEach(function(t){return t.onMatch(t,function(a){return t.add(null,a)})}),_lastMediaTime=e,_dispatch("matchMedia"))},Context=function(){function l(n,t){this.selector=t&&selector(t),this.data=[],this._r=[],this.isReverted=!1,this.id=_contextID++,n&&this.add(n)}var e=l.prototype;return e.add=function(t,a,o){_isFunction(t)&&(o=a,a=t,t=_isFunction);var d=this,f=function(){var u=_context,p=d.selector,_;return u&&u!==d&&u.data.push(d),o&&(d.selector=selector(o)),_context=d,_=a.apply(d,arguments),_isFunction(_)&&d._r.push(_),_context=u,d.selector=p,d.isReverted=!1,_};return d.last=f,t===_isFunction?f(d,function(h){return d.add(null,h)}):t?d[t]=f:f},e.ignore=function(t){var a=_context;_context=null,t(this),_context=a},e.getTweens=function(){var t=[];return this.data.forEach(function(a){return a instanceof l?t.push.apply(t,a.getTweens()):a instanceof Tween&&!(a.parent&&a.parent.data==="nested")&&t.push(a)}),t},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(t,a){var o=this;if(t?function(){for(var f=o.getTweens(),h=o.data.length,u;h--;)u=o.data[h],u.data==="isFlip"&&(u.revert(),u.getChildren(!0,!0,!1).forEach(function(p){return f.splice(f.indexOf(p),1)}));for(f.map(function(p){return{g:p._dur||p._delay||p._sat&&!p._sat.vars.immediateRender?p.globalTime(0):-1/0,t:p}}).sort(function(p,_){return _.g-p.g||-1/0}).forEach(function(p){return p.t.revert(t)}),h=o.data.length;h--;)u=o.data[h],u instanceof Timeline?u.data!=="nested"&&(u.scrollTrigger&&u.scrollTrigger.revert(),u.kill()):!(u instanceof Tween)&&u.revert&&u.revert(t);o._r.forEach(function(p){return p(t,o)}),o.isReverted=!0}():this.data.forEach(function(f){return f.kill&&f.kill()}),this.clear(),a)for(var d=_media.length;d--;)_media[d].id===this.id&&_media.splice(d,1)},e.revert=function(t){this.kill(t||{})},l}(),MatchMedia=function(){function l(n){this.contexts=[],this.scope=n}var e=l.prototype;return e.add=function(t,a,o){_isObject(t)||(t={matches:t});var d=new Context(0,o||this.scope),f=d.conditions={},h,u,p;_context&&!d.selector&&(d.selector=_context.selector),this.contexts.push(d),a=d.add("onMatch",a),d.queries=t;for(u in t)u==="all"?p=1:(h=_win$1.matchMedia(t[u]),h&&(_media.indexOf(d)<0&&_media.push(d),(f[u]=h.matches)&&(p=1),h.addListener?h.addListener(_onMediaChange):h.addEventListener("change",_onMediaChange)));return p&&a(d,function(_){return d.add(null,_)}),this},e.revert=function(t){this.kill(t||{})},e.kill=function(t){this.contexts.forEach(function(a){return a.kill(t,!0)})},l}(),_gsap={registerPlugin:function l(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];n.forEach(function(a){return _createPlugin(a)})},timeline:function l(e){return new Timeline(e)},getTweensOf:function l(e,n){return _globalTimeline.getTweensOf(e,n)},getProperty:function l(e,n,t,a){_isString(e)&&(e=toArray(e)[0]);var o=_getCache(e||{}).get,d=t?_passThrough:_numericIfPossible;return t==="native"&&(t=""),e&&(n?d((_plugins[n]&&_plugins[n].get||o)(e,n,t,a)):function(f,h,u){return d((_plugins[f]&&_plugins[f].get||o)(e,f,h,u))})},quickSetter:function l(e,n,t){if(e=toArray(e),e.length>1){var a=e.map(function(p){return gsap.quickSetter(p,n,t)}),o=a.length;return function(p){for(var _=o;_--;)a[_](p)}}e=e[0]||{};var d=_plugins[n],f=_getCache(e),h=f.harness&&(f.harness.aliases||{})[n]||n,u=d?function(p){var _=new d;_quickTween._pt=0,_.init(e,t?p+t:p,_quickTween,0,[e]),_.render(1,_),_quickTween._pt&&_renderPropTweens(1,_quickTween)}:f.set(e,h);return d?u:function(p){return u(e,h,t?p+t:p,f,1)}},quickTo:function l(e,n,t){var a,o=gsap.to(e,_merge((a={},a[n]="+=0.1",a.paused=!0,a),t||{})),d=function(h,u,p){return o.resetTo(n,h,u,p)};return d.tween=o,d},isTweening:function l(e){return _globalTimeline.getTweensOf(e,!0).length>0},defaults:function l(e){return e&&e.ease&&(e.ease=_parseEase(e.ease,_defaults.ease)),_mergeDeep(_defaults,e||{})},config:function l(e){return _mergeDeep(_config,e||{})},registerEffect:function l(e){var n=e.name,t=e.effect,a=e.plugins,o=e.defaults,d=e.extendTimeline;(a||"").split(",").forEach(function(f){return f&&!_plugins[f]&&!_globals[f]&&_warn(n+" effect requires "+f+" plugin.")}),_effects[n]=function(f,h,u){return t(toArray(f),_setDefaults(h||{},o),u)},d&&(Timeline.prototype[n]=function(f,h,u){return this.add(_effects[n](f,_isObject(h)?h:(u=h)&&{},this),u)})},registerEase:function l(e,n){_easeMap[e]=_parseEase(n)},parseEase:function l(e,n){return arguments.length?_parseEase(e,n):_easeMap},getById:function l(e){return _globalTimeline.getById(e)},exportRoot:function l(e,n){e===void 0&&(e={});var t=new Timeline(e),a,o;for(t.smoothChildTiming=_isNotFalse(e.smoothChildTiming),_globalTimeline.remove(t),t._dp=0,t._time=t._tTime=_globalTimeline._time,a=_globalTimeline._first;a;)o=a._next,(n||!(!a._dur&&a instanceof Tween&&a.vars.onComplete===a._targets[0]))&&_addToTimeline(t,a,a._start-a._delay),a=o;return _addToTimeline(_globalTimeline,t,0),t},context:function l(e,n){return e?new Context(e,n):_context},matchMedia:function l(e){return new MatchMedia(e)},matchMediaRefresh:function l(){return _media.forEach(function(e){var n=e.conditions,t,a;for(a in n)n[a]&&(n[a]=!1,t=1);t&&e.revert()})||_onMediaChange()},addEventListener:function l(e,n){var t=_listeners[e]||(_listeners[e]=[]);~t.indexOf(n)||t.push(n)},removeEventListener:function l(e,n){var t=_listeners[e],a=t&&t.indexOf(n);a>=0&&t.splice(a,1)},utils:{wrap,wrapYoyo,distribute,random,snap,normalize,getUnit,clamp,splitColor,toArray,selector,mapRange,pipe,unitize,interpolate,shuffle},install:_install,effects:_effects,ticker:_ticker,updateRoot:Timeline.updateRoot,plugins:_plugins,globalTimeline:_globalTimeline,core:{PropTween,globals:_addGlobal,Tween,Timeline,Animation,getCache:_getCache,_removeLinkedListItem,reverting:function l(){return _reverting$1},context:function l(e){return e&&_context&&(_context.data.push(e),e._ctx=_context),_context},suppressOverwrites:function l(e){return _suppressOverwrites=e}}};_forEachName("to,from,fromTo,delayedCall,set,killTweensOf",function(l){return _gsap[l]=Tween[l]});_ticker.add(Timeline.updateRoot);_quickTween=_gsap.to({},{duration:0});var _getPluginPropTween=function l(e,n){for(var t=e._pt;t&&t.p!==n&&t.op!==n&&t.fp!==n;)t=t._next;return t},_addModifiers=function l(e,n){var t=e._targets,a,o,d;for(a in n)for(o=t.length;o--;)d=e._ptLookup[o][a],d&&(d=d.d)&&(d._pt&&(d=_getPluginPropTween(d,a)),d&&d.modifier&&d.modifier(n[a],e,t[o],a))},_buildModifierPlugin=function l(e,n){return{name:e,rawVars:1,init:function(a,o,d){d._onInit=function(f){var h,u;if(_isString(o)&&(h={},_forEachName(o,function(p){return h[p]=1}),o=h),n){h={};for(u in o)h[u]=n(o[u]);o=h}_addModifiers(f,o)}}}},gsap=_gsap.registerPlugin({name:"attr",init:function l(e,n,t,a,o){var d,f,h;this.tween=t;for(d in n)h=e.getAttribute(d)||"",f=this.add(e,"setAttribute",(h||0)+"",n[d],a,o,0,0,d),f.op=d,f.b=h,this._props.push(d)},render:function l(e,n){for(var t=n._pt;t;)_reverting$1?t.set(t.t,t.p,t.b,t):t.r(e,t.d),t=t._next}},{name:"endArray",init:function l(e,n){for(var t=n.length;t--;)this.add(e,t,e[t]||0,n[t],0,0,0,0,0,1)}},_buildModifierPlugin("roundProps",_roundModifier),_buildModifierPlugin("modifiers"),_buildModifierPlugin("snap",snap))||_gsap;Tween.version=Timeline.version=gsap.version="3.12.4";_coreReady=1;_windowExists$1()&&_wake();_easeMap.Power0;_easeMap.Power1;_easeMap.Power2;_easeMap.Power3;_easeMap.Power4;_easeMap.Linear;_easeMap.Quad;_easeMap.Cubic;_easeMap.Quart;_easeMap.Quint;_easeMap.Strong;_easeMap.Elastic;_easeMap.Back;_easeMap.SteppedEase;_easeMap.Bounce;_easeMap.Sine;_easeMap.Expo;_easeMap.Circ;/*!
261
+ */var _config={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},_defaults={duration:.5,overwrite:!1,delay:0},_suppressOverwrites,_reverting$1,_context,_bigNum$1=1e8,_tinyNum=1/_bigNum$1,_2PI=Math.PI*2,_HALF_PI=_2PI/4,_gsID=0,_sqrt=Math.sqrt,_cos=Math.cos,_sin=Math.sin,_isString=function l(e){return typeof e=="string"},_isFunction=function l(e){return typeof e=="function"},_isNumber=function l(e){return typeof e=="number"},_isUndefined=function l(e){return typeof e>"u"},_isObject=function l(e){return typeof e=="object"},_isNotFalse=function l(e){return e!==!1},_windowExists$1=function l(){return typeof window<"u"},_isFuncOrString=function l(e){return _isFunction(e)||_isString(e)},_isTypedArray=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},_isArray=Array.isArray,_strictNumExp=/(?:-?\.?\d|\.)+/gi,_numExp=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,_numWithUnitExp=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,_complexStringNumExp=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,_relExp=/[+-]=-?[.\d]+/,_delimitedValueExp=/[^,'"\[\]\s]+/gi,_unitExp=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,_globalTimeline,_win$1,_coreInitted,_doc$1,_globals={},_installScope={},_coreReady,_install=function l(e){return(_installScope=_merge(e,_globals))&&gsap},_missingPlugin=function l(e,n){return console.warn("Invalid property",e,"set to",n,"Missing plugin? gsap.registerPlugin()")},_warn=function l(e,n){return!n&&console.warn(e)},_addGlobal=function l(e,n){return e&&(_globals[e]=n)&&_installScope&&(_installScope[e]=n)||_globals},_emptyFunc=function l(){return 0},_startAtRevertConfig={suppressEvents:!0,isStart:!0,kill:!1},_revertConfigNoKill={suppressEvents:!0,kill:!1},_revertConfig={suppressEvents:!0},_reservedProps={},_lazyTweens=[],_lazyLookup={},_lastRenderedFrame,_plugins={},_effects={},_nextGCFrame=30,_harnessPlugins=[],_callbackNames="",_harness=function l(e){var n=e[0],t,a;if(_isObject(n)||_isFunction(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(a=_harnessPlugins.length;a--&&!_harnessPlugins[a].targetTest(n););t=_harnessPlugins[a]}for(a=e.length;a--;)e[a]&&(e[a]._gsap||(e[a]._gsap=new GSCache(e[a],t)))||e.splice(a,1);return e},_getCache=function l(e){return e._gsap||_harness(toArray(e))[0]._gsap},_getProperty=function l(e,n,t){return(t=e[n])&&_isFunction(t)?e[n]():_isUndefined(t)&&e.getAttribute&&e.getAttribute(n)||t},_forEachName=function l(e,n){return(e=e.split(",")).forEach(n)||e},_round=function l(e){return Math.round(e*1e5)/1e5||0},_roundPrecise=function l(e){return Math.round(e*1e7)/1e7||0},_parseRelative=function l(e,n){var t=n.charAt(0),a=parseFloat(n.substr(2));return e=parseFloat(e),t==="+"?e+a:t==="-"?e-a:t==="*"?e*a:e/a},_arrayContainsAny=function l(e,n){for(var t=n.length,a=0;e.indexOf(n[a])<0&&++a<t;);return a<t},_lazyRender=function l(){var e=_lazyTweens.length,n=_lazyTweens.slice(0),t,a;for(_lazyLookup={},_lazyTweens.length=0,t=0;t<e;t++)a=n[t],a&&a._lazy&&(a.render(a._lazy[0],a._lazy[1],!0)._lazy=0)},_lazySafeRender=function l(e,n,t,a){_lazyTweens.length&&!_reverting$1&&_lazyRender(),e.render(n,t,a||_reverting$1&&n<0&&(e._initted||e._startAt)),_lazyTweens.length&&!_reverting$1&&_lazyRender()},_numericIfPossible=function l(e){var n=parseFloat(e);return(n||n===0)&&(e+"").match(_delimitedValueExp).length<2?n:_isString(e)?e.trim():e},_passThrough=function l(e){return e},_setDefaults=function l(e,n){for(var t in n)t in e||(e[t]=n[t]);return e},_setKeyframeDefaults=function l(e){return function(n,t){for(var a in t)a in n||a==="duration"&&e||a==="ease"||(n[a]=t[a])}},_merge=function l(e,n){for(var t in n)e[t]=n[t];return e},_mergeDeep=function l(e,n){for(var t in n)t!=="__proto__"&&t!=="constructor"&&t!=="prototype"&&(e[t]=_isObject(n[t])?l(e[t]||(e[t]={}),n[t]):n[t]);return e},_copyExcluding=function l(e,n){var t={},a;for(a in e)a in n||(t[a]=e[a]);return t},_inheritDefaults=function l(e){var n=e.parent||_globalTimeline,t=e.keyframes?_setKeyframeDefaults(_isArray(e.keyframes)):_setDefaults;if(_isNotFalse(e.inherit))for(;n;)t(e,n.vars.defaults),n=n.parent||n._dp;return e},_arraysMatch=function l(e,n){for(var t=e.length,a=t===n.length;a&&t--&&e[t]===n[t];);return t<0},_addLinkedListItem=function l(e,n,t,a,o){t===void 0&&(t="_first"),a===void 0&&(a="_last");var d=e[a],f;if(o)for(f=n[o];d&&d[o]>f;)d=d._prev;return d?(n._next=d._next,d._next=n):(n._next=e[t],e[t]=n),n._next?n._next._prev=n:e[a]=n,n._prev=d,n.parent=n._dp=e,n},_removeLinkedListItem=function l(e,n,t,a){t===void 0&&(t="_first"),a===void 0&&(a="_last");var o=n._prev,d=n._next;o?o._next=d:e[t]===n&&(e[t]=d),d?d._prev=o:e[a]===n&&(e[a]=o),n._next=n._prev=n.parent=null},_removeFromParent=function l(e,n){e.parent&&(!n||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},_uncache=function l(e,n){if(e&&(!n||n._end>e._dur||n._start<0))for(var t=e;t;)t._dirty=1,t=t.parent;return e},_recacheAncestors=function l(e){for(var n=e.parent;n&&n.parent;)n._dirty=1,n.totalDuration(),n=n.parent;return e},_rewindStartAt=function l(e,n,t,a){return e._startAt&&(_reverting$1?e._startAt.revert(_revertConfigNoKill):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(n,!0,a))},_hasNoPausedAncestors=function l(e){return!e||e._ts&&l(e.parent)},_elapsedCycleDuration=function l(e){return e._repeat?_animationCycle(e._tTime,e=e.duration()+e._rDelay)*e:0},_animationCycle=function l(e,n){var t=Math.floor(e/=n);return e&&t===e?t-1:t},_parentToChildTotalTime=function l(e,n){return(e-n._start)*n._ts+(n._ts>=0?0:n._dirty?n.totalDuration():n._tDur)},_setEnd=function l(e){return e._end=_roundPrecise(e._start+(e._tDur/Math.abs(e._ts||e._rts||_tinyNum)||0))},_alignPlayhead=function l(e,n){var t=e._dp;return t&&t.smoothChildTiming&&e._ts&&(e._start=_roundPrecise(t._time-(e._ts>0?n/e._ts:((e._dirty?e.totalDuration():e._tDur)-n)/-e._ts)),_setEnd(e),t._dirty||_uncache(t,e)),e},_postAddChecks=function l(e,n){var t;if((n._time||!n._dur&&n._initted||n._start<e._time&&(n._dur||!n.add))&&(t=_parentToChildTotalTime(e.rawTime(),n),(!n._dur||_clamp(0,n.totalDuration(),t)-n._tTime>_tinyNum)&&n.render(t,!0)),_uncache(e,n)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(t=e;t._dp;)t.rawTime()>=0&&t.totalTime(t._tTime),t=t._dp;e._zTime=-_tinyNum}},_addToTimeline=function l(e,n,t,a){return n.parent&&_removeFromParent(n),n._start=_roundPrecise((_isNumber(t)?t:t||e!==_globalTimeline?_parsePosition(e,t,n):e._time)+n._delay),n._end=_roundPrecise(n._start+(n.totalDuration()/Math.abs(n.timeScale())||0)),_addLinkedListItem(e,n,"_first","_last",e._sort?"_start":0),_isFromOrFromStart(n)||(e._recent=n),a||_postAddChecks(e,n),e._ts<0&&_alignPlayhead(e,e._tTime),e},_scrollTrigger=function l(e,n){return(_globals.ScrollTrigger||_missingPlugin("scrollTrigger",n))&&_globals.ScrollTrigger.create(n,e)},_attemptInitTween=function l(e,n,t,a,o){if(_initTween(e,n,o),!e._initted)return 1;if(!t&&e._pt&&!_reverting$1&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&_lastRenderedFrame!==_ticker.frame)return _lazyTweens.push(e),e._lazy=[o,a],1},_parentPlayheadIsBeforeStart=function l(e){var n=e.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||l(n))},_isFromOrFromStart=function l(e){var n=e.data;return n==="isFromStart"||n==="isStart"},_renderZeroDurationTween=function l(e,n,t,a){var o=e.ratio,d=n<0||!n&&(!e._start&&_parentPlayheadIsBeforeStart(e)&&!(!e._initted&&_isFromOrFromStart(e))||(e._ts<0||e._dp._ts<0)&&!_isFromOrFromStart(e))?0:1,f=e._rDelay,h=0,u,p,_;if(f&&e._repeat&&(h=_clamp(0,e._tDur,n),p=_animationCycle(h,f),e._yoyo&&p&1&&(d=1-d),p!==_animationCycle(e._tTime,f)&&(o=1-d,e.vars.repeatRefresh&&e._initted&&e.invalidate())),d!==o||_reverting$1||a||e._zTime===_tinyNum||!n&&e._zTime){if(!e._initted&&_attemptInitTween(e,n,a,t,h))return;for(_=e._zTime,e._zTime=n||(t?_tinyNum:0),t||(t=n&&!_),e.ratio=d,e._from&&(d=1-d),e._time=0,e._tTime=h,u=e._pt;u;)u.r(d,u.d),u=u._next;n<0&&_rewindStartAt(e,n,t,!0),e._onUpdate&&!t&&_callback(e,"onUpdate"),h&&e._repeat&&!t&&e.parent&&_callback(e,"onRepeat"),(n>=e._tDur||n<0)&&e.ratio===d&&(d&&_removeFromParent(e,1),!t&&!_reverting$1&&(_callback(e,d?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=n)},_findNextPauseTween=function l(e,n,t){var a;if(t>n)for(a=e._first;a&&a._start<=t;){if(a.data==="isPause"&&a._start>n)return a;a=a._next}else for(a=e._last;a&&a._start>=t;){if(a.data==="isPause"&&a._start<n)return a;a=a._prev}},_setDuration=function l(e,n,t,a){var o=e._repeat,d=_roundPrecise(n)||0,f=e._tTime/e._tDur;return f&&!a&&(e._time*=d/e._dur),e._dur=d,e._tDur=o?o<0?1e10:_roundPrecise(d*(o+1)+e._rDelay*o):d,f>0&&!a&&_alignPlayhead(e,e._tTime=e._tDur*f),e.parent&&_setEnd(e),t||_uncache(e.parent,e),e},_onUpdateTotalDuration=function l(e){return e instanceof Timeline?_uncache(e):_setDuration(e,e._dur)},_zeroPosition={_start:0,endTime:_emptyFunc,totalDuration:_emptyFunc},_parsePosition=function l(e,n,t){var a=e.labels,o=e._recent||_zeroPosition,d=e.duration()>=_bigNum$1?o.endTime(!1):e._dur,f,h,u;return _isString(n)&&(isNaN(n)||n in a)?(h=n.charAt(0),u=n.substr(-1)==="%",f=n.indexOf("="),h==="<"||h===">"?(f>=0&&(n=n.replace(/=/,"")),(h==="<"?o._start:o.endTime(o._repeat>=0))+(parseFloat(n.substr(1))||0)*(u?(f<0?o:t).totalDuration()/100:1)):f<0?(n in a||(a[n]=d),a[n]):(h=parseFloat(n.charAt(f-1)+n.substr(f+1)),u&&t&&(h=h/100*(_isArray(t)?t[0]:t).totalDuration()),f>1?l(e,n.substr(0,f-1),t)+h:d+h)):n==null?d:+n},_createTweenType=function l(e,n,t){var a=_isNumber(n[1]),o=(a?2:1)+(e<2?0:1),d=n[o],f,h;if(a&&(d.duration=n[1]),d.parent=t,e){for(f=d,h=t;h&&!("immediateRender"in f);)f=h.vars.defaults||{},h=_isNotFalse(h.vars.inherit)&&h.parent;d.immediateRender=_isNotFalse(f.immediateRender),e<2?d.runBackwards=1:d.startAt=n[o-1]}return new Tween(n[0],d,n[o+1])},_conditionalReturn=function l(e,n){return e||e===0?n(e):n},_clamp=function l(e,n,t){return t<e?e:t>n?n:t},getUnit=function l(e,n){return!_isString(e)||!(n=_unitExp.exec(e))?"":n[1]},clamp=function l(e,n,t){return _conditionalReturn(t,function(a){return _clamp(e,n,a)})},_slice=[].slice,_isArrayLike=function l(e,n){return e&&_isObject(e)&&"length"in e&&(!n&&!e.length||e.length-1 in e&&_isObject(e[0]))&&!e.nodeType&&e!==_win$1},_flatten=function l(e,n,t){return t===void 0&&(t=[]),e.forEach(function(a){var o;return _isString(a)&&!n||_isArrayLike(a,1)?(o=t).push.apply(o,toArray(a)):t.push(a)})||t},toArray=function l(e,n,t){return _context&&!n&&_context.selector?_context.selector(e):_isString(e)&&!t&&(_coreInitted||!_wake())?_slice.call((n||_doc$1).querySelectorAll(e),0):_isArray(e)?_flatten(e,t):_isArrayLike(e)?_slice.call(e,0):e?[e]:[]},selector=function l(e){return e=toArray(e)[0]||_warn("Invalid scope")||{},function(n){var t=e.current||e.nativeElement||e;return toArray(n,t.querySelectorAll?t:t===e?_warn("Invalid scope")||_doc$1.createElement("div"):e)}},shuffle=function l(e){return e.sort(function(){return .5-Math.random()})},distribute=function l(e){if(_isFunction(e))return e;var n=_isObject(e)?e:{each:e},t=_parseEase(n.ease),a=n.from||0,o=parseFloat(n.base)||0,d={},f=a>0&&a<1,h=isNaN(a)||f,u=n.axis,p=a,_=a;return _isString(a)?p=_={center:.5,edges:.5,end:1}[a]||0:!f&&h&&(p=a[0],_=a[1]),function(b,S,E){var g=(E||n).length,v=d[g],T,R,x,C,w,P,D,N,k;if(!v){if(k=n.grid==="auto"?0:(n.grid||[1,_bigNum$1])[1],!k){for(D=-_bigNum$1;D<(D=E[k++].getBoundingClientRect().left)&&k<g;);k<g&&k--}for(v=d[g]=[],T=h?Math.min(k,g)*p-.5:a%k,R=k===_bigNum$1?0:h?g*_/k-.5:a/k|0,D=0,N=_bigNum$1,P=0;P<g;P++)x=P%k-T,C=R-(P/k|0),v[P]=w=u?Math.abs(u==="y"?C:x):_sqrt(x*x+C*C),w>D&&(D=w),w<N&&(N=w);a==="random"&&shuffle(v),v.max=D-N,v.min=N,v.v=g=(parseFloat(n.amount)||parseFloat(n.each)*(k>g?g-1:u?u==="y"?g/k:k:Math.max(k,g/k))||0)*(a==="edges"?-1:1),v.b=g<0?o-g:o,v.u=getUnit(n.amount||n.each)||0,t=t&&g<0?_invertEase(t):t}return g=(v[b]-v.min)/v.max||0,_roundPrecise(v.b+(t?t(g):g)*v.v)+v.u}},_roundModifier=function l(e){var n=Math.pow(10,((e+"").split(".")[1]||"").length);return function(t){var a=_roundPrecise(Math.round(parseFloat(t)/e)*e*n);return(a-a%1)/n+(_isNumber(t)?0:getUnit(t))}},snap=function l(e,n){var t=_isArray(e),a,o;return!t&&_isObject(e)&&(a=t=e.radius||_bigNum$1,e.values?(e=toArray(e.values),(o=!_isNumber(e[0]))&&(a*=a)):e=_roundModifier(e.increment)),_conditionalReturn(n,t?_isFunction(e)?function(d){return o=e(d),Math.abs(o-d)<=a?o:d}:function(d){for(var f=parseFloat(o?d.x:d),h=parseFloat(o?d.y:0),u=_bigNum$1,p=0,_=e.length,b,S;_--;)o?(b=e[_].x-f,S=e[_].y-h,b=b*b+S*S):b=Math.abs(e[_]-f),b<u&&(u=b,p=_);return p=!a||u<=a?e[p]:d,o||p===d||_isNumber(d)?p:p+getUnit(d)}:_roundModifier(e))},random=function l(e,n,t,a){return _conditionalReturn(_isArray(e)?!n:t===!0?!!(t=0):!a,function(){return _isArray(e)?e[~~(Math.random()*e.length)]:(t=t||1e-5)&&(a=t<1?Math.pow(10,(t+"").length-2):1)&&Math.floor(Math.round((e-t/2+Math.random()*(n-e+t*.99))/t)*t*a)/a})},pipe=function l(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return function(a){return n.reduce(function(o,d){return d(o)},a)}},unitize=function l(e,n){return function(t){return e(parseFloat(t))+(n||getUnit(t))}},normalize=function l(e,n,t){return mapRange(e,n,0,1,t)},_wrapArray=function l(e,n,t){return _conditionalReturn(t,function(a){return e[~~n(a)]})},wrap=function l(e,n,t){var a=n-e;return _isArray(e)?_wrapArray(e,l(0,e.length),n):_conditionalReturn(t,function(o){return(a+(o-e)%a)%a+e})},wrapYoyo=function l(e,n,t){var a=n-e,o=a*2;return _isArray(e)?_wrapArray(e,l(0,e.length-1),n):_conditionalReturn(t,function(d){return d=(o+(d-e)%o)%o||0,e+(d>a?o-d:d)})},_replaceRandom=function l(e){for(var n=0,t="",a,o,d,f;~(a=e.indexOf("random(",n));)d=e.indexOf(")",a),f=e.charAt(a+7)==="[",o=e.substr(a+7,d-a-7).match(f?_delimitedValueExp:_strictNumExp),t+=e.substr(n,a-n)+random(f?o:+o[0],f?0:+o[1],+o[2]||1e-5),n=d+1;return t+e.substr(n,e.length-n)},mapRange=function l(e,n,t,a,o){var d=n-e,f=a-t;return _conditionalReturn(o,function(h){return t+((h-e)/d*f||0)})},interpolate=function l(e,n,t,a){var o=isNaN(e+n)?0:function(S){return(1-S)*e+S*n};if(!o){var d=_isString(e),f={},h,u,p,_,b;if(t===!0&&(a=1)&&(t=null),d)e={p:e},n={p:n};else if(_isArray(e)&&!_isArray(n)){for(p=[],_=e.length,b=_-2,u=1;u<_;u++)p.push(l(e[u-1],e[u]));_--,o=function(E){E*=_;var g=Math.min(b,~~E);return p[g](E-g)},t=n}else a||(e=_merge(_isArray(e)?[]:{},e));if(!p){for(h in n)_addPropTween.call(f,e,h,"get",n[h]);o=function(E){return _renderPropTweens(E,f)||(d?e.p:e)}}}return _conditionalReturn(t,o)},_getLabelInDirection=function l(e,n,t){var a=e.labels,o=_bigNum$1,d,f,h;for(d in a)f=a[d]-n,f<0==!!t&&f&&o>(f=Math.abs(f))&&(h=d,o=f);return h},_callback=function l(e,n,t){var a=e.vars,o=a[n],d=_context,f=e._ctx,h,u,p;if(o)return h=a[n+"Params"],u=a.callbackScope||e,t&&_lazyTweens.length&&_lazyRender(),f&&(_context=f),p=h?o.apply(u,h):o.call(u),_context=d,p},_interrupt=function l(e){return _removeFromParent(e),e.scrollTrigger&&e.scrollTrigger.kill(!!_reverting$1),e.progress()<1&&_callback(e,"onInterrupt"),e},_quickTween,_registerPluginQueue=[],_createPlugin=function l(e){if(_windowExists$1()&&e){e=!e.name&&e.default||e;var n=e.name,t=_isFunction(e),a=n&&!t&&e.init?function(){this._props=[]}:e,o={init:_emptyFunc,render:_renderPropTweens,add:_addPropTween,kill:_killPropTweensOf,modifier:_addPluginModifier,rawVars:0},d={targetTest:0,get:0,getSetter:_getSetter,aliases:{},register:0};if(_wake(),e!==a){if(_plugins[n])return;_setDefaults(a,_setDefaults(_copyExcluding(e,o),d)),_merge(a.prototype,_merge(o,_copyExcluding(e,d))),_plugins[a.prop=n]=a,e.targetTest&&(_harnessPlugins.push(a),_reservedProps[n]=1),n=(n==="css"?"CSS":n.charAt(0).toUpperCase()+n.substr(1))+"Plugin"}_addGlobal(n,a),e.register&&e.register(gsap,a,PropTween)}else e&&_registerPluginQueue.push(e)},_255=255,_colorLookup={aqua:[0,_255,_255],lime:[0,_255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,_255],navy:[0,0,128],white:[_255,_255,_255],olive:[128,128,0],yellow:[_255,_255,0],orange:[_255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[_255,0,0],pink:[_255,192,203],cyan:[0,_255,_255],transparent:[_255,_255,_255,0]},_hue=function l(e,n,t){return e+=e<0?1:e>1?-1:0,(e*6<1?n+(t-n)*e*6:e<.5?t:e*3<2?n+(t-n)*(2/3-e)*6:n)*_255+.5|0},splitColor=function l(e,n,t){var a=e?_isNumber(e)?[e>>16,e>>8&_255,e&_255]:0:_colorLookup.black,o,d,f,h,u,p,_,b,S,E;if(!a){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),_colorLookup[e])a=_colorLookup[e];else if(e.charAt(0)==="#"){if(e.length<6&&(o=e.charAt(1),d=e.charAt(2),f=e.charAt(3),e="#"+o+o+d+d+f+f+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return a=parseInt(e.substr(1,6),16),[a>>16,a>>8&_255,a&_255,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),a=[e>>16,e>>8&_255,e&_255]}else if(e.substr(0,3)==="hsl"){if(a=E=e.match(_strictNumExp),!n)h=+a[0]%360/360,u=+a[1]/100,p=+a[2]/100,d=p<=.5?p*(u+1):p+u-p*u,o=p*2-d,a.length>3&&(a[3]*=1),a[0]=_hue(h+1/3,o,d),a[1]=_hue(h,o,d),a[2]=_hue(h-1/3,o,d);else if(~e.indexOf("="))return a=e.match(_numExp),t&&a.length<4&&(a[3]=1),a}else a=e.match(_strictNumExp)||_colorLookup.transparent;a=a.map(Number)}return n&&!E&&(o=a[0]/_255,d=a[1]/_255,f=a[2]/_255,_=Math.max(o,d,f),b=Math.min(o,d,f),p=(_+b)/2,_===b?h=u=0:(S=_-b,u=p>.5?S/(2-_-b):S/(_+b),h=_===o?(d-f)/S+(d<f?6:0):_===d?(f-o)/S+2:(o-d)/S+4,h*=60),a[0]=~~(h+.5),a[1]=~~(u*100+.5),a[2]=~~(p*100+.5)),t&&a.length<4&&(a[3]=1),a},_colorOrderData=function l(e){var n=[],t=[],a=-1;return e.split(_colorExp).forEach(function(o){var d=o.match(_numWithUnitExp)||[];n.push.apply(n,d),t.push(a+=d.length+1)}),n.c=t,n},_formatColors=function l(e,n,t){var a="",o=(e+a).match(_colorExp),d=n?"hsla(":"rgba(",f=0,h,u,p,_;if(!o)return e;if(o=o.map(function(b){return(b=splitColor(b,n,1))&&d+(n?b[0]+","+b[1]+"%,"+b[2]+"%,"+b[3]:b.join(","))+")"}),t&&(p=_colorOrderData(e),h=t.c,h.join(a)!==p.c.join(a)))for(u=e.replace(_colorExp,"1").split(_numWithUnitExp),_=u.length-1;f<_;f++)a+=u[f]+(~h.indexOf(f)?o.shift()||d+"0,0,0,0)":(p.length?p:o.length?o:t).shift());if(!u)for(u=e.split(_colorExp),_=u.length-1;f<_;f++)a+=u[f]+o[f];return a+u[_]},_colorExp=function(){var l="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",e;for(e in _colorLookup)l+="|"+e+"\\b";return new RegExp(l+")","gi")}(),_hslExp=/hsl[a]?\(/,_colorStringFilter=function l(e){var n=e.join(" "),t;if(_colorExp.lastIndex=0,_colorExp.test(n))return t=_hslExp.test(n),e[1]=_formatColors(e[1],t),e[0]=_formatColors(e[0],t,_colorOrderData(e[1])),!0},_tickerActive,_ticker=function(){var l=Date.now,e=500,n=33,t=l(),a=t,o=1e3/240,d=o,f=[],h,u,p,_,b,S,E=function g(v){var T=l()-a,R=v===!0,x,C,w,P;if(T>e&&(t+=T-n),a+=T,w=a-t,x=w-d,(x>0||R)&&(P=++_.frame,b=w-_.time*1e3,_.time=w=w/1e3,d+=x+(x>=o?4:o-x),C=1),R||(h=u(g)),C)for(S=0;S<f.length;S++)f[S](w,b,P,v)};return _={time:0,frame:0,tick:function(){E(!0)},deltaRatio:function(v){return b/(1e3/(v||60))},wake:function(){_coreReady&&(!_coreInitted&&_windowExists$1()&&(_win$1=_coreInitted=window,_doc$1=_win$1.document||{},_globals.gsap=gsap,(_win$1.gsapVersions||(_win$1.gsapVersions=[])).push(gsap.version),_install(_installScope||_win$1.GreenSockGlobals||!_win$1.gsap&&_win$1||{}),p=_win$1.requestAnimationFrame,_registerPluginQueue.forEach(_createPlugin)),h&&_.sleep(),u=p||function(v){return setTimeout(v,d-_.time*1e3+1|0)},_tickerActive=1,E(2))},sleep:function(){(p?_win$1.cancelAnimationFrame:clearTimeout)(h),_tickerActive=0,u=_emptyFunc},lagSmoothing:function(v,T){e=v||1/0,n=Math.min(T||33,e)},fps:function(v){o=1e3/(v||240),d=_.time*1e3+o},add:function(v,T,R){var x=T?function(C,w,P,D){v(C,w,P,D),_.remove(x)}:v;return _.remove(v),f[R?"unshift":"push"](x),_wake(),x},remove:function(v,T){~(T=f.indexOf(v))&&f.splice(T,1)&&S>=T&&S--},_listeners:f},_}(),_wake=function l(){return!_tickerActive&&_ticker.wake()},_easeMap={},_customEaseExp=/^[\d.\-M][\d.\-,\s]/,_quotesExp=/["']/g,_parseObjectInString=function l(e){for(var n={},t=e.substr(1,e.length-3).split(":"),a=t[0],o=1,d=t.length,f,h,u;o<d;o++)h=t[o],f=o!==d-1?h.lastIndexOf(","):h.length,u=h.substr(0,f),n[a]=isNaN(u)?u.replace(_quotesExp,"").trim():+u,a=h.substr(f+1).trim();return n},_valueInParentheses=function l(e){var n=e.indexOf("(")+1,t=e.indexOf(")"),a=e.indexOf("(",n);return e.substring(n,~a&&a<t?e.indexOf(")",t+1):t)},_configEaseFromString=function l(e){var n=(e+"").split("("),t=_easeMap[n[0]];return t&&n.length>1&&t.config?t.config.apply(null,~e.indexOf("{")?[_parseObjectInString(n[1])]:_valueInParentheses(e).split(",").map(_numericIfPossible)):_easeMap._CE&&_customEaseExp.test(e)?_easeMap._CE("",e):t},_invertEase=function l(e){return function(n){return 1-e(1-n)}},_propagateYoyoEase=function l(e,n){for(var t=e._first,a;t;)t instanceof Timeline?l(t,n):t.vars.yoyoEase&&(!t._yoyo||!t._repeat)&&t._yoyo!==n&&(t.timeline?l(t.timeline,n):(a=t._ease,t._ease=t._yEase,t._yEase=a,t._yoyo=n)),t=t._next},_parseEase=function l(e,n){return e&&(_isFunction(e)?e:_easeMap[e]||_configEaseFromString(e))||n},_insertEase=function l(e,n,t,a){t===void 0&&(t=function(h){return 1-n(1-h)}),a===void 0&&(a=function(h){return h<.5?n(h*2)/2:1-n((1-h)*2)/2});var o={easeIn:n,easeOut:t,easeInOut:a},d;return _forEachName(e,function(f){_easeMap[f]=_globals[f]=o,_easeMap[d=f.toLowerCase()]=t;for(var h in o)_easeMap[d+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=_easeMap[f+"."+h]=o[h]}),o},_easeInOutFromOut=function l(e){return function(n){return n<.5?(1-e(1-n*2))/2:.5+e((n-.5)*2)/2}},_configElastic=function l(e,n,t){var a=n>=1?n:1,o=(t||(e?.3:.45))/(n<1?n:1),d=o/_2PI*(Math.asin(1/a)||0),f=function(p){return p===1?1:a*Math.pow(2,-10*p)*_sin((p-d)*o)+1},h=e==="out"?f:e==="in"?function(u){return 1-f(1-u)}:_easeInOutFromOut(f);return o=_2PI/o,h.config=function(u,p){return l(e,u,p)},h},_configBack=function l(e,n){n===void 0&&(n=1.70158);var t=function(d){return d?--d*d*((n+1)*d+n)+1:0},a=e==="out"?t:e==="in"?function(o){return 1-t(1-o)}:_easeInOutFromOut(t);return a.config=function(o){return l(e,o)},a};_forEachName("Linear,Quad,Cubic,Quart,Quint,Strong",function(l,e){var n=e<5?e+1:e;_insertEase(l+",Power"+(n-1),e?function(t){return Math.pow(t,n)}:function(t){return t},function(t){return 1-Math.pow(1-t,n)},function(t){return t<.5?Math.pow(t*2,n)/2:1-Math.pow((1-t)*2,n)/2})});_easeMap.Linear.easeNone=_easeMap.none=_easeMap.Linear.easeIn;_insertEase("Elastic",_configElastic("in"),_configElastic("out"),_configElastic());(function(l,e){var n=1/e,t=2*n,a=2.5*n,o=function(f){return f<n?l*f*f:f<t?l*Math.pow(f-1.5/e,2)+.75:f<a?l*(f-=2.25/e)*f+.9375:l*Math.pow(f-2.625/e,2)+.984375};_insertEase("Bounce",function(d){return 1-o(1-d)},o)})(7.5625,2.75);_insertEase("Expo",function(l){return l?Math.pow(2,10*(l-1)):0});_insertEase("Circ",function(l){return-(_sqrt(1-l*l)-1)});_insertEase("Sine",function(l){return l===1?1:-_cos(l*_HALF_PI)+1});_insertEase("Back",_configBack("in"),_configBack("out"),_configBack());_easeMap.SteppedEase=_easeMap.steps=_globals.SteppedEase={config:function l(e,n){e===void 0&&(e=1);var t=1/e,a=e+(n?0:1),o=n?1:0,d=1-_tinyNum;return function(f){return((a*_clamp(0,d,f)|0)+o)*t}}};_defaults.ease=_easeMap["quad.out"];_forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(l){return _callbackNames+=l+","+l+"Params,"});var GSCache=function l(e,n){this.id=_gsID++,e._gsap=this,this.target=e,this.harness=n,this.get=n?n.get:_getProperty,this.set=n?n.getSetter:_getSetter},Animation$1=function(){function l(n){this.vars=n,this._delay=+n.delay||0,(this._repeat=n.repeat===1/0?-2:n.repeat||0)&&(this._rDelay=n.repeatDelay||0,this._yoyo=!!n.yoyo||!!n.yoyoEase),this._ts=1,_setDuration(this,+n.duration,1,1),this.data=n.data,_context&&(this._ctx=_context,_context.data.push(this)),_tickerActive||_ticker.wake()}var e=l.prototype;return e.delay=function(t){return t||t===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+t-this._delay),this._delay=t,this):this._delay},e.duration=function(t){return arguments.length?this.totalDuration(this._repeat>0?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},e.totalDuration=function(t){return arguments.length?(this._dirty=0,_setDuration(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(t,a){if(_wake(),!arguments.length)return this._tTime;var o=this._dp;if(o&&o.smoothChildTiming&&this._ts){for(_alignPlayhead(this,t),!o._dp||o.parent||_postAddChecks(o,this);o&&o.parent;)o.parent._time!==o._start+(o._ts>=0?o._tTime/o._ts:(o.totalDuration()-o._tTime)/-o._ts)&&o.totalTime(o._tTime,!0),o=o.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&t<this._tDur||this._ts<0&&t>0||!this._tDur&&!t)&&_addToTimeline(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!a||this._initted&&Math.abs(this._zTime)===_tinyNum||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),_lazySafeRender(this,t,a)),this},e.time=function(t,a){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+_elapsedCycleDuration(this))%(this._dur+this._rDelay)||(t?this._dur:0),a):this._time},e.totalProgress=function(t,a){return arguments.length?this.totalTime(this.totalDuration()*t,a):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},e.progress=function(t,a){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-t:t)+_elapsedCycleDuration(this),a):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(t,a){var o=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*o,a):this._repeat?_animationCycle(this._tTime,o)+1:1},e.timeScale=function(t,a){if(!arguments.length)return this._rts===-_tinyNum?0:this._rts;if(this._rts===t)return this;var o=this.parent&&this._ts?_parentToChildTotalTime(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||t===-_tinyNum?0:this._rts,this.totalTime(_clamp(-Math.abs(this._delay),this._tDur,o),a!==!1),_setEnd(this),_recacheAncestors(this)},e.paused=function(t){return arguments.length?(this._ps!==t&&(this._ps=t,t?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(_wake(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==_tinyNum&&(this._tTime-=_tinyNum)))),this):this._ps},e.startTime=function(t){if(arguments.length){this._start=t;var a=this.parent||this._dp;return a&&(a._sort||!this.parent)&&_addToTimeline(a,this,t-this._delay),this}return this._start},e.endTime=function(t){return this._start+(_isNotFalse(t)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(t){var a=this.parent||this._dp;return a?t&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?_parentToChildTotalTime(a.rawTime(t),this):this._tTime:this._tTime},e.revert=function(t){t===void 0&&(t=_revertConfig);var a=_reverting$1;return _reverting$1=t,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(t),this.totalTime(-.01,t.suppressEvents)),this.data!=="nested"&&t.kill!==!1&&this.kill(),_reverting$1=a,this},e.globalTime=function(t){for(var a=this,o=arguments.length?t:a.rawTime();a;)o=a._start+o/(Math.abs(a._ts)||1),a=a._dp;return!this.parent&&this._sat?this._sat.globalTime(t):o},e.repeat=function(t){return arguments.length?(this._repeat=t===1/0?-2:t,_onUpdateTotalDuration(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(t){if(arguments.length){var a=this._time;return this._rDelay=t,_onUpdateTotalDuration(this),a?this.time(a):this}return this._rDelay},e.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},e.seek=function(t,a){return this.totalTime(_parsePosition(this,t),_isNotFalse(a))},e.restart=function(t,a){return this.play().totalTime(t?-this._delay:0,_isNotFalse(a))},e.play=function(t,a){return t!=null&&this.seek(t,a),this.reversed(!1).paused(!1)},e.reverse=function(t,a){return t!=null&&this.seek(t||this.totalDuration(),a),this.reversed(!0).paused(!1)},e.pause=function(t,a){return t!=null&&this.seek(t,a),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-_tinyNum:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-_tinyNum,this},e.isActive=function(){var t=this.parent||this._dp,a=this._start,o;return!!(!t||this._ts&&this._initted&&t.isActive()&&(o=t.rawTime(!0))>=a&&o<this.endTime(!0)-_tinyNum)},e.eventCallback=function(t,a,o){var d=this.vars;return arguments.length>1?(a?(d[t]=a,o&&(d[t+"Params"]=o),t==="onUpdate"&&(this._onUpdate=a)):delete d[t],this):d[t]},e.then=function(t){var a=this;return new Promise(function(o){var d=_isFunction(t)?t:_passThrough,f=function(){var u=a.then;a.then=null,_isFunction(d)&&(d=d(a))&&(d.then||d===a)&&(a.then=u),o(d),a.then=u};a._initted&&a.totalProgress()===1&&a._ts>=0||!a._tTime&&a._ts<0?f():a._prom=f})},e.kill=function(){_interrupt(this)},l}();_setDefaults(Animation$1.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-_tinyNum,_prom:0,_ps:!1,_rts:1});var Timeline=function(l){_inheritsLoose(e,l);function e(t,a){var o;return t===void 0&&(t={}),o=l.call(this,t)||this,o.labels={},o.smoothChildTiming=!!t.smoothChildTiming,o.autoRemoveChildren=!!t.autoRemoveChildren,o._sort=_isNotFalse(t.sortChildren),_globalTimeline&&_addToTimeline(t.parent||_globalTimeline,_assertThisInitialized(o),a),t.reversed&&o.reverse(),t.paused&&o.paused(!0),t.scrollTrigger&&_scrollTrigger(_assertThisInitialized(o),t.scrollTrigger),o}var n=e.prototype;return n.to=function(a,o,d){return _createTweenType(0,arguments,this),this},n.from=function(a,o,d){return _createTweenType(1,arguments,this),this},n.fromTo=function(a,o,d,f){return _createTweenType(2,arguments,this),this},n.set=function(a,o,d){return o.duration=0,o.parent=this,_inheritDefaults(o).repeatDelay||(o.repeat=0),o.immediateRender=!!o.immediateRender,new Tween(a,o,_parsePosition(this,d),1),this},n.call=function(a,o,d){return _addToTimeline(this,Tween.delayedCall(0,a,o),d)},n.staggerTo=function(a,o,d,f,h,u,p){return d.duration=o,d.stagger=d.stagger||f,d.onComplete=u,d.onCompleteParams=p,d.parent=this,new Tween(a,d,_parsePosition(this,h)),this},n.staggerFrom=function(a,o,d,f,h,u,p){return d.runBackwards=1,_inheritDefaults(d).immediateRender=_isNotFalse(d.immediateRender),this.staggerTo(a,o,d,f,h,u,p)},n.staggerFromTo=function(a,o,d,f,h,u,p,_){return f.startAt=d,_inheritDefaults(f).immediateRender=_isNotFalse(f.immediateRender),this.staggerTo(a,o,f,h,u,p,_)},n.render=function(a,o,d){var f=this._time,h=this._dirty?this.totalDuration():this._tDur,u=this._dur,p=a<=0?0:_roundPrecise(a),_=this._zTime<0!=a<0&&(this._initted||!u),b,S,E,g,v,T,R,x,C,w,P,D;if(this!==_globalTimeline&&p>h&&a>=0&&(p=h),p!==this._tTime||d||_){if(f!==this._time&&u&&(p+=this._time-f,a+=this._time-f),b=p,C=this._start,x=this._ts,T=!x,_&&(u||(f=this._zTime),(a||!o)&&(this._zTime=a)),this._repeat){if(P=this._yoyo,v=u+this._rDelay,this._repeat<-1&&a<0)return this.totalTime(v*100+a,o,d);if(b=_roundPrecise(p%v),p===h?(g=this._repeat,b=u):(g=~~(p/v),g&&g===p/v&&(b=u,g--),b>u&&(b=u)),w=_animationCycle(this._tTime,v),!f&&this._tTime&&w!==g&&this._tTime-w*v-this._dur<=0&&(w=g),P&&g&1&&(b=u-b,D=1),g!==w&&!this._lock){var N=P&&w&1,k=N===(P&&g&1);if(g<w&&(N=!N),f=N?0:p%u?u:p,this._lock=1,this.render(f||(D?0:_roundPrecise(g*v)),o,!u)._lock=0,this._tTime=p,!o&&this.parent&&_callback(this,"onRepeat"),this.vars.repeatRefresh&&!D&&(this.invalidate()._lock=1),f&&f!==this._time||T!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(u=this._dur,h=this._tDur,k&&(this._lock=2,f=N?u:-1e-4,this.render(f,!0),this.vars.repeatRefresh&&!D&&this.invalidate()),this._lock=0,!this._ts&&!T)return this;_propagateYoyoEase(this,D)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(R=_findNextPauseTween(this,_roundPrecise(f),_roundPrecise(b)),R&&(p-=b-(b=R._start))),this._tTime=p,this._time=b,this._act=!x,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=a,f=0),!f&&b&&!o&&!g&&(_callback(this,"onStart"),this._tTime!==p))return this;if(b>=f&&a>=0)for(S=this._first;S;){if(E=S._next,(S._act||b>=S._start)&&S._ts&&R!==S){if(S.parent!==this)return this.render(a,o,d);if(S.render(S._ts>0?(b-S._start)*S._ts:(S._dirty?S.totalDuration():S._tDur)+(b-S._start)*S._ts,o,d),b!==this._time||!this._ts&&!T){R=0,E&&(p+=this._zTime=-_tinyNum);break}}S=E}else{S=this._last;for(var F=a<0?a:b;S;){if(E=S._prev,(S._act||F<=S._end)&&S._ts&&R!==S){if(S.parent!==this)return this.render(a,o,d);if(S.render(S._ts>0?(F-S._start)*S._ts:(S._dirty?S.totalDuration():S._tDur)+(F-S._start)*S._ts,o,d||_reverting$1&&(S._initted||S._startAt)),b!==this._time||!this._ts&&!T){R=0,E&&(p+=this._zTime=F?-_tinyNum:_tinyNum);break}}S=E}}if(R&&!o&&(this.pause(),R.render(b>=f?0:-_tinyNum)._zTime=b>=f?1:-1,this._ts))return this._start=C,_setEnd(this),this.render(a,o,d);this._onUpdate&&!o&&_callback(this,"onUpdate",!0),(p===h&&this._tTime>=this.totalDuration()||!p&&f)&&(C===this._start||Math.abs(x)!==Math.abs(this._ts))&&(this._lock||((a||!u)&&(p===h&&this._ts>0||!p&&this._ts<0)&&_removeFromParent(this,1),!o&&!(a<0&&!f)&&(p||f||!h)&&(_callback(this,p===h&&a>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(p<h&&this.timeScale()>0)&&this._prom())))}return this},n.add=function(a,o){var d=this;if(_isNumber(o)||(o=_parsePosition(this,o,a)),!(a instanceof Animation$1)){if(_isArray(a))return a.forEach(function(f){return d.add(f,o)}),this;if(_isString(a))return this.addLabel(a,o);if(_isFunction(a))a=Tween.delayedCall(0,a);else return this}return this!==a?_addToTimeline(this,a,o):this},n.getChildren=function(a,o,d,f){a===void 0&&(a=!0),o===void 0&&(o=!0),d===void 0&&(d=!0),f===void 0&&(f=-_bigNum$1);for(var h=[],u=this._first;u;)u._start>=f&&(u instanceof Tween?o&&h.push(u):(d&&h.push(u),a&&h.push.apply(h,u.getChildren(!0,o,d)))),u=u._next;return h},n.getById=function(a){for(var o=this.getChildren(1,1,1),d=o.length;d--;)if(o[d].vars.id===a)return o[d]},n.remove=function(a){return _isString(a)?this.removeLabel(a):_isFunction(a)?this.killTweensOf(a):(_removeLinkedListItem(this,a),a===this._recent&&(this._recent=this._last),_uncache(this))},n.totalTime=function(a,o){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=_roundPrecise(_ticker.time-(this._ts>0?a/this._ts:(this.totalDuration()-a)/-this._ts))),l.prototype.totalTime.call(this,a,o),this._forcing=0,this):this._tTime},n.addLabel=function(a,o){return this.labels[a]=_parsePosition(this,o),this},n.removeLabel=function(a){return delete this.labels[a],this},n.addPause=function(a,o,d){var f=Tween.delayedCall(0,o||_emptyFunc,d);return f.data="isPause",this._hasPause=1,_addToTimeline(this,f,_parsePosition(this,a))},n.removePause=function(a){var o=this._first;for(a=_parsePosition(this,a);o;)o._start===a&&o.data==="isPause"&&_removeFromParent(o),o=o._next},n.killTweensOf=function(a,o,d){for(var f=this.getTweensOf(a,d),h=f.length;h--;)_overwritingTween!==f[h]&&f[h].kill(a,o);return this},n.getTweensOf=function(a,o){for(var d=[],f=toArray(a),h=this._first,u=_isNumber(o),p;h;)h instanceof Tween?_arrayContainsAny(h._targets,f)&&(u?(!_overwritingTween||h._initted&&h._ts)&&h.globalTime(0)<=o&&h.globalTime(h.totalDuration())>o:!o||h.isActive())&&d.push(h):(p=h.getTweensOf(f,o)).length&&d.push.apply(d,p),h=h._next;return d},n.tweenTo=function(a,o){o=o||{};var d=this,f=_parsePosition(d,a),h=o,u=h.startAt,p=h.onStart,_=h.onStartParams,b=h.immediateRender,S,E=Tween.to(d,_setDefaults({ease:o.ease||"none",lazy:!1,immediateRender:!1,time:f,overwrite:"auto",duration:o.duration||Math.abs((f-(u&&"time"in u?u.time:d._time))/d.timeScale())||_tinyNum,onStart:function(){if(d.pause(),!S){var v=o.duration||Math.abs((f-(u&&"time"in u?u.time:d._time))/d.timeScale());E._dur!==v&&_setDuration(E,v,0,1).render(E._time,!0,!0),S=1}p&&p.apply(E,_||[])}},o));return b?E.render(0):E},n.tweenFromTo=function(a,o,d){return this.tweenTo(o,_setDefaults({startAt:{time:_parsePosition(this,a)}},d))},n.recent=function(){return this._recent},n.nextLabel=function(a){return a===void 0&&(a=this._time),_getLabelInDirection(this,_parsePosition(this,a))},n.previousLabel=function(a){return a===void 0&&(a=this._time),_getLabelInDirection(this,_parsePosition(this,a),1)},n.currentLabel=function(a){return arguments.length?this.seek(a,!0):this.previousLabel(this._time+_tinyNum)},n.shiftChildren=function(a,o,d){d===void 0&&(d=0);for(var f=this._first,h=this.labels,u;f;)f._start>=d&&(f._start+=a,f._end+=a),f=f._next;if(o)for(u in h)h[u]>=d&&(h[u]+=a);return _uncache(this)},n.invalidate=function(a){var o=this._first;for(this._lock=0;o;)o.invalidate(a),o=o._next;return l.prototype.invalidate.call(this,a)},n.clear=function(a){a===void 0&&(a=!0);for(var o=this._first,d;o;)d=o._next,this.remove(o),o=d;return this._dp&&(this._time=this._tTime=this._pTime=0),a&&(this.labels={}),_uncache(this)},n.totalDuration=function(a){var o=0,d=this,f=d._last,h=_bigNum$1,u,p,_;if(arguments.length)return d.timeScale((d._repeat<0?d.duration():d.totalDuration())/(d.reversed()?-a:a));if(d._dirty){for(_=d.parent;f;)u=f._prev,f._dirty&&f.totalDuration(),p=f._start,p>h&&d._sort&&f._ts&&!d._lock?(d._lock=1,_addToTimeline(d,f,p-f._delay,1)._lock=0):h=p,p<0&&f._ts&&(o-=p,(!_&&!d._dp||_&&_.smoothChildTiming)&&(d._start+=p/d._ts,d._time-=p,d._tTime-=p),d.shiftChildren(-p,!1,-1/0),h=0),f._end>o&&f._ts&&(o=f._end),f=u;_setDuration(d,d===_globalTimeline&&d._time>o?d._time:o,1,1),d._dirty=0}return d._tDur},e.updateRoot=function(a){if(_globalTimeline._ts&&(_lazySafeRender(_globalTimeline,_parentToChildTotalTime(a,_globalTimeline)),_lastRenderedFrame=_ticker.frame),_ticker.frame>=_nextGCFrame){_nextGCFrame+=_config.autoSleep||120;var o=_globalTimeline._first;if((!o||!o._ts)&&_config.autoSleep&&_ticker._listeners.length<2){for(;o&&!o._ts;)o=o._next;o||_ticker.sleep()}}},e}(Animation$1);_setDefaults(Timeline.prototype,{_lock:0,_hasPause:0,_forcing:0});var _addComplexStringPropTween=function l(e,n,t,a,o,d,f){var h=new PropTween(this._pt,e,n,0,1,_renderComplexString,null,o),u=0,p=0,_,b,S,E,g,v,T,R;for(h.b=t,h.e=a,t+="",a+="",(T=~a.indexOf("random("))&&(a=_replaceRandom(a)),d&&(R=[t,a],d(R,e,n),t=R[0],a=R[1]),b=t.match(_complexStringNumExp)||[];_=_complexStringNumExp.exec(a);)E=_[0],g=a.substring(u,_.index),S?S=(S+1)%5:g.substr(-5)==="rgba("&&(S=1),E!==b[p++]&&(v=parseFloat(b[p-1])||0,h._pt={_next:h._pt,p:g||p===1?g:",",s:v,c:E.charAt(1)==="="?_parseRelative(v,E)-v:parseFloat(E)-v,m:S&&S<4?Math.round:0},u=_complexStringNumExp.lastIndex);return h.c=u<a.length?a.substring(u,a.length):"",h.fp=f,(_relExp.test(a)||T)&&(h.e=0),this._pt=h,h},_addPropTween=function l(e,n,t,a,o,d,f,h,u,p){_isFunction(a)&&(a=a(o||0,e,d));var _=e[n],b=t!=="get"?t:_isFunction(_)?u?e[n.indexOf("set")||!_isFunction(e["get"+n.substr(3)])?n:"get"+n.substr(3)](u):e[n]():_,S=_isFunction(_)?u?_setterFuncWithParam:_setterFunc:_setterPlain,E;if(_isString(a)&&(~a.indexOf("random(")&&(a=_replaceRandom(a)),a.charAt(1)==="="&&(E=_parseRelative(b,a)+(getUnit(b)||0),(E||E===0)&&(a=E))),!p||b!==a||_forceAllPropTweens)return!isNaN(b*a)&&a!==""?(E=new PropTween(this._pt,e,n,+b||0,a-(b||0),typeof _=="boolean"?_renderBoolean:_renderPlain,0,S),u&&(E.fp=u),f&&E.modifier(f,this,e),this._pt=E):(!_&&!(n in e)&&_missingPlugin(n,a),_addComplexStringPropTween.call(this,e,n,b,a,S,h||_config.stringFilter,u))},_processVars=function l(e,n,t,a,o){if(_isFunction(e)&&(e=_parseFuncOrString(e,o,n,t,a)),!_isObject(e)||e.style&&e.nodeType||_isArray(e)||_isTypedArray(e))return _isString(e)?_parseFuncOrString(e,o,n,t,a):e;var d={},f;for(f in e)d[f]=_parseFuncOrString(e[f],o,n,t,a);return d},_checkPlugin=function l(e,n,t,a,o,d){var f,h,u,p;if(_plugins[e]&&(f=new _plugins[e]).init(o,f.rawVars?n[e]:_processVars(n[e],a,o,d,t),t,a,d)!==!1&&(t._pt=h=new PropTween(t._pt,o,e,0,1,f.render,f,0,f.priority),t!==_quickTween))for(u=t._ptLookup[t._targets.indexOf(o)],p=f._props.length;p--;)u[f._props[p]]=h;return f},_overwritingTween,_forceAllPropTweens,_initTween=function l(e,n,t){var a=e.vars,o=a.ease,d=a.startAt,f=a.immediateRender,h=a.lazy,u=a.onUpdate,p=a.runBackwards,_=a.yoyoEase,b=a.keyframes,S=a.autoRevert,E=e._dur,g=e._startAt,v=e._targets,T=e.parent,R=T&&T.data==="nested"?T.vars.targets:v,x=e._overwrite==="auto"&&!_suppressOverwrites,C=e.timeline,w,P,D,N,k,F,M,U,$,B,J,ne,ie;if(C&&(!b||!o)&&(o="none"),e._ease=_parseEase(o,_defaults.ease),e._yEase=_?_invertEase(_parseEase(_===!0?o:_,_defaults.ease)):0,_&&e._yoyo&&!e._repeat&&(_=e._yEase,e._yEase=e._ease,e._ease=_),e._from=!C&&!!a.runBackwards,!C||b&&!a.stagger){if(U=v[0]?_getCache(v[0]).harness:0,ne=U&&a[U.prop],w=_copyExcluding(a,_reservedProps),g&&(g._zTime<0&&g.progress(1),n<0&&p&&f&&!S?g.render(-1,!0):g.revert(p&&E?_revertConfigNoKill:_startAtRevertConfig),g._lazy=0),d){if(_removeFromParent(e._startAt=Tween.set(v,_setDefaults({data:"isStart",overwrite:!1,parent:T,immediateRender:!0,lazy:!g&&_isNotFalse(h),startAt:null,delay:0,onUpdate:u&&function(){return _callback(e,"onUpdate")},stagger:0},d))),e._startAt._dp=0,e._startAt._sat=e,n<0&&(_reverting$1||!f&&!S)&&e._startAt.revert(_revertConfigNoKill),f&&E&&n<=0&&t<=0){n&&(e._zTime=n);return}}else if(p&&E&&!g){if(n&&(f=!1),D=_setDefaults({overwrite:!1,data:"isFromStart",lazy:f&&!g&&_isNotFalse(h),immediateRender:f,stagger:0,parent:T},w),ne&&(D[U.prop]=ne),_removeFromParent(e._startAt=Tween.set(v,D)),e._startAt._dp=0,e._startAt._sat=e,n<0&&(_reverting$1?e._startAt.revert(_revertConfigNoKill):e._startAt.render(-1,!0)),e._zTime=n,!f)l(e._startAt,_tinyNum,_tinyNum);else if(!n)return}for(e._pt=e._ptCache=0,h=E&&_isNotFalse(h)||h&&!E,P=0;P<v.length;P++){if(k=v[P],M=k._gsap||_harness(v)[P]._gsap,e._ptLookup[P]=B={},_lazyLookup[M.id]&&_lazyTweens.length&&_lazyRender(),J=R===v?P:R.indexOf(k),U&&($=new U).init(k,ne||w,e,J,R)!==!1&&(e._pt=N=new PropTween(e._pt,k,$.name,0,1,$.render,$,0,$.priority),$._props.forEach(function(Y){B[Y]=N}),$.priority&&(F=1)),!U||ne)for(D in w)_plugins[D]&&($=_checkPlugin(D,w,e,J,k,R))?$.priority&&(F=1):B[D]=N=_addPropTween.call(e,k,D,"get",w[D],J,R,0,a.stringFilter);e._op&&e._op[P]&&e.kill(k,e._op[P]),x&&e._pt&&(_overwritingTween=e,_globalTimeline.killTweensOf(k,B,e.globalTime(n)),ie=!e.parent,_overwritingTween=0),e._pt&&h&&(_lazyLookup[M.id]=1)}F&&_sortPropTweensByPriority(e),e._onInit&&e._onInit(e)}e._onUpdate=u,e._initted=(!e._op||e._pt)&&!ie,b&&n<=0&&C.render(_bigNum$1,!0,!0)},_updatePropTweens=function l(e,n,t,a,o,d,f,h){var u=(e._pt&&e._ptCache||(e._ptCache={}))[n],p,_,b,S;if(!u)for(u=e._ptCache[n]=[],b=e._ptLookup,S=e._targets.length;S--;){if(p=b[S][n],p&&p.d&&p.d._pt)for(p=p.d._pt;p&&p.p!==n&&p.fp!==n;)p=p._next;if(!p)return _forceAllPropTweens=1,e.vars[n]="+=0",_initTween(e,f),_forceAllPropTweens=0,h?_warn(n+" not eligible for reset"):1;u.push(p)}for(S=u.length;S--;)_=u[S],p=_._pt||_,p.s=(a||a===0)&&!o?a:p.s+(a||0)+d*p.c,p.c=t-p.s,_.e&&(_.e=_round(t)+getUnit(_.e)),_.b&&(_.b=p.s+getUnit(_.b))},_addAliasesToVars=function l(e,n){var t=e[0]?_getCache(e[0]).harness:0,a=t&&t.aliases,o,d,f,h;if(!a)return n;o=_merge({},n);for(d in a)if(d in o)for(h=a[d].split(","),f=h.length;f--;)o[h[f]]=o[d];return o},_parseKeyframe=function l(e,n,t,a){var o=n.ease||a||"power1.inOut",d,f;if(_isArray(n))f=t[e]||(t[e]=[]),n.forEach(function(h,u){return f.push({t:u/(n.length-1)*100,v:h,e:o})});else for(d in n)f=t[d]||(t[d]=[]),d==="ease"||f.push({t:parseFloat(e),v:n[d],e:o})},_parseFuncOrString=function l(e,n,t,a,o){return _isFunction(e)?e.call(n,t,a,o):_isString(e)&&~e.indexOf("random(")?_replaceRandom(e):e},_staggerTweenProps=_callbackNames+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",_staggerPropsToSkip={};_forEachName(_staggerTweenProps+",id,stagger,delay,duration,paused,scrollTrigger",function(l){return _staggerPropsToSkip[l]=1});var Tween=function(l){_inheritsLoose(e,l);function e(t,a,o,d){var f;typeof a=="number"&&(o.duration=a,a=o,o=null),f=l.call(this,d?a:_inheritDefaults(a))||this;var h=f.vars,u=h.duration,p=h.delay,_=h.immediateRender,b=h.stagger,S=h.overwrite,E=h.keyframes,g=h.defaults,v=h.scrollTrigger,T=h.yoyoEase,R=a.parent||_globalTimeline,x=(_isArray(t)||_isTypedArray(t)?_isNumber(t[0]):"length"in a)?[t]:toArray(t),C,w,P,D,N,k,F,M;if(f._targets=x.length?_harness(x):_warn("GSAP target "+t+" not found. https://gsap.com",!_config.nullTargetWarn)||[],f._ptLookup=[],f._overwrite=S,E||b||_isFuncOrString(u)||_isFuncOrString(p)){if(a=f.vars,C=f.timeline=new Timeline({data:"nested",defaults:g||{},targets:R&&R.data==="nested"?R.vars.targets:x}),C.kill(),C.parent=C._dp=_assertThisInitialized(f),C._start=0,b||_isFuncOrString(u)||_isFuncOrString(p)){if(D=x.length,F=b&&distribute(b),_isObject(b))for(N in b)~_staggerTweenProps.indexOf(N)&&(M||(M={}),M[N]=b[N]);for(w=0;w<D;w++)P=_copyExcluding(a,_staggerPropsToSkip),P.stagger=0,T&&(P.yoyoEase=T),M&&_merge(P,M),k=x[w],P.duration=+_parseFuncOrString(u,_assertThisInitialized(f),w,k,x),P.delay=(+_parseFuncOrString(p,_assertThisInitialized(f),w,k,x)||0)-f._delay,!b&&D===1&&P.delay&&(f._delay=p=P.delay,f._start+=p,P.delay=0),C.to(k,P,F?F(w,k,x):0),C._ease=_easeMap.none;C.duration()?u=p=0:f.timeline=0}else if(E){_inheritDefaults(_setDefaults(C.vars.defaults,{ease:"none"})),C._ease=_parseEase(E.ease||a.ease||"none");var U=0,$,B,J;if(_isArray(E))E.forEach(function(ne){return C.to(x,ne,">")}),C.duration();else{P={};for(N in E)N==="ease"||N==="easeEach"||_parseKeyframe(N,E[N],P,E.easeEach);for(N in P)for($=P[N].sort(function(ne,ie){return ne.t-ie.t}),U=0,w=0;w<$.length;w++)B=$[w],J={ease:B.e,duration:(B.t-(w?$[w-1].t:0))/100*u},J[N]=B.v,C.to(x,J,U),U+=J.duration;C.duration()<u&&C.to({},{duration:u-C.duration()})}}u||f.duration(u=C.duration())}else f.timeline=0;return S===!0&&!_suppressOverwrites&&(_overwritingTween=_assertThisInitialized(f),_globalTimeline.killTweensOf(x),_overwritingTween=0),_addToTimeline(R,_assertThisInitialized(f),o),a.reversed&&f.reverse(),a.paused&&f.paused(!0),(_||!u&&!E&&f._start===_roundPrecise(R._time)&&_isNotFalse(_)&&_hasNoPausedAncestors(_assertThisInitialized(f))&&R.data!=="nested")&&(f._tTime=-_tinyNum,f.render(Math.max(0,-p)||0)),v&&_scrollTrigger(_assertThisInitialized(f),v),f}var n=e.prototype;return n.render=function(a,o,d){var f=this._time,h=this._tDur,u=this._dur,p=a<0,_=a>h-_tinyNum&&!p?h:a<_tinyNum?0:a,b,S,E,g,v,T,R,x,C;if(!u)_renderZeroDurationTween(this,a,o,d);else if(_!==this._tTime||!a||d||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==p){if(b=_,x=this.timeline,this._repeat){if(g=u+this._rDelay,this._repeat<-1&&p)return this.totalTime(g*100+a,o,d);if(b=_roundPrecise(_%g),_===h?(E=this._repeat,b=u):(E=~~(_/g),E&&E===_roundPrecise(_/g)&&(b=u,E--),b>u&&(b=u)),T=this._yoyo&&E&1,T&&(C=this._yEase,b=u-b),v=_animationCycle(this._tTime,g),b===f&&!d&&this._initted&&E===v)return this._tTime=_,this;E!==v&&(x&&this._yEase&&_propagateYoyoEase(x,T),this.vars.repeatRefresh&&!T&&!this._lock&&this._time!==u&&this._initted&&(this._lock=d=1,this.render(_roundPrecise(g*E),!0).invalidate()._lock=0))}if(!this._initted){if(_attemptInitTween(this,p?a:b,d,o,_))return this._tTime=0,this;if(f!==this._time&&!(d&&this.vars.repeatRefresh&&E!==v))return this;if(u!==this._dur)return this.render(a,o,d)}if(this._tTime=_,this._time=b,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=R=(C||this._ease)(b/u),this._from&&(this.ratio=R=1-R),b&&!f&&!o&&!E&&(_callback(this,"onStart"),this._tTime!==_))return this;for(S=this._pt;S;)S.r(R,S.d),S=S._next;x&&x.render(a<0?a:!b&&T?-_tinyNum:x._dur*x._ease(b/this._dur),o,d)||this._startAt&&(this._zTime=a),this._onUpdate&&!o&&(p&&_rewindStartAt(this,a,o,d),_callback(this,"onUpdate")),this._repeat&&E!==v&&this.vars.onRepeat&&!o&&this.parent&&_callback(this,"onRepeat"),(_===this._tDur||!_)&&this._tTime===_&&(p&&!this._onUpdate&&_rewindStartAt(this,a,!0,!0),(a||!u)&&(_===this._tDur&&this._ts>0||!_&&this._ts<0)&&_removeFromParent(this,1),!o&&!(p&&!f)&&(_||f||T)&&(_callback(this,_===h?"onComplete":"onReverseComplete",!0),this._prom&&!(_<h&&this.timeScale()>0)&&this._prom()))}return this},n.targets=function(){return this._targets},n.invalidate=function(a){return(!a||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(a),l.prototype.invalidate.call(this,a)},n.resetTo=function(a,o,d,f,h){_tickerActive||_ticker.wake(),this._ts||this.play();var u=Math.min(this._dur,(this._dp._time-this._start)*this._ts),p;return this._initted||_initTween(this,u),p=this._ease(u/this._dur),_updatePropTweens(this,a,o,d,f,p,u,h)?this.resetTo(a,o,d,f,1):(_alignPlayhead(this,0),this.parent||_addLinkedListItem(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},n.kill=function(a,o){if(o===void 0&&(o="all"),!a&&(!o||o==="all"))return this._lazy=this._pt=0,this.parent?_interrupt(this):this;if(this.timeline){var d=this.timeline.totalDuration();return this.timeline.killTweensOf(a,o,_overwritingTween&&_overwritingTween.vars.overwrite!==!0)._first||_interrupt(this),this.parent&&d!==this.timeline.totalDuration()&&_setDuration(this,this._dur*this.timeline._tDur/d,0,1),this}var f=this._targets,h=a?toArray(a):f,u=this._ptLookup,p=this._pt,_,b,S,E,g,v,T;if((!o||o==="all")&&_arraysMatch(f,h))return o==="all"&&(this._pt=0),_interrupt(this);for(_=this._op=this._op||[],o!=="all"&&(_isString(o)&&(g={},_forEachName(o,function(R){return g[R]=1}),o=g),o=_addAliasesToVars(f,o)),T=f.length;T--;)if(~h.indexOf(f[T])){b=u[T],o==="all"?(_[T]=o,E=b,S={}):(S=_[T]=_[T]||{},E=o);for(g in E)v=b&&b[g],v&&((!("kill"in v.d)||v.d.kill(g)===!0)&&_removeLinkedListItem(this,v,"_pt"),delete b[g]),S!=="all"&&(S[g]=1)}return this._initted&&!this._pt&&p&&_interrupt(this),this},e.to=function(a,o){return new e(a,o,arguments[2])},e.from=function(a,o){return _createTweenType(1,arguments)},e.delayedCall=function(a,o,d,f){return new e(o,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:a,onComplete:o,onReverseComplete:o,onCompleteParams:d,onReverseCompleteParams:d,callbackScope:f})},e.fromTo=function(a,o,d){return _createTweenType(2,arguments)},e.set=function(a,o){return o.duration=0,o.repeatDelay||(o.repeat=0),new e(a,o)},e.killTweensOf=function(a,o,d){return _globalTimeline.killTweensOf(a,o,d)},e}(Animation$1);_setDefaults(Tween.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});_forEachName("staggerTo,staggerFrom,staggerFromTo",function(l){Tween[l]=function(){var e=new Timeline,n=_slice.call(arguments,0);return n.splice(l==="staggerFromTo"?5:4,0,0),e[l].apply(e,n)}});var _setterPlain=function l(e,n,t){return e[n]=t},_setterFunc=function l(e,n,t){return e[n](t)},_setterFuncWithParam=function l(e,n,t,a){return e[n](a.fp,t)},_setterAttribute=function l(e,n,t){return e.setAttribute(n,t)},_getSetter=function l(e,n){return _isFunction(e[n])?_setterFunc:_isUndefined(e[n])&&e.setAttribute?_setterAttribute:_setterPlain},_renderPlain=function l(e,n){return n.set(n.t,n.p,Math.round((n.s+n.c*e)*1e6)/1e6,n)},_renderBoolean=function l(e,n){return n.set(n.t,n.p,!!(n.s+n.c*e),n)},_renderComplexString=function l(e,n){var t=n._pt,a="";if(!e&&n.b)a=n.b;else if(e===1&&n.e)a=n.e;else{for(;t;)a=t.p+(t.m?t.m(t.s+t.c*e):Math.round((t.s+t.c*e)*1e4)/1e4)+a,t=t._next;a+=n.c}n.set(n.t,n.p,a,n)},_renderPropTweens=function l(e,n){for(var t=n._pt;t;)t.r(e,t.d),t=t._next},_addPluginModifier=function l(e,n,t,a){for(var o=this._pt,d;o;)d=o._next,o.p===a&&o.modifier(e,n,t),o=d},_killPropTweensOf=function l(e){for(var n=this._pt,t,a;n;)a=n._next,n.p===e&&!n.op||n.op===e?_removeLinkedListItem(this,n,"_pt"):n.dep||(t=1),n=a;return!t},_setterWithModifier=function l(e,n,t,a){a.mSet(e,n,a.m.call(a.tween,t,a.mt),a)},_sortPropTweensByPriority=function l(e){for(var n=e._pt,t,a,o,d;n;){for(t=n._next,a=o;a&&a.pr>n.pr;)a=a._next;(n._prev=a?a._prev:d)?n._prev._next=n:o=n,(n._next=a)?a._prev=n:d=n,n=t}e._pt=o},PropTween=function(){function l(n,t,a,o,d,f,h,u,p){this.t=t,this.s=o,this.c=d,this.p=a,this.r=f||_renderPlain,this.d=h||this,this.set=u||_setterPlain,this.pr=p||0,this._next=n,n&&(n._prev=this)}var e=l.prototype;return e.modifier=function(t,a,o){this.mSet=this.mSet||this.set,this.set=_setterWithModifier,this.m=t,this.mt=o,this.tween=a},l}();_forEachName(_callbackNames+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(l){return _reservedProps[l]=1});_globals.TweenMax=_globals.TweenLite=Tween;_globals.TimelineLite=_globals.TimelineMax=Timeline;_globalTimeline=new Timeline({sortChildren:!1,defaults:_defaults,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});_config.stringFilter=_colorStringFilter;var _media=[],_listeners={},_emptyArray=[],_lastMediaTime=0,_contextID=0,_dispatch=function l(e){return(_listeners[e]||_emptyArray).map(function(n){return n()})},_onMediaChange=function l(){var e=Date.now(),n=[];e-_lastMediaTime>2&&(_dispatch("matchMediaInit"),_media.forEach(function(t){var a=t.queries,o=t.conditions,d,f,h,u;for(f in a)d=_win$1.matchMedia(a[f]).matches,d&&(h=1),d!==o[f]&&(o[f]=d,u=1);u&&(t.revert(),h&&n.push(t))}),_dispatch("matchMediaRevert"),n.forEach(function(t){return t.onMatch(t,function(a){return t.add(null,a)})}),_lastMediaTime=e,_dispatch("matchMedia"))},Context=function(){function l(n,t){this.selector=t&&selector(t),this.data=[],this._r=[],this.isReverted=!1,this.id=_contextID++,n&&this.add(n)}var e=l.prototype;return e.add=function(t,a,o){_isFunction(t)&&(o=a,a=t,t=_isFunction);var d=this,f=function(){var u=_context,p=d.selector,_;return u&&u!==d&&u.data.push(d),o&&(d.selector=selector(o)),_context=d,_=a.apply(d,arguments),_isFunction(_)&&d._r.push(_),_context=u,d.selector=p,d.isReverted=!1,_};return d.last=f,t===_isFunction?f(d,function(h){return d.add(null,h)}):t?d[t]=f:f},e.ignore=function(t){var a=_context;_context=null,t(this),_context=a},e.getTweens=function(){var t=[];return this.data.forEach(function(a){return a instanceof l?t.push.apply(t,a.getTweens()):a instanceof Tween&&!(a.parent&&a.parent.data==="nested")&&t.push(a)}),t},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(t,a){var o=this;if(t?function(){for(var f=o.getTweens(),h=o.data.length,u;h--;)u=o.data[h],u.data==="isFlip"&&(u.revert(),u.getChildren(!0,!0,!1).forEach(function(p){return f.splice(f.indexOf(p),1)}));for(f.map(function(p){return{g:p._dur||p._delay||p._sat&&!p._sat.vars.immediateRender?p.globalTime(0):-1/0,t:p}}).sort(function(p,_){return _.g-p.g||-1/0}).forEach(function(p){return p.t.revert(t)}),h=o.data.length;h--;)u=o.data[h],u instanceof Timeline?u.data!=="nested"&&(u.scrollTrigger&&u.scrollTrigger.revert(),u.kill()):!(u instanceof Tween)&&u.revert&&u.revert(t);o._r.forEach(function(p){return p(t,o)}),o.isReverted=!0}():this.data.forEach(function(f){return f.kill&&f.kill()}),this.clear(),a)for(var d=_media.length;d--;)_media[d].id===this.id&&_media.splice(d,1)},e.revert=function(t){this.kill(t||{})},l}(),MatchMedia=function(){function l(n){this.contexts=[],this.scope=n}var e=l.prototype;return e.add=function(t,a,o){_isObject(t)||(t={matches:t});var d=new Context(0,o||this.scope),f=d.conditions={},h,u,p;_context&&!d.selector&&(d.selector=_context.selector),this.contexts.push(d),a=d.add("onMatch",a),d.queries=t;for(u in t)u==="all"?p=1:(h=_win$1.matchMedia(t[u]),h&&(_media.indexOf(d)<0&&_media.push(d),(f[u]=h.matches)&&(p=1),h.addListener?h.addListener(_onMediaChange):h.addEventListener("change",_onMediaChange)));return p&&a(d,function(_){return d.add(null,_)}),this},e.revert=function(t){this.kill(t||{})},e.kill=function(t){this.contexts.forEach(function(a){return a.kill(t,!0)})},l}(),_gsap={registerPlugin:function l(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];n.forEach(function(a){return _createPlugin(a)})},timeline:function l(e){return new Timeline(e)},getTweensOf:function l(e,n){return _globalTimeline.getTweensOf(e,n)},getProperty:function l(e,n,t,a){_isString(e)&&(e=toArray(e)[0]);var o=_getCache(e||{}).get,d=t?_passThrough:_numericIfPossible;return t==="native"&&(t=""),e&&(n?d((_plugins[n]&&_plugins[n].get||o)(e,n,t,a)):function(f,h,u){return d((_plugins[f]&&_plugins[f].get||o)(e,f,h,u))})},quickSetter:function l(e,n,t){if(e=toArray(e),e.length>1){var a=e.map(function(p){return gsap.quickSetter(p,n,t)}),o=a.length;return function(p){for(var _=o;_--;)a[_](p)}}e=e[0]||{};var d=_plugins[n],f=_getCache(e),h=f.harness&&(f.harness.aliases||{})[n]||n,u=d?function(p){var _=new d;_quickTween._pt=0,_.init(e,t?p+t:p,_quickTween,0,[e]),_.render(1,_),_quickTween._pt&&_renderPropTweens(1,_quickTween)}:f.set(e,h);return d?u:function(p){return u(e,h,t?p+t:p,f,1)}},quickTo:function l(e,n,t){var a,o=gsap.to(e,_merge((a={},a[n]="+=0.1",a.paused=!0,a),t||{})),d=function(h,u,p){return o.resetTo(n,h,u,p)};return d.tween=o,d},isTweening:function l(e){return _globalTimeline.getTweensOf(e,!0).length>0},defaults:function l(e){return e&&e.ease&&(e.ease=_parseEase(e.ease,_defaults.ease)),_mergeDeep(_defaults,e||{})},config:function l(e){return _mergeDeep(_config,e||{})},registerEffect:function l(e){var n=e.name,t=e.effect,a=e.plugins,o=e.defaults,d=e.extendTimeline;(a||"").split(",").forEach(function(f){return f&&!_plugins[f]&&!_globals[f]&&_warn(n+" effect requires "+f+" plugin.")}),_effects[n]=function(f,h,u){return t(toArray(f),_setDefaults(h||{},o),u)},d&&(Timeline.prototype[n]=function(f,h,u){return this.add(_effects[n](f,_isObject(h)?h:(u=h)&&{},this),u)})},registerEase:function l(e,n){_easeMap[e]=_parseEase(n)},parseEase:function l(e,n){return arguments.length?_parseEase(e,n):_easeMap},getById:function l(e){return _globalTimeline.getById(e)},exportRoot:function l(e,n){e===void 0&&(e={});var t=new Timeline(e),a,o;for(t.smoothChildTiming=_isNotFalse(e.smoothChildTiming),_globalTimeline.remove(t),t._dp=0,t._time=t._tTime=_globalTimeline._time,a=_globalTimeline._first;a;)o=a._next,(n||!(!a._dur&&a instanceof Tween&&a.vars.onComplete===a._targets[0]))&&_addToTimeline(t,a,a._start-a._delay),a=o;return _addToTimeline(_globalTimeline,t,0),t},context:function l(e,n){return e?new Context(e,n):_context},matchMedia:function l(e){return new MatchMedia(e)},matchMediaRefresh:function l(){return _media.forEach(function(e){var n=e.conditions,t,a;for(a in n)n[a]&&(n[a]=!1,t=1);t&&e.revert()})||_onMediaChange()},addEventListener:function l(e,n){var t=_listeners[e]||(_listeners[e]=[]);~t.indexOf(n)||t.push(n)},removeEventListener:function l(e,n){var t=_listeners[e],a=t&&t.indexOf(n);a>=0&&t.splice(a,1)},utils:{wrap,wrapYoyo,distribute,random,snap,normalize,getUnit,clamp,splitColor,toArray,selector,mapRange,pipe,unitize,interpolate,shuffle},install:_install,effects:_effects,ticker:_ticker,updateRoot:Timeline.updateRoot,plugins:_plugins,globalTimeline:_globalTimeline,core:{PropTween,globals:_addGlobal,Tween,Timeline,Animation:Animation$1,getCache:_getCache,_removeLinkedListItem,reverting:function l(){return _reverting$1},context:function l(e){return e&&_context&&(_context.data.push(e),e._ctx=_context),_context},suppressOverwrites:function l(e){return _suppressOverwrites=e}}};_forEachName("to,from,fromTo,delayedCall,set,killTweensOf",function(l){return _gsap[l]=Tween[l]});_ticker.add(Timeline.updateRoot);_quickTween=_gsap.to({},{duration:0});var _getPluginPropTween=function l(e,n){for(var t=e._pt;t&&t.p!==n&&t.op!==n&&t.fp!==n;)t=t._next;return t},_addModifiers=function l(e,n){var t=e._targets,a,o,d;for(a in n)for(o=t.length;o--;)d=e._ptLookup[o][a],d&&(d=d.d)&&(d._pt&&(d=_getPluginPropTween(d,a)),d&&d.modifier&&d.modifier(n[a],e,t[o],a))},_buildModifierPlugin=function l(e,n){return{name:e,rawVars:1,init:function(a,o,d){d._onInit=function(f){var h,u;if(_isString(o)&&(h={},_forEachName(o,function(p){return h[p]=1}),o=h),n){h={};for(u in o)h[u]=n(o[u]);o=h}_addModifiers(f,o)}}}},gsap=_gsap.registerPlugin({name:"attr",init:function l(e,n,t,a,o){var d,f,h;this.tween=t;for(d in n)h=e.getAttribute(d)||"",f=this.add(e,"setAttribute",(h||0)+"",n[d],a,o,0,0,d),f.op=d,f.b=h,this._props.push(d)},render:function l(e,n){for(var t=n._pt;t;)_reverting$1?t.set(t.t,t.p,t.b,t):t.r(e,t.d),t=t._next}},{name:"endArray",init:function l(e,n){for(var t=n.length;t--;)this.add(e,t,e[t]||0,n[t],0,0,0,0,0,1)}},_buildModifierPlugin("roundProps",_roundModifier),_buildModifierPlugin("modifiers"),_buildModifierPlugin("snap",snap))||_gsap;Tween.version=Timeline.version=gsap.version="3.12.4";_coreReady=1;_windowExists$1()&&_wake();_easeMap.Power0;_easeMap.Power1;_easeMap.Power2;_easeMap.Power3;_easeMap.Power4;_easeMap.Linear;_easeMap.Quad;_easeMap.Cubic;_easeMap.Quart;_easeMap.Quint;_easeMap.Strong;_easeMap.Elastic;_easeMap.Back;_easeMap.SteppedEase;_easeMap.Bounce;_easeMap.Sine;_easeMap.Expo;_easeMap.Circ;/*!
262
262
  * CSSPlugin 3.12.4
263
263
  * https://gsap.com
264
264
  *
@@ -271,5 +271,5 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
271
271
  ${l.thinkful?"speech-bubble--italic":""}
272
272
  `,children:[jsxRuntimeExports.jsxs("div",{className:`speech-bubble__header ${l.thinkful?"speech-bubble__header--thinking":""}`,children:[l.thinkful?jsxRuntimeExports.jsx("div",{className:"thinking-icon-wrap",children:jsxRuntimeExports.jsx("div",{className:"icon-bubble-thinkful-black"})}):null,l.avatar?jsxRuntimeExports.jsx("div",{className:"speech-bubble__avatar",children:jsxRuntimeExports.jsx("img",{src:o(),alt:l.name})}):null,l.voiceOver?jsxRuntimeExports.jsx("div",{className:"speech-bubble__avatar",children:jsxRuntimeExports.jsx("div",{className:"icon-narrator"})}):null,jsxRuntimeExports.jsxs("div",{className:"speech-bubble__name",children:[jsxRuntimeExports.jsx("span",{children:l.name}),l.thinkful?jsxRuntimeExports.jsxs("span",{children:["[ ",e("emotion.thinking")," ]"]}):null]})]}),l.text?jsxRuntimeExports.jsx("div",{className:"speech-bubble__text",children:HTMLReactParser$1(l.text)}):null]})}const SpeechBubbleComponent$1=React$2.forwardRef(SpeechBubbleComponent);function BubbleWrapper({currentMessage:l,translate:e}){const n=document.querySelector(".screens--container");return jsxRuntimeExports.jsx("group",{children:jsxRuntimeExports.jsx(arcadeThreeCore.HtmlPro,{wrapperClass:"htmlpro-wrap-100-h",onOcclude:()=>null,zIndexRange:[5,5],portal:n?{current:n}:void 0,style:{width:"100vw",height:"100%",position:"static"},calculatePosition:()=>[0,0],children:jsxRuntimeExports.jsx(SpeechBubbleComponent$1,{translate:e,message:l})})})}const cleanStyle={width:"100vw",height:"100%",position:"static"};function DialogDecision(l){const e=document.querySelector(".screens--container");return React$2.useEffect(()=>(l.onMount&&l.onMount(),()=>{l.onUnMount&&l.onUnMount()}),[]),jsxRuntimeExports.jsx(arcadeThreeCore.HtmlPro,{wrapperClass:"htmlpro-wrap-100-h",zIndexRange:[6,6],style:cleanStyle,portal:e?{current:e}:void 0,onOcclude:()=>{},calculatePosition:()=>[0,0],children:jsxRuntimeExports.jsx(DecisionComponent,{inScene:!0,...l})})}const cache={},loader=new GLTFLoader;function useStateMachine(l){const e=fiber.useThree(u=>u.scene),n=React$2.useMemo(()=>{var p;const u={};for(const _ of l)if(_.slots)for(const b of _.slots){if(!b.uid)continue;const S=(p=b.character)==null?void 0:p.resource.animations;S&&(u[b.uid]||(u[b.uid]=Object.keys(S).reduce((E,g)=>(E[g]=S[g].url,E),{})))}return u},[l]),t=React$2.useMemo(()=>{const u=new Set;for(const p of l)if(p.slots)for(const _ of p.slots)_.uid&&u.add(_.uid);return Array.from(u)},[l]),a=async u=>{const p=n[u];if(!cache[p.talking]){const{animations:b}=await loader.loadAsync(p.talking);b[0].name="talking",cache[p.talking]=b[0]}},o=()=>{t.forEach(u=>{h(u,"idle")})},d=()=>{t.forEach(u=>{const p=e.getObjectByProperty("uid",u);p&&(delete p.userData._active,h(u,"idle"))})},f=async(u,p,_)=>{const b=getCurrentVisible(u,e);if(cache[u]||(cache[u]={}),!b)return new Promise(E=>E(!1));const S=b.userData.animator;if(p){const E=n[u];let g=cache[E.talking],v=p,T=cache[p];if(!T){const{animations:R}=await loader.loadAsync(p);T=cache[p]=R[0]}if(_&&E.talking!==p&&(g?(T=mixWithTalkingClip(g,T),v+="_talking"):a(u).then(()=>{g=cache[E.talking],T=mixWithTalkingClip(g,T),v+="_talking"})),!b.userData._active||b.userData._active!==v){b.userData._active=v;const R=S.register(v,T);return new Promise(x=>{S.mix(v).then(C=>x(C?R:!1))})}}return new Promise(E=>E(!1))},h=async(u,p)=>{const _=getCurrentVisible(u,e);if(cache[u]||(cache[u]={}),!_)return new Promise(S=>S(!1));const b=_.userData.animator;if(p==="idle")return b.mix("idle"),b.getAction("idle");{const S=n[u],E=p.split("_")[0],g=S[E],v=cache[S.talking];let T=cache[g];if(!T){const{animations:R}=await loader.loadAsync(S[E]);T=cache[S[E]]=R[0]}if(p.includes("talking")&&p!=="talking"&&(T=mixWithTalkingClip(v,T)),!_.userData._active||_.userData._active!==p){_.userData._active=p;const R=b.register(p,T);return new Promise(x=>{b.mix(p).then(C=>x(C?R:!1))})}}return new Promise(S=>S(!1))};return{startAnimation:h,startAnimationUrl:f,preloadTalking:a,resetActives:o,unmountActives:d}}const characterMs=75,minMs=1400,headSize=2,raycast=new three.Raycaster,animationTarget=new three.Object3D,maxCharacterToSwitch=70;raycast.firstHitOnly=!0;function DialogComponent({keyboardControl:l,emitEvent:e,lines:n,actors:t,edges:a,soundActions:o,zoomInActor:d,autoPlay:f,autoEnd:h,pause:u,progress:p}){var Pt;const _=n.length-1<=(p==null?void 0:p.line)?n.length-1:(p==null?void 0:p.line)||0,[b,S]=React$2.useState(_),[E,g]=React$2.useState(!!f),[v,T]=React$2.useState(!1),[R,x]=React$2.useState(!1),C=fiber.useThree(Ne=>Ne.scene),w=fiber.useThree(Ne=>Ne.camera),{start:P,stop:D}=useTimeout(),N=React$2.useRef([]),k=React$2.useMemo(()=>w.clone(),[]),F=React$2.useRef({pos:[0,0,0],child:null}),M=n[b],U=n[b-1],$=React$2.useRef(!1),B=!!a,{voiceOver:J,decision:ne}=M||{},ie=React$2.useRef({}),Y=(Pt=M==null?void 0:M.slots)==null?void 0:Pt.find(Ne=>Ne.talking),q=React$2.useRef(!1),{startAnimation:re,startAnimationUrl:ce,resetActives:fe,preloadTalking:te,unmountActives:H}=useStateMachine(n),W=React$2.useRef(),V=Object.keys((M==null?void 0:M.audio)||{}).length,z=Object.keys((M==null?void 0:M.voice)||{}).length,Q=J||(M==null?void 0:M.type)==="conversationalNarration",ee=ne||(M==null?void 0:M.type)==="conversationalDecision",le=(M==null?void 0:M.type)==="conversationalCamera",ue=E&&!ee&&!le,[he,ve]=React$2.useState({text:"",name:"",inScene:!1,thinkful:!1,voiceOver:!1,avatar:"",show:!1}),be=React$2.useMemo(()=>n.reduce((Ne,Je)=>(Je.slots&&Je.slots.filter(wt=>wt.uid).forEach(wt=>{Ne.includes(wt.uid)||Ne.push(wt.uid)}),Ne),[]),[n]),Re=React$2.useCallback(Ne=>e({type:"translate",payload:Ne}),[e]),[Le,Oe]=React$2.useState([]),Ke=React$2.useMemo(()=>Le[Le.length-1],[Le]),St=React$2.useCallback(()=>{const Ne=a.find(ot=>ot.fromId===Ke)||a.find(ot=>ot.toId===Ke),Je=n.find(ot=>ot.id===(Ne==null?void 0:Ne.fromId));return!Ke&&(p==null?void 0:p.line)>=0?{decision:!0}:Je},[a,n,Ke]),it=React$2.useCallback(()=>{if(B){const Je=St();return Je==null?void 0:Je.decision}const Ne=n[b-1]?n[b-1]:{};return b>0&&(Ne==null?void 0:Ne.decision)},[M,B,n,Ke,a]),gt=React$2.useCallback(()=>{if(B){const Je=St();return(Je==null?void 0:Je.type)==="conversationalCamera"}const Ne=n[b-1]?n[b-1]:{};return b>0&&(Ne==null?void 0:Ne.type)==="conversationalCamera"},[M,B,n,Ke,a]),Ge=React$2.useCallback(Ne=>{var ot,wt;const Je=t.find($e=>($e==null?void 0:$e.uid)===(Ne==null?void 0:Ne.uid)?$e:"");return((wt=(ot=Ne==null?void 0:Ne.character)==null?void 0:ot.resource)==null?void 0:wt.url)||(Je==null?void 0:Je.completeUrl)||""},[t]),Me=(Ne=()=>{})=>{if(q.current)q.current&&(q.current=!1);else{w.updateProjectionMatrix(),w.updateMatrixWorld(!0);const Je=F.current.child?F.current.pos:k.position.toArray();if(animationTarget.position.fromArray(Je),F.current.parent){animationTarget.quaternion.equals(w.quaternion)||animationTarget.applyQuaternion(w.quaternion);const ot=F.current.isLeft?-1:1,wt=headSize*ot;animationTarget.translateX(-10*ot+wt),animationTarget.translateY(-2),animationTarget.translateZ(30)}gsapWithCSS.to(w.position,{duration:.9,ease:"power3.easeInOut",onStart:()=>{q.current=!0},onUpdate:()=>{N.current.length&&N.current.forEach(ot=>{const{object:wt}=ot;wt.material.visible=!0})},onComplete:()=>{Ne(),raycast.set(w.getWorldPosition(new three.Vector3(0,0,0)),w.getWorldDirection(new three.Vector3));const ot=raycast.intersectObjects(C.children,!0);N.current=ot.filter(wt=>wt.distance<10),N.current.length&&N.current.forEach(wt=>{const{object:$e}=wt;$e.material.side=0}),q.current=!1,$.current&&e({type:"success"}),F.current.child||w.copy(k)},...animationTarget.position})}},De=React$2.useCallback(()=>{F.current.child=null,F.current.parent=null,d&&Me()},[d]),Ve=(Ne,Je,ot,wt=!1)=>{const $e=Je.includes("seated");ot?ce(Ne,ot.url,Je.includes("talking")).then(Ft=>{Ft&&BASIC_ACTIONS_TYPES_WHITELIST.includes(ot.animationId)&&($.current?re(Ne,"idle"):re(Ne,W.current===Ne?"neutral_talking":"neutral"))}):re(Ne,wt&&!$e?`${Je}-seated`:Je)},ct=()=>{if(!(Y!=null&&Y.emotion)||$.current)return;const{emotion:Ne,uid:Je,animation:ot}=Y,wt=getCurrentVisible(Je,C);if(wt){const{isSeated:$e}=wt;te(Je).then(()=>{Ve(Je,$e&&!Ne.includes("seated")?`${Ne}-seated_talking`:`${Ne}_talking`,ot,$e),ot&&BASIC_ACTIONS_TYPES_WHITELIST.includes(ot.animationId)&&(W.current=Je)})}},dt=()=>{if(!(Y!=null&&Y.uid)||$.current)return;const{emotion:Ne,uid:Je,animation:ot}=Y,wt=getCurrentVisible(Je,C);if(wt){const{isSeated:$e}=wt;W.current===Je?(Ve(Je,"neutral",null,$e),W.current=null):Ve(Je,Ne,ot,$e)}},rt=React$2.useCallback(()=>{$.current=!0,ve({show:!1}),De(),fe(),d||e({type:"success"})},[w,e,De,d]);React$2.useEffect(()=>()=>{ie.current={},H()},[]);const xt=Ne=>{ve({show:!1}),S(Ne),e({type:"notifyProgress",payload:{line:Ne}})},Et=React$2.useCallback((Ne=!0)=>{const Je=Ne?["fromId","toId"]:["toId","fromId"],ot=a.filter(Ft=>Ft[Je[0]]===M.id),wt=ot.length===1?ot[0]:ot.find(Ft=>Ft[Je[1]]===Ke);if(!(wt!=null&&wt[Je[0]])){rt();return}Ne||Oe(Le.slice(0,Le.length-1));const $e=n.findIndex(Ft=>Ft.id===wt[Je[1]]);$e>=0?xt($e):rt()},[M==null?void 0:M.id,e,a,rt,n]),Qe=React$2.useCallback((Ne,Je)=>{const ot=[3,2,1][Ne.id],$e=a.filter(At=>At.fromId===(M==null?void 0:M.id)).find(At=>parseInt(At.fromPointIndex)===ot),Ft=n.findIndex(At=>At.id===($e==null?void 0:$e.toId));Ft>=0?($e==null?void 0:$e.fromId)===($e==null?void 0:$e.toId)?Je():xt(Ft):rt()},[M==null?void 0:M.id,a,rt,n]),Be=React$2.useCallback(()=>{if(ie.current={...Y},x(!1),dt(),B)Et(!1);else if(!it()){const Ne=b-1;ve({show:!1}),S(Ne),e({type:"notifyProgress",payload:{line:Ne}})}},[Et,e,B,U,b,Y]),Xe=React$2.useCallback(Ne=>{if(B){if(Ne){const Je=[3,2,1][Ne.id],wt=a.filter($e=>$e.fromId===M.id).find($e=>parseInt($e.fromPointIndex)===Je);if(wt){const $e=n.findIndex(Ft=>Ft.id===wt.toId);$e>=0&&e({type:"notifyProgress",payload:{line:$e}})}else e({type:"saveNode"})}}else if(b<n.length-1){const Je=b+1;e({type:"notifyProgress",payload:{line:Je}})}else e({type:"saveNode"})},[a,b,n,e,M==null?void 0:M.id,B]),Ye=React$2.useCallback((Ne,Je)=>{if(ie.current={...Y},Oe([...Le,M.id]),x(!1),dt(),B)Ne?Qe(Ne,Je):Et();else if(b<n.length-1){const ot=b+1;xt(ot)}else(h||ee||le)&&rt()},[e,M==null?void 0:M.id,B,ee,le,b,n.length,Qe,Et,rt,Y]),Pe=()=>{g(!1),Be()},Ae=()=>B?M&&M.type!=="conversationalDecision"&&!a.find(Ne=>Ne.fromId===M.id):b===n.length-1,_e=()=>{Ae()?rt():(g(!1),Ye())};React$2.useEffect(()=>{if(B&&!v){const Ne=p==null?void 0:p.line;if(Ne>=0){T(!0),S(Ne);return}const Je=n.filter(ot=>!a.find(wt=>wt.toId===ot.id));if(Je.length){const ot=Je[0],wt=n.indexOf(ot);wt>=0&&(T(!0),S(wt))}}},[a,B,n,v]);const Ie=Ne=>{if(ie.current.uid===Ne.uid||F.current.parent===Ne)return;const Je=new three.Object3D,ot=Ne.getObjectByName("Head_M");ot.updateMatrixWorld(!0),Je.applyMatrix4(ot.matrixWorld),Je.applyQuaternion(w.quaternion);const wt=d?2.5:2,$e=d?1.2:1.5;Je.translateY(wt),Je.translateX($e);const Ft=new three.Vector3;Ft.setFromMatrixPosition(ot.matrixWorld);const xe=Ft.project(w).x<0;F.current={pos:Je.position.toArray(),child:ot,parent:Ne,isLeft:xe}},tt=Ne=>{e({type:"resetZIndexUIContainer",payload:Ne})};React$2.useEffect(()=>{var Ne;if(Q)De(),ve({text:M==null?void 0:M.text,name:(M==null?void 0:M.alias)||(M==null?void 0:M.name)||`[ ${Re("storylines.misc.voiceOver")} ]`,inScene:!1,voiceOver:!0,thinkful:!1,top:!1,avatar:Ge(Y),show:!0});else if(!$.current&&!ee&&!le){const Je=M==null?void 0:M.slots.filter($e=>$e.uid&&!$e.talking),ot=[...Je.map($e=>$e.uid)||[],Y==null?void 0:Y.uid];if(be.filter($e=>!ot.includes($e)).forEach($e=>{re($e,"idle")}),Je.forEach($e=>{const Ft=getCurrentVisible($e.uid,C);if(Ft){const{isSeated:At}=Ft;Ve($e.uid,$e.emotion,$e.animation,At)}}),Y){const $e=getCurrentVisible(Y.uid,C),Ft=t.find(At=>At.uid===Y.uid);$e&&!$.current?setTimeout(()=>{var At,xe;if(Y.uid===$e.uid){Ie($e);const{isSeated:ae,userData:me}=$e,{emotion:Ee,animation:we}=Y;!((At=me._active)!=null&&At.includes("talking"))&&!((xe=me._active)!=null&&xe.includes(Ee))&&Ve(Y.uid,Ee,we,ae);const de=()=>{var Se;ve({text:Y.text,name:Y.alias||((Se=Y.character)==null?void 0:Se.name),inScene:!0,thinkful:Y.emotion.includes("think"),avatar:Ge(Y),show:!0})};d?(q.current=!1,Me(de)):de()}},150):(De(),ve({text:Y.text,name:Y.alias||((Ne=Y.character)==null?void 0:Ne.name)||(Ft==null?void 0:Ft.name),left:!1,top:Y.text.length>maxCharacterToSwitch,inScene:!1,thinkful:Y.emotion.includes("think"),avatar:Ge(Y),show:!0}))}else De(),ve({show:!0})}},[t,M,d,C,Re,Ge,De,ee,Q,be]);const Gt=useEkho({audioType:M==null?void 0:M.audioType,volume:M==null?void 0:M.audioVolume,voice:M==null?void 0:M.voice,started:he.show,text:cleanTextOfHtmlTags(he==null?void 0:he.text),audio:M==null?void 0:M.audio,slide:b,soundActions:o,emitEvent:e,pauseTTS:u,onStart:()=>{var Ne;(Ne=Y==null?void 0:Y.emotion)!=null&&Ne.includes("think")||ct()},onError:()=>{dt(),x(!0)},onFinish:()=>{dt(),ue&&!u&&Ye()}});React$2.useEffect(()=>(Gt(),()=>{Gt()}),[b,Gt]),React$2.useEffect(()=>{var Ne;if(((M==null?void 0:M.audioType)==="none"||R)&&(he!=null&&he.show)&&!(Y!=null&&Y.emotion.includes("think"))){ct();const Je=characterMs*(((Ne=he==null?void 0:he.text)==null?void 0:Ne.length)||0);setTimeout(()=>{dt()},Je<minMs?minMs:Je)}},[R,M==null?void 0:M.audioType,Y==null?void 0:Y.emotion,he]),React$2.useEffect(()=>{var Ne;if(ue&&he.show&&((M==null?void 0:M.audioType)==="none"||R)&&!u){const Je=characterMs*(((Ne=he==null?void 0:he.text)==null?void 0:Ne.length)||0);(!Ae()||Ae()&&h)&&P(Ye,Je<minMs?minMs:Je)}return()=>{D()}},[he,Ye,P,h,D,M==null?void 0:M.audioType,ue,V,z,R]);const Dt=React$2.useMemo(()=>b===0||it()||gt(),[b,it,gt]),ke=l({disabled:ee||!he.show,repeat:!1,forward:_e,rewind:Dt?null:Pe});React$2.useEffect(()=>ke(),[ke]);const mt=document.querySelector(".screens--container");if(le)return jsxRuntimeExports.jsx(ChangeCamera,{...M,emitEvent:e,success:!1,onFinish:Ye},`change-camera-${b}`);if(ee){const Ne=M.id?n.filter(ot=>ot.decision).findIndex(ot=>ot.id===M.id)+1:n.filter(ot=>ot.decision).findIndex(ot=>ot===M)+1,Je={...M.payload,decisionNumber:Ne,inheritProps:{slots:[],disableBackground:!0},required:!B,branched:B,onAddPoints:Xe,onFinish:Ye,emitEvent:e,pause:u,soundActions:o,keyboardControl:l,onMount:()=>{De(),tt(!0)},onUnMount:()=>{q.current=!1,tt(!1)}};return jsxRuntimeExports.jsx(DialogDecision,{...Je})}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[he.text?jsxRuntimeExports.jsx(BubbleWrapper,{translate:Re,currentMessage:he}):null,jsxRuntimeExports.jsx(arcadeThreeCore.HtmlPro,{wrapperClass:"htmlpro-wrap-100-h",style:{width:"100vw",height:"100%",position:"static"},portal:mt?{current:mt}:void 0,zIndexRange:[6,6],onOcclude:()=>{},calculatePosition:()=>[0,0],children:jsxRuntimeExports.jsxs("div",{dir:LangIsRtl()?"rtl":"ltr",className:"dialog-component-controls",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:Pe,disabled:Dt||!he.show,className:`gat--btn__round ${Dt||!he.show?"disabled":""}`,"aria-label":LangIsRtl()?Re("storylines.misc.forward"):Re("storylines.misc.rewind"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),jsxRuntimeExports.jsx("button",{type:"button",onClick:_e,disabled:!he.show,className:`gat--btn__round
273
273
  ${he.show?"":"disabled"}
274
- ${E&&Ae()?"glowing-animation":""}`,"aria-label":LangIsRtl()?Re("storylines.misc.rewind"):Re("storylines.misc.forward"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})})]})}function AnimationComponent({animation:l,loopTimes:e,resource:n,enableInteraction:t,makeDefault:a,emitEvent:o}){const[d,f]=React$2.useState(!1),h=fiber.useThree(_=>_.scene),u=React$2.useMemo(()=>new GLTFLoader,[]),p=React$2.useRef(1);return React$2.useEffect(()=>{f(!1)},[n.uid,l==null?void 0:l.url]),React$2.useEffect(()=>{if(!d){const _=h.getObjectByProperty("uid",n.uid);if(_&&l&&_.skeletonId===l.skeletonId)if(a)o({type:"saveAnimation",payload:{uid:n.uid,animation:l.id,index:_.index}}),o({type:"success"});else{const b=t;b||o({type:"success"});const S=_.userData.animator,E=()=>{S.getAction(l.url).setLoop(three.LoopRepeat,1/0),p.current=0;function v(){p.current+=1,p.current>=e&&(S.mix("idle"),b&&o({type:"success"}),S.removeEventListener("loop",v))}S.mix(l.url),S.addEventListener("loop",v),f(!0)};S.getAction(l.url)?E():u.load(l.url,g=>{S.register(l.url,g.animations[0]),E()})}else o({type:"success"})}},[h,l==null?void 0:l.url,e,o,d,u,n.uid,a,l,n,t]),null}function EmailPill({text:l,error:e,handleClick:n}){return jsxRuntimeExports.jsxs("div",{"data-testid":`${e?" pill--error":"pill--ok"}`,className:`email-pill ${e?" email-pill--error":""}`,children:[jsxRuntimeExports.jsx("div",{children:l}),jsxRuntimeExports.jsx("div",{className:"email-pill__delete",children:jsxRuntimeExports.jsx("button",{type:"button",onClick:n,className:"icon-close unset-button","aria-label":"icon click"})})]})}function StepOne({handleContinue:l,handleCancel:e,translate:n,text:t}){const[a,o]=React$2.useState([]),[d,f]=React$2.useState(0),[h,u]=React$2.useState(0),p=React$2.useRef(null),_=(g,v,T)=>{g.stopPropagation(),o(a.filter(R=>R!==a[T])),v.error&&f(d-1),v.isRepeat&&u(h-1)},b=()=>{p.current&&p.current.focus()},S=()=>{[" ",",",";","."].includes(p.current.value)&&(p.current.value="")},E=g=>{const v=p.current.value,T=["Space","Comma","Period","Enter"],R=["Space","Comma","Enter","Tab"];v===""&&(T.includes(g.code)||g.keyCode==="186"||g.key==="Enter"||g.key===" ")?g.preventDefault():p.current.value.length>1&&(R.includes(g.code)||g.type==="blur")&&(g.preventDefault(),/[A-Za-z0-9._%+-]{3,}@[A-Za-z0-9_+-]{2,}([.]{1}[a-zA-Z]{2,}|[.]{1}[a-zA-Z]{2,}[.]{1}[a-zA-Z]{2,})/.test(v)?a.find(C=>C.text===v)?(u(h+1),o([...a,{text:v,error:!0,isRepeat:!0}])):o([...a,{text:v}]):(o([...a,{text:v,error:!0}]),f(d+1)),p.current.value="")};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__body",children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__title",children:n("puzzles.referrals.inviter.titleStep1")}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__subtitle",children:t}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__form",children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__instructions",children:[jsxRuntimeExports.jsx("div",{dir:"auto",children:n("puzzles.referrals.inviter.instructions")}),jsxRuntimeExports.jsx("div",{dir:"auto",children:n("puzzles.referrals.inviter.limit")})]}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__faketextarea",onKeyUp:()=>{},role:"button",tabIndex:"-1",onClick:b,"aria-labelledby":"list of emails",children:jsxRuntimeExports.jsxs("div",{className:"referrals-piece__scrollarea",id:"list of emails",children:[a&&a.map((g,v)=>jsxRuntimeExports.jsx(EmailPill,{text:g.text,error:g.error,handleClick:T=>_(T,g,v),emailPillIndex:v},`${a.indexOf(g)}`)),a.length<=9?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{id:"email",ref:p,className:"referrals-piece__inputemail",onChange:S,onKeyDown:E,onBlur:E,type:"email",autoComplete:"off"}),jsxRuntimeExports.jsx("label",{className:"referrals-piece__emaillabel",htmlFor:"email",children:jsxRuntimeExports.jsx("span",{children:n("puzzles.referrals.inviter.skipButton")})})]}):null]})}),jsxRuntimeExports.jsxs("div",{dir:LangIsRtl()?"rtl":"auto",className:"referrals-piece__footervalidation",children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__errormessage",children:[jsxRuntimeExports.jsx("div",{children:h>0?n("puzzles.referrals.inviter.errorEmailRepeat"):null}),jsxRuntimeExports.jsx("div",{children:d>0?n("puzzles.referrals.inviter.errorMessage"):null})]}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__counter","data-testid":"pillcounter",children:[a.length,"/10"]})]})]})]}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__buttons",children:[jsxRuntimeExports.jsx("button",{"data-testid":"cancelButton",className:"gat--btn gat--btn__secondary",type:"button",onClick:e,children:n("puzzles.referrals.inviter.skipButton")}),jsxRuntimeExports.jsx("button",{className:`gat--btn gat--btn__primary ${h>0||d>0||a.length===0?" disabled":""}`,type:"button",disabled:d>0||a.length===0,onClick:()=>l(a),children:n("puzzles.referrals.inviter.inviteButton")})]})]})}function StepTwo({handleFinish:l,translate:e,valid:n,invalid:t}){const[a,o]=React$2.useState(!1),d=()=>{o(!a)},f=n===1?"invitationSend":"invitationsSend",h=t===1?"invitationNotSend":"invitationsNotSend";return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__body",dir:"auto",children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__title",children:e("puzzles.referrals.inviter.titleStep2")}),jsxRuntimeExports.jsxs("ul",{className:"referrals-piece__feedback",children:[!!n.current&&jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__feedbackicon icon-check-circle-black color--success"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("strong",{children:n.current})," ",e(`puzzles.referrals.inviter.${f}`)]})]}),!!t.current&&jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__feedbackicon icon-error-circle-black color--error"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("strong",{children:t.current})," ",e(`puzzles.referrals.inviter.${h}`)]}),jsxRuntimeExports.jsx("button",{className:"un-button",type:"button",onClick:d,children:e("puzzles.referrals.inviter.whyFail")})]})]}),a?jsxRuntimeExports.jsxs("ul",{className:"referrals-piece__failsreasons",children:[jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons1")}),jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons2")}),jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons3")})]}):null]}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__buttons",children:jsxRuntimeExports.jsx("button",{className:"gat--btn gat--btn__primary",type:"button",onClick:l,children:e("puzzles.referrals.inviter.continueButton")})})]})}function ReferralComponent({emitEvent:l,text:e,rewards:n,referrals:t}){const a=b=>l({type:"translate",payload:b}),[o,d]=React$2.useState("step1"),f=React$2.useRef(0),h=React$2.useRef(0),u=async b=>{const S=b.map(g=>g.text),E=await l({type:"sendReferrals",payload:S});f.current=E&&E.data?E.data.valid.length:0,h.current=S.length-f.current,d("step2")};if(!t)return l({type:"success"}),null;const p=()=>{l({type:"success"})},_=()=>{if(f.current){const b=n.map(S=>(S.points*=f.current,S));l({type:"addPoints",complex:!0,finish:!0,payload:b})}else l({type:"success"})};return jsxRuntimeExports.jsx("div",{className:"referrals-piece",children:jsxRuntimeExports.jsxs("div",{className:"referrals-piece__center",children:[o==="step1"&&jsxRuntimeExports.jsx(StepOne,{translate:a,handleContinue:u,handleCancel:p,text:e}),o==="step2"&&jsxRuntimeExports.jsx(StepTwo,{translate:a,handleFinish:_,valid:f,invalid:h})]})})}exports.AnimationComponent=AnimationComponent;exports.AutoEvaluationComponent=AutoEvaluation;exports.CardsSelectorPuzzleComponent=CardsSelectorPuzzleComponent;exports.CartelComponent=CartelComponent;exports.ChainedImageClickPuzzleComponent=ChainedImageClickPuzzleComponent;exports.ChangeCamera=ChangeCamera;exports.ComicComponent=ComicComponent;exports.ConversationalComponent=ConversationalComponent;exports.ConversationalProComponent=ConversationalProComponent;exports.CrackerPuzzleComponent=CrackerPuzzleComponent;exports.DecisionComponent=DecisionComponent;exports.DialogComponent=DialogComponent;exports.DragItemPuzzleComponent=DragItemPuzzleComponent;exports.FrameImageClickComponent=FrameImageClickComponent;exports.HackerPuzzleComponent=HackerPuzzleComponent;exports.HangedPuzzleComponent=HangedPuzzleComponent;exports.ImageClickPuzzleComponent=ImageClickPuzzleComponent;exports.ImageComponent=ImageComponent;exports.InventoryItem=InventoryItem;exports.KeyboardPuzzleComponent=KeyboardPuzzleComponent;exports.LecturesComponent=LecturesComponent;exports.LoginPuzzleComponent=LoginPuzzleComponent;exports.NoticeComponent=NoticeComponent;exports.PatternComponent=PatternComponent;exports.PdfComponent=PdfComponent;exports.PdfVisor=PdfVisor;exports.ReferralComponent=ReferralComponent;exports.SurveyComponent=SurveyComponent;exports.TerminalPuzzleComponent=TerminalPuzzleComponent;exports.TestComponent=TestComponent;exports.TextClickPuzzleComponent=TextClickPuzzleComponent;exports.UrlComponent=UrlComponent;exports.VideoComponent=VideoComponent;exports.VideoVisor=VideoVisor;exports.WebBuilderPuzzleComponent=WebBuilderPuzzleComponent;exports.WriterPuzzleComponent=WriterPuzzleComponent;
274
+ ${E&&Ae()?"glowing-animation":""}`,"aria-label":LangIsRtl()?Re("storylines.misc.rewind"):Re("storylines.misc.forward"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})})]})}const activeCache=arcadeThreeCore.ProgressManager.request("AssetLoader").cache,assetLoader=new arcadeThreeCore.AssetLoader(void 0,activeCache);function Animation({animation:l,loopTimes:e,onAnimationFinish:n,onAnimationSave:t,resource:a,makeDefault:o,emitEvent:d}){const f=fiber.useThree(p=>p.scene),h=React$2.useRef(1),u=React$2.useRef();return React$2.useEffect(()=>{if(!u.current){const p=f.getObjectByProperty("uid",a.uid);if(p&&l&&p.skeletonId===l.skeletonId)if(o)t({uid:a.uid,animation:l.id,index:p.index}),n(l);else{const _=p.userData.animator,b=()=>{_.getAction(l.url).setLoop(three.LoopRepeat,1/0),h.current=1;function E(){h.current>=e&&(_.mix("idle"),n(l),_.removeEventListener("loop",E)),h.current+=1}_.mix(l.url).then(g=>{g&&_.addEventListener("loop",E)})};_.getAction(l.url)?b():assetLoader.load(l.url,S=>{_.register(l.url,S.animations[0]),b()})}else n(l);u.current=l.id}},[f,l.url,e,d,a.uid,o,l,a,n,t]),null}function MultipleAnimation({animations:l=[],enableInteraction:e,emitEvent:n}){const[t,a]=React$2.useState(!1),o=l.length,d=React$2.useRef(0),f=()=>{d.current+=1,d.current>=o&&a(!0)},h=u=>{n({type:"saveAnimation",payload:u})};return React$2.useEffect(()=>{t&&n({type:"success"})},[n,t]),React$2.useEffect(()=>{e&&a(!0)},[e]),l.map(({animation:u,resource:p,..._})=>jsxRuntimeExports.jsx(Animation,{animation:u,resource:p,..._,onAnimationSave:h,onAnimationFinish:f},`${u.id}_${p.uid}`))}function EmailPill({text:l,error:e,handleClick:n}){return jsxRuntimeExports.jsxs("div",{"data-testid":`${e?" pill--error":"pill--ok"}`,className:`email-pill ${e?" email-pill--error":""}`,children:[jsxRuntimeExports.jsx("div",{children:l}),jsxRuntimeExports.jsx("div",{className:"email-pill__delete",children:jsxRuntimeExports.jsx("button",{type:"button",onClick:n,className:"icon-close unset-button","aria-label":"icon click"})})]})}function StepOne({handleContinue:l,handleCancel:e,translate:n,text:t}){const[a,o]=React$2.useState([]),[d,f]=React$2.useState(0),[h,u]=React$2.useState(0),p=React$2.useRef(null),_=(g,v,T)=>{g.stopPropagation(),o(a.filter(R=>R!==a[T])),v.error&&f(d-1),v.isRepeat&&u(h-1)},b=()=>{p.current&&p.current.focus()},S=()=>{[" ",",",";","."].includes(p.current.value)&&(p.current.value="")},E=g=>{const v=p.current.value,T=["Space","Comma","Period","Enter"],R=["Space","Comma","Enter","Tab"];v===""&&(T.includes(g.code)||g.keyCode==="186"||g.key==="Enter"||g.key===" ")?g.preventDefault():p.current.value.length>1&&(R.includes(g.code)||g.type==="blur")&&(g.preventDefault(),/[A-Za-z0-9._%+-]{3,}@[A-Za-z0-9_+-]{2,}([.]{1}[a-zA-Z]{2,}|[.]{1}[a-zA-Z]{2,}[.]{1}[a-zA-Z]{2,})/.test(v)?a.find(C=>C.text===v)?(u(h+1),o([...a,{text:v,error:!0,isRepeat:!0}])):o([...a,{text:v}]):(o([...a,{text:v,error:!0}]),f(d+1)),p.current.value="")};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__body",children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__title",children:n("puzzles.referrals.inviter.titleStep1")}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__subtitle",children:t}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__form",children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__instructions",children:[jsxRuntimeExports.jsx("div",{dir:"auto",children:n("puzzles.referrals.inviter.instructions")}),jsxRuntimeExports.jsx("div",{dir:"auto",children:n("puzzles.referrals.inviter.limit")})]}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__faketextarea",onKeyUp:()=>{},role:"button",tabIndex:"-1",onClick:b,"aria-labelledby":"list of emails",children:jsxRuntimeExports.jsxs("div",{className:"referrals-piece__scrollarea",id:"list of emails",children:[a&&a.map((g,v)=>jsxRuntimeExports.jsx(EmailPill,{text:g.text,error:g.error,handleClick:T=>_(T,g,v),emailPillIndex:v},`${a.indexOf(g)}`)),a.length<=9?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{id:"email",ref:p,className:"referrals-piece__inputemail",onChange:S,onKeyDown:E,onBlur:E,type:"email",autoComplete:"off"}),jsxRuntimeExports.jsx("label",{className:"referrals-piece__emaillabel",htmlFor:"email",children:jsxRuntimeExports.jsx("span",{children:n("puzzles.referrals.inviter.skipButton")})})]}):null]})}),jsxRuntimeExports.jsxs("div",{dir:LangIsRtl()?"rtl":"auto",className:"referrals-piece__footervalidation",children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__errormessage",children:[jsxRuntimeExports.jsx("div",{children:h>0?n("puzzles.referrals.inviter.errorEmailRepeat"):null}),jsxRuntimeExports.jsx("div",{children:d>0?n("puzzles.referrals.inviter.errorMessage"):null})]}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__counter","data-testid":"pillcounter",children:[a.length,"/10"]})]})]})]}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__buttons",children:[jsxRuntimeExports.jsx("button",{"data-testid":"cancelButton",className:"gat--btn gat--btn__secondary",type:"button",onClick:e,children:n("puzzles.referrals.inviter.skipButton")}),jsxRuntimeExports.jsx("button",{className:`gat--btn gat--btn__primary ${h>0||d>0||a.length===0?" disabled":""}`,type:"button",disabled:d>0||a.length===0,onClick:()=>l(a),children:n("puzzles.referrals.inviter.inviteButton")})]})]})}function StepTwo({handleFinish:l,translate:e,valid:n,invalid:t}){const[a,o]=React$2.useState(!1),d=()=>{o(!a)},f=n===1?"invitationSend":"invitationsSend",h=t===1?"invitationNotSend":"invitationsNotSend";return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__body",dir:"auto",children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__title",children:e("puzzles.referrals.inviter.titleStep2")}),jsxRuntimeExports.jsxs("ul",{className:"referrals-piece__feedback",children:[!!n.current&&jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__feedbackicon icon-check-circle-black color--success"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("strong",{children:n.current})," ",e(`puzzles.referrals.inviter.${f}`)]})]}),!!t.current&&jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__feedbackicon icon-error-circle-black color--error"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("strong",{children:t.current})," ",e(`puzzles.referrals.inviter.${h}`)]}),jsxRuntimeExports.jsx("button",{className:"un-button",type:"button",onClick:d,children:e("puzzles.referrals.inviter.whyFail")})]})]}),a?jsxRuntimeExports.jsxs("ul",{className:"referrals-piece__failsreasons",children:[jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons1")}),jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons2")}),jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons3")})]}):null]}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__buttons",children:jsxRuntimeExports.jsx("button",{className:"gat--btn gat--btn__primary",type:"button",onClick:l,children:e("puzzles.referrals.inviter.continueButton")})})]})}function ReferralComponent({emitEvent:l,text:e,rewards:n,referrals:t}){const a=b=>l({type:"translate",payload:b}),[o,d]=React$2.useState("step1"),f=React$2.useRef(0),h=React$2.useRef(0),u=async b=>{const S=b.map(g=>g.text),E=await l({type:"sendReferrals",payload:S});f.current=E&&E.data?E.data.valid.length:0,h.current=S.length-f.current,d("step2")};if(!t)return l({type:"success"}),null;const p=()=>{l({type:"success"})},_=()=>{if(f.current){const b=n.map(S=>(S.points*=f.current,S));l({type:"addPoints",complex:!0,finish:!0,payload:b})}else l({type:"success"})};return jsxRuntimeExports.jsx("div",{className:"referrals-piece",children:jsxRuntimeExports.jsxs("div",{className:"referrals-piece__center",children:[o==="step1"&&jsxRuntimeExports.jsx(StepOne,{translate:a,handleContinue:u,handleCancel:p,text:e}),o==="step2"&&jsxRuntimeExports.jsx(StepTwo,{translate:a,handleFinish:_,valid:f,invalid:h})]})})}exports.AnimationComponent=MultipleAnimation;exports.AutoEvaluationComponent=AutoEvaluation;exports.CardsSelectorPuzzleComponent=CardsSelectorPuzzleComponent;exports.CartelComponent=CartelComponent;exports.ChainedImageClickPuzzleComponent=ChainedImageClickPuzzleComponent;exports.ChangeCamera=ChangeCamera;exports.ComicComponent=ComicComponent;exports.ConversationalComponent=ConversationalComponent;exports.ConversationalProComponent=ConversationalProComponent;exports.CrackerPuzzleComponent=CrackerPuzzleComponent;exports.DecisionComponent=DecisionComponent;exports.DialogComponent=DialogComponent;exports.DragItemPuzzleComponent=DragItemPuzzleComponent;exports.FrameImageClickComponent=FrameImageClickComponent;exports.HackerPuzzleComponent=HackerPuzzleComponent;exports.HangedPuzzleComponent=HangedPuzzleComponent;exports.ImageClickPuzzleComponent=ImageClickPuzzleComponent;exports.ImageComponent=ImageComponent;exports.InventoryItem=InventoryItem;exports.KeyboardPuzzleComponent=KeyboardPuzzleComponent;exports.LecturesComponent=LecturesComponent;exports.LoginPuzzleComponent=LoginPuzzleComponent;exports.NoticeComponent=NoticeComponent;exports.PatternComponent=PatternComponent;exports.PdfComponent=PdfComponent;exports.PdfVisor=PdfVisor;exports.ReferralComponent=ReferralComponent;exports.SurveyComponent=SurveyComponent;exports.TerminalPuzzleComponent=TerminalPuzzleComponent;exports.TestComponent=TestComponent;exports.TextClickPuzzleComponent=TextClickPuzzleComponent;exports.UrlComponent=UrlComponent;exports.VideoComponent=VideoComponent;exports.VideoVisor=VideoVisor;exports.WebBuilderPuzzleComponent=WebBuilderPuzzleComponent;exports.WriterPuzzleComponent=WriterPuzzleComponent;
275
275
  //# sourceMappingURL=arcade-components.cjs.map