PageSourceSearch

https://ar.snap.com/mwp/chunks/LazyCustomMotifHandler-4WNAU4OK.mjs

js snap.com collected 2026-10-01 08:29:12 UTC 10,437 bytes, 33 lines download raw bytes

1
2      // Merge in the client-visible compile-time environment.
3      window.process = {
4        ...window.process,
5        env: {
6          ...window.process?.env,
7          ...({"CI_COMMIT":"2c5c7131d4533d97accd3e00b00e60d713ff6981","CI_PIPELINE_ID":"41789dce-b5c6-4568-a140-bda74441f6f8","GOOGLE_CLOUD_PROJECT":"marketing-web-platform","DEPLOYMENT_TYPE":"production","NODE_ENV":"production","PREVIEW":"false","SITE_CONFIG":"ar"})
8        }
9      };
10
11      // Stop crashing when certain node libraries are imported.
12      window.global = window.global ?? {};
13    
14import{$ as ge,D as fe,Z as me,_ as pe,ca as ue,ha as v,ra as O}from"./chunk-O4HAT6GZ.mjs";import{L as ce,a as se}from"./chunk-PKBSZI62.mjs";import"./chunk-XX2CAYX7.mjs";import"./chunk-52COQ74A.mjs";import"./chunk-A75TWWTU.mjs";import"./chunk-BNAP55G6.mjs";import"./chunk-Q2ENNH4G.mjs";import"./chunk-T5DBBEKA.mjs";import"./chunk-IO7B6257.mjs";import{a as Le}from"./chunk-IIM3TUQT.mjs";import{h as ne}from"./chunk-DAUCXRHA.mjs";import{A as H,C as ie,D as ae,F as W,G as _,M as le,S as F,T as Q,b as oe,q as re,s as R}from"./chunk-5NJA464I.mjs";import"./chunk-C45TSCXU.mjs";import{b as De,d as U}from"./chunk-SOCJ5NZ5.mjs";var xe=De((ve,Z)=>{"use strict";
14Object.defineProperty(ve,"__esModule",{value:!0});var{round:$,floor:de,max:Ve}=Math,we=e=>{let[,t]=/([a-f\d]{3,6})/i.exec(e)||[],o=t?t.length:0;if(o===3)t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2];else if(o!==6)return[0,0,0];let r=parseInt(t,16);return[r>>16&255,r>>8&255,255&r]},Ee=(e,t,o)=>e===t&&t===o?e<8?16:e>248?231:$((e-8)/247*24)+232:16+36*$(e/51)+6*$(t/51)+$(o/51),J=e=>{let t,o,r,n,a,i;return e<8?30+e:e<16?e-8+90:(e>=232?t=o=r=(10*(e-232)+8)/255:(i=(e-=16)%36,t=de(e/36)/5,o=de(i/6)/5,r=i%6/5),n=2*Ve(t,o,r),n===0?30:(a=30+($(r)<<2|$(o)<<1|$(t)),n===2?a+60:a))},be=(e,t,o)=>J(Ee(e,t,o)),q=(e=>{let t=h=>!!u.find((b=>h.test(b))),o=globalThis,r=o.Deno,n=r!=null,a=o.process||r||{},i=a.stdout,g=(n?r.build.os:a.platform)==="win32",u=a.argv||a.args||[],s=a.env||{},c=-1;if(n)try{s=s.toObject()}catch{c=0}let l="FORCE_COLOR",p=s[l],M=parseInt(p),d=p==="false"?0:isNaN(M)?3:M,m="NO_COLOR"in s||d===0||t(/^-{1,2}(no-color|color=(false|never))$/),C=l in s&&d||t(/^-{1,2}color=?(true|always)?$/),E=(s.NEXT_RUNTIME||"").indexOf("edge")>-1||"PM2_HOME"in s&&"pm_id"in s||(n?r.isatty(1):i&&"isTTY"in i);return m?0:(c<0&&(c=((h,b,T)=>{let{TERM:y,COLORTERM:w}=h;return"TF_BUILD"in h?1:"TEAMCITY_VERSION"in h?2:"CI"in h?["GITHUB_ACTIONS","GITEA_ACTIONS"].some((N=>N in h))?3:1:!b||/-mono|dumb/i.test(y)?0:T||w==="truecolor"||w==="24bit"||y==="xterm-kitty"?3:/-256(colou?r)?$/i.test(y)?2:/^screen|^tmux|^xterm|^vt[1-5][0-9]([0-9])?|^ansi|color|cygwin|linux|mintty|rxvt/i.test(y)?1:3})(s,E,g)),C&&c===0?3:c)})(),Se=q>0,Pe={open:"",close:""},f=Se?(e,t)=>({open:`\x1B[${e}m`,close:`\x1B[${t}m`}):()=>Pe,S=39,P=49,ye=e=>(t,o,r)=>e(Ee(t,o,r)),he=e=>t=>{let[o,r,n]=we(t);return e(o,r,n)},D=e=>f(`38;5;${e}`,S),L=e=>f(`48;5;${e}`,P),I=(e,t,o)=>f(`38;2;${e};${t};${o}`,S),V=(e,t,o)=>f(`48;2;${e};${t};${o}`,P);q===1?(D=e=>f(J(e),S),L=e=>f(J(e)+10,P),I=(e,t,o)=>f(be(e,t,o),S),V=(e,t,o)=>f(be(e,t,o)+10,P)):q===2&&(I=ye(D),V=ye(L));var A,z,k={ansi256:D,bgAnsi256:L,fg:D,bg:L,rgb:I,bgRgb:V,hex:he(I),bgHex:he(V),visible:Pe,reset:f(0,0),inverse:f(7,27),hidden:f(8,28),bold:f(1,22),dim:f(2,22),italic:f(3,23),underline:f(4,24),strikethrough:f(9,29),strike:f(9,29),grey:f(90,S),gray:f(90,S),bgGrey:f(100,P),bgGray:f(100,P)},je=["black","red","green","yellow","blue","magenta","cyan","white"],Me="Bright",B=30;for(A of je)z="bg"+A[0].toUpperCase()+A.slice(1),k[A]=f(B,S),k[A+Me]=f(B+60,S),k[z]=f(B+10,P),k[z+Me]=f(B+70,P),B++;var{defineProperty:Ge,defineProperties:Ye,setPrototypeOf:$e}=Object,He=/[�›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,We=/(\r?\n)/g,Ce={},Te=({_p:e},{open:t,close:o})=>{let r=(i,...g)=>{if(!i)return"";let u=r._p,{_a:s,_b:c}=u,l=i.raw!=null?String.raw(i,...g):""+i;if(l.includes("\x1B"))for(;u!=null;){let p=u.close,M=p.length;if(M){let d,m=0,C="";for(;~(d=l.indexOf(p,m));)C+=l.slice(m,d)+u.open,m=d+M;m&&(l=C+l.slice(m))}u=u._p}return l.includes(`
15`)&&(l=l.replace(We,c+"$1"+s)),s+l+c},n=t,a=o;return e!=null&&(n=e._a+t,a=o+e._b),$e(r,X),r._p={open:t,close:o,_a:n,_b:a,_p:e},r.open=n,r.close=a,r},Re=function(){let e=t=>""+t;return e.isSupported=()=>Se,e.strip=t=>t.replace(He,""),e.extend=t=>{for(let o in t){let r=t[o],n=typeof r,a=n==="string"?I(...we(r)):r;Ce[o]=n==="function"?{get(){return(...i)=>Te(this,r(...i))}}:{get(){let i=Te(this,a);return Ge(this,o,{value:i}),i}}}X=Ye({},Ce),$e(e,X)},e.extend(k),e},X,Qe=new Re;Z.exports=Qe,Z.exports.Ansis=Re});var x=U(oe());var K=U(xe(),1);var{ansi256:Ze,fg:Ke,bgAnsi256:et,bg:tt,rgb:ot,bgRgb:rt,hex:nt,bgHex:it,reset:at,inverse:st,hidden:lt,visible:ft,bold:ct,dim:mt,italic:pt,underline:gt,strikethrough:ut,strike:dt,black:bt,red:Fe,green:yt,yellow:ht,blue:Mt,magenta:Ct,cyan:Tt,white:wt,grey:Et,gray:j,blackBright:St,redBright:Oe,greenBright:Pt,yellowBright:$t,blueBright:Rt,magentaBright:vt,cyanBright:xt,whiteBright:Ft,bgBlack:Ot,bgRed:At,bgGreen:Bt,bgYellow:kt,bgBlue:It,bgMagenta:Nt,bgCyan:Ut,bgWhite:_t,bgGrey:Dt,bgGray:Lt,bgBlackBright:Vt,bgRedBright:jt,bgGreenBright:Gt,bgYellowBright:Yt,bgBlueBright:Ht,bgMagentaBright:Wt,bgCyanBright:Qt,bgWhiteBright:zt}=K.default;var ze={"Snap Motif/Global":"sdsm-default","Snap Motif/Primary":"sdsm-default","Snap Motif/Secondary":"sdsm-secondary","Snap Motif/Tertiary":"sdsm-tertiary","Snap Motif/Quaternary":"sdsm-quaternary","Snap Motif/Quinary":"sdsm-quinary"},Ae={"sdsm-default":R.Yellow,"sdsm-secondary":R.Black,"sdsm-tertiary":R.White,"sdsm-quaternary":R.Gray,"sdsm-quinary":R.Black},Be=3,ke=Object.entries(ie).flatMap(([e,t])=>t.map(o=>[o,e])).reduce((e,[t,o])=>(e[t]=o,e),{}),Je=new Set(Object.keys(ke));function qe(e,t){if(typeof e.value=="string")return e.value;if(e.type==="boxShadow"){let o=[e.value.x,e.value.y,e.value.blur,e.value.spread,e.value.color].join(" ");return e.value.type==="innerShadow"?`inset ${o}`:o}throw new Error(`Error: Parsing of values with type "${e.type}" with no string values is not supported.
16${j(`Path: ${t}`)} | Token Value: ${JSON.stringify(e)}`)}function Ie(e,t,o){let r={name:e,fontFamily:["Ghost Sans"],"sdsm-default":{name:"Imported Deafult",legacyName:Ae["sdsm-default"]}},n=new Map,a=new Map;for(let[g,u]of Object.entries(t)){let s=ze[g];if(g.startsWith("$"))continue;if(!s){o?.(new Error(`Unrecognized scheme name "${g}"`));continue}if(!u)continue;r[s]||(r[s]={...s==="sdsm-default"?void 0:_(r["sdsm-default"]),name:`Imported ${ne(s.substring(5))}`,legacyName:Ae[s]});let c=[{object:u,currentPath:"",attemptsLeft:Be}];for(;c.length>0;){let d=function(y){if(!M){o?.(new Error(y));return}c.push({currentPath:l,object:p,attemptsLeft:M-1})};var i=d;let{currentPath:l,object:p,attemptsLeft:M}=c.shift();if(!p){o?.(new Error(`Found an empty value at path ${p}`));continue}if(typeof p!="object"){o?.(new Error(`Found value "${p}" that is't an object. Bad data.`));continue}if(!("type"in p)){for(let[y,w]of Object.entries(p))c.push({currentPath:l===""?y:`${l}.${y}`,object:w,attemptsLeft:Be});continue}let m=p;if(m.type==="typography"){!r.fontFamily&&typeof m.value!="string"&&(r.fontFamily=[...r.fontFamily,m.value.fontFamily]);continue}let C=l;l.includes(".")&&(C=l.split(".").slice(-1)[0]);let E=C,h=qe(m,l);n.set(l,h),Je.has(E)&&a.set(l,`var(${E})`);let b=h;for(let y=0;y<4&&b.includes("{");y++)for(let[w]of b.matchAll(/\{[^}]+\}/g)){if(!w)continue;let N=w.substring(1,w.length-1),te=a.get(N)??n.get(N);te&&(b=b.replace(w,te))}if(b.includes("{")){d(`Unable to resolve reference for ${Fe(b)}"
17${j(`Path: ${g} / ${l})`)}`);continue}let T=ke[E];if(!T){if(g==="Snap Motif/Global")continue;o?.(new Error(`Unable to find a component for "${Oe(E)}".
18${j(`Path: ${g} / ${l}`)}`));continue}r[s][T]||(r[s][T]={}),T==="sdsm"&&E==="--bg-color"&&b.includes("gradient")&&(r[s][T]["--bg-image"]=b,r[s][T]["--bg-color"]="transparent"),r[s][T][E]=b}}return r}function Ne(e,t){let o=_(e);for(let r of ae)if(!(!e[r]||!t[r])){for(let n of Object.values(H))if(!(!e[r][n]||!t[r][n]))for(let a of Object.keys(o[r][n])){let i=a,g=e[r][n][i],u=t[r][n][i];g===u&&delete o[r][n][i]}}return o}var G=U(oe()),_e=U(Le());var Ue=re`
19  position: fixed;
20  right: 0;
21  bottom: 0;
22  border: 1px black solid;
23  background-color: white;
24  padding: 4px;
25  font-family: monospace, sans-serif;
26  font-size: 10px;
27  z-index: 999; /* To render over other things */
28`;var Xe="mwp-debug",ee=({children:e,name:t})=>{let o=v.isClient?document.getElementById(Xe):null,{getCurrentUrl:r}=(0,G.useContext)(ue),a=new URL(r()).searchParams.get("mwp_debug")==="true";return(0,G.useEffect)(()=>{a&&o?.classList.add(Ue)},[o,a]),!a||!o?null:(0,_e.createPortal)(e,o,t)};ee.displayName="IntoDebugPortal";var Y="CustomMotifHandler",wo=({children:e,motif:t,...o}
28)=>{let r=(0,x.useMemo)(()=>{if(!v.isClient||v.isDeploymentTypeProd)return null;let i=pe("mwp-custom-motif");if(!i)return null;let g=JSON.parse(i);return O.logDebug({component:Y,message:"Applying custom motif from local storage."}),le(W,g)},[]);(0,x.useLayoutEffect)(()=>{r&&window.document.querySelectorAll('style[data-emotion~="marketing-web-emotion"').forEach(i=>i.remove())},[r]);let n=(0,x.useCallback)(i=>{let g=i.target.files?.[0];if(!g)return;let u=new FileReader;u.onload=s=>{if(typeof s.target?.result!="string")return;let c="",l=JSON.parse(s.target?.result),p=[],M=m=>{p.push(m),O.logWarning({component:Y,message:`Non-critical error parsing motif: ${m}`})},d=null;try{d=Ie("uploaded-custom",l,M),c+="Successfully parsed motif. Applying to the current site after reload.",O.logDebug({component:Y,message:`${c} - ${d}`})}catch(m){O.logError({component:Y,message:"Error parsing motif",error:m}),c+="Critical error parsing motif. Could not apply. See the following information. ",c+=`
29 ${m}`}if(p.length>0&&(c+=`
30
31Non Critical Errors:
32`,c+=p.map((m,C)=>`${C+1}. ${m.message}`).join(`
33`)),c&&alert(c),d){let m=Ne(d,W);me("mwp-custom-motif",JSON.stringify(m)),window.location.reload()}},u.readAsText(g)},[]);if(v.isDeploymentTypeProd)return null;let a=t;return r&&(a=r),Q(fe,{motif:a,...o,children:[e,F(ee,{name:"custom-motif-debug",children:r?F(ce,{size:se.Compact,onClick:()=>{ge("mwp-custom-motif"),window.location.reload()},children:"Remove Uploaded Motif"}):Q("section",{children:[F("p",{children:"Upload a figma token motif json file to apply it to the site."}),F("input",{type:"file",onChange:n})]})})]})};export{wo as LazyCustomMotifHandler};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.