scrawl-canvas
Version:
Responsive, interactive and more accessible HTML5 canvas elements. Scrawl-canvas is a JavaScript library designed to make using the HTML5 canvas element easier, and more fun
1 lines • 620 kB
JavaScript
const t={},e=[],i={},n=[],s={},r=[],o={},a=[],l={},c=[],h={},u=[],d={},f=[],p={},g=[],m={},y=[],b={},S=[],A={},C=[],k={},v=[],P={},O={},x=[],D={},w=[],F={},R=[],T={},E=[],H={},I=[],L={},B=[],$={};function M(h=""){const u=function(t,e,i=!1){t.forEach((t=>{const n=e[t];n&&n.kill&&n.kill(i)}))};if(h){u(a.filter((t=>0===t.indexOf(h))),o);u(c.filter((t=>0===t.indexOf(h))),l);u(v.filter((t=>0===t.indexOf(h))),k,!0);u(B.filter((t=>0===t.indexOf(h))),L);u(I.filter((t=>0===t.indexOf(h))),H);u(n.filter((t=>0===t.indexOf(h))),i);u(r.filter((t=>0===t.indexOf(h))),s);u(S.filter((t=>0===t.indexOf(h))),b);u(e.filter((t=>0===t.indexOf(h))),t);u(x.filter((t=>0===t.indexOf(h))),O);u(w.filter((t=>0===t.indexOf(h))),D);u(R.filter((t=>0===t.indexOf(h))),F)}}function X(t=""){const e=`100px ${t}`;return C.includes(e)}function Y(t=""){const e=`100px ${t}`;return C.includes(e)?A[e]:null}function G(t=""){return a.includes(t)?o[t]:null}function N(t=""){return c.includes(t)?l[t]:null}function z(t=""){return y.includes(t)?m[t]:null}function j(t=""){return u.includes(t)?h[t]:null}function V(t=""){return B.includes(t)?L[t]:null}function W(t=""){return I.includes(t)?H[t]:null}function U(t=""){return B.includes(t)?L[t]:f.includes(t)?d[t]:null}function Z(t=""){return f.includes(t)?d[t]:null}function K(t=""){return S.includes(t)?b[t]:null}function _(t=""){return v.includes(t)?k[t]:null}function q(t=""){return E.includes(t)?T[t]:null}function Q(t=""){return g.includes(t)?p[t]:null}const J={};var tt=Object.freeze({__proto__:null,anchor:t,anchornames:e,animation:i,animationnames:n,animationtickers:s,animationtickersnames:r,artefact:o,artefactnames:a,asset:l,assetnames:c,canvas:h,canvasnames:u,cell:d,cellnames:f,checkFontIsLoaded:X,constructors:J,element:p,elementnames:g,entity:m,entitynames:y,filter:b,filternames:S,findArtefact:G,findAsset:N,findCanvas:j,findCell:Z,findElement:Q,findEntity:z,findFilter:K,findGroup:_,findPattern:U,findStack:q,findStyles:V,findTween:W,fontfamilymetadata:A,fontfamilymetadatanames:C,force:O,forcenames:x,getFontMetadata:Y,group:k,groupnames:v,palette:{},palettenames:[],particle:P,particlenames:[],purge:M,spring:D,springnames:w,stack:T,stacknames:E,styles:L,stylesnames:B,tween:H,tweennames:I,unstackedelement:$,unstackedelementnames:[],version:"8.15.0",world:F,worldnames:R});const et=Math.abs,it=Object.assign,nt=Math.atan2,st=Math.ceil,rt=window.getComputedStyle,ot=Math.cos,at=Object.create,lt=Object.entries,ct=Math.floor,ht=Math.hypot,ut=Array.isArray,dt=Number.isFinite,ft=Object.keys,pt=Math.max,gt=Math.min,mt=Date.now,yt=JSON.parse,bt=2*Math.PI,St=.5*Math.PI,At=Math.pow,Ct=Math.PI/180,kt=Math.random,vt=Math.round,Pt=Object.setPrototypeOf,Ot=Math.sin,xt=Math.sqrt,Dt=.016,wt=Object.values,Ft="BODY",Rt="image_",Tt="video_",Et="2d",Ht="absolute",It=["Canvas","Stack"],Lt="addEventListener",Bt="alpha-to-channels",$t="alpha-to-luminance",Mt="alphabetic",Xt="anchor",Yt="animation",Gt="anonymous",Nt="area-alpha",zt=",",jt="aria-hidden",Vt="aria-live",Wt="asset",Ut=/.*\/(.*?)\./,Zt="auto",Kt="autofocus",_t="average-channels",qt="bezier",Qt="rgb(0 0 0 / 1)",Jt="black-white",te="rgb(0 0 0 / 0)",ee="blend",ie="block",ne="bluenoise",se="blur",re="blurAction",oe="border-box",ae="bottom",le="canvas",ce="center",he="channels-to-alpha",ue="chroma",de="clamp-channels",fe="clear",pe="click",ge="clickAction",me="close",ye="color",be="colors-to-alpha",Se="compose",Ae="control",Ce="coord",ke=["topLeft","topRight","bottomRight","bottomLeft"],ve='[data-scrawl-corner-div="sc"]',Pe="corrode",Oe="data-scrawl-group",xe="data-tab-order",De="12px sans-serif",we="any_random_string_will_do",Fe="description",Re="destination-out",Te="destination-over",Ee="dimensions",He="disabled",Ie="displace",Le="display-p3",Be="div",$e="down",Me="download",Xe="element",Ye="emboss",Ge="end",Ne="endControl",ze="enter",je="entity",Ve="euler",We="fill",Ue="filter",Ze="flood",Ke="focus",_e="focusAction",qe=["Label","EnhancedLabel"],Qe="form",Je="function",ti="gaussian-blur",ei="glitch",ii=["Cell","CellFragment"],ni="grayscale",si="green",ri="hanging",oi="height",ai="high",li="href",ci="hreflang",hi="ideographic",ui="img",di=["RGB","HSL","HWB","XYZ","LAB","LCH","OKLAB","OKLCH"],fi="invert-channels",pi="leave",gi="left",mi="lineDash",yi="linear",bi="lock-channels-to-levels",Si="ltr",Ai="luminance-to-alpha",Ci="map-to-gradient",ki="matrix",vi="mean",Pi="mimic",Oi="middle",xi="modify-ok-channels",Di="modulate-channels",wi="modulate-ok-channels",Fi="mouse",Ri="mousedown",Ti="mouseenter",Ei="mouseleave",Hi="mousemove",Ii="mouseup",Li="move",Bi="multiply",$i="name",Mi="negative",Xi="newsprint",Yi="none",Gi="normal",Ni="offset",zi="particle",ji="path",Vi="%",Wi="0%",Ui="100%",Zi="50%",Ki="ping",_i="pivot",qi="pixelate",Qi="pointerdown",Ji="pointerenter",tn="pointerleave",en="pointermove",nn="pointerup",sn="polite",rn="process-image",on="0px",an="quadratic",ln=["radiusX"],cn=["radiusX","radiusY"],hn=["radiusY"],un="random",dn="random-noise",fn="rect-grid",pn="rectangle",gn="red",mn="reduce-palette",yn="referrerpolicy",bn="rel",Sn="relative",An="removeEventListener",Cn="reverseByDelta",kn="RGB",vn="right",Pn="role",On="root",xn="rotate-hue",Dn="round",wn="set-channel-to-level",Fn="source",Rn="source-in",Tn="source-out",En="source-over",Hn=" ",In="srgb",Ln="start",Bn="startControl",$n=["direction","fillStyle","filter","font","fontKerning","fontStretch","fontVariantCaps","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","imageSmoothingQuality","letterSpacing","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","strokeStyle","textAlign","textBaseline","textRendering","wordSpacing"],Mn=["fillStyle","filter","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","imageSmoothingQuality","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","strokeStyle"],Xn=["direction","font","fontKerning","fontStretch","fontVariantCaps","letterSpacing","textRendering","wordSpacing"],Yn="step-channels",Gn="styles",Nn="subscribe",zn="swirl",jn="Action",Vn="Bezier",Wn="Canvas",Un="Cell",Zn="Color",Kn="Coordinate",_n="EnhancedLabel",qn="Filter",Qn="Group",Jn="Image",ts="Label",es="Line",is="Palette",ns="Particle",ss="Picture",rs="Polyline",os="Quadratic",as="Quaternion",ls="RenderAnimation",cs="Sprite",hs="Stack",us="Ticker",ds="Tween",fs="Vector",ps="Video",gs="World",ms="tabOrder",ys="target",bs="threshold",Ss="tiles",As="tint-channels",Cs="top",ks="touchcancel",vs="touchend",Ps="touchmove",Os="touchstart",xs="true",Ds="tween",ws="type",Fs="undefined",Rs="unknown",Ts="up",Es="updateByDelta",Hs="user-defined-legacy",Is="value",Ls="vary-channels-by-weights",Bs="video",$s="rgb(255 255 255 / 1)",Ms="width",Xs="M0,0",Ys="",Gs=["ARTICLE","ASIDE","DIV","FOOTER","HEADER","MAIN","NAV","SECTION"],Ns=["ARTICLE","ASIDE","DIV","FOOTER","HEADER","MAIN","NAV","SECTION","ADDRESS","BLOCKQUOTE","DL","FIGURE","FORM","H1","H2","H3","H4","H5","H6","HGROUP","MENU","METER","OL","P","PRE","PROGRESS","SEARCH","SELECT","TABLE","TEXTAREA","UL","OUTPUT"],zs=["BASE","HEAD","LINK","META","STYLE","TITLE","BODY","DD","DT","FIGCAPTION","HR","LI","ABBR","B","BDI","BDO","BR","CITE","CODE","DATA","DFN","EM","I","KBD","MARK","Q","RP","RT","RUBY","S","SAMP","SMALL","SPAN","STRONG","SUB","SUP","TIME","U","VAR","WBR","AREA","MAP","TRACK","SOURCE","NOSCRIPT","SCRIPT","DEL","INS","CAPTION","COL","COLGROUP","TBODY","TD","TFOOT","TH","THEAD","TR","DATALIST","FIELDSET","LABEL","LEGEND","OPTGROUP","OPTION","SLOT","DIALOG","SUMMARY","TEMPLATE","ACRONYM","BIG","CENTER","CONTENT","DIR","FONT","FRAME","FRAMESET","IMAGE","MARQUEE","MENUITEM","NOBR","NOEMBED","NOFRAMES","PARAM","PLAINTEXT","RB","RTC","SHADOW","STRIKE","TT","XMP","ANIMATE","ANIMATEMOTION","ANIMATETRANSFORM","CIRCLE","CLIPPATH","CURSOR","DEFS","DESC","ELLIPSE","FEBLEND","FECOLORMATRIX","FECOMPONENTTRANSFER","FECOMPOSITE","FECONVOLVEMATRIX","FEDIFFUSELIGHTING","FEDISPLACEMENTMAP","FEDISTANTLIGHT","FEDROPSHADOW","FEFLOOD","FEFUNCA","FEFUNCB","FEFUNCG","FEFUNCR","FEGAUSSIANBLUR","FEIMAGE","FEMERGE","FEMERGENODE","FEMORPHOLOGY","FEOFFSET","FEPOINTLIGHT","FESPECULARLIGHTING","FESPOTLIGHT","FETILE","FETURBULENCE","FILTER","FONT-FACE-FORMAT","FONT-FACE-NAME","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE","FONT","FONT","FOREIGNOBJECT","G","GLYPH","GLYPHREF","HKERN","IMAGE","LINE","LINEARGRADIENT","MARKER","MASK","METADATA","MISSING-GLYPH","MPATH","PATH","PATTERN","POLYGON","POLYLINE","RADIALGRADIENT","RECT","SCRIPT","SET","STOP","STYLE","SWITCH","SYMBOL","TEXT","TEXTPATH","TREF","TSPAN","USE","VIEW","VKERN"],js=Math.PI,Vs="ms",Ws=(t,e)=>{if(null!=e){gi===t||Cs===t?t=Wi:vn===t||ae===t?t=Ui:ce===t&&(t=Zi);const i=!(!t.substring&&!e.substring);return lr(t)?t+=lr(e)?e:parseFloat(e):t=parseFloat(t)+(lr(e)?e:parseFloat(e)),i?t+Vi:t}return t},Us=function(t,e,i){return t<e?e:t>i?i:t},Zs=t=>{if(lr(t))return[Vs,t];if(t.substring){const e=t.match(/^\d+\.?\d*(\D*)/);let i=e[1].toLowerCase?e[1].toLowerCase():Vs,n=parseFloat(t);if(dt(n)){switch(i){case"s":n*=1e3;break;case"%":break;default:i=Vs}return[i,n]}return[Vs,0]}},Ks=t=>dt(t)?((t%=360)<0&&(t+=360),t):0,_s=t=>{if(dt(t)){if(t<-1e-6)return t;if(t>1e-6)return t}return 0},qs=()=>{},Qs=function(t){return t},Js=function(){return new Error("Clone functionality is not supported for this object")},tr={},er=()=>{function t(){return ct(65536*(1+kt())).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`},ir=()=>performance.now().toString(36)+kt().toString(36).substr(2),nr=function(t,e,i){return e+t*(i-e)},sr=t=>"boolean"==typeof t,rr=t=>"[object HTMLCanvasElement]"===Object.prototype.toString.call(t),or=t=>!!(t&&t.querySelector&&t.dispatchEvent),ar=t=>typeof t===Je,lr=t=>!!dt(t),cr=t=>"[object Object]"===Object.prototype.toString.call(t),hr=t=>!(!t||!t.type||t.type!==as),ur=(t,e)=>{if(cr(t)&&cr(e))for(const i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},dr=(t,e)=>(cr(t)&&cr(e)&<(e).forEach((([i,n])=>{null==n?delete t[i]:t[i]=e[i]})),t),fr=(t,e)=>(ut(t)&&(ut(e)?e.forEach((e=>fr(t,e))):t.includes(e)||t.push(e)),t),pr=(t,e)=>{if(ut(t)){const i=t.indexOf(e);i>=0&&t.splice(i,1)}return t},gr=t=>typeof t!==Fs,mr=(...t)=>t.every((t=>typeof t!==Fs)),yr=(...t)=>t.find((t=>typeof t!==Fs)),br=(...t)=>!!t.find((t=>typeof t!==Fs)),Sr={out:t=>1-ot(t*js/2),in:t=>Ot(t*js/2),easeIn:t=>{const e=1-t;return 1-e*e},easeIn3:t=>{const e=1-t;return 1-e*e*e},easeIn4:t=>{const e=1-t;return 1-e*e*e*e},easeIn5:t=>{const e=1-t;return 1-e*e*e*e*e},easeOutIn:t=>t<.5?2*t*t:1-At(-2*t+2,2)/2,easeOutIn3:t=>t<.5?4*t*t*t:1-At(-2*t+2,3)/2,easeOutIn4:t=>t<.5?8*t*t*t*t:1-At(-2*t+2,4)/2,easeOutIn5:t=>t<.5?16*t*t*t*t*t:1-At(-2*t+2,5)/2,easeInOut:t=>{const e=.5-t;return t<.5?.5+-2*e*e:.5+At(2*(t-.5),2)/2},easeInOut3:t=>{const e=.5-t;return t<.5?.5+-4*e*e*e:.5+At(2*(t-.5),3)/2},easeInOut4:t=>{const e=.5-t;return t<.5?.5+-8*e*e*e*e:.5+At(2*(t-.5),4)/2},easeInOut5:t=>{const e=.5-t;return t<.5?.5+-16*e*e*e*e*e:.5+At(2*(t-.5),5)/2},easeOut:t=>t*t,easeOut3:t=>t*t*t,easeOut4:t=>t*t*t*t,easeOut5:t=>t*t*t*t*t,none:t=>t,linear:t=>t,cosine:t=>.5*(1+ot((1-t)*js)),hermite:t=>t*t*(2*-t+3),quintic:t=>t*t*t*(t*(6*t-15)+10),easeOutSine:t=>1-ot(t*js/2),easeInSine:t=>Ot(t*js/2),easeOutInSine:t=>-(ot(js*t)-1)/2,easeOutQuad:t=>t*t,easeInQuad:t=>1-(1-t)*(1-t),easeOutInQuad:t=>t<.5?2*t*t:1-At(-2*t+2,2)/2,easeOutCubic:t=>t*t*t,easeInCubic:t=>1-At(1-t,3),easeOutInCubic:t=>t<.5?4*t*t*t:1-At(-2*t+2,3)/2,easeOutQuart:t=>t*t*t*t,easeInQuart:t=>1-At(1-t,4),easeOutInQuart:t=>t<.5?8*t*t*t*t:1-At(-2*t+2,4)/2,easeOutQuint:t=>t*t*t*t*t,easeInQuint:t=>1-At(1-t,5),easeOutInQuint:t=>t<.5?16*t*t*t*t*t:1-At(-2*t+2,5)/2,easeOutExpo:t=>0===t?0:At(2,10*t-10),easeInExpo:t=>1===t?1:1-At(2,-10*t),easeOutInExpo:t=>0===t||1===t?t:t<.5?At(2,20*t-10)/2:(2-At(2,-20*t+10))/2,easeOutCirc:t=>1-xt(1-At(t,2)),easeInCirc:t=>xt(1-At(t-1,2)),easeOutInCirc:t=>t<.5?(1-xt(1-At(2*t,2)))/2:(xt(1-At(-2*t+2,2))+1)/2,easeOutBack:t=>2.70158*t*t*t-1.70158*t*t,easeInBack:t=>1+2.70158*At(t-1,3)+1.70158*At(t-1,2),easeOutInBack:t=>{const e=2.5949095;return t<.5?At(2*t,2)*(7.189819*t-e)/2:(At(2*t-2,2)*((e+1)*(2*t-2)+e)+2)/2},easeOutElastic:t=>{const e=2*js/3;return 0===t||1===t?t:-At(2,10*t-10)*Ot((10*t-10.75)*e)},easeInElastic:t=>{const e=2*js/3;return 0===t||1===t?t:At(2,-10*t)*Ot((10*t-.75)*e)+1},easeOutInElastic:t=>{const e=2*js/4.5;return 0===t||1===t?t:t<.5?-At(2,20*t-10)*Ot((20*t-11.125)*e)/2:At(2,-20*t+10)*Ot((20*t-11.125)*e)/2+1},easeOutBounce:t=>{const e=7.5625,i=2.75;return(t=1-t)<1/i?1-e*t*t:t<2/i?1-(e*(t-=1.5/i)*t+.75):t<2.5/i?1-(e*(t-=2.25/i)*t+.9375):1-(e*(t-=2.625/i)*t+.984375)},easeInBounce:t=>{const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeOutInBounce:t=>{const e=7.5625,i=2.75;let n;return t<.5?(n=(t=1-2*t)<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375,(1-n)/2):(n=(t=2*t-1)<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375,(1+n)/2)}},Ar=()=>at(Object.prototype);let Cr=!1;const kr=()=>Cr,vr=t=>Cr=t;let Pr=!1;const Or=()=>Pr,xr=t=>Pr=t;let Dr=!1;const wr=()=>Dr,Fr=t=>Dr=t;let Rr=!1;const Tr=()=>Rr,Er=t=>Rr=t;let Hr=!1;const Ir=()=>Hr,Lr=t=>Hr=t;let Br=!1;const $r=()=>Br,Mr=t=>Br=t;let Xr=!1;const Yr=()=>Xr,Gr=t=>Xr=t;let Nr=!1;const zr=()=>Nr,jr=t=>Nr=t;let Vr=!1;const Wr=()=>Vr,Ur=t=>Vr=t;let Zr=!1;const Kr=()=>Zr,_r=t=>Zr=t;let qr=!0;const Qr=t=>qr=t;let Jr=!1;const to=t=>Jr=t;let eo=!0;const io=t=>eo=t,no=function(){Pr=!0,Dr=!0},so="GenericArray",ro=function(){const t=[];return Pt(t,ro.prototype),t};J.GenericArray=ro;const oo=ro.prototype=at(Array.prototype);oo.constructor=ro,oo.type=so;const ao=[],lo=function(){return ao.length||ao.push(new ro),ao.shift()},co=function(...t){t.forEach((t=>{t&&t.type===so&&(t.length=0,ao.push(t),ao.length>20&&(console.log("purging genericArrayPool"),ao.length=10))}))},ho=[],uo=[],fo=t=>{fr(uo,t),Qr(!0)},po=t=>{pr(uo,t),Qr(!0)},go=t=>uo.includes(t),mo=()=>{qr&&(Qr(!1),(()=>{const t=lo();let e,n,s,r;for(s=0,r=uo.length;s<r;s++)e=i[uo[s]],e&&(n=ct(e.order)||0,t[n]||(t[n]=lo()),t[n].push(e));for(ho.length=0,s=0,r=t.length;s<r;s++)e=t[s],e&&(ho.push(...e),co(e));co(t)})());for(let t=0,e=ho.length;t<e;t++){const e=ho[t];if(e.chokedAnimation){const t=mt();e.lastRun+825/e.maxFrameRate<t&&(e.fn(),e.lastRun=t)}else e.fn()}Jr&&window.requestAnimationFrame(mo)},yo=()=>{to(!0),mo()},bo=()=>to(!1),So=function(t,e,i=tr){if(typeof window.IntersectionObserver===Je&&t&&t.run){const n=new IntersectionObserver((e=>{let i,n,s;for(i=0,n=e.length;i<n;i++)s=e[i],s.isIntersecting&&!t.isRunning()?t.run():!s.isIntersecting&&t.isRunning()&&t.halt()}),i);return e&&e.domElement&&n.observe(e.domElement),function(){n.disconnect()}}return qs},Ao=function(t,e,i){return t&&ar(e)&&i?(ko(t,e,i,An),ko(t,e,i,Lt),function(){Co(t,e,i)}):qs},Co=function(t,e,i){t&&ar(e)&&i&&ko(t,e,i,An)},ko=function(t,e,i,n){const s=lo(),r=lo();ut(t)?s.push(...t):s.push(t),i.substring?r.push(...document.body.querySelectorAll(i)):ut(i)?r.push(...i):r.push(i),navigator.pointerEnabled||navigator.msPointerEnabled?Po(s,e,r,n):vo(s,e,r,n),co(r,s)},vo=function(t,e,i,n){let s,r,o,a,l,c;for(s=0,r=t.length;s<r;s++)for(l=t[s],o=0,a=i.length;o<a;o++)if(c=i[o],or(c)||c.document||c.characterSet)switch(l){case Li:c[n](Hi,e,!1),c[n](Ps,e,{passive:!1}),c[n]("touchfollow",e,{passive:!1});break;case Ts:c[n](Ii,e,!1),c[n](vs,e,{passive:!1});break;case $e:c[n](Ri,e,!1),c[n](Os,e,{passive:!1});break;case pi:c[n](Ei,e,!1),c[n]("touchleave",e,{passive:!1});break;case ze:c[n](Ti,e,!1),c[n]("touchenter",e,{passive:!1})}},Po=function(t,e,i,n){let s,r,o,a,l,c;for(s=0,r=t.length;s<r;s++)for(l=t[s],o=0,a=i.length;o<a;o++)if(c=i[o],or(c)||c.document||c.characterSet)switch(l){case Li:c[n](en,e,!1);break;case Ts:c[n](nn,e,!1);break;case $e:c[n](Qi,e,!1);break;case pi:c[n](tn,e,!1);break;case ze:c[n](Ji,e,!1)}},Oo=function(t,e,i){return t&&ar(e)&&i?(Do(t,e,i,An),Do(t,e,i,Lt),function(){xo(t,e,i)}):qs},xo=function(t,e,i){t&&ar(e)&&i&&Do(t,e,i,An)},Do=function(t,e,i,n){const s=lo(),r=lo();let o,a,l,c,h,u;for(ut(t)?s.push(...t):s.push(t),i.substring?r.push(...document.body.querySelectorAll(i)):ut(i)?r.push(...i):r.push(i),o=0,a=s.length;o<a;o++)for(h=s[o],l=0,c=r.length;l<c;l++)u=r[l],(or(u)||u.document||u.characterSet)&&u[n](h,e,!1);co(r,s)},wo="~~~",Fo=["Image","Sprite","Video","Canvas","Stack"];function Ro(t=tr){t.defs={},t.getters={},t.setters={},t.deltaSetters={},t.get=function(t){let e,i;if(gr(t)){if(i=this.getters[t],i)return i.call(this);{const i=this.defs[t];if(typeof i!==Fs)return e=this[t],typeof e!==Fs?e:i}}return null},t.set=function(t=tr){let e,i,n,s;const r=ft(t),o=r.length;if(o){const a=this.setters,l=this.defs;for(e=0;e<o;e++)i=r[e],n=t[i],i&&i!==$i&&null!=n&&(s=a[i],s?s.call(this,n):typeof l[i]!==Fs&&(this[i]=n))}return this},t.setDelta=function(t=tr){let e,i,n,s;const r=ft(t),o=r.length;if(o){const a=this.deltaSetters,l=this.defs;for(e=0;e<o;e++)i=r[e],n=t[i],i&&i!==$i&&null!=n&&(s=a[i],s?s.call(this,n):typeof l[i]!==Fs&&(this[i]=Ws(this[i],n)))}return this};t.defs=ur(t.defs,{name:""});const e=t.getters;e.type=function(){return this.type},e.isArtefact=function(){return this.isArtefact},e.isAsset=function(){return this.isAsset},t.packetExclusions=[],t.packetExclusionsByRegex=[],t.packetCoordinates=[],t.packetObjects=[],t.packetFunctions=[],t.saveAsPacket=function(t=tr){sr(t)&&t&&(t={includeDefaults:!0});const e=this.defs,i=ft(e),n=this.packetExclusions,s=this.packetExclusionsByRegex,r=this.packetCoordinates,o=this.packetObjects,a=this.packetFunctions;let l=t.includeDefaults||!1,c={};return l&&!ut(l)?l=ft(e):l||(l=[]),lt(this).forEach((([t,e])=>{let h,u=!0;if(i.includes(t)||(u=!1),u&&n.includes(t)&&(u=!1),u&&(h=s.some((e=>new RegExp(e).test(t))),h&&(u=!1)),u)if(a.includes(t)){if(gr(e)&&null!=e){const i=this.stringifyFunction(e);i&&i.length&&(c[t]=i)}}else o.includes(t)&&this[t]&&this[t].name?c[t]=this[t].name:r.includes(t)?(l.includes(t)||e[0]||e[1])&&(c[t]=e):(h=this.processPacketOut(t,e,l),h&&(c[t]=e))}),this),c=this.finalizePacketOut(c,t),JSON.stringify([this.name,this.type,this.lib,c])},t.stringifyFunction=function(t){const e=t.toString().match(/\(([\s\S]*?)\)[\s\S]*?\{([\s\S]*)\}/),i=e[1],n=e[2];return!!mr(i,n)&&`${i}${wo}${n}`},t.processPacketOut=function(t,e,i){let n=!0;return i.includes(t)||e!==this.defs[t]||(n=!1),n},t.finalizePacketOut=function(t){return t},t.importPacket=function(t){const e=this,i=function(t){return new Promise(((i,n)=>{let s;t.substring||n(new Error("Packet url supplied for import is not a string")),"["===t[0]?(s=e.actionPacket(t),s&&s.lib?i(s):n(s)):t.includes('"name":')?n(new Error("Bad packet supplied for import")):fetch(t).then((t=>{if(!t.ok)throw new Error(`Packet import from server failed - ${t.status}: ${t.statusText} - ${t.url}`);return t.text()})).then((t=>{if(s=e.actionPacket(t),!s||!s.lib)throw s;i(s)})).catch((t=>n(t)))}))};if(ut(t)){const e=[];return t.forEach((t=>e.push(i(t)))),new Promise(((t,i)=>{Promise.all(e).then((e=>t(e))).catch((t=>i(t)))}))}if(t.substring)return i(t);Promise.reject(new Error("Argument supplied for packet import is not a string or array of strings"))},t.actionPacket=function(t){try{if(t&&t.substring){if("["===t[0]){let e,i,n,s;try{[e,i,n,s]=yt(t)}catch(t){throw new Error(`Failed to process packet due to JSON parsing error - ${t.message}`)}if(mr(e,i,n,s)){if(Fo.includes(i))throw new Error("Failed to process packet - Stacks, Canvases and visual assets are excluded from the packet system");let t=tt[n][e];if(t)t.set(s);else{if(s.outerHTML&&s.host){const t=document.querySelector(`#${s.host}`);if(t){const i=document.createElement("div");i.innerHTML=s.outerHTML;const n=i.firstElementChild;n&&(n.id=e,t.appendChild(n),s.domElement=n)}}if(t=new J[i](s),!t)throw new Error("Failed to create Scrawl-canvas object from supplied packet")}if(t.packetFunctions.forEach((e=>this.actionPacketFunctions(t,e))),s.anchor&&t.anchor&&t.anchor.packetFunctions.forEach((e=>{t.anchor[e]=s.anchor[e],this.actionPacketFunctions(t.anchor,e),t.anchor.build()})),s.button&&t.button&&t.button.packetFunctions.forEach((e=>{t.button[e]=s.button[e],this.actionPacketFunctions(t.button,e),t.button.build()})),t)return t;throw new Error("Failed to process supplied packet")}throw new Error("Failed to process packet - JSON string holds incomplete data")}throw new Error("Failed to process packet - JSON string does not represent an array")}throw new Error("Failed to process packet - not a JSON string")}catch(t){return console.log(t),t}},t.actionPacketFunctions=function(t,e){const i=t[e];if(gr(i)&&null!=i&&i.substring)if(i===wo)t[e]=qs;else{let n,s,r;[n,s]=i.split(wo),n=n.split(zt),n=n.map((t=>t.trim())),s.includes("[native code]")?t[e]=qs:(r=new Function(...n,s),t[e]=r.bind(t))}},t.clone=function(t=tr){const e=this.name;let i,n,s,r;this.name=t.name||Ys,t.useNewTicker?(n=this.ticker,this.ticker=null,i=this.saveAsPacket(),this.ticker=n):(this.anchor&&(s=this.anchor,this.anchor=null),this.button&&(r=this.button,this.button=null),i=this.saveAsPacket(),s&&(this.anchor=s),r&&(this.button=r)),this.name=e;let o=this.actionPacket(i);return this.packetFunctions.forEach((t=>{this[t]&&(o[t]=this[t])})),o=this.postCloneAction(o,t),o.set(t),o},t.postCloneAction=function(t){return t},t.kill=function(){return this.deregister()},t.makeName=function(t){return t&&t.substring&&!tt[`${this.lib}names`].includes(t)?this.name=t:this.name=ir(),this},t.register=function(){if(!gr(this.name))throw new Error(`core/base error - register() name not set: ${this}`);const t=tt[`${this.lib}names`],e=tt[this.lib];return this.isArtefact&&(fr(a,this.name),o[this.name]=this),this.isAsset&&(fr(c,this.name),l[this.name]=this),fr(t,this.name),e[this.name]=this,this},t.deregister=function(){if(!gr(this.name))throw new Error(`core/base error - deregister() name not set: ${this}`);const t=tt[`${this.lib}names`],e=tt[this.lib];return this.isArtefact&&(pr(a,this.name),delete o[this.name]),this.isAsset&&(pr(c,this.name),delete l[this.name]),pr(t,this.name),delete e[this.name],this}}const Animation=function(t=tr){return this.makeName(t.name),this.order=gr(t.order)?t.order:this.defs.order,this.fn=t.fn||qs,this.onRun=t.onRun||qs,this.onHalt=t.onHalt||qs,this.onKill=t.onKill||qs,this.maxFrameRate=t.maxFrameRate||60,this.lastRun=0,this.chokedAnimation=!0,this.register(),t.delay||this.run(),this},To=Animation.prototype=Ar();To.type="Animation",To.lib=Yt,To.isArtefact=!1,To.isAsset=!1,Ro(To);To.defs=ur(To.defs,{order:1,maxFrameRate:60,fn:null,onRun:null,onHalt:null,onKill:null}),To.stringifyFunction=qs,To.processPacketOut=qs,To.finalizePacketOut=qs,To.saveAsPacket=function(){return`[${this.name}, ${this.type}, ${this.lib}, {}]`},To.clone=Js,To.run=function(){return this.onRun(),fo(this.name),setTimeout((()=>no()),20),this},To.isRunning=function(){return go(this.name)},To.halt=function(){return this.onHalt(),po(this.name),this},To.kill=function(){return this.onKill(),po(this.name),this.deregister(),!0};const Eo=function(t){return!!t&&new Animation(t)};J.Animation=Animation;const Ho="change",Io="touch",Lo=[],Bo={x:0,y:0,scrollX:0,scrollY:0,w:0,h:0,type:Fi,prefersReducedMotion:!1,prefersDarkColorScheme:!1,prefersReduceTransparency:!1,prefersContrast:!1,prefersReduceData:!1,prefersInvertedColors:!1,prefersForcedColors:!1,displaySupportsP3Color:!1,canvasSupportsP3Color:!1,devicePixelRatio:0,rawTouches:[]},$o=window.matchMedia("(prefers-contrast: more)");$o.addEventListener(Ho,(()=>{const t=$o.matches;Bo.prefersContrast!==t&&(Bo.prefersContrast=t,Er(!0))})),Bo.prefersContrast=$o.matches;const Mo=window.matchMedia("(prefers-reduced-motion: reduce)");Mo.addEventListener(Ho,(()=>{const t=Mo.matches;Bo.prefersReducedMotion!==t&&(Bo.prefersReducedMotion=t,Lr(!0))})),Bo.prefersReducedMotion=Mo.matches;const Xo=window.matchMedia("(prefers-color-scheme: dark)");Xo.addEventListener(Ho,(()=>{const t=Xo.matches;Bo.prefersDarkColorScheme!==t&&(Bo.prefersDarkColorScheme=t,Mr(!0))})),Bo.prefersDarkColorScheme=Xo.matches;const Yo=window.matchMedia("(prefers-reduced-transparency: reduce)");Yo.addEventListener(Ho,(()=>{const t=Yo.matches;Bo.prefersReduceTransparency!==t&&(Bo.prefersReduceTransparency=t,Gr(!0))})),Bo.prefersReduceTransparency=Yo.matches;const Go=window.matchMedia("(prefers-reduced-data: reduce)");Go.addEventListener(Ho,(()=>{const t=Go.matches;Bo.prefersReduceData!==t&&(Bo.prefersReduceData=t,jr(!0))})),Bo.prefersReduceData=Go.matches;const No=window.matchMedia("(inverted-colors: inverted)");No.addEventListener(Ho,(()=>{const t=No.matches;Bo.prefersInvertedColors!==t&&(Bo.prefersInvertedColors=t,_r(!0))})),Bo.prefersInvertedColors=No.matches;const zo=window.matchMedia("(forced-colors: active)");zo.addEventListener(Ho,(()=>{const t=zo.matches;Bo.prefersForcedColors!==t&&(Bo.prefersForcedColors=t,Ur(!0))})),Bo.prefersForcedColors=zo.matches;const jo=window.matchMedia("(color-gamut: p3)");jo.addEventListener(Ho,(()=>{const t=jo.matches;Bo.displaySupportsP3Color!==t&&(Bo.displaySupportsP3Color=t)})),Bo.displaySupportsP3Color=jo.matches;Bo.canvasSupportsP3Color=(()=>{const t=document.createElement("canvas");try{return t.getContext("2d",{colorSpace:Le}).getContextAttributes().colorSpace===Le}catch{console.log("checkCanvasSupportsDisplayP3 errored")}return!1})();const Vo=()=>Bo.devicePixelRatio;let Wo=!1;const Uo=()=>Wo,Zo=t=>Wo=t;let Ko=qs;const _o=t=>Ko=t,qo=()=>{const t=window.devicePixelRatio;Bo.devicePixelRatio=t,wt(h).forEach((t=>t.dirtyDimensions=!0)),wt(d).forEach((t=>t.dirtyDimensions=!0)),wt(m).forEach((t=>t.dirtyHost=!0)),Wo||Ko(),matchMedia(`(resolution: ${t}dppx)`).addEventListener(Ho,qo,{once:!0})};qo();const Qo=function(){const t=document.documentElement.clientWidth,e=document.documentElement.clientHeight;Bo.w===t&&Bo.h===e||(Bo.w=t,Bo.h=e,xr(!0),Fr(!0))},Jo=function(){const t=window.pageXOffset,e=window.pageYOffset;Bo.scrollX===t&&Bo.scrollY===e||(Bo.x+=t-Bo.scrollX,Bo.y+=e-Bo.scrollY,Bo.scrollX=t,Bo.scrollY=e,xr(!0))},ta=function(t){const e=vt(t.pageX),i=vt(t.pageY);Bo.x===e&&Bo.y===i||(Bo.type=navigator.pointerEnabled?"pointer":Fi,Bo.x=e,Bo.y=i,xr(!0))};let ea=0,ia=16;const na=function(){return ia},sa=function(t){dt(t)&&(ia=t)},ra=function(t,e=!0){if(Bo.rawTouches.length=0,t.touches&&t.touches.length){Bo.rawTouches.push(...t.touches);const e=t.touches[0],i=vt(e.pageX),n=vt(e.pageY);Bo.x===i&&Bo.y===n||(Bo.type=Io,Bo.x=i,Bo.y=n)}else Bo.type=Io,e&&(Bo.x=0,Bo.y=0);const i=mt();i>ea+ia&&(ea=i,oa())},oa=function(){for(let t=0,e=Lo.length;t<e;t++)aa(Lo[t])},aa=function(t){const e=o[t];if(e){const{here:t,domElement:i}=e;if(t.prefersContrast=Bo.prefersContrast,t.prefersReducedMotion=Bo.prefersReducedMotion,t.prefersDarkColorScheme=Bo.prefersDarkColorScheme,t.prefersReduceTransparency=Bo.prefersReduceTransparency,t.prefersReduceData=Bo.prefersReduceData,t.prefersInvertedColors=Bo.prefersInvertedColors,t.prefersForcedColors=Bo.prefersForcedColors,t.devicePixelRatio=Bo.devicePixelRatio,Tr()&&e.contrastActions(),Ir()&&e.reducedMotionActions(),$r()&&e.colorSchemeActions(),Yr()&&e.reducedTransparencyActions(),zr()&&e.reducedDataActions(),Kr()&&e.invertedColorsActions(),Wr()&&e.forcedColorsActions(),i){const n=i.getBoundingClientRect(),s=vt(n.left+window.pageXOffset),r=vt(n.top+window.pageYOffset),o=n.top,a=n.height,l=window.innerHeight;t.w=vt(n.width),t.h=vt(a),t.type=Bo.type;const c=o/l,h=(o+a)/l,u=(c+h)/2;t.inViewportTop=c,t.inViewportBase=h,t.inViewportCenter=u,e.localMouseListener?(t.localListener=!0,t.active=!1,t.normX=!!t.originalWidth&&t.x/t.originalWidth,t.normY=!!t.originalHeight&&t.y/t.originalHeight,t.offsetX=s,t.offsetY=r,t.x>e.activePadding&&t.x<t.originalWidth-e.activePadding&&t.y>0+e.activePadding&&t.y<t.originalHeight-e.activePadding&&(t.active=!0)):(t.localListener=!1,t.active=!0,t.x=vt(Bo.x-s),t.y=vt(Bo.y-r),t.normX=!!t.w&&t.x/t.w,t.normY=!!t.h&&t.y/t.h,t.offsetX=s,t.offsetY=r,(t.normX<0||t.normX>1||t.normY<0||t.normY>1)&&(t.active=!1));const d=Bo.rawTouches;if(t.touches||(t.touches=[]),d.length){t.touches.length=0;for(let e=0,i=d.length;e<i;e++){const i=d[e];t.touches.push([vt(i.pageX-s),vt(i.pageY-r)])}}if(e.type===Wn&&e.updateBaseHere(t,e.fit),e.checkForResize&&!e.dirtyDimensions&&!e.dirtyDomDimensions){const[i,n]=e.currentDimensions;if(e.type===Wn){const s=e.computedStyles,r=ct(t.w-parseFloat(s.borderLeftWidth)-parseFloat(s.borderRightWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)),o=ct(t.h-parseFloat(s.borderTopWidth)-parseFloat(s.borderBottomWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom));i===r&&n===o||e.set({dimensions:[r,o]})}else i===t.w&&n===t.h||e.set({dimensions:[t.w,t.h]})}}}},la=Eo({name:"SC-core-listeners-tracker",order:0,delay:!0,fn:function(){const t=kr(),e=Or(),i=wr(),n=Tr(),s=Ir(),r=$r(),o=Yr(),a=zr(),l=Kr(),c=Wr();(t&&e||s||n||r||o||a||l||c)&&oa(),t&&e&&xr(!1),n&&Er(!1),s&&Lr(!1),r&&Mr(!1),o&&Gr(!1),a&&jr(!1),l&&_r(!1),c&&Ur(!1),i&&(Fr(!1),wt(m).forEach((t=>{qe.includes(t.type)&&t.recalculateFont(!0)})))}}),ca=function(){ua(An),ua(Lt),vr(!0),xr(!0),la.run()},ha=function(){vr(!1),xr(!1),la.halt(),ua(An)},ua=function(t){navigator.pointerEnabled||navigator.msPointerEnabled?(window[t](en,ta,!1),window[t](nn,ta,!1),window[t](Qi,ta,!1),window[t](tn,ta,!1),window[t](Ji,ta,!1)):(window[t](Hi,ta,!1),window[t](Ii,ta,!1),window[t](Ri,ta,!1),window[t](Ei,ta,!1),window[t](Ti,ta,!1),window[t](Ps,ra,{passive:!0}),window[t](Os,ra,{passive:!0}),window[t](vs,ra,{passive:!0}),window[t](ks,ra,{passive:!0})),window[t]("scroll",Jo,{passive:!0}),window[t]("resize",Qo,!1)},da=function(){const{fontfamilymetadata:t,fontfamilymetadatanames:e}=tt;e.forEach((e=>delete t[e])),e.length=0},fa=t=>{const{canvasSupportsP3Color:e,displaySupportsP3Color:i}=Bo;return t&&e&&i?Le:In},pa=["bottom","boxSizing","display","height","left","perspective","perspectiveOrigin","position","right","top","transform","transformOrigin","width","zIndex"],ga=[];let ma=!1;const ya=function(t=Ys){if(ma||t){const e=lo();let i,n,s,r,a,l,c,h,u,d,f,p,g,m,y;t&&t.substring?e.push(t):(ma=!1,e.push(...ga),ga.length=0);const b=Uo(),S=Vo();for(i=0,n=e.length;i<n;i++)if(s=o[e[i]],s&&(r=s.domElement,r&&(s.dirtyClasses&&(s.dirtyClasses=!1,r.className.substring&&(r.className=s.classes)),a=r.style,a))){if(s.dirtyCss)for(s.dirtyCss=!1,p=s.css||tr,g=ft(p),d=0,f=g.length;d<f;d++)m=g[d],y=p[m],pa.includes(m)||(a[m]=y);s.dirtyPerspective&&(s.dirtyPerspective=!1,l=s.perspective,a.perspectiveOrigin=`${l.x} ${l.y}`,a.perspective=`${l.z}px`),s.dirtyPosition&&(s.dirtyPosition=!1,a.position=s.position),s.dirtyDomDimensions&&(s.dirtyDomDimensions=!1,c=s.currentDimensions,h=c[0],u=c[1],s.type===Wn?(b?(r.width=h,r.height=u):(s.ignoreCanvasCssDimensions||(a.width=`${h}px`,a.height=`${u}px`),r.width=h*S,r.height=u*S),s.renderOnResize&&s.render()):(a.width=`${h}px`,a.height=u?`${u}px`:Zt)),s.dirtyTransformOrigin&&(s.dirtyTransformOrigin=!1,a.transformOrigin=s.currentTransformOriginString),s.dirtyTransform&&(s.dirtyTransform=!1,a.transform=s.currentTransformString),s.dirtyVisibility&&(s.dirtyVisibility=!1,a.display=s.visibility?ie:Yi),s.dirtyStampOrder&&(s.dirtyStampOrder=!1,a.zIndex=s.stampOrder)}co(e)}},ba=(t=100)=>{setTimeout((()=>{y.forEach((t=>{const e=m[t];qe.includes(e.type)&&e.recalculateFont()}))}),t)},Sa=[],Aa=[],Ca=t=>{fr(Sa,t),io(!0)},ka=t=>{pr(Sa,t),io(!0)},va=()=>(eo&&Pa(),Aa),Pa=function(){io(!1);const t=lo();let e,i,n,s;for(n=0,s=Sa.length;n<s;n++)e=o[Sa[n]],e&&(i=ct(e.order)||0,t[i]||(t[i]=lo()),t[i].push(e.name));for(Aa.length=0,n=0,s=t.length;n<s;n++)e=t[n],e&&(Aa.push(...e),co(e));co(t)},Oa=["lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit"],xa=["filter","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","imageSmoothingQuality"],Da=["shadowBlur","shadowOffsetX","shadowOffsetY"],wa=["fillStyle","shadowColor","strokeStyle"],State=function(){return this.set(this.defs),this.lineDash=[],this},Fa=State.prototype=Ar();Fa.type="State",Ro(Fa),Fa.defs={fillStyle:Qt,strokeStyle:Qt,globalAlpha:1,globalCompositeOperation:En,lineWidth:1,lineCap:"butt",lineJoin:"miter",lineDash:null,lineDashOffset:0,miterLimit:10,shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:Qt,font:De,direction:Si,fontKerning:Gi,textRendering:Zt,letterSpacing:on,wordSpacing:on,fontStretch:Gi,fontVariantCaps:Gi,filter:Yi,imageSmoothingEnabled:!0,imageSmoothingQuality:ai,textAlign:gi,textBaseline:Cs},Fa.processPacketOut=function(t,e,i){let n=!0;if(t===mi)e.length||(n=!!i.includes(mi));else i.includes(t)||e!==this.defs[t]||(n=!1);return n},Fa.finalizePacketOut=function(t){const e=t.fillStyle,i=t.strokeStyle;return e&&!e.substring&&(t.fillStyle=e.name),i&&!i.substring&&(t.strokeStyle=i.name),t};const Ra=Fa.getters,Ta=Fa.setters;Ra.canvasFont=function(){return this.font},Ta.canvasFont=function(t){this.font=t},Fa.getChanges=function(t,e){let i,n,s,r,o,a,l,c,h;const u=this.defs,d={},f=function(t,e){return typeof t[e]!==Fs?t[e]:u[e]};for(t.substring&&(t=m[t]),s=0,r=xa.length;s<r;s++)i=xa[s],c=f(this,i),h=f(e,i),h!==c&&(d[i]=c);for(s=0,r=Da.length;s<r;s++)i=Da[s],c=f(this,i),h=f(e,i),t.scaleShadow?(n=(c||0)*(t.scale||1),n!==h&&(d[i]=n)):c!==h&&(d[i]=c);if(this.lineWidth||e.lineWidth)for(s=0,r=Oa.length;s<r;s++)if(i=Oa[s],c=f(this,i),h=f(e,i),i===mi){if(c.length||h.length)if(c.length!==h.length)d.lineDash=c;else{for(l=!1,o=0,a=c.length;o<a;o++)if(c[o]!==h[o]){l=!0;break}l&&(d.lineDash=c)}}else"lineWidth"===i?t.scaleOutline?(n=(c||1)*(t.scale||1),n!==h&&(d.lineWidth=n)):c!==h&&(d.lineWidth=c):h!==c&&(d[i]=c);for(s=0,r=wa.length;s<r;s++)i=wa[s],h=f(e,i),c=f(this,i),c.substring&&h!==c?d[i]=c:c.type===Zn?(c=c.getData(),h!==c&&(d[i]=c)):d[i]=c;if(qe.includes(t.type))for(s=0,r=Xn.length;s<r;s++)i=Xn[s],c=f(this,i),h=f(e,i),h!==c&&(d[i]=c);return d},Fa.setStateFromEngine=function(t){let e;for(let i=0,n=$n.length;i<n;i++)e=$n[i],this[e]=t[e];return this.lineDash=gr(t.lineDash)?t.lineDash:[],this.lineDashOffset=yr(t.lineDashOffset,0),t.textAlign=gi,this.textAlign=gi,t.textBaseline=Cs,this.textBaseline=Cs,this};const Ea=function(t){return!!t&&new State};J.State=State;var Ha=function(){var t=4022871197;return function(e){if(e){e=e.toString();for(var i=0;i<e.length;i++){var n=.02519603282416938*(t+=e.charCodeAt(i));n-=t=n>>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)}t=4022871197}},Ia=function(t){return function(){var e,i,n=48,s=1,r=n,o=new Array(n),a=0,l=new Ha;for(e=0;e<n;e++)o[e]=l(Math.random());var c=function(){++r>=n&&(r=0);var t=1768863*o[r]+2.3283064365386963e-10*s;return o[r]=t-(s=0|t)},h=function(t){return Math.floor(t*(c()+11102230246251565e-32*(2097152*c()|0)))};h.string=function(t){var e,i="";for(e=0;e<t;e++)i+=String.fromCharCode(33+h(94));return i};return h.cleanString=function(t){return t=(t=(t=t.replace(/(^\s*)|(\s*$)/gi,"")).replace(/[\x00-\x1F]/gi,"")).replace(/\n /,"\n")},h.hashString=function(t){for(t=h.cleanString(t),l(t),e=0;e<t.length;e++)for(a=t.charCodeAt(e),i=0;i<n;i++)o[i]-=l(a),o[i]<0&&(o[i]+=1)},h.seed=function(t){var e,i,n,s;void 0!==t&&null!=t||(t=Math.random()),"string"!=typeof t&&(e=t,i=function(t,e){return"function"==typeof e?e.toString():e},t=JSON.stringify(e,function(t,e){var i=[],n=[];return null==e&&(e=function(t,e){return i[0]===e?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(e)).join(".")+"]"}),function(s,r){if(i.length>0){var o=i.indexOf(this);~o?i.splice(o+1):i.push(this),~o?n.splice(o,1/0,s):n.push(s),~i.indexOf(r)&&(r=e.call(this,s,r))}else i.push(r);return null==t?r:t.call(this,s,r)}}(i,s),n)),h.initState(),h.hashString(t)},h.addEntropy=function(){var t=[];for(e=0;e<arguments.length;e++)t.push(arguments[e]);!function(){var t=Array.prototype.slice.call(arguments);for(e=0;e<t.length;e++)for(i=0;i<n;i++)o[i]-=l(t[e]),o[i]<0&&(o[i]+=1)}(a+++(new Date).getTime()+t.join("")+Math.random())},h.initState=function(){for(l(),e=0;e<n;e++)o[e]=l(" ");s=1,r=n},h.done=function(){l=null},void 0!==t&&h.seed(t),h.range=function(t){return h(t)},h.random=function(){return h(Number.MAX_VALUE-1)/Number.MAX_VALUE},h.floatBetween=function(t,e){return h.random()*(e-t)+t},h.intBetween=function(t,e){return Math.floor(h.random()*(e-t+1))+t},h}()};const La=function(t){return new Ia(t)},Ba={},$a={};let Ma=1e3;const Xa=t=>{dt(t)&&t>=200&&t<=1e4&&(Ma=t)},Ya=t=>{dt(t)&&t>=200&&t<=1e4&&(Ma=t)},Ga=t=>!!Ba[t],Na=t=>Ba[t]?($a[t]=mt(),Ba[t]):null,za=(t,e)=>{Ba[t]=e,$a[t]=mt()},ja=function(t,e=[]){const i=mt();return Ba[t]?($a[t]=i,Ba[t]):(Ba[t]=e,$a[t]=i,Ba[t])};let Va=200,Wa=0;const Ua=t=>{dt(t)&&t>=10&&t<=5e3&&(Va=t)};Eo({name:"SC-core-workstore-hygeine",order:998,fn:()=>(()=>{const t=mt();if(Wa<t-Va){const e=ft(Ba),i=t-Ma;for(let t,n=0,s=e.length;n<s;n++)t=e[n],$a[t]<i&&(delete Ba[t],delete $a[t]);Wa=t}})()});const Za=["Gradient","RadialGradient","Pattern"];function Ka(t=tr){t.setEngineFromState=function(t){const e=this.state,i=$n.length;let n,s,r,o;for(n=0;n<i;n++)s=$n[n],r=t[s],o=e[s],s===mi?(t.lineDash=o,t.setLineDash(t.lineDash)):r!==o&&(t[s]=o);return t.textAlign!==gi&&(t.textAlign=gi),t.textBaseline!==Cs&&(t.textBaseline=Cs),this},t.setToDefaults=function(){const t=this.state.defs,e=this.state,i=this.engine;return lt(t).forEach((([t,n])=>{t===mi?(ut(i.lineDash)?i.lineDash.length=0:i.lineDash=[],ut(e.lineDash)?e.lineDash.length=0:e.lineDash=[]):(i[t]=n,e[t]=n)})),i.textAlign=e.textAlign=gi,i.textBaseline=e.textBaseline=Cs,this},t.setEngine=function(t){const e=this.state,i=t.state;if(i){const n=i.getChanges(t,e),s=this.setEngineActions;if(ft(n).length){const i=this.engine;for(const r in n)s[r](n[r],i,Za,t,this),e[r]=n[r]}}return t},t.setEngineActions={fillStyle:function(t,e,i,n,s){if(t.substring){let i=!1;B.includes(t)?i=L[t]:f.includes(t)&&(i=d[t]),i?(n.state.fillStyle=i,e.fillStyle=i.getData(n,s)):e.fillStyle=t}else e.fillStyle=t.getData(n,s)},filter:function(t,e){e.filter=t},font:function(t,e){e.font=t},globalAlpha:function(t,e){e.globalAlpha=t},globalCompositeOperation:function(t,e){e.globalCompositeOperation=t},imageSmoothingEnabled:function(t,e){e.imageSmoothingEnabled=t},imageSmoothingQuality:function(t,e){e.imageSmoothingQuality=t},lineCap:function(t,e){e.lineCap=t},lineDash:function(t,e){e.lineDash=t,e.setLineDash&&e.setLineDash(t)},lineDashOffset:function(t,e){e.lineDashOffset=t},lineJoin:function(t,e){e.lineJoin=t},lineWidth:function(t,e){e.lineWidth=t},miterLimit:function(t,e){e.miterLimit=t},shadowBlur:function(t,e){e.shadowBlur=t},shadowColor:function(t,e){e.shadowColor=t},shadowOffsetX:function(t,e){e.shadowOffsetX=t},shadowOffsetY:function(t,e){e.shadowOffsetY=t},strokeStyle:function(t,e,i,n,s){if(t.substring){let i=!1;B.includes(t)?i=L[t]:f.includes(t)&&(i=d[t]),i?(n.state.strokeStyle=i,e.strokeStyle=i.getData(n,s)):e.strokeStyle=t}else e.strokeStyle=t.getData(n,s)},direction:function(t,e){e.direction=t},fontKerning:function(t,e){e.fontKerning=t},fontStretch:function(t,e){e.fontStretch=t},fontVariantCaps:function(t,e){e.fontVariantCaps=t},letterSpacing:function(t,e){e.letterSpacing=t},textAlign:function(t,e){e.textAlign=gi},textBaseline:function(t,e){e.textBaseline=Cs},textRendering:function(t,e){e.textRendering=t},wordSpacing:function(t,e){e.wordSpacing=t}},t.clearShadow=function(){return this.engine.shadowOffsetX=0,this.engine.shadowOffsetY=0,this.engine.shadowBlur=0,this.state.shadowOffsetX=0,this.state.shadowOffsetY=0,this.state.shadowBlur=0,this},t.restoreShadow=function(t){const e=t.state;return this.engine.shadowOffsetX=e.shadowOffsetX,this.engine.shadowOffsetY=e.shadowOffsetY,this.engine.shadowBlur=e.shadowBlur,this.state.shadowOffsetX=e.shadowOffsetX,this.state.shadowOffsetY=e.shadowOffsetY,this.state.shadowBlur=e.shadowBlur,this},t.setToClearShape=function(){return this.engine.fillStyle=te,this.engine.strokeStyle=te,this.engine.shadowColor=te,this.state.fillStyle=te,this.state.strokeStyle=te,this.state.shadowColor=te,this},t.saveEngine=function(){return this.engine.save(),this},t.restoreEngine=function(){return this.engine.restore(),this},t.getEntityHits=function(){const t=[],e=lo(),i=lo();return this.groupBuckets&&this.groupBuckets.forEach((t=>{t.visibility&&e.push(...t.getAllArtefactsAt(this.here))}),this),e.forEach((e=>{const n=e.artefact;n.visibility&&!i.includes(n.name)&&(i.push(n.name),t.push(n))})),co(i,e),t},t.rotateDestination=function(t,e,i,n){const s=n||this,r=s.mimic,o=s.pivot;let a,l,c=s.currentRotation;if(r&&r.name&&s.useMimicFlip?(a=r.flipReverse?-1:1,l=r.flipUpend?-1:1):(a=s.flipReverse?-1:1,l=s.flipUpend?-1:1),r&&r.name&&s.useMimicRotation?c=r.currentRotation:o&&o.name&&s.addPivotRotation&&(c=o.currentRotation),c){c*=Ct;const n=ot(c),s=Ot(c);t.setTransform(n*a,s*a,-s*l,n*l,e,i)}else t.setTransform(a,0,0,l,e,i);return this}}const _a="CellFragment",qa=function(t,e=In){this.name=t;const i=this.element=document.createElement(le);this.engine=i.getContext(Et,{willReadFrequently:!0,colorSpace:e}),i.width=1,i.height=1;return(this.state=Ea(tr)).setStateFromEngine(this.engine),this},Qa=qa.prototype=Ar();Qa.type=_a,Ro(Qa),Ka(Qa),Qa.stringifyFunction=qs,Qa.processPacketOut=qs,Qa.finalizePacketOut=qs,Qa.saveAsPacket=function(){return`[${this.name}, ${this.type}, ${this.lib}, {}]`},Qa.clone=Js,Qa.setDimensions=function(t,e){this.w=t,this.h=e,this.element.width=t,this.element.height=e,this.engine.textAlign=gi,this.engine.textBaseline=Cs},Qa.clearCell=function(){this.engine.clearRect(0,0,this.w,this.h)};const Ja=[];let tl=0;const el=function(t=1,e=1,i=In){Ja.length||Ja.push(new qa("pool_"+tl++,fa(i===Le)));const n=Ja.shift();return n.setDimensions(t,e),n.engine.save(),n},il=function(...t){t.forEach((t=>{t&&t.type===_a&&(t.setDimensions(1,1),t.engine.restore(),t.state.setStateFromEngine(t.engine),Ja.push(t))}))},Coordinate=function(t,e){const i=[0,0];return Pt(i,Coordinate.prototype),t&&i.set(t,e),i},nl=Coordinate.prototype=at(Array.prototype);nl.constructor=Coordinate,nl.type=Kn,nl.set=function(t,e){return gr(t)&&(t.type===Kn?this.setFromArray(t):t.type===fs?this.setFromVector(t):t.type===as?this.setFromVector(t.v):ut(t)?this.setFromArray(t):gr(e)&&this.setFromArray([t,e])),this},nl.setFromArray=function(t){return this[0]=t[0],this[1]=t[1],this},nl.setFromVector=function(t){return this[0]=t.x,this[1]=t.y,this},nl.zero=function(){return this[0]=0,this[1]=0,this},nl.vectorAdd=function(t){return this[0]+=t.x,this[1]+=t.y,this},nl.vectorSubtract=function(t){return this[0]-=t.x,this[1]-=t.y,this},nl.add=function(t){return this[0]+=t[0],this[1]+=t[1],this},nl.subtract=function(t){return this[0]-=t[0],this[1]-=t[1],this},nl.multiply=function(t){return this[0]*=t[0],this[1]*=t[1],this},nl.divide=function(t){const[e,i]=t;return e&&i&&(this[0]/=e,this[1]/=i),this},nl.scalarMultiply=function(t){return this[0]*=t,this[1]*=t,this},nl.scalarDivide=function(t){return t&&t.toFixed&&(this[0]/=t,this[1]/=t),this},nl.getMagnitude=function(){return ht(...this)},nl.rotate=function(t){const[e,i]=this;let n=nt(i,e);n+=.01745329251*t;const s=ht(e,i);return this[0]=s*ot(n),this[1]=s*Ot(n),this},nl.reverse=function(){return this[0]=-this[0],this[1]=-this[1],this},nl.getDotProduct=function(t){return this[0]*t[0]+this[1]*t[1]},nl.normalize=function(){const t=this.getMagnitude();return t>0&&(this[0]/=t,this[1]/=t),this};const sl=[],rl=function(t,e){sl.length||sl.push(new Coordinate);const i=sl.shift();return i.set(t,e),i},ol=function(...t){t.forEach((t=>{t&&t.type===Kn&&sl.push(t.zero())}))},al=function(t,e){return new Coordinate(t,e)};J.Coordinate=Coordinate;const ll=180/Math.PI,cl="0",hl="hwb",ul="lab",dl="lch",fl="_max",pl="_min",gl="oklab",ml="oklch",yl="xyz",bl=["HSL","HWB"],Sl="HSL",Al="HWB",Cl="LAB",kl="LCH",vl="OKLAB",Pl="OKLCH",Ol=["RGB","HSL","HWB","LAB","LCH","OKLAB","OKLCH"],xl="XYZ",Dl=216/24389,wl=24389/27,Fl=Math.cbrt,Rl=null!=Fl?Fl:t=>At(t,1/3),Tl=[.3457/.3585,1,.2958/.3585],El=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]],Hl=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],Il=[[506752/1228815,87881/245763,12673/70218],[87098/409605,175762/245763,12673/175545],[7918/409605,87881/737289,1001167/1053270]],Ll=[[12831/3959,-329/214,-1974/3959],[-851781/878810,1648619/878810,36519/878810],[705/12673,-2585/12673,705/667]],Bl=[[.8190224432164319,.3619062562801221,-.12887378261216414],[.0329836671980271,.9292868468965546,.03614466816999844],[.048177199566046255,.26423952494422764,.6335478258136937]],$l=[[.2104542553,.793617785,-.0040720468],[1.9779984951,-2.428592205,.4505937099],[.0259040371,.7827717662,-.808675766]],Ml=[[1.2268798733741557,-.5578149965554813,.28139105017721583],[-.04057576262431372,1.1122868293970594,-.07171106666151701],[-.07637294974672142,-.4214933239627914,1.5869240244272418]],Xl=[[.9999999984505198,.39633779217376786,.2158037580607588],[1.0000000088817609,-.10556134232365635,-.06385417477170591],[1.0000000546724108,-.08948418209496575,-1.2914855378640917]],Yl=document.createElement(le);Yl.width=1,Yl.height=1;const Gl=Yl.getContext(Et,{willReadFrequently:!0});Gl.globalAlpha=1,Gl.globalCompositeOperation=En;const Color=function(t=tr){return this.makeName(t.name),this.register(),this.set(this.defs),this.rgb=[],this.rgb_max=[],this.rgb_min=[],this.hsl=[],this.hsl_max=[],this.hsl_min=[],this.hwb=[],this.hwb_max=[],this.hwb_min=[],this.xyz=[],this.xyz_max=[],this.xyz_min=[],this.lab=[],this.lab_max=[],this.lab_min=[],this.lch=[],this.lch_max=[],this.lch_min=[],this.oklab=[],this.oklab_max=[],this.oklab_min=[],this.oklch=[],this.oklch_max=[],this.oklch_min=[],this.easingFunction=Qs,this.dirtyFilterIdentifier=!1,this.convert(te),this.convert(Qt,pl),this.convert($s,fl),this.set(t),this},Nl=Color.prototype=Ar();Nl.type=Zn,Nl.lib=Gn,Nl.isArtefact=!1,Nl.isAsset=!1,Ro(Nl);const zl={rgb:null,rgb_max:null,rgb_min:null,hsl:null,hsl_max:null,hsl_min:null,hwb:null,hwb_max:null,hwb_min:null,xyz:null,xyz_max:null,xyz_min:null,lab:null,lab_max:null,lab_min:null,lch:null,lch_max:null,lch_min:null,oklab:null,oklab_max:null,oklab_min:null,oklch:null,oklch_max:null,oklch_min:null,easing:yi,easingFunction:null,colorSpace:kn,returnColorAs:kn};Nl.defs=ur(Nl.defs,zl),Nl.packetFunctions=fr(Nl.packetFunctions,["easingFunction"]),Nl.kill=function(){const t=this.name;return wt(m).forEach((e=>{const i=e.state;if(i){const e=i.fillStyle,n=i.strokeStyle,s=i.shadowColor;cr(e)&&e.name===t&&(i.fillStyle=i.defs.fillStyle),cr(n)&&n.name===t&&(i.strokeStyle=i.defs.strokeStyle),cr(s)&&s.name===t&&(i.shadowColor=i.defs.shadowColor)}})),this.deregister(),this},Nl.get=function(t){if(gr(t)){if(t.toFixed)return this.getRangeColor(t);if("min"===t)return this.getMinimumColor();if("max"===t)return this.getMaximumColor();if(t===un)return this.generateRandomColor(),this.getCurrentColor();{const e=this.getters[t];if(e)return e.call(this);{const e=this.defs[t];if(typeof e!==Fs){const i=this[t];return typeof i!==Fs?i:e}return}}}return this.getCurrentColor()},Nl.set=function(t=tr){const e=ft(t),i=e.length;if(i){const n=this.setters,s=this.defs;let r,o,a,l;for(o=0;o<i;o++)a=e[o],l=t[a],a&&a!==$i&&null!=l&&(r=n[a],r?r.call(this,l):typeof s[a]!==Fs&&(this[a]=l));t.random&&this.generateRandomColor()}return this};const jl=Nl.setters;jl.color=function(t){this.convert(t)},Nl.setColor=function(t){return this.convert(t),this},jl.minimumColor=function(t){this.convert(t,pl)},Nl.setMinimumColor=function(t){return this.convert(t,pl),this},jl.maximumColor=function(t){this.convert(t,fl)},Nl.setMaximumColor=function(t){return this.convert(t,fl),this},jl.easing=function(t){this.setEasingHelper(t)},jl.easingFunction=jl.easing,Nl.setEasing=function(t){return this.setEasingHelper(t),this},Nl.setEasingFunction=Nl.setEasing,Nl.setEasingHelper=function(t){ar(t)?(this.easing=Je,this.easingFunction=t):t.substring&&Sr[t]?(this.easing=t,this.easingFunction=Qs):(this.easing=yi,this.easingFunction=Qs)},jl.colorSpace=function(t){this.setColorSpaceHelper(t)},Nl.setColorSpace=function(t){return this.setColorSpaceHelper(t),this},Nl.setColorSpaceHelper=function(t){if(t.substring&&(t=t.toUpperCase(),di.includes(t))){const e=this.getCurrentColor(),i=this.getMinimumColor(),n=this.getMaximumColor();this.colorSpace=t.toUpperCase(),this.updateColorConversions(e,i,n)}},jl.returnColorAs=function(t){this.setReturnColorAsHelper(t)},Nl.setReturnColorAs=function(t){return this.setReturnColorAsHelper(t),this},Nl.setReturnColorAsHelper=function(t){if(t.substring&&(t=t.toUpperCase(),Ol.includes(t))){const e=this.getCurrentColor(),i=this.getMinimumColor(),n=this.getMaximumColor();this.returnColorAs=t.toUpperCase(),this.updateColorConversions(e,i,n)}},Nl.updateColorConversions=function(t,e,i){this.convert(t),this.convert(e,pl),this.convert(i,fl)},Nl.getData=function(){return this.getCurrentColor()},Nl.getCurrentColor=function(){const{rgb:t,hsl:e,hwb:i,lab:n,lch:s,oklab:r,oklch:o}=this;return this.returnColor(t,e,i,n,s,r,o)},Nl.getMinimumColor=function(){const{rgb_min:t,hsl_min:e,hwb_min:i,lab_min:n,lch_min:s,oklab_min:r,oklch_min:o}=this;return this.returnColor(t,e,i,n,s,r,o)},Nl.getMaximumColor=function(){const{rgb_max:t,hsl_max:e,hwb_max:i,lab_max:n,lch_max:s,oklab_max:r,oklch_max:o}=this;return this.returnColor(t,e,i,n,s,r,o)},Nl.returnColor=function(t,e,i,n,s,r,o){null==t&&({rgb:t,hsl:e,hwb:i,lab:n,lch:s,oklab:r,oklch:o}=this);const{buildColorString:a,returnColorAs:l}=this;switch(l){case kn:return a(...t,kn);case Sl:return a(...e,Sl);case Al:return Vl?a(...i,Al):a(...t,kn);case Cl:return Wl?a(...n,Cl):a(...t,kn);case kl:return Ul?a(...s,kl):a(...t,kn);case vl:return Zl?a(...r,vl):a(...t,kn);case Pl:return Kl?a(...o,Pl):a(...t,kn);default:return te}},Nl.returnColorFromValues=function(t,e,i,n){const{colorSpace:s,returnColorAs:r}=this,o=this.buildColorString(t,e,i,n,s);let a=!1;return xl===s||s!==r?a=!0:(Al!==r||Vl)&&(Cl!==r||Wl)&&(kl!==r||Ul)&&(vl!==r||Zl)&&(Pl!==r||Kl)||(a=!0),a?(