UNPKG

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 665 kB
const t={},e=[],i={},n=[],s={},r=[],o={},a=[],l={},c=[],h={},u=[],d={},f=[],p={},g=[],m={},y=[],b={},S=[],A={},k=[],C={},w=[],v={},P={},O=[],x={},D=[],F={},R=[],T={},E=[],I={},H=[],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(w.filter(t=>0===t.indexOf(h)),C,!0);u(B.filter(t=>0===t.indexOf(h)),L);u(H.filter(t=>0===t.indexOf(h)),I);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(O.filter(t=>0===t.indexOf(h)),P);u(D.filter(t=>0===t.indexOf(h)),x);u(R.filter(t=>0===t.indexOf(h)),F)}}function Y(t=""){const e=`100px ${t}`;return k.includes(e)}function X(t=""){const e=`100px ${t}`;return k.includes(e)?A[e]:null}function N(t=""){return a.includes(t)?o[t]:null}function G(t=""){return c.includes(t)?l[t]:null}function U(t=""){return y.includes(t)?m[t]:null}function z(t=""){return u.includes(t)?h[t]:null}function j(t=""){return B.includes(t)?L[t]:null}function V(t=""){return H.includes(t)?I[t]:null}function W(t=""){return B.includes(t)?L[t]:f.includes(t)?d[t]:null}function Z(t=""){return f.includes(t)?d[t]:null}function _(t=""){return S.includes(t)?b[t]:null}function q(t=""){return w.includes(t)?C[t]:null}function K(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:Y,constructors:J,element:p,elementnames:g,entity:m,entitynames:y,filter:b,filternames:S,findArtefact:N,findAsset:G,findCanvas:z,findCell:Z,findElement:Q,findEntity:U,findFilter:_,findGroup:q,findPattern:W,findStack:K,findStyles:j,findTween:V,fontfamilymetadata:A,fontfamilymetadatanames:k,force:P,forcenames:O,getFontMetadata:X,group:C,groupnames:w,palette:{},palettenames:[],particle:v,particlenames:[],purge:M,spring:x,springnames:D,stack:T,stacknames:E,styles:L,stylesnames:B,tween:I,tweennames:H,unstackedelement:$,unstackedelementnames:[],version:"8.17.0",world:F,worldnames:R});const et=Math.abs,it=Object.assign,nt=Math.acos,st=Math.atan2,rt=Math.ceil,ot=window.getComputedStyle,at=Math.cos,lt=Object.create,ct=Object.entries,ht=Math.floor,ut=Math.hypot,dt=Array.isArray,ft=Number.isFinite,pt=Object.keys,gt=Math.max,mt=Math.min,yt=Date.now,bt=JSON.parse,St=2*Math.PI,At=.5*Math.PI,kt=Math.pow,Ct=Math.PI/180,wt=Math.random,vt=Math.round,Pt=Object.setPrototypeOf,Ot=Math.sin,xt=Math.sqrt,Dt=Math.tan,Ft=.016,Rt=Object.values,Tt="BODY",Et="image_",It="video_",Ht="2d",Lt="absolute",Bt=["Canvas","Stack"],$t="addEventListener",Mt="alpha-to-channels",Yt="alpha-to-luminance",Xt="alphabetic",Nt="anchor",Gt="animation",Ut="anonymous",zt="area-alpha",jt=",",Vt="aria-hidden",Wt="aria-live",Zt="asset",_t=/.*\/(.*?)\./,qt="auto",Kt="autofocus",Qt="average-channels",Jt="bezier",te="rgb(0 0 0 / 1)",ee="black-white",ie="rgb(0 0 0 / 0)",ne="blend",se="block",re="bluenoise",oe="blur",ae="blurAction",le="border-box",ce="bottom",he="canvas",ue="center",de="channels-to-alpha",fe="chroma",pe="clamp-channels",ge=["down","round","up"],me="clear",ye="click",be="clickAction",Se="close",Ae="color",ke="colors-to-alpha",Ce="compose",we="control",ve="coord",Pe=["topLeft","topRight","bottomRight","bottomLeft"],Oe='[data-scrawl-corner-div="sc"]',xe="corrode",De="data-scrawl-group",Fe="data-tab-order",Re="deconvolute",Te="12px sans-serif",Ee="any_random_string_will_do",Ie="description",He="destination-out",Le="destination-over",Be="dimensions",$e="disabled",Me="displace",Ye="display-p3",Xe="div",Ne="down",Ge="download",Ue="element",ze="emboss",je="end",Ve="endControl",We="enter",Ze="entity",_e="euler",qe="fill",Ke="flood",Qe="focus",Je="focusAction",ti=["Label","EnhancedLabel"],ei="form",ii="function",ni="gaussian-blur",si="glitch",ri=["Cell","CellFragment"],oi="grayscale",ai="green",li="hanging",ci="height",hi="high",ui="href",di="hreflang",fi="ideographic",pi="img",gi=["rgb","hsl","hwb","xyz","lab","lch","oklab","oklch"],mi="invert-channels",yi="leave",bi="left",Si="lineDash",Ai="linear",ki="lock-channels-to-levels",Ci="ltr",wi="luminance-to-alpha",vi="map-to-gradient",Pi="matrix",Oi="mean",xi="mimic",Di="middle",Fi="modify-ok-channels",Ri="modulate-channels",Ti="modulate-ok-channels",Ei="mouse",Ii="mousedown",Hi="mouseenter",Li="mouseleave",Bi="mousemove",$i="mouseup",Mi="move",Yi="multiply",Xi="name",Ni="negative",Gi="newsprint",Ui="none",zi="normal",ji="ok-perceptual-curves",Vi="offset",Wi="particle",Zi="path",_i="%",qi="0%",Ki="100%",Qi="50%",Ji="ping",tn="pivot",en="pixelate",nn="pointerdown",sn="pointerenter",rn="pointerleave",on="pointermove",an="pointerup",ln="polite",cn="process-image",hn="0px",un="quadratic",dn=["radiusX"],fn=["radiusX","radiusY"],pn=["radiusY"],gn="random",mn="random-noise",yn="rectangle",bn="red",Sn="reduce-palette",An="referrerpolicy",kn="rel",Cn="relative",wn="removeEventListener",vn="reverseByDelta",Pn="rgb",On="right",xn="role",Dn="root",Fn="rotate-hue",Rn="round",Tn="set-channel-to-level",En="source",In="source-in",Hn="source-out",Ln="source-over",Bn=" ",$n="srgb",Mn="start",Yn="startControl",Xn=["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"],Nn=["fillStyle","filter","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","imageSmoothingQuality","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","strokeStyle"],Gn=["direction","font","fontKerning","fontStretch","fontVariantCaps","letterSpacing","textRendering","wordSpacing"],Un="step-channels",zn="styles",jn="subscribe",Vn="swirl",Wn="Action",Zn="Bezier",_n="Canvas",qn="Cell",Kn="Color",Qn="Coordinate",Jn="EnhancedLabel",ts="Filter",es="Grid",is="Group",ns="Image",ss="Label",rs="Line",os="Palette",as="Particle",ls="Picture",cs="Polyline",hs="Quadratic",us="Quaternion",ds="RenderAnimation",fs="Sprite",ps="Stack",gs="Ticker",ms="Tween",ys="Vector",bs="Video",Ss="World",As="tabOrder",ks="target",Cs="threshold",ws=["rect","hex","random","points"],vs="tiles",Ps="tint-channels",Os="top",xs="touchcancel",Ds="touchend",Fs="touchmove",Rs="touchstart",Ts="true",Es="tween",Is="type",Hs="undefined",Ls="unknown",Bs="unsharp",$s="up",Ms="updateByDelta",Ys="user-defined-legacy",Xs="value",Ns="vary-channels-by-weights",Gs="video",Us="rgb(255 255 255 / 1)",zs="width",js="M0,0",Vs="",Ws="zoom-blur",Zs=Math.PI,_s="ms",qs=(t,e)=>{if(null==e)return t;if(pr(t)&&pr(e))return t+e;t.substring&&(bi===t||Os===t?t=qi:On===t||ce===t?t=Ki:ue===t&&(t=Qi));const i=!(!t.substring&&!e.substring),n=(pr(t)?t:parseFloat(t)||0)+(pr(e)?e:parseFloat(e)||0);return i?n+_i:n},Ks=function(t,e,i){return t<e?e:t>i?i:t},Qs=t=>{if(pr(t))return[_s,t];if(t.substring){const e=t.match(/^\d+\.?\d*(\D*)/);let i=e[1].toLowerCase?e[1].toLowerCase():_s,n=parseFloat(t);if(ft(n)){switch(i){case"s":n*=1e3;break;case"%":break;default:i=_s}return[i,n]}return[_s,0]}},Js=t=>(t%360+360)%360,tr=t=>{if(ft(t)){if(t<-1e-6)return t;if(t>1e-6)return t}return 0},er=()=>{},ir=function(t){return t},nr=function(){return new Error("Clone functionality is not supported for this object")},sr={},rr=()=>{function t(){return ht(65536*(1+wt())).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`},or=()=>performance.now().toString(36)+wt().toString(36).substr(2),ar=function(t,e,i){return e+t*(i-e)},lr=t=>t<0?0:t>255?255:0|t,cr=(t,e,i)=>t<e?e:t>i?i:t,hr=t=>"boolean"==typeof t,ur=t=>"[object HTMLCanvasElement]"===Object.prototype.toString.call(t),dr=t=>!!(t&&t.querySelector&&t.dispatchEvent),fr=t=>typeof t===ii,pr=t=>!!ft(t),gr=t=>"[object Object]"===Object.prototype.toString.call(t),mr=t=>!(!t||!t.type||t.type!==us),yr=(t,e)=>{if(gr(t)&&gr(e))for(const i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},br=(t,e)=>(gr(t)&&gr(e)&&ct(e).forEach(([i,n])=>{null==n?delete t[i]:t[i]=e[i]}),t),Sr=(t,e)=>(dt(t)&&(dt(e)?e.forEach(e=>Sr(t,e)):t.includes(e)||t.push(e)),t),Ar=(t,e)=>{if(dt(t)){const i=t.indexOf(e);i>=0&&t.splice(i,1)}return t},kr=t=>typeof t!==Hs,Cr=(...t)=>t.every(t=>typeof t!==Hs),wr=(...t)=>t.find(t=>typeof t!==Hs),vr=(...t)=>!!t.find(t=>typeof t!==Hs),Pr={out:t=>1-at(t*Zs/2),in:t=>Ot(t*Zs/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-kt(-2*t+2,2)/2,easeOutIn3:t=>t<.5?4*t*t*t:1-kt(-2*t+2,3)/2,easeOutIn4:t=>t<.5?8*t*t*t*t:1-kt(-2*t+2,4)/2,easeOutIn5:t=>t<.5?16*t*t*t*t*t:1-kt(-2*t+2,5)/2,easeInOut:t=>{const e=.5-t;return t<.5?.5+-2*e*e:.5+kt(2*(t-.5),2)/2},easeInOut3:t=>{const e=.5-t;return t<.5?.5+-4*e*e*e:.5+kt(2*(t-.5),3)/2},easeInOut4:t=>{const e=.5-t;return t<.5?.5+-8*e*e*e*e:.5+kt(2*(t-.5),4)/2},easeInOut5:t=>{const e=.5-t;return t<.5?.5+-16*e*e*e*e*e:.5+kt(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+at((1-t)*Zs)),hermite:t=>t*t*(2*-t+3),quintic:t=>t*t*t*(t*(6*t-15)+10),easeOutSine:t=>1-at(t*Zs/2),easeInSine:t=>Ot(t*Zs/2),easeOutInSine:t=>-(at(Zs*t)-1)/2,easeOutQuad:t=>t*t,easeInQuad:t=>1-(1-t)*(1-t),easeOutInQuad:t=>t<.5?2*t*t:1-kt(-2*t+2,2)/2,easeOutCubic:t=>t*t*t,easeInCubic:t=>1-kt(1-t,3),easeOutInCubic:t=>t<.5?4*t*t*t:1-kt(-2*t+2,3)/2,easeOutQuart:t=>t*t*t*t,easeInQuart:t=>1-kt(1-t,4),easeOutInQuart:t=>t<.5?8*t*t*t*t:1-kt(-2*t+2,4)/2,easeOutQuint:t=>t*t*t*t*t,easeInQuint:t=>1-kt(1-t,5),easeOutInQuint:t=>t<.5?16*t*t*t*t*t:1-kt(-2*t+2,5)/2,easeOutExpo:t=>0===t?0:kt(2,10*t-10),easeInExpo:t=>1===t?1:1-kt(2,-10*t),easeOutInExpo:t=>0===t||1===t?t:t<.5?kt(2,20*t-10)/2:(2-kt(2,-20*t+10))/2,easeOutCirc:t=>1-xt(1-kt(t,2)),easeInCirc:t=>xt(1-kt(t-1,2)),easeOutInCirc:t=>t<.5?(1-xt(1-kt(2*t,2)))/2:(xt(1-kt(-2*t+2,2))+1)/2,easeOutBack:t=>2.70158*t*t*t-1.70158*t*t,easeInBack:t=>1+2.70158*kt(t-1,3)+1.70158*kt(t-1,2),easeOutInBack:t=>{const e=2.5949095;return t<.5?kt(2*t,2)*(7.189819*t-e)/2:(kt(2*t-2,2)*((e+1)*(2*t-2)+e)+2)/2},easeOutElastic:t=>{const e=2*Zs/3;return 0===t||1===t?t:-kt(2,10*t-10)*Ot((10*t-10.75)*e)},easeInElastic:t=>{const e=2*Zs/3;return 0===t||1===t?t:kt(2,-10*t)*Ot((10*t-.75)*e)+1},easeOutInElastic:t=>{const e=2*Zs/4.5;return 0===t||1===t?t:t<.5?-kt(2,20*t-10)*Ot((20*t-11.125)*e)/2:kt(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)}},Or=()=>lt(Object.prototype);let xr=!1;const Dr=()=>xr,Fr=t=>xr=t;let Rr=!1;const Tr=()=>Rr,Er=t=>Rr=t;let Ir=!1;const Hr=()=>Ir,Lr=t=>Ir=t;let Br=!1;const $r=()=>Br,Mr=t=>Br=t;let Yr=!1;const Xr=()=>Yr,Nr=t=>Yr=t;let Gr=!1;const Ur=()=>Gr,zr=t=>Gr=t;let jr=!1;const Vr=()=>jr,Wr=t=>jr=t;let Zr=!1;const _r=()=>Zr,qr=t=>Zr=t;let Kr=!1;const Qr=()=>Kr,Jr=t=>Kr=t;let to=!1;const eo=()=>to,io=t=>to=t;let no=!0;const so=t=>no=t;let ro=!1;const oo=t=>ro=t;let ao=!0;const lo=t=>ao=t,co=function(){Rr=!0,Ir=!0},ho="GenericArray",uo=function(){const t=[];return Pt(t,uo.prototype),t};J.GenericArray=uo;const fo=uo.prototype=lt(Array.prototype);fo.constructor=uo,fo.type=ho;const po=[],go=function(...t){po.length||po.push(new uo);const e=po.pop();return t.length&&e.push(...t),e},mo=function(...t){t.forEach(t=>{t&&t.type===ho&&(t.length=0,po.push(t),po.length>512&&(console.log("purging genericArrayPool"),po.length=256))})},yo=[],bo=[],So=t=>{Sr(bo,t),so(!0)},Ao=t=>{Ar(bo,t),so(!0)},ko=t=>bo.includes(t),Co=()=>{no&&(so(!1),(()=>{const t=go();let e,n,s,r;for(s=0,r=bo.length;s<r;s++)e=i[bo[s]],e&&(n=ht(e.order)||0,t[n]||(t[n]=go()),t[n].push(e));for(yo.length=0,s=0,r=t.length;s<r;s++)e=t[s],e&&(yo.push(...e),mo(e));mo(t)})());for(let t=0,e=yo.length;t<e;t++){const e=yo[t];if(e.chokedAnimation){const t=yt();e.lastRun+825/e.maxFrameRate<t&&(e.fn(),e.lastRun=t)}else e.fn()}ro&&window.requestAnimationFrame(Co)},wo=()=>{oo(!0),Co()},vo=()=>oo(!1),Po=function(t,e,i=sr){if(typeof window.IntersectionObserver===ii&&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 er},Oo=function(t,e,i){return t&&fr(e)&&i?(Do(t,e,i,wn),Do(t,e,i,$t),function(){xo(t,e,i)}):er},xo=function(t,e,i){t&&fr(e)&&i&&Do(t,e,i,wn)},Do=function(t,e,i,n){const s=go(),r=go();dt(t)?s.push(...t):s.push(t),i.substring?r.push(...document.body.querySelectorAll(i)):dt(i)?r.push(...i):r.push(i),navigator.pointerEnabled||navigator.msPointerEnabled?Ro(s,e,r,n):Fo(s,e,r,n),mo(r,s)},Fo=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],dr(c)||c.document||c.characterSet)switch(l){case Mi:c[n](Bi,e,!1),c[n](Fs,e,{passive:!1}),c[n]("touchfollow",e,{passive:!1});break;case $s:c[n]($i,e,!1),c[n](Ds,e,{passive:!1});break;case Ne:c[n](Ii,e,!1),c[n](Rs,e,{passive:!1});break;case yi:c[n](Li,e,!1),c[n]("touchleave",e,{passive:!1});break;case We:c[n](Hi,e,!1),c[n]("touchenter",e,{passive:!1})}},Ro=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],dr(c)||c.document||c.characterSet)switch(l){case Mi:c[n](on,e,!1);break;case $s:c[n](an,e,!1);break;case Ne:c[n](nn,e,!1);break;case yi:c[n](rn,e,!1);break;case We:c[n](sn,e,!1)}},To=function(t,e,i){return t&&fr(e)&&i?(Io(t,e,i,wn),Io(t,e,i,$t),function(){Eo(t,e,i)}):er},Eo=function(t,e,i){t&&fr(e)&&i&&Io(t,e,i,wn)},Io=function(t,e,i,n){const s=go(),r=go();let o,a,l,c,h,u;for(dt(t)?s.push(...t):s.push(t),i.substring?r.push(...document.body.querySelectorAll(i)):dt(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],(dr(u)||u.document||u.characterSet)&&u[n](h,e,!1);mo(r,s)},Ho="~~~",Lo=["Image","Sprite","Video","Canvas","Stack"];function Bo(t=sr){t.defs={},t.getters={},t.setters={},t.deltaSetters={},t.get=function(t){let e,i;if(kr(t)){if(i=this.getters[t],i)return i.call(this);{const i=this.defs[t];if(typeof i!==Hs)return e=this[t],typeof e!==Hs?e:i}}return null},t.set=function(t=sr){let e,i,n,s;const r=pt(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!==Xi&&null!=n&&(s=a[i],s?s.call(this,n):typeof l[i]!==Hs&&(this[i]=n))}return this},t.setDelta=function(t=sr){let e,i,n,s;const r=pt(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!==Xi&&null!=n&&(s=a[i],s?s.call(this,n):typeof l[i]!==Hs&&(this[i]=qs(this[i],n)))}return this};t.defs=yr(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=sr){hr(t)&&t&&(t={includeDefaults:!0});const e=this.defs,i=pt(e),n=this.packetExclusions,s=this.packetExclusionsByRegex,r=this.packetCoordinates,o=this.packetObjects,a=this.packetFunctions;let l=t.includeDefaults||!1,c={};return l&&!dt(l)?l=pt(e):l||(l=[]),ct(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(kr(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],s=`${i}${Ho}${n}`;return s!==Ho&&s},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(dt(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]=bt(t)}catch(t){throw new Error(`Failed to process packet due to JSON parsing error - ${t.message}`)}if(Cr(e,i,n,s)){if(Lo.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(kr(i)&&null!=i&&i.substring)if(i===Ho)t[e]=er;else{let n,s,r;[n,s]=i.split(Ho),n=n.split(jt),n=n.map(t=>t.trim()),s.includes("[native code]")?t[e]=er:(r=new Function(...n,s),t[e]=r.bind(t))}},t.clone=function(t=sr){const e=this.name;let i,n,s,r;this.name=t.name||Vs,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=or(),this},t.register=function(){if(!kr(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&&(Sr(a,this.name),o[this.name]=this),this.isAsset&&(Sr(c,this.name),l[this.name]=this),Sr(t,this.name),e[this.name]=this,this},t.deregister=function(){if(!kr(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&&(Ar(a,this.name),delete o[this.name]),this.isAsset&&(Ar(c,this.name),delete l[this.name]),Ar(t,this.name),delete e[this.name],this}}const Animation=function(t=sr){return this.makeName(t.name),this.order=kr(t.order)?t.order:this.defs.order,this.fn=t.fn||er,this.onRun=t.onRun||er,this.onHalt=t.onHalt||er,this.onKill=t.onKill||er,this.maxFrameRate=t.maxFrameRate||60,this.lastRun=0,this.chokedAnimation=!0,this.register(),t.delay||this.run(),this},$o=Animation.prototype=Or();$o.type="Animation",$o.lib=Gt,$o.isArtefact=!1,$o.isAsset=!1,Bo($o);$o.defs=yr($o.defs,{order:1,maxFrameRate:60,fn:null,onRun:null,onHalt:null,onKill:null}),$o.stringifyFunction=er,$o.processPacketOut=er,$o.finalizePacketOut=er,$o.saveAsPacket=function(){return`[${this.name}, ${this.type}, ${this.lib}, {}]`},$o.clone=nr,$o.run=function(){return this.onRun(),So(this.name),setTimeout(()=>co(),20),this},$o.isRunning=function(){return ko(this.name)},$o.halt=function(){return this.onHalt(),Ao(this.name),this},$o.kill=function(){return this.onKill(),Ao(this.name),this.deregister(),!0};const Mo=function(t){return!!t&&new Animation(t)};J.Animation=Animation;const Yo="change",Xo="touch",No=[],Go={x:0,y:0,scrollX:0,scrollY:0,w:0,h:0,type:Ei,prefersReducedMotion:!1,prefersDarkColorScheme:!1,prefersReduceTransparency:!1,prefersContrast:!1,prefersReduceData:!1,prefersInvertedColors:!1,prefersForcedColors:!1,displaySupportsP3Color:!1,canvasSupportsP3Color:!1,devicePixelRatio:0,rawTouches:[]},Uo=window.matchMedia("(prefers-contrast: more)");Uo.addEventListener(Yo,()=>{const t=Uo.matches;Go.prefersContrast!==t&&(Go.prefersContrast=t,Mr(!0))}),Go.prefersContrast=Uo.matches;const zo=window.matchMedia("(prefers-reduced-motion: reduce)");zo.addEventListener(Yo,()=>{const t=zo.matches;Go.prefersReducedMotion!==t&&(Go.prefersReducedMotion=t,Nr(!0))}),Go.prefersReducedMotion=zo.matches;const jo=window.matchMedia("(prefers-color-scheme: dark)");jo.addEventListener(Yo,()=>{const t=jo.matches;Go.prefersDarkColorScheme!==t&&(Go.prefersDarkColorScheme=t,zr(!0))}),Go.prefersDarkColorScheme=jo.matches;const Vo=window.matchMedia("(prefers-reduced-transparency: reduce)");Vo.addEventListener(Yo,()=>{const t=Vo.matches;Go.prefersReduceTransparency!==t&&(Go.prefersReduceTransparency=t,Wr(!0))}),Go.prefersReduceTransparency=Vo.matches;const Wo=window.matchMedia("(prefers-reduced-data: reduce)");Wo.addEventListener(Yo,()=>{const t=Wo.matches;Go.prefersReduceData!==t&&(Go.prefersReduceData=t,qr(!0))}),Go.prefersReduceData=Wo.matches;const Zo=window.matchMedia("(inverted-colors: inverted)");Zo.addEventListener(Yo,()=>{const t=Zo.matches;Go.prefersInvertedColors!==t&&(Go.prefersInvertedColors=t,io(!0))}),Go.prefersInvertedColors=Zo.matches;const _o=window.matchMedia("(forced-colors: active)");_o.addEventListener(Yo,()=>{const t=_o.matches;Go.prefersForcedColors!==t&&(Go.prefersForcedColors=t,Jr(!0))}),Go.prefersForcedColors=_o.matches;const qo=window.matchMedia("(color-gamut: p3)");qo.addEventListener(Yo,()=>{const t=qo.matches;Go.displaySupportsP3Color!==t&&(Go.displaySupportsP3Color=t)}),Go.displaySupportsP3Color=qo.matches;Go.canvasSupportsP3Color=(()=>{const t=document.createElement("canvas");try{return t.getContext("2d",{colorSpace:Ye}).getContextAttributes().colorSpace===Ye}catch{console.log("checkCanvasSupportsDisplayP3 errored")}return!1})();const Ko=()=>Go.devicePixelRatio;let Qo=!1;const Jo=()=>Qo,ta=t=>Qo=t;let ea=er;const ia=t=>ea=t,na=()=>{const t=window.devicePixelRatio;Go.devicePixelRatio=t,Rt(h).forEach(t=>t.dirtyDimensions=!0),Rt(d).forEach(t=>t.dirtyDimensions=!0),Rt(m).forEach(t=>t.dirtyHost=!0),Qo||ea(),matchMedia(`(resolution: ${t}dppx)`).addEventListener(Yo,na,{once:!0})};na();const sa=function(){const t=document.documentElement.clientWidth,e=document.documentElement.clientHeight;Go.w===t&&Go.h===e||(Go.w=t,Go.h=e,Er(!0),Lr(!0))},ra=function(){const t=window.pageXOffset,e=window.pageYOffset;Go.scrollX===t&&Go.scrollY===e||(Go.x+=t-Go.scrollX,Go.y+=e-Go.scrollY,Go.scrollX=t,Go.scrollY=e,Er(!0))},oa=function(t){const e=vt(t.pageX),i=vt(t.pageY);Go.x===e&&Go.y===i||(Go.type=navigator.pointerEnabled?"pointer":Ei,Go.x=e,Go.y=i,Er(!0))};let aa=0,la=16;const ca=function(){return la},ha=function(t){ft(t)&&(la=t)},ua=function(t,e=!0){if(Go.rawTouches.length=0,t.touches&&t.touches.length){Go.rawTouches.push(...t.touches);const e=t.touches[0],i=vt(e.pageX),n=vt(e.pageY);Go.x===i&&Go.y===n||(Go.type=Xo,Go.x=i,Go.y=n)}else Go.type=Xo,e&&(Go.x=0,Go.y=0);const i=yt();i>aa+la&&(aa=i,da())},da=function(){for(let t=0,e=No.length;t<e;t++)fa(No[t])},fa=function(t){const e=o[t];if(e){const{here:t,domElement:i}=e;if(t.prefersContrast=Go.prefersContrast,t.prefersReducedMotion=Go.prefersReducedMotion,t.prefersDarkColorScheme=Go.prefersDarkColorScheme,t.prefersReduceTransparency=Go.prefersReduceTransparency,t.prefersReduceData=Go.prefersReduceData,t.prefersInvertedColors=Go.prefersInvertedColors,t.prefersForcedColors=Go.prefersForcedColors,t.devicePixelRatio=Go.devicePixelRatio,$r()&&e.contrastActions(),Xr()&&e.reducedMotionActions(),Ur()&&e.colorSchemeActions(),Vr()&&e.reducedTransparencyActions(),_r()&&e.reducedDataActions(),eo()&&e.invertedColorsActions(),Qr()&&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=Go.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(Go.x-s),t.y=vt(Go.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=Go.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===_n&&e.updateBaseHere(t,e.fit),e.checkForResize&&!e.dirtyDimensions&&!e.dirtyDomDimensions){const[i,n]=e.currentDimensions;if(e.type===_n){const s=e.computedStyles,r=ht(t.w-parseFloat(s.borderLeftWidth)-parseFloat(s.borderRightWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)),o=ht(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]})}}}},pa=Mo({name:"SC-core-listeners-tracker",order:0,delay:!0,fn:function(){const t=Dr(),e=Tr(),i=Hr(),n=$r(),s=Xr(),r=Ur(),o=Vr(),a=_r(),l=eo(),c=Qr();(t&&e||s||n||r||o||a||l||c)&&da(),t&&e&&Er(!1),n&&Mr(!1),s&&Nr(!1),r&&zr(!1),o&&Wr(!1),a&&qr(!1),l&&io(!1),c&&Jr(!1),i&&(Lr(!1),Rt(m).forEach(t=>{ti.includes(t.type)&&t.recalculateFont(!0)}))}}),ga=function(){ya(wn),ya($t),Fr(!0),Er(!0),pa.run()},ma=function(){Fr(!1),Er(!1),pa.halt(),ya(wn)},ya=function(t){navigator.pointerEnabled||navigator.msPointerEnabled?(window[t](on,oa,!1),window[t](an,oa,!1),window[t](nn,oa,!1),window[t](rn,oa,!1),window[t](sn,oa,!1)):(window[t](Bi,oa,!1),window[t]($i,oa,!1),window[t](Ii,oa,!1),window[t](Li,oa,!1),window[t](Hi,oa,!1),window[t](Fs,ua,{passive:!0}),window[t](Rs,ua,{passive:!0}),window[t](Ds,ua,{passive:!0}),window[t](xs,ua,{passive:!0})),window[t]("scroll",ra,{passive:!0}),window[t]("resize",sa,!1)},ba=function(){const{fontfamilymetadata:t,fontfamilymetadatanames:e}=tt;e.forEach(e=>delete t[e]),e.length=0},Sa=t=>{const{canvasSupportsP3Color:e,displaySupportsP3Color:i}=Go;return t&&e&&i?Ye:$n},Aa=["bottom","boxSizing","display","height","left","perspective","perspectiveOrigin","position","right","top","transform","transformOrigin","width","zIndex"],ka=[];let Ca=!1;const wa=function(t=Vs){if(Ca||t){const e=go();let i,n,s,r,a,l,c,h,u,d,f,p,g,m,y;t&&t.substring?e.push(t):(Ca=!1,e.push(...ka),ka.length=0);const b=Jo(),S=Ko();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||sr,g=pt(p),d=0,f=g.length;d<f;d++)m=g[d],y=p[m],Aa.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===_n?(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`:qt)),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?se:Ui),s.dirtyStampOrder&&(s.dirtyStampOrder=!1,a.zIndex=s.stampOrder)}mo(e)}},va=(t=100)=>{setTimeout(()=>{y.forEach(t=>{const e=m[t];ti.includes(e.type)&&e.recalculateFont()})},t)},Pa=[],Oa=[],xa=t=>{Sr(Pa,t),lo(!0)},Da=t=>{Ar(Pa,t),lo(!0)},Fa=()=>(ao&&Ra(),Oa),Ra=function(){lo(!1);const t=go();let e,i,n,s;for(n=0,s=Pa.length;n<s;n++)e=o[Pa[n]],e&&(i=ht(e.order)||0,t[i]||(t[i]=go()),t[i].push(e.name));for(Oa.length=0,n=0,s=t.length;n<s;n++)e=t[n],e&&(Oa.push(...e),mo(e));mo(t)},Ta=["lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit"],Ea=["filter","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","imageSmoothingQuality"],Ia=["shadowBlur","shadowOffsetX","shadowOffsetY"],Ha=["fillStyle","shadowColor","strokeStyle"],State=function(){return this.set(this.defs),this.lineDash=[],this},La=State.prototype=Or();La.type="State",Bo(La),La.defs={fillStyle:te,strokeStyle:te,globalAlpha:1,globalCompositeOperation:Ln,lineWidth:1,lineCap:"butt",lineJoin:"miter",lineDash:null,lineDashOffset:0,miterLimit:10,shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:te,font:Te,direction:Ci,fontKerning:zi,textRendering:qt,letterSpacing:hn,wordSpacing:hn,fontStretch:zi,fontVariantCaps:zi,filter:Ui,imageSmoothingEnabled:!0,imageSmoothingQuality:hi,textAlign:bi,textBaseline:Os},La.processPacketOut=function(t,e,i){let n=!0;if(t===Si)e.length||(n=!!i.includes(Si));else i.includes(t)||e!==this.defs[t]||(n=!1);return n},La.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 Ba=La.getters,$a=La.setters;Ba.canvasFont=function(){return this.font},$a.canvasFont=function(t){this.font=t},La.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]!==Hs?t[e]:u[e]};for(t.substring&&(t=m[t]),s=0,r=Ea.length;s<r;s++)i=Ea[s],c=f(this,i),h=f(e,i),h!==c&&(d[i]=c);for(s=0,r=Ia.length;s<r;s++)i=Ia[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=Ta.length;s<r;s++)if(i=Ta[s],c=f(this,i),h=f(e,i),i===Si){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=Ha.length;s<r;s++)i=Ha[s],h=f(e,i),c=f(this,i),c.substring&&h!==c?d[i]=c:c.type===Kn?(c=c.getData(),h!==c&&(d[i]=c)):d[i]=c;if(ti.includes(t.type))for(s=0,r=Gn.length;s<r;s++)i=Gn[s],c=f(this,i),h=f(e,i),h!==c&&(d[i]=c);return d},La.setStateFromEngine=function(t){let e;for(let i=0,n=Xn.length;i<n;i++)e=Xn[i],this[e]=t[e];return this.lineDash=kr(t.lineDash)?t.lineDash:[],this.lineDashOffset=wr(t.lineDashOffset,0),t.textAlign=bi,this.textAlign=bi,t.textBaseline=Os,this.textBaseline=Os,this};const Ma=function(t){return!!t&&new State};J.State=State;var Ya=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}},Xa=function(t){return function(){var e,i,n=48,s=1,r=n,o=new Array(n),a=0,l=new Ya;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 Na=function(t){return new Xa(t)},Ga={},Ua={};let za=1e3;const ja=t=>{ft(t)&&t>=200&&t<=1e4&&(za=t)},Va=t=>{ft(t)&&t>=200&&t<=1e4&&(za=t)},Wa=t=>!!Ga[t],Za=t=>Ga[t]?(Ua[t]=yt(),Ga[t]):null,_a=(t,e)=>{Ga[t]=e,Ua[t]=yt()},qa=function(t,e=[]){const i=yt();return Ga[t]?(Ua[t]=i,Ga[t]):(Ga[t]=e,Ua[t]=i,Ga[t])};let Ka=200,Qa=0;const Ja=t=>{ft(t)&&t>=10&&t<=5e3&&(Ka=t)};Mo({name:"SC-core-workstore-hygiene",order:998,fn:()=>(()=>{const t=yt();if(Qa<t-Ka){const e=pt(Ga),i=t-za;for(let t,n=0,s=e.length;n<s;n++)t=e[n],Ua[t]<i&&(delete Ga[t],delete Ua[t]);Qa=t}})()});const tl=document.createElement(he);tl.width=1,tl.height=1;const el=tl.getContext(Ht,{willReadFrequently:!0});el.globalAlpha=1,el.globalCompositeOperation=Ln;const il=function(){return this},nl=il.prototype=Or();nl.type="ColorEngine",nl.getMetricLinearGrayscaleValue=function(t,e,i){return 255*(.2126*ic(t)+.7152*ic(e)+.0722*ic(i))+.5|0},nl.getDisplayLinearGrayscaleValue=function(t,e,i){const n=ic(t),s=ic(e),r=ic(i);return nc(.2126*n+.7152*s+.0722*r)},nl.getBestGray=nl.getDisplayLinearGrayscaleValue,nl.getBT709GrayscaleValue=function(t,e,i){return.2126*t+.7152*e+.0722*i+.5|0},nl.getGray=nl.getBT709GrayscaleValue,nl.getBT601GrayscaleValue=function(t,e,i){return.299*t+.587*e+.114*i+.5|0},nl.getRGBGrayscaleValue=function(t,e,i){return(t+e+i)/3+.5|0};const sl=",",rl=/\s*,\s*/,ol=[0,0,0,0],al="hsl",ll=/^(?:hsl|hsla)\s*\(\s*([^)]+)\s*\)$/,cl="hwb",hl=/^hwb\s*\(\s*([^)]+)\s*\)$/,ul="lab",dl=/^lab\s*\(\s*([^)]+)\s*\)$/,fl="lch",pl=/^lch\s*\(\s*([^)]+)\s*\)$/,gl=/[a-z%]+$/,ml="none",yl="oklab",bl="oklch",Sl="rgb",Al=/^(?:rgb|rgba)\s*\(\s*([^)]+)\s*\)$/,kl="/",Cl=/\s+/g,wl=/\s+/,vl="string",Pl=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}(?:[0-9a-f]{2})?)$/,Ol=/%$/,xl=180/Math.PI,Dl="xyz",Fl=[],Rl=()=>{if(Fl.length){const t=Fl.pop();return t.ok=!1,t.value=0,t}return{ok:!1,value:0}},Tl=(...t)=>{for(const e of t)Fl.push(e)},El=t=>{if(!(t=t.trim()))return NaN;if(Ol.test(t)){const e=parseFloat(t.slice(0,-1));return ft(e)?vt(255*cr(e,0,100)/100):NaN}{const e=parseFloat(t);return ft(e)?vt(cr(e,0,255)):NaN}},Il=t=>{if(!(t=t.trim()))return NaN;if(Ol.test(t)){const e=parseFloat(t.slice(0,-1));return ft(e)?cr(e/100,0,1):NaN}{const e=parseFloat(t);return ft(e)?cr(e,0,1):NaN}},Hl=t=>{if(!(t=t.trim().toLowerCase()))return NaN;if(t===ml)return 0;const e=t.match(gl),i=e?e[0]:Vs,n=parseFloat(t);if(!ft(n))return NaN;let s;switch(i){case Vs:case"deg":s=n;break;case"rad":s=n*xl;break;case"grad":s=.9*n;break;case"turn":s=360*n;break;default:return NaN}return s=(s%360+360)%360,s},Ll=t=>{const e=Rl();if(!(t=t.trim().toLowerCase()))return e;if(t===ml)return e.ok=!0,e;const i=Ol.test(t),n=parseFloat(i?t.slice(0,-1):t);if(!ft(n))return e;const s=cr(n,0,100);return e.ok=!0,e.value=s,e},Bl=t=>{const e=Rl();if(!(t=t.trim().toLowerCase()))return e;if(t===ml)return e.ok=!0,e;t.endsWith("%")&&(t=t.slice(0,-1));const i=parseFloat(t);return ft(i)?(e.ok=!0,e.value=i,e):e},$l=t=>{if(typeof t!==vl)return ol;const e=t.trim().toLowerCase();if(e.includes(sl))return ol;const i=e.match(/^oklch\s*\(\s*([^)]+)\s*\)$/);if(!i)return ol;const n=i[1].trim().split(kl);let s,r=1;if(1!==n.length&&2!==n.length)return ol;if(s=n[0].trim().split(wl).filter(Boolean),3!==s.length)return ol;if(2===n.length){const t=n[1].trim();if(!t)return ol;if(r=Il(t),!ft(r))return ol}const o=s[0].endsWith("%"),a=o?Ll(s[0]):Bl(s[0]),l=(t=>{const e=Rl();if(!(t=t.trim().toLowerCase()))return e;if(t===ml)return e.ok=!0,e;const i=t.endsWith("%");i&&(t=t.slice(0,-1));const n=parseFloat(t);if(!ft(n))return e;const s=i?n/100*.4:n;return e.ok=!0,e.value=cr(s,0,.4),e})(s[1]),c=Hl(s[2]);if(!a.ok||!l.ok||!ft(c))return Tl(a,l),ol;const h=a.value*(o?.01:1),u=cr(h,0,1),d=l.value;return Tl(a,l),ft(u)&&ft(d)&&ft(c)?[u,d,c,r]:ol},Ml="rgb-and-ok-space-color-values-cache",Yl=t=>{const e=t.trim(),i=(Wa(Ml)||_a(Ml,new Map),Za(Ml)),n=i.get(e);if(n)return n;const s=el.fillStyle;el.fillStyle="#010203";const r=el.fillStyle;el.fillStyle=e;if(el.fillStyle===r&&e!==r){const t=[...ol];return i.set(e,t),el.fillStyle=s,t}el.clearRect(0,0,1,1),el.fillRect(0,0,1,1);const o=el.getImageData(0,0,1,1).data,a=[o[0],o[1],o[2],o[3]/255];return i.set(e,a),el.fillStyle=s,a},Xl=nl.getColorValuesFromString=function(t){if(typeof t!==vl)return[Sl,0,0,0,0];const e=t.trim().toLowerCase();if(!e)return[Sl,0,0,0,0];if(e.includes("color-mix(")||e.includes("color(from"))return[Sl,0,0,0,0];const i=(t,e)=>[t,e[0],e[1],e[2],e[3]];if(e.includes("#")){const e=(t=>{if(typeof t!==vl)return ol;const e=t.trim().toLowerCase().replace(Cl,Vs);if(!Pl.test(e))return ol;let i=e.slice(1);3!==i.length&&4!==i.length||(i=i.split(Vs).map(t=>t+t).join(Vs));const n=parseInt(i.slice(0,2),16),s=parseInt(i.slice(2,4),16),r=parseInt(i.slice(4,6),16),o=8===i.length?parseInt(i.slice(6,8),16)/255:1;return ft(n)&&ft(s)&&ft(r)&&ft(o)?[n,s,r,o]:ol})(t);return i(Sl,e)}if(e.includes("oklch(")){const e=$l(t);return i(bl,e)}if(e.includes("oklab(")){const e=(t=>{if(typeof t!==vl)return ol;const e=t.trim().toLowerCase();if(e.includes(sl))return ol;const i=e.match(/^oklab\s*\(\s*([^)]+)\s*\)$/);if(!i)return ol;let n,s=1;const r=i[1].trim().split(kl);if(1===r.length){if(n=r[0].trim().split(wl).filter(Boolean),3!==n.length)return ol}else{if(2!==r.length)return ol;{const t=r[0].trim(),e=r[1].trim();if(n=t.split(wl).filter(Boolean),3!==n.length||!e)return ol;if(s=Il(e),!ft(s))return ol}}const o=n[0].endsWith("%"),a=n[1].endsWith("%"),l=n[2].endsWith("%"),c=o?Ll(n[0]):Bl(n[0]),h=Bl(n[1]),u=Bl(n[2]);if(!c.ok||!h.ok||!u.ok)return Tl(c,h,u),ol;let d=c.value;o&&(d*=.01);let f=h.value;a&&(f*=.004);let p=u.value;l&&(p*=.004);const g=cr(d,0,1),m=cr(f,-.4,.4),y=cr(p,-.4,.4);return Tl(c,h,u),ft(g)&&ft(m)&&ft(y)?[g,m,y,s]:ol})(t);return i(yl,e)}if(e.includes("lch(")){const e=(t=>{if(typeof t!==vl)return ol;const e=t.trim().toLowerCase();if(e.includes(sl))return ol;const i=e.match(pl);if(!i)return ol;let n,s=1;const r=i[1].trim().split(kl);if(1!==r.length&&2!==r.length)return ol;if(n=r[0].trim().split(wl).filter(Boolean),3!==n.length)return ol;if(2===r.length){const t=r[1].trim();if(!t)return ol;if(s=Il(t),!ft(s))return ol}const o=Ll(n[0]),a=Bl(n[1]),l=Hl(n[2]);if(!o.ok||!a.ok||!ft(l))return Tl(o,a),ol;const c=cr(o.value,0,100),h=cr(a.value,0,150),u=l;return Tl(o,a),ft(c)&&ft(h)&&ft(u)?[c,h,u,s]:ol})(t);return i(fl,e)}if(e.includes("lab(")){const e=(t=>{if(typeof t!==vl)return ol;const e=t.trim().toLowerCase();if(e.includes(sl))return ol;const i=e.match(dl);if(!i)return ol;let n,s=1;const r=i[1].trim().split(kl);if(1===r.length){if(n=r[0].trim().split(wl).filter(Boolean),3!==n.length)return ol}else{if(2!==r.length)return ol;{const t=r[0].trim(),e=r[1].trim();if(n=t.split(wl).filter(Boolean),3!==n.length||!e)return ol;if(s=Il(e),!ft(s))return ol}}const o=Ll(n[0]),a=Bl(n[1]),l=Bl(n[2]);if(!o.ok||!a.ok||!l.ok)return Tl(o,a,l),ol;const c=cr(o.value,0,100),h=cr(a.value,-125,125),u=cr(l.value,-125,125);return Tl(o,a,l),ft(c)&&ft(h)&&ft(u)?[c,h,u,s]:ol})(t);return i(ul,e)}if(e.includes("rgb(")||e.includes("rgba(")){const e=(t=>{if(typeof t!==vl)return ol;const e=t.trim().toLowerCase().match(Al);if(!e)return ol;const i=e[1].trim();let n,s=1;if(i.includes(sl)){if(n=i.split(rl),3!==n.length&&4!==n.length)return ol;4===n.length&&(s=Il(n[3]))}else{const t=i.split(kl);if(1===t.length){if(n=t[0].trim().split(wl).filter(Boolean),3!==n.length)return ol}else{if(2!==t.length)return ol;{const e=t[0].trim(),i=t[1].trim();if(n=e.split(wl).filter(Boolean),3!==n.length||!i)return ol;s=Il(i)}}}const r=El(n[0]),o=El(n[1]),a=El(n[2]);return ft(r)&&ft(o)&&ft(a)&&ft(s)?[r,o,a,s]:ol})(t);return i(Sl,e)}if(e.includes("hsl(")||e.includes("hsla(")){const e=(t=>{if(!t.substring)return ol;const e=t.trim().toLowerCase().match(ll);if(!e)return ol;const i=e[1].trim();let n,s=1;if(i.includes(sl)){if(n=i.split(rl),3!==n.length&&4!==n.length)return ol;if(4===n.length&&(s=Il(n[3]),!ft(s)))return ol}else{const t=i.split(kl);if(1===t.length){if(n=t[0].trim().split(wl).filter(Boolean),3!==n.length)return ol}else{if(2!==t.length)return ol;{const e=t[0].trim(),i=t[1].trim();if(n=e.split(wl).filter(Boolean),3!==n.length||!i)return ol;if(s=Il(i),!ft(s))return ol}}}const r=Hl(n[0]),o=Ll(n[1]),a=Ll(n[2]);if(!o.ok||!a.ok||!ft(r))return Tl(o,a),ol;const l=o.value,c=a.value;return Tl(o,a),[r,l,c,s]})(t);return i(al,e)}if(e.includes("hwb(")){const e=(t=>{if(typeof t!==vl)return ol;const e=t.trim().toLowerCase();if(e.includes(sl))return ol;const i=e.match(hl);if(!i)return ol;let n,s=1;const r=i[1].trim().split(kl);if(1===r.length){if(n=r[0].trim().split(wl).filter(Boolean),3!==n.length)return ol}else{if(2!==r.length)return ol;{const t=r[0].trim(),e=r[1].trim();if(n=t.split(wl).filter(Boolean),3!==n.length||!e)return ol;if(s=Il(e),!ft(s))return ol}}const o=Hl(n[0]),a=Ll(n[1]),l=Ll(n[2]);if(!ft(o)||!a.ok||!l.ok)return Tl(a,l),ol;const c=a.value,h=l.value;return Tl(a,l),[o,c,h,s]})(t);return i(cl,e)}if(e.includes("color(")){const e=Yl(t);return i(Sl,e)}const n=Yl(t);return i(Sl,n)};nl.extractRGBfromColorString=function(t){const e=Xl(t);if(e[0]===Sl)return[e[1],e[2],e[3]];const i=kc(e,Sl);return[i[1],i[2],i[3]]},nl.buildColorStringFromData=function(t){if(null==t||!dt(t)||5!==t.length)return ie;const[e,i,n,s,r]=t;if(typeof e!==vl||!ft(i)||!ft(n)||!ft(s))return ie;let o,a,l,c,h,u,d,f,p,g=ft(r)?r:1;switch(g=g>1?1:g<0?0:g,e){case Sl:return o=lr(vt(cr(i,0,255))),a=lr(vt(cr(n,0,255))),l=lr(vt(cr(s,0,255))),`rgb(${o} ${a} ${l} / ${g})`;case al:return c=Js(i),h=cr(n,0,100),u=cr(s,0,100),`hsl(${c} ${h}% ${u}% / ${g})`;case cl:return c=Js(i),d=cr(n,0,100),l=cr(s,0,100),`hwb(${c} ${d}% ${l}% / ${g})`;case ul:return u=cr(i,0,100),f=cr(n,-125,125),l=cr(s,-125,125),`lab(${u}% ${f} ${l} / ${g})`;case fl:return u=cr(i,0,100),p=cr(n,0,230),c=Js(s),`lch(${u}% ${p} ${c} / ${g})`;case yl:return u=cr(i,0,1),f=cr(n,-.4,.4),l=cr(s,-.4,.4),`oklab(${u} ${f} ${l} / ${g})`;case bl:return u=cr(i,0,1),p=cr(n,0,.4),c=Js(s),`oklch(${u} ${p} ${c} / ${g})`;case Dl:{const[t,e,r]=uc(i,n,s);return u=cr(t,0,100),f=cr(e,-125,125),l=cr(r,-125,125),`lab(${u}% ${f} ${l} / ${g})`}default:return ie}},nl.convertRGBtoHex=function(t,e,i){return"#"+[t=gt(0,vt(mt(255,ft(t)?t:0))),e=gt(0,vt(mt(255,ft(e)?e:0))),i=gt(0,vt(mt(255,ft(i)?i:0)))].map(t=>t.toString(16).padStart(2,"0")).join(Vs)};const Nl=.4,Gl=-.4,Ul="rgb-and-ok-spaces-color-values-cache",zl=nl.getRgbOkCache=function(){return Wa(Ul)||_a(Ul,{labColorLib:new Map,lchColorLib:new Map,rgbColorLib:new Map}),Za(Ul)};nl.getOkValsForRgb=function(t,e,i,n){null==n&&(n=zl());const s=Wl(t,e,i),r=n.rgbColorLib.get(s);if(void 0!==r)return r;const o=gc(t,e,i),a=Sc(o[0],o[1],o[2]),l=[o[0],o[1],o[2],a[1],a[2]];return n.rgbColorLib.set(s,l),n.labColorLib.set(jl(o[0],o[1],o[2]),[t,e,i]),n.lchColorLib.set(Vl(a[0],a[1],a[2]),[t,e,i]),l},nl.getRgbValsForOklch=function(t,e,i,n){null==n&&(n=zl());const s=Vl(t,e,i),r=n.lchColorLib.get(s);if(void 0!==r)return r;const o=Ac(t,e,i),a=mc(o[0],o[1],o[2]);return n.lchColorLib.set(s,a),n.labColorLib.set(jl(o[0],o[1],o[2]),a),a},nl.getRgbValsForOklab=function(t,e,i,n){null==n&&(n=zl());const s=jl(t,e,i),r=n.labColorLib.get(s);if(void 0!==r)return r;const o=mc(t,e,i);n.labColorLib.set(s,o);const a=Sc(t,e,i);return n.lchColorLib.set(Vl(a[0],a[1],a[2]),o),o};const jl=function(t,e,i){const n=Zl(t);e<Gl?e=Gl:e>Nl&&(e=Nl),i<Gl?i=Gl:i>Nl&&(i=Nl);return 251001*n+501*ht(625*(e+.4))+ht(625*(i+.4))},Vl=function(t,e,i){e<0?e=0:e>.8&&(e=.8);return 108540*Zl(t)+540*ht(250*e)+ht(1.5*i)},Wl=function(t,e,i){return t<<16|e<<8|i},Zl=function(t){return t<0?t=0:t>1&&(t=1),ht(t<.4?250*t:t<.9?100+600*(t-.4):400+1e3*(t-.9))},_l=216/24389,ql=24389/27,Kl=Math.cbrt,Ql=null!=Kl?Kl:t=>kt(t,1/3),Jl=[.3457/.3585,1,.2958/.3585],tc=new Float32Array(256);for(let t,e=0;e<256;e++)t=e/255,tc[e]=t<=.04045?t/12.92:kt((t+.055)/1.055,2.4);const ec=new Uint8ClampedArray(4097);for(let t,e,i=0;i<=4096;i++)t=i/4096,e=t<=.0031308?12.92*t:1.055*kt(t,1/2.4)-.055,ec[i]=255*e+.5|0;const ic=t=>tc[255&t],nc=t=>{let e=4096*t+.5|0;return e<0?e=0:e>4096&&(e=4096),ec[e]},sc=function(t,e,i){const n=gt(t/=255,e/=255,i/=255),s=mt(t,e,i),r=(s+n)/2,o=n-s;let a=0,l=0;if(0!==o){switch(l=0===r||1===r?0:(n-r)/mt(r,1-r),n){case t:a=(e-i)/o+(e<i?6:0);break;case e:a=(i-t)/o+2;break;case i:a=(t-e)/o+4}a*=60}return[a,100*l,100*r]},rc=function(t,e,i){t=Js(t),e/=100,i/=100;const n=function(n){const s=(n+t/30)%12,r=e*mt(i,1-i);return i-r*gt(-1,mt(s-3,9-s,1))};return[lr(vt(255*n(0))),lr(vt(255*n(8))),lr(vt(255*n(4)))]},oc=function(t,e,i){const n=sc(t,e,i),s=mt(t/=255,e/=255,i/=255),r=1-gt(t,e,i);return[n[0],100*s,100*r]},ac=function(t,e,i){if((e/=100)+(i/=100)>=1){const t=lr(vt(255*(e/(e+i))));return[t,t,t]}const n=rc(t,100,50);for(let t=0;t<3;t++){let s=n[t]/255;s=s*(1-e-i)+e,n[t]=lr(vt(255*s))}return n},lc=function(t,e,i){const n=ic(t),s=ic(e),r=ic(i);return[.4123907992659593*n+.357584339383878*s+.1804807884018343*r,.2126390058715104*n+.715168678767756*s+.0721923153607337*r,.0193308187155919*n+.1191947797946259*s+.9505321522496606*r]},cc=function(t,e,i){const n=-.9692436362808798*t+1.8759675015077206*e+.04155505740717561*i,s=.05563007969699361*t+-.20397695888897657*e+1.0569715142428786*i;return[nc(3.2409699419045213*t+-1.5373831775700935*e+-.4986107602930033*i),nc(n),nc(s)]},hc=180/Math.PI,uc=function(t,e,i){const n=(1.0479298208405488*t+.022946793341019088*e-.05019222954313557*i)/Jl[0],s=(.029627815688159344*t+.990434484573249*e-.01707382502938514*i)/Jl[1],r=(-.009243058152591178*t+.015055144896577895*e+.7518742899580008*i)/Jl[2],o=n>_l?Ql(n):(ql*n+16)/116,a=s>_l?Ql(s):(ql*s+16)/116;return[116*a-16,500*(o-a),200*(a-(r>_l?Ql(r):(ql*r+16)/116))]},dc=function(t,e,i){const n=(t+16)/116,s=e/500+n,r=n-i/200,o=s*s*s,a=r*r*r,l=(o>_l?o:(116*s-16)/ql)*Jl[0],c=(t>8?((t+16)/116)**3:t/ql)*Jl[1],h=(a>_l?a:(116*r-16)/ql)*Jl[2];return[.9554734527042182*l-.023098536874261423*c+.0632593086610217*h,-.028369706963208136*l+1.0099954580058226*c+.021041398966943008*h,.012314001688319899*l-.020507696433477912*c+1.3303659366080753*h]},fc=function(t,e,i){const n=st(i,e)*hc;return[t,xt(kt(e,2)+kt(i,2)),n>=0?n:n+360]},pc=function(t,e,i){return[t,e*at(i*Ct),e*Ot(i*Ct)]},gc=function(t,e,i){const n=ic(t),s=ic(e),r=ic(i),o=.2119034982*n+.6806995451*s+.1073969566*r,a=.0883024619*n+.2817188376*s+.6299787005*r,l=Ql(.4122214708*n+.5363325363*s+.0514459929*r),c=Ql(o),h=Ql(a);return[.2104542553*l+.793617785*c-.0040720468*h,1.9779984951*l-2.428592205*c+.4505937099*h,.0259040371*l+.7827717662*c-.808675766*h]},mc=function(t,e,i){const n=t+.3963377774*e+.2158037573*i,s=t-.1055613458*e-.0638541728*i,r=t-.0894841775*e-1.291485548*i,o=n*n*n,a=s*s*s,l=r*r*r,c=-1.2684380046*o+2.6097574011*a-.3413193965*l,h=-.0041960863*o-.7034186147*a+1.707614701*l;return[nc(4.0767416621*o-3.3077115913*a+.2309699292*l),nc(c),nc(h)]},yc=function(t,e,i){const n=.0329836671980271*t+.9292868468965546*e+.03614466816999844*i,s=.048177199566046255*t+.26423952494422764*e+.6335478258136937*i,r=Ql(.8190224432164319*t+.3619062562801221*e-.12887378261216414*i),o=Ql(n),a=Ql(s);return[.2104542553*r+.793617785*o-.0040720468*a,1.9779984951*r-2.428592205*o+.4505937099*a,.0259040371*r+.7827717662*o-.808675766*a]},bc=function(t,e,i){const n=.9999999984505198*t+.39633779217376786*e+.2158037580607588*i,s=1.0000000088817609*t-.10556134232365635*e-.0638541747717059*i,r=1.000000054672411*t-.08948418209496577*e-1.2914855378640917*i,o=n*n*n,a=s*s*s,l=r*r*r;return[1.2268798733741557*o-.5578149965554813*a+.28139105017721583*l,-.04057576262431372*o+1.1122868293970594*a-.07171106666151701*l,-.07637294974672142*o-.421493323962