!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ed0f0d11-0d91-5d6c-985c-2334e85dc5db")}catch(e){}}(); (()=>{"use strict";let e,t,n,o;var r={},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,s),n.exports}s.rv=()=>"1.7.5",s.ruid="bundler=rspack@1.7.5";class a extends WebSocket{constructor(e,t,n){super(e,t),this.onCloseCb=n,this.events=[],this._onopen_=null,this._onmessage_=null,this._onclose_=null,this._onerror_=null,super.onopen=this.onOpen,super.onmessage=this.onMessage,super.onclose=this.onClose,super.onerror=this.onError}onOpen(e){this.events.push({event:"onopen",ev:e}),this.flushIfInitialized()}onMessage(e){this.events.push({event:"onmessage",ev:e}),this.flushIfInitialized()}onClose(e){this.onCloseCb?.(),this.events.push({event:"onclose",ev:e}),this.flushIfInitialized()}onError(e){this.events.push({event:"onerror",ev:e}),this.flushIfInitialized()}flushIfInitialized(){if(this._onmessage_&&this._onopen_&&this._onclose_&&this._onerror_)for(;this.events.length>0;){let{event:e,ev:t}=this.events.shift();switch(e){case"onopen":this._onopen_(t);break;case"onmessage":this._onmessage_(t);break;case"onclose":this._onclose_(t);break;case"onerror":this._onerror_(t)}}}set onopen(e){this._onopen_=e,this.flushIfInitialized()}get onopen(){return this._onopen_}set onmessage(e){this._onmessage_=e,this.flushIfInitialized()}get onmessage(){return this._onmessage_}set onclose(e){this._onclose_=e,this.flushIfInitialized()}get onclose(){return this._onclose_}set onerror(e){this._onerror_=e,this.flushIfInitialized()}get onerror(){return this._onerror_}}class c{constructor(){this.queue=[],this.storeErrors=!0}static getInstance(){return c.instance||(c.instance=new c),c.instance}registerError(e){this.queue.push(e)}onerror(e,t,n,o,r){return this.storeErrors&&this.queue.push({message:e,source:t,lineno:n,colno:o,error:r}),!1}drainErrors(){for(let e of(this.storeErrors=!1,this.queue))window.onerror?.(e.message,e.source,e.lineno,e.colno,e.error);this.queue.length=0}init(){return{onerror:this.onerror.bind(this),drainErrors:this.drainErrors.bind(this),registerError:this.registerError.bind(this)}}}let l=c.getInstance(),d=!1,w=!1;window.MONITORING=window.MONITORING||{};let u=window.MONITORING;function p(e,t,n){try{let o=`${n}:connectStart`;performance.mark(o,{startTime:t}),e.addEventListener("open",()=>{let e=`${n}:open`;performance.mark(e),performance.measure(`${n}:connect`,o,e)},{once:!0}),e.addEventListener("message",()=>{let e=`${n}:firstByte`;performance.mark(e),performance.measure(`${n}:firstByte`,o,e)},{once:!0})}catch(e){console.error("Error instrumenting WebSocket timing",e)}}let f=window.matchMedia("(prefers-color-scheme: dark)");function m(e){return"system"===e?f.matches?"dark":"light":"dark"===e?"dark":"light"}function h(e){return"dark"===e?"1E1E1E":"F5F5F5"}let _="global-debug-theme-preference";function I(e){if(e){let t=e?.getItem(_);return t||"system"}return null}async function g(e,t,n){if(null==n)return void e.preconnect(e.url(t));if("number"==typeof n?.meta)return void e.preconnect(e.url({...t,checkpointReconnect:{reconnectKey:n.reconnectKey,sequenceNumber:n.meta}}));try{let o=await n.meta;if(null==o)throw Error("Checkpoint reconnect meta was null");e.preconnect(e.url({...t,checkpointReconnect:{reconnectKey:n.reconnectKey,sequenceNumber:o.sequenceNumber}}))}catch(n){console.warn("Failed to get checkpoint reconnect meta, falling back to preconnect without checkpoint reconnect params",n),delete window.CHECKPOINT_DATA,e.preconnect(e.url(t))}}function S(e){return Array.from(e).map(e=>String.fromCharCode(e.charCodeAt(0)-1)).join("")}let y=Object.freeze("gjhnb"),N=Object.freeze("dispnf.fyufotjpo;00"),O=Object.freeze("np{.fyufotjpo;00"),k=Error,T=String.prototype.includes,E=Object.getOwnPropertyDescriptor(k.prototype,"stack")?.get;performance?.mark("figma:bootstrap:earlyJsExecutionStart"),self.global=self;let{onerror:L,drainErrors:A,registerError:b}=l.init();window.onerror=L,window.drainErrors=A;try{u.earlyVisibilityChangeHandler=()=>{let e=window.performance.now();d||(d=!0,u.firstVisibilityChange={visibilityState:document.visibilityState,time:e}),u.mostRecentVisibilityChange={visibilityState:document.visibilityState,time:e}},window.addEventListener("visibilitychange",u.earlyVisibilityChangeHandler)}catch(e){console.error("Error initializing page visibility listener",e)}try{u.earlyNetworkStatusChangeHandler=()=>{let e=window.performance.now();w||(w=!0,u.firstNetworkStatusChange={networkStatus:window.navigator.onLine?"online":"offline",time:e}),u.mostRecentNetworkStatus={networkStatus:window.navigator.onLine?"online":"offline",time:e}},window.addEventListener("online",u.earlyNetworkStatusChangeHandler),window.addEventListener("offline",u.earlyNetworkStatusChangeHandler)}catch(e){console.error("Error initializing network status listener",e)}"true"===new URLSearchParams(window.location.search).get("api_paywall")&&sessionStorage.setItem("figma_initial_api_paywall","true"),(()=>{var r,i,s;let c,l,d,w,u,L,{file_minimal_user_state:A,mock_user_state_for_tests_json:v,multiplayer_preconnect_options:P,omit_core_data:R,omit_user_state:C,preload_fullscreen_urls:D,should_connect_to_multiplayer:$,api_user_state_path:H,api_session_state_path:F,skip_lg_preload:U,checkpoint_url:q,checkpoint_sequence_number:G}=window.EARLY_ARGS||{};if(window.INITIAL_OPTIONS||(window.INITIAL_OPTIONS={}),window.EARLY_ARGS?.feature_flags?.track_initial_options_usage&&function(){let e=window.INITIAL_OPTIONS;if(!e)return;window.INITIAL_OPTIONS_ACCESSED_FIELDS||(window.INITIAL_OPTIONS_ACCESSED_FIELDS=new Map);let t=new Proxy(e,{get(t,n){let o=t[n];if("symbol"==typeof n||!e.hasOwnProperty(n)||Array.isArray(e)&&"length"===n||!window.INITIAL_OPTIONS_ACCESSED_FIELDS)return o;let r=Error().stack;if(r){let e=window.INITIAL_OPTIONS_ACCESSED_FIELDS.get(n);e||(e=new Set,window.INITIAL_OPTIONS_ACCESSED_FIELDS.set(n,e)),e.add(r)}return o},set:(e,t,n)=>(e[t]=n,!0)});window.INITIAL_OPTIONS=t}(),q){let e,t="figma:checkpoint-fetch:fetch-start";performance?.mark(t);let n=crypto.randomUUID(),o=fetch(q),r=o.then(e=>e.ok?e.arrayBuffer().then(e=>{let n="figma:checkpoint-fetch:fetch-body-end";return performance?.mark(n),performance?.measure("figma:checkpoint-fetch:fetch-body",t,n),e}):(console.warn(`Unable to fetch checkpoint: status ${e.status}`,e),performance?.mark("figma:checkpoint-fetch:fetch-failed"),null)).catch(e=>(console.warn("[checkpoint-reconnect] Checkpoint fetch failed",e),performance?.mark("figma:checkpoint-fetch:fetch-body-failed"),null));if(null!=G)e=G,window.CHECKPOINT_DATA={url:q,reconnectKey:n,source:"sinatra",earlySequenceNumber:G,buffer:r};else{let i=o.then(e=>{if(!e.ok)return null;let n="figma:checkpoint-fetch:fetch-headers-end";performance?.mark(n),performance?.measure("figma:checkpoint-fetch:fetch-headers",t,n);let o=e.headers.get("X-Figma-Sequence-Number"),r=null!=o?parseInt(o):null;return"number"!=typeof r||Number.isNaN(r)?(console.warn(`[checkpoint-reconnect] X-Figma-Sequence-Number header must contain sequence number (received: ${r})`),performance?.mark("figma:checkpoint-fetch:fetch-headers-failed"),null):{sequenceNumber:r}},()=>null).catch(e=>(console.warn("[checkpoint-reconnect] Failed to extract checkpoint metadata from headers",e),performance?.mark("figma:checkpoint-fetch:fetch-headers-failed"),null));e=i,window.CHECKPOINT_DATA={url:q,reconnectKey:n,source:"multiplayer",meta:i,buffer:r}}c={reconnectKey:n,meta:e}}((e,t,n,o,r,i,s)=>{if(e){window.userStateXHR={readyState:4,status:200,responseText:e};return}if(!window.Fig)return;if(o||!window.INITIAL_OPTIONS.user_data){window.startUserStateXHR=()=>{};return}let a=i||"/api/session/state";window.startUserStateXHR=function(e){let t=r;if(!t){t="/api/user/state";var o=[];window.INITIAL_OPTIONS.org_id&&o.push("org_id="+window.INITIAL_OPTIONS.org_id),window.INITIAL_OPTIONS.team_id&&o.push("team_id="+window.INITIAL_OPTIONS.team_id),n&&o.push("omit_core_data=1"),e&&o.push("file_key="+e),0!==o.length&&(t+="?"+o.join("&"))}window.userStateXHR=new XMLHttpRequest,window.userStateXHR.open("GET",t);let i=window.INITIAL_OPTIONS.user_data?.id;i&&window.userStateXHR.setRequestHeader("X-Figma-User-ID",i),window.userStateXHR.send();var s=window.performance?window.performance.now():-1;window.userStateXHR.addEventListener("load",function(){window.userStateXHRDuration=window.performance?window.performance.now()-s:-1},!1),window.sessionStateXHR=new XMLHttpRequest,window.sessionStateXHR.open("GET",a),i&&window.sessionStateXHR.setRequestHeader("X-Figma-User-ID",i),window.sessionStateXHR.send()};let c="/preload-android-proto"===location.pathname||"/file/new"===location.pathname||"/design/new"===location.pathname||"/slides/new"===location.pathname||"/board/new"===location.pathname||"/site/new"===location.pathname||"/buzz/new"===location.pathname||"/spec/new"===location.pathname||"/rev/new"===location.pathname||"/make/new"===location.pathname,l=window.INITIAL_OPTIONS.editing_file&&window.INITIAL_OPTIONS.editing_file.key;t?window.startUserStateXHR(l):c||window.startUserStateXHR()})(v,!!A,!!R,!!C,H,F);let X=/iPhone|iPad|iPod/.test(navigator.userAgent),M=!!window.EARLY_ARGS?.feature_flags?.livegraph_skip_early_conn_preload;if(!X&&!U&&!M){let e,t,n,o,r,i=(e=window.INITIAL_OPTIONS?.figma_url,t=!!window.EARLY_ARGS?.feature_flags?.livegraph_connect_next,n={clientUrl:window.document.URL},o=window.__figmaDesktop||window.__figmaDesktopGetPopoutAPI?.(),r=window.bellFeedAPI,o?(n.desktop=JSON.stringify(o.appVersion),o.version>=126&&(n.desktopOS=JSON.stringify(o.osVersion))):r&&(n.bell="1",r.version>=8&&(n.desktop=JSON.stringify(r.desktopAppVersion),n.desktopOS=JSON.stringify(r.osVersion))),{url:function(e){let t,n;if(e)try{let o=new URL(e);n=o.protocol,t=o.host}catch(e){}return(void 0===t||void 0===n)&&("admin.staging.figma.com"===(t=window.location.host)||"embed.staging.figma.com"===t?t="staging.figma.com":("admin.figma.com"===t||"embed.figma.com"===t)&&(t="www.figma.com"),n=window.location.protocol),`${"https:"===n?"wss":"ws"}://${t}`}(e),userId:window.INITIAL_OPTIONS?.user_data?.id||null,anonUserId:window.INITIAL_OPTIONS?.anonymous_user_id||null,pageLoadToken:window.INITIAL_OPTIONS?.page_load_token||"",preloadedViews:window.INITIAL_OPTIONS?.livegraph_preload_views||{},commitHash:window.INITIAL_OPTIONS?.release_manifest_git_commit||"missing",clientType:o||r?"desktop":"web",requestedProtocolVersion:window.INITIAL_OPTIONS?.launchdarkly_client_flags?.livegraph_client_requests_query_independence?"2":"1",useNext:t,extras:n}),s=new URLSearchParams(i.pageLoadToken);for(let[e,t]of(s.append("userId",i.userId||""),s.append("anonUserId",i.anonUserId||""),s.append("clientType",i.clientType),s.append("commitHash",i.commitHash),s.append("preload",JSON.stringify(i.preloadedViews)),s.append("requestedProtocolVersion",i.requestedProtocolVersion??"1"),Object.entries(i.extras)))s.append(e,t);s.append("connectionType","initial"),s.append("reconnect","0");let c=i.useNext?"/api/livegraph-next":"/api/livegraph",l=`${i.url}${c}?${s.toString()}`;if(!i.extras.bell)try{let e=performance.now();window.LGEarlyWS=new a(l,void 0,()=>{window.LGEarlyWS=void 0}),p(window.LGEarlyWS,e,"figma:ws:livegraph")}catch(e){console.warn("Early.js Bootstrap Error: LG websocket creation failed",e),console.error(e),b({message:"Early.js Bootstrap Error: LG websocket creation failed",error:e})}}if(r=!1!==$,i=c,l=window.INITIAL_OPTIONS.user_data?.id,d=window.INITIAL_OPTIONS.tracking_session_id,w=window.INITIAL_OPTIONS.release_manifest_git_commit,u=null,null!=window.__figmaDesktop?u=window.__figmaDesktop.clientID??null:null!=window.__figmaDesktopGetPopoutAPI&&(u=window.__figmaDesktopGetPopoutAPI().clientID??null),L=i?.reconnectKey??null,window.mpGlobal={version:function(){if(!window.EARLY_ARGS?.feature_flags?.manifest_commit_sha)return 153;let e=window.location.search;if(e.includes("force-client-version")){let t=new URLSearchParams(e).get("force-client-version");if(t){let e=parseInt(t);if(!isNaN(e)&&e>0)return console.log(`!! Overriding client version to ${e}`),e}}return 153}(),sock:null,msgs:[],perfMetrics:[],shouldConnectToMultiplayer:r,url({fileKey:e,role:t,oauthToken:n,nodeIds:o,suppressDecodeErrors:i,tagForLogging:s,forceViewOnly:a,canvasQuerySkipContainers:c,checkpointReconnect:p}){if(!r)return"";let f=null;P&&e===P.fileKey&&P.targetFileVersion&&(f=P.targetFileVersion);let m=null!==L&&p?.reconnectKey===L,h=m?"":("editor"===t||"viewerWithCpp"===t)&&o?`&scenegraph-queries-initial-nodes=${o}`:"",_=new URLSearchParams(window.location.search),I="true"===_.get("recovery"),g="true"===_.get("merge-on-file-open"),S=_.get("force-dpl-journaled-reconnect");"editor"!==t||P?.forceIncrementalForEditors!==1||I||g?(P?.forceIncrementalForEditors===0||I)&&(h+="&use-incremental-for-editors=0"):h+="&use-incremental-for-editors=1",!m&&"editor"===t&&(window.EARLY_ARGS?.feature_flags?.incremental_loading_validation||g&&window.EARLY_ARGS?.feature_flags?.incremental_loading_validation_branching)&&(h+="&incremental-loading-validation=1");let y=1;try{let e=JSON.parse(sessionStorage.getItem("reload_times")||"[0]"),t=e[e.length-1];y=+(Date.now()-t<5e3)}catch(e){}let N=c;("prototype"===t||"viewer"===t)&&(N=!0);let O=window.INITIAL_OPTIONS.e2e_traffic,k=window.INITIAL_OPTIONS.e2e_test_name;return`${location.protocol.replace("http","ws")}//${location.host}/api/multiplayer/${e}?role=${t}&tracking_session_id=${d}&version=${this.version}&recentReload=${y}&file-load-streaming-compression`+h+(n?"&oauth_token="+n:"")+(l?`&user-id=${l}`:"")+(f?`&target-file-version=${f}`:"")+(w?`&client_release=${w}`:"")+(i?"&suppress-decode-errors":"")+(s?`&tag-for-logging=${s}`:"")+(O?"&e2e_traffic=true":"")+(k?`&e2e_test_name=${k}`:"")+(a?"&force-view-only":"")+(u?`&clientID=${u}`:"")+(N?"&canvas-query-skip-containers":"")+(null!==S?`&force-dpl-journaled-reconnect=${S}`:"")+(m?"&previousLoadMode=full":"")+(p?.reconnectKey?`&reconnect-key=${p.reconnectKey}`:"")+(p?.sequenceNumber!=null?`&reconnect-sequence-number=${p.sequenceNumber}`:"")},DEBUG_THEME_PREFERENCE_KEY:_,DARK_THEME_MEDIA_QUERY:f,themePreferenceFromLocalStorage:I,getBackgroundColorForTheme:h,getVisibleTheme:m,preconnect(e){if(!1===r)return;if(this.sock){if(e===this.sock.url&&this.sock.readyState!==WebSocket.CLOSED)return;try{this.sock.close()}catch(e){}}let t=performance.now();this.sock=new WebSocket(e),this.sock.binaryType="arraybuffer",p(this.sock,t,"figma:ws:multiplayer"),this.sock.onopen=e=>{this.perfMetrics.push({key:"mp-ws-onopen",ts:performance.now(),nBytes:void 0})},this.sock.onmessage=e=>{let t=new Uint8Array(e.data);this.msgs.push(t),this.perfMetrics.push({key:"mp-ws-onmessage",ts:performance.now(),nBytes:t.length*t.BYTES_PER_ELEMENT})},this.msgs=[],this.perfMetrics=[]},isCheckpointReconnectUrl:e=>null!==L&&new URL(e).searchParams.get("reconnect-key")===L},P&&(P.forceViewOnly=!1,(window.INITIAL_OPTIONS?.cluster_name==="staging"||window.INITIAL_OPTIONS?.cluster_name==="local")&&(function(){let e=null;try{e=window.localStorage}catch(e){}return e})()?.getItem("force-vscode")==="true"?P.forceViewOnly=!0:P.forceViewOnly=window?.location.ancestorOrigins&&[...window.location.ancestorOrigins].some(e=>e.startsWith("vscode-webview://")),g(mpGlobal,P,i)),!D&&!/FigmaMobile-Android/.test(navigator.userAgent)&&(P?.role==="editor"||P?.role==="viewerWithCpp"||P?.role==="prototype")){let e,t=P?.role==="prototype"?Fig.prototypeLibURLs:Fig.fullscreenURLs,n=(s=t["compiled_wasm.js"],(e=new Promise((e,t)=>{let n,o=((n=document.createElement("script")).type="text/javascript",n.async=!0,n.setAttribute("nonce",window.INITIAL_OPTIONS.csp_nonce),n.crossOrigin="anonymous",n);o.onload=e,o.src=s,document.head.appendChild(o)})).catch(e=>console.error(`Fetching ${s} failed: ${e}`)),e),o=fetch(t["compiled_wasm.wasm"]);if(o.catch(e=>console.error(`Fetching compiled_wasm.wasm failed: ${e}`)),window.EARLY_ARGS?.feature_flags?.wasm_compile_then_instantiate){let e=performance.now(),t=WebAssembly.compileStreaming(o),r=t.then(()=>performance.now(),()=>void 0);t.catch(e=>console.error(`compileStreaming compiled_wasm.wasm failed: ${e}`)),window.FULLSCREEN_PRELOADS={kind:"compile_then_instantiate",compiledWasm:t,wasmResponse:o,compileWasmStart:e,compileWasmEndPromise:r,js:n}}else window.FULLSCREEN_PRELOADS={kind:"instantiate",wasm:o,js:n}}!function(){try{if(window.INITIAL_OPTIONS.e2e_traffic||window.location.pathname.startsWith("/test/interactions"))return;let r=window.INITIAL_OPTIONS.editing_file?.can_edit===!1;Object.defineProperty(window,e||(e=S(y)),{get:()=>{let e,i;if((e=new k,!((i=E?E.call(e):e.stack)&&(null==t&&(t=S(N)),null==n&&(n=S(O)),T.call(i,t)||T.call(i,n))))&&!r){if(null!=o){let e=window.__windowDotFigmaOnAccess;"function"==typeof e&&e()}return o}},set:e=>{r||(o=null!=e?e:void 0)},configurable:!1,enumerable:!1})}catch(e){}}(),performance?.mark("figma:bootstrap:earlyJsExecutionEnd")})()})();
//# debugId=ed0f0d11-0d91-5d6c-985c-2334e85dc5db
//# sourceMappingURL=https://admin.figma.com/admin/webpack-artifacts/7cd40b27a4421c22ff16daa2323ba9b8108bdf8c/early-e64b190daacc7b57.min.js.map