@reqvire-org/ads 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/dist/bun-compiler.mjs +6 -5
- package/dist/check.mjs +3 -43
- package/dist/cli.mjs +1 -1
- package/dist/contrast-composition.mjs +6 -60
- package/dist/contrast-styles.mjs +88 -0
- package/dist/mcp/apps.mjs +7 -1
- package/dist/mcp/build-status.mjs +8 -3
- package/dist/mcp/drafts.mjs +13 -1
- package/dist/mcp/preview-http.bundle.js +7 -0
- package/dist/mcp/preview-http.mjs +148 -0
- package/dist/mcp/preview-widget.bundle.js +47 -47
- package/dist/mcp/resource-loader.js +1 -201
- package/dist/mcp/sandbox-host.mjs +6 -1
- package/dist/mcp/server.mjs +35 -4
- package/dist/mcp/showcase-host.mjs +55 -5
- package/dist/mcp/showcase-http.mjs +66 -0
- package/dist/preview-bun.mjs +75 -60
- package/dist/preview-incremental.mjs +358 -0
- package/dist/preview-manifest-update.mjs +70 -0
- package/dist/preview-resources.mjs +33 -1
- package/dist/render-composition.mjs +27 -5
- package/dist/scenarios-compiler.mjs +19 -1
- package/dist/showcase/client.bundle.js +54 -54
- package/dist/showcase/comparison.js +15 -12
- package/dist/showcase/connection.js +10 -0
- package/dist/showcase/http-client.bundle.js +9 -0
- package/dist/showcase/http-connection.js +86 -0
- package/dist/showcase/http-preview.js +81 -0
- package/dist/showcase-http-routes.mjs +31 -0
- package/dist/skills/README.md +3 -3
- package/dist/skills/ads-designer/SKILL.md +5 -1
- package/dist/skills/ads-designer/references/accessibility.md +6 -2
- package/dist/skills/ads-designer/references/captures.md +1 -1
- package/dist/skills/ads-designer/references/runtimes.md +31 -0
- package/dist/skills/ads-designer/references/workflows.md +16 -0
- package/dist/skills/ads-import/references/captures.md +1 -1
- package/dist/skills/ads-import/references/runtimes.md +31 -0
- package/dist/skills/ads-import/references/workflows.md +16 -0
- package/dist/skills/ads-migrate/SKILL.md +3 -1
- package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +2 -3
- package/dist/skills/ads-migrate/references/0.4.3-to-0.4.4.md +89 -0
- package/dist/skills/ads-migrate/references/0.4.4-to-0.4.5.md +72 -0
- package/dist/skills/ads-port/references/captures.md +1 -1
- package/dist/skills/ads-port/references/runtimes.md +31 -0
- package/dist/skills/ads-port/references/workflows.md +16 -0
- package/dist/style-token-rules.mjs +51 -0
- package/dist/verification/browser.mjs +2 -2
- package/docs/ADS.md +9 -7
- package/docs/ARCHITECTURE.md +109 -48
- package/docs/CACHING.md +40 -1
- package/docs/CHANGELOG.md +100 -22
- package/docs/GUIDE.md +37 -10
- package/docs/HTTP-SHOWCASE-POC.md +397 -0
- package/docs/MCP.md +104 -25
- package/docs/benchmarks/README.md +1 -1
- package/docs/benchmarks/http-showcase-optimized.json +1879 -0
- package/docs/benchmarks/http-showcase-profile.json +308 -0
- package/docs/benchmarks/http-showcase.json +3069 -0
- package/package.json +6 -4
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AppBridge, PostMessageTransport } from "
|
|
1
|
+
import { AppBridge, PostMessageTransport } from "./connection.js";
|
|
2
|
+
import { httpPreviewBridge } from "./http-preview.js";
|
|
2
3
|
|
|
3
4
|
/** Each version gets its own ordinary opaque MCP App, never another browser shell. */
|
|
4
|
-
export async function mountComparisonApp({slot,title,sandboxUrl,resourceUri,result,readResource,callTool,context,onError,onState}) {
|
|
5
|
-
const options={slot,title,sandboxUrl,resourceUri,readResource,callTool,context,onError,onState};
|
|
5
|
+
export async function mountComparisonApp({slot,title,sandboxUrl,httpPreview=false,resourceUri,result,readResource,callTool,context,onError,onState}) {
|
|
6
|
+
const options={slot,title,sandboxUrl,httpPreview,resourceUri,readResource,callTool,context,onError,onState};
|
|
6
7
|
let latest=result,active,opening,restarting,closed=false;
|
|
7
8
|
function reopen(){
|
|
8
9
|
if(closed||restarting)return;
|
|
@@ -20,26 +21,28 @@ export async function mountComparisonApp({slot,title,sandboxUrl,resourceUri,resu
|
|
|
20
21
|
return{
|
|
21
22
|
async updateResult(value){latest=value;await restarting;if(!closed)await active.updateResult(latest);},
|
|
22
23
|
refreshContext(){if(!closed&&!restarting)active.refreshContext();},
|
|
24
|
+
receiveBuild(uri,report){if(!closed&&!restarting)active.receiveBuild?.(uri,report);},
|
|
25
|
+
reconcileBuild(){if(!closed&&!restarting)return active.reconcileBuild?.();},
|
|
23
26
|
async close(){closed=true;await restarting;await active?.close();},
|
|
24
27
|
};
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
async function mountVersion({slot,title,sandboxUrl,resourceUri,result,readResource,callTool,context,onError,onState,onReopen}){
|
|
30
|
+
async function mountVersion({slot,title,sandboxUrl,httpPreview,resourceUri,result,readResource,callTool,context,onError,onState,onReopen}){
|
|
28
31
|
let disposed=false;
|
|
29
|
-
const resource=await readResource({uri:resourceUri});
|
|
30
|
-
const content=resource
|
|
31
|
-
if(!content)throw new Error("Comparison preview App is unavailable.");
|
|
32
|
-
const frame=document.createElement("iframe");frame.title=title;frame.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms");frame.src=sandboxUrl;slot.append(frame);
|
|
33
|
-
const bridge=new AppBridge(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:context(frame)});
|
|
32
|
+
const resource=httpPreview?undefined:await readResource({uri:resourceUri});
|
|
33
|
+
const content=resource?.contents.find(item=>item.mimeType==="text/html;profile=mcp-app"&&typeof item.text==="string");
|
|
34
|
+
if(!httpPreview&&!content)throw new Error("Comparison preview App is unavailable.");
|
|
35
|
+
const frame=document.createElement("iframe");frame.title=title;frame.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms");if(!httpPreview)frame.src=sandboxUrl;slot.append(frame);
|
|
36
|
+
const bridge=httpPreview?httpPreviewBridge({frame,context:context(frame),draftScope:result.structuredContent?.draftScope}):new AppBridge(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:context(frame)});
|
|
34
37
|
bridge.onreadresource=readResource;bridge.oncalltool=callTool;bridge.onerror=error=>{if(!disposed)onError(error);};
|
|
35
38
|
bridge.onloggingmessage=value=>{if(disposed||value.logger!=="ads-preview")return;if(value.data?.code==="ADS_PREVIEW_REOPEN"){onReopen();return;}onState?.(value.data);if(value.data?.state==="error")onError(new Error(value.data.message));};
|
|
36
39
|
let timer;
|
|
37
40
|
const initialized=new Promise((resolve,reject)=>{timer=setTimeout(()=>reject(new Error("Comparison App initialization timed out.")),15000);bridge.oninitialized=()=>{clearTimeout(timer);resolve();};});
|
|
38
|
-
bridge.onsandboxready=()=>bridge.sendSandboxResourceReady({html:content.text,csp:content._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});
|
|
41
|
+
if(!httpPreview)bridge.onsandboxready=()=>bridge.sendSandboxResourceReady({html:content.text,csp:content._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});
|
|
39
42
|
const observer=new ResizeObserver(()=>bridge.setHostContext(context(frame)));
|
|
40
43
|
try{
|
|
41
|
-
await Promise.all([bridge.connect(new PostMessageTransport(frame.contentWindow,frame.contentWindow)),initialized]);
|
|
44
|
+
await Promise.all([bridge.connect(httpPreview?undefined:new PostMessageTransport(frame.contentWindow,frame.contentWindow)),initialized]);
|
|
42
45
|
observer.observe(frame);await bridge.sendToolInput({arguments:{}});await bridge.sendToolResult(result);
|
|
43
46
|
}catch(error){observer.disconnect();frame.remove();await bridge.close();throw error;}finally{clearTimeout(timer);}
|
|
44
|
-
return {updateResult:value=>bridge.sendToolResult(value),refreshContext:()=>bridge.setHostContext(context(frame)),async close(){disposed=true;observer.disconnect();try{await bridge.teardownResource({},{timeout:500});}catch{/* A disconnected App may not acknowledge teardown. */}await bridge.close();frame.remove();}};
|
|
47
|
+
return {updateResult:value=>bridge.sendToolResult(value),refreshContext:()=>bridge.setHostContext(context(frame)),receiveBuild:(uri,report)=>bridge.receiveBuild?.(uri,report),reconcileBuild:()=>bridge.reconcileBuild?.(),async close(){disposed=true;observer.disconnect();try{await bridge.teardownResource({},{timeout:500});}catch{/* A disconnected App may not acknowledge teardown. */}await bridge.close();frame.remove();}};
|
|
45
48
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
|
|
2
|
+
export { AppBridge, PostMessageTransport } from "@modelcontextprotocol/ext-apps/app-bridge";
|
|
3
|
+
export const httpTransport = false;
|
|
4
|
+
export function createClient() {
|
|
5
|
+
return new Client({ name: "ads-showcase", version: "1.0.0" }, {
|
|
6
|
+
versionNegotiation: { mode: "auto" },
|
|
7
|
+
capabilities: { extensions: { "io.modelcontextprotocol/ui": { mimeTypes: ["text/html;profile=mcp-app"] } } },
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export const connectClient = client => client.connect(new StreamableHTTPClientTransport(new URL("mcp", location.href)));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function Fe(e){if(e?.failure?.scope!=="project")return"Preview build failed";if(e.failure.phase==="validation")return"Project validation failed";if(e.failure.phase==="discovery")return"Project scenario discovery failed";return"Project preview build failed"}function aa(e=[]){return e.map((t)=>{let a=t.file?t.file+(t.line?`:${t.line}`:"")+(t.column?`:${t.column}`:""):"";return(a?`${a}: `:"")+t.message}).join(`
|
|
2
|
+
`)}var Mi=new Map([["explorer","ads://project/explorer"],["build","ads://project/build"],["icons","ads://project/icons"],["tokens","ads://project/tokens"],["scenarios","ads://project/scenarios"],["drafts","ads://project/drafts"],["previews/manifest","ads://preview/manifest"],["previews/live","ads://preview/live"]]);function vt(e,t=!0){let a=new RegExp("^ads://drafts/([a-zA-Z0-9_-]+)/resource\\?uri=(.+)$").exec(e);if(a&&t)return`drafts/${a[1]}/${vt(decodeURIComponent(a[2]),!1)}`;let[s,...r]=e.split("?"),i=r.length?r.join("?"):void 0,n=[...Mi].find(([,o])=>o===s)?.[0];if(!n||i!==void 0&&(!n.startsWith("previews/")||!/^from=[a-f0-9]{64}$/.test(i)))throw Error("Unsupported showcase HTTP resource.");return n+(i?`?${i}`:"")}var Me=!0,Ge=void 0,Ve=void 0,ia=async()=>{};function sa(){let e=new AbortController,t=new Map,a=new Set,s=new Map,r;async function i(o,{body:_,signal:u,timeout:c=45000}={}){let p=AbortSignal.timeout(c),g=AbortSignal.any([e.signal,p,...u?[u]:[]]);try{let h=await fetch(new URL(`api/${o}`,location.href),{signal:g,..._===void 0?{}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)}}),f=await h.json();if(!h.ok)throw Object.assign(Error(f.error?.message??"Showcase HTTP request failed."),f.error);return f}catch(h){if(p.aborted&&!u?.aborted&&!e.signal.aborted)throw Object.assign(Error("Showcase HTTP request timed out."),{code:"REQUEST_TIMEOUT"});throw h}}let n={async readResource({uri:o},_){let u=vt(o),c=async()=>({contents:[{uri:o,mimeType:"application/json",text:JSON.stringify(await i(u,_))}]});if(!/(?:^|\/)build$/.test(u))return c();let p=s.get(o);if(p&&p.signal===_?.signal)return p.task;let g={signal:_?.signal,task:c()};s.set(o,g);let h=()=>{if(s.get(o)===g)s.delete(o)};return g.task.then(h,h),g.task},onBuildReport(o){return a.add(o),()=>a.delete(o)},async callTool({name:o,arguments:_={}},u){let c,p;if(o==="ads_show_scenario")c="previews",p=_;else if(o==="ads_show_draft"&&/^[a-zA-Z0-9_-]+$/.test(_.id))c=`drafts/${_.id}/preview`,p={..._},delete p.id;else throw Error("This action is not available in the HTTP showcase.");return{structuredContent:await i(c,{...u,body:p})}},setNotificationHandler(o,_){t.set(o,_)},async listen({resourceSubscriptions:o=[]}={}){let _=new Set(o),u=new EventSource(new URL("api/events",location.href)),c,p,g,h=!1,f=!1,l=new Promise((x)=>{c=x}),w=new Promise((x,v)=>{p=x,g=v}),k=setTimeout(()=>{u.close(),g(Error("Showcase event stream timed out.")),c("remote")},15000);return u.onmessage=(x)=>{let v=JSON.parse(x.data);if(v.type==="ready")clearTimeout(k),p(),n.onconnectionchange?.({connected:!0,reconnected:h}),f=!1,h=!0;else if(v.type==="build")for(let b of a)b(v.uri,v.report);else if(v.type==="resources")t.get("notifications/resources/list_changed")?.();else if(v.type==="tools")t.get("notifications/tools/list_changed")?.();else if(v.type==="resource"&&_.has(v.uri))t.get("notifications/resources/updated")?.({params:{uri:v.uri}})},u.onerror=()=>{if(!f)n.onconnectionchange?.({connected:!1});if(f=!0,u.readyState===EventSource.CLOSED)clearTimeout(k),g(Error("Showcase event stream closed.")),c("remote")},r={closed:l,close(){u.close(),clearTimeout(k),g(new DOMException("Showcase closed","AbortError")),c("local")}},await w,r},async close(){r?.close(),e.abort(),a.clear(),s.clear()}};return n}var na=[200,800],Ti=(e)=>e?.name==="TypeError"&&/^(Failed to fetch|fetch failed|Load failed|NetworkError when attempting to fetch resource\.)$/.test(e.message);function Pi(e,t){return new Promise((a,s)=>{t?.throwIfAborted();let i=setTimeout(()=>{t?.removeEventListener("abort",n),a()},e),n=()=>{clearTimeout(i),t.removeEventListener("abort",n),s(t.reason)};t?.addEventListener("abort",n,{once:!0})})}function ra(e,{signal:t,onDiagnostic:a,wait:s=Pi}={}){return async(r)=>{for(let i=1;;i++){t?.throwIfAborted();try{let n=await e(r);if(t?.throwIfAborted(),i>1)a?.({state:"recovered",uri:r.uri,attempt:i});return n}catch(n){if(t?.throwIfAborted(),!Ti(n))throw n;if(i>na.length)throw a?.({state:"exhausted",uri:r.uri,attempt:i,message:n.message}),Object.assign(Error(`MCP resource transport failed for ${r.uri} after ${i} attempts: ${n.message}. Inspect the host connection and browser network diagnostics; this resource-loading error does not establish a component assertion failure.`,{cause:n}),{code:"ADS_RESOURCE_TRANSPORT"});let o=na[i-1];a?.({state:"retry",uri:r.uri,attempt:i,nextAttempt:i+1,delayMs:o,message:n.message}),await s(o,t)}}}}function oa(e,{onError:t,delay:a=150,setTimer:s=setTimeout,clearTimer:r=clearTimeout}={}){let i=!1,n=!1,o=!1,_=!1,u=!1,c;function p(){if(!i||n||o||!_||c!==void 0)return;c=s(()=>{c=void 0,o=!0;let g=u;_=u=!1,Promise.resolve().then(()=>e(g)).catch((h)=>{if(!n)t?.(h)}).finally(()=>{o=!1,p()})},a)}return{schedule(g=!1){if(n)return;_=!0,u||=g,p()},start(){i=!0,p()},close(){n=!0,_=u=!1,r(c),c=void 0}}}function da(e){let t=[],a=new Map;for(let s of e){if(!s.group){t.push(s);continue}if(!a.has(s.group))a.set(s.group,[]);a.get(s.group).push(s)}return[...t.length?[{label:null,entries:t}]:[],...[...a].sort(([s],[r])=>s.localeCompare(r)).map(([s,r])=>({label:s,entries:r}))]}var $i=(e)=>typeof e==="string"&&/^(?:ads:\/\/project\/build|ads:\/\/preview\/(?:manifest|live)(?:\?from=[a-f0-9]{64})?)$/.test(e);function Ze({frame:e,context:t,draftScope:a}){let s,r=0,i=!1,n,o,_,u=new AbortController;async function c(f,l=!1){let w=await fetch("preview-http",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f),...l?{keepalive:!0}:{signal:u.signal}}),k=await w.json();if(!w.ok)throw Object.assign(Error(k.error??"HTTP preview control failed."),{code:k.code});return k}function p(f,l,w={}){if(!i&&s)e.contentWindow?.postMessage({channel:"ads-preview-http",instance:s.id,epoch:r,method:f,params:l,...w},"*")}async function g(f){let l=f.data;if(i||f.source!==e.contentWindow||f.origin!=="null"||l?.channel!=="ads-preview-http"||l.instance!==s?.id)return;if(l.method==="ready"){p("init",t),clearTimeout(o),n?.(),h.oninitialized?.();return}if(l.epoch!==r)return;if(l.method==="log"){h.onloggingmessage?.(l.params);return}if(!["read","prepare"].includes(l.method)||!Number.isSafeInteger(l.request))return;let w=r;try{let k;if(l.method==="prepare")k=await c({...l.params,op:"prepare",id:s.id});else{let x=l.params?.uri,v=a&&typeof x==="string"&&x.startsWith(a)?decodeURIComponent(x.slice(a.length)):x;if(!$i(v)||a&&x===v)throw Error("Unexpected HTTP preview control resource.");k=await h.onreadresource({uri:x})}if(!i&&r===w)p("response",void 0,{request:l.request,result:k})}catch(k){if(!i&&r===w)p("response",void 0,{request:l.request,error:k.message,code:k.code})}}let h={async reconcileBuild(){if(i||!s)return;try{await c({op:"keepalive",id:s.id});let f=a?a+encodeURIComponent("ads://project/build"):"ads://project/build",l=await h.onreadresource({uri:f});h.receiveBuild(f,JSON.parse(l.contents.find((w)=>typeof w.text==="string").text))}catch(f){if(i)return;if(f.code==="ADS_PREVIEW_REOPEN")h.onloggingmessage?.({logger:"ads-preview",data:{state:"error",id:_,code:f.code}});else h.onerror?.(f)}},receiveBuild(f,l){let w=a?a+encodeURIComponent("ads://project/build"):"ads://project/build";if(f===w)p("build",l)},setHostContext(f){t=f,p("context",f)},async sendToolInput(){},async sendToolResult(f){if(f.structuredContent?.draftScope!==a)throw Error("Cannot change the scope of an HTTP preview instance.");_=(f.structuredContent?.previewResult?.structuredContent??f.structuredContent)?.scenario?.id,r++,p("select",f)},async connect(){if(s=await c({op:"open",draftScope:a}),i){await c({op:"close",id:s.id},!0);return}window.addEventListener("message",g);let f=new Promise((l,w)=>{n=l,o=setTimeout(()=>w(Error("HTTP preview initialization timed out.")),15000)});e.setAttribute("sandbox","allow-scripts allow-forms"),e.dataset.previewDelivery="http",e.src=s.url,await f},async teardownResource(){p("teardown")},async close(){if(i)return;if(p("teardown"),i=!0,clearTimeout(o),window.removeEventListener("message",g),u.abort(),s)await c({op:"close",id:s.id},!0).catch(()=>{});e.remove()}};return h}async function _a({slot:e,title:t,sandboxUrl:a,httpPreview:s=!1,resourceUri:r,result:i,readResource:n,callTool:o,context:_,onError:u,onState:c}){let p={slot:e,title:t,sandboxUrl:a,httpPreview:s,resourceUri:r,readResource:n,callTool:o,context:_,onError:u,onState:c},g=i,h,f,l,w=!1;function k(){if(w||l)return;c?.({state:"loading"}),l=Promise.resolve().then(async()=>{if(await f,await h?.close(),w)return;f=ua({...p,result:g,onReopen:k});try{h=await f}finally{f=void 0}}).catch((x)=>{if(!w)u(x)}).finally(()=>{l=void 0})}f=ua({...p,result:g,onReopen:k});try{h=await f}finally{f=void 0}return{async updateResult(x){if(g=x,await l,!w)await h.updateResult(g)},refreshContext(){if(!w&&!l)h.refreshContext()},receiveBuild(x,v){if(!w&&!l)h.receiveBuild?.(x,v)},reconcileBuild(){if(!w&&!l)return h.reconcileBuild?.()},async close(){w=!0,await l,await h?.close()}}}async function ua({slot:e,title:t,sandboxUrl:a,httpPreview:s,resourceUri:r,result:i,readResource:n,callTool:o,context:_,onError:u,onState:c,onReopen:p}){let g=!1,f=(s?void 0:await n({uri:r}))?.contents.find((b)=>b.mimeType==="text/html;profile=mcp-app"&&typeof b.text==="string");if(!s&&!f)throw Error("Comparison preview App is unavailable.");let l=document.createElement("iframe");if(l.title=t,l.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),!s)l.src=a;e.append(l);let w=s?Ze({frame:l,context:_(l),draftScope:i.structuredContent?.draftScope}):new Ge(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:_(l)});w.onreadresource=n,w.oncalltool=o,w.onerror=(b)=>{if(!g)u(b)},w.onloggingmessage=(b)=>{if(g||b.logger!=="ads-preview")return;if(b.data?.code==="ADS_PREVIEW_REOPEN"){p();return}if(c?.(b.data),b.data?.state==="error")u(Error(b.data.message))};let k,x=new Promise((b,C)=>{k=setTimeout(()=>C(Error("Comparison App initialization timed out.")),15000),w.oninitialized=()=>{clearTimeout(k),b()}});if(!s)w.onsandboxready=()=>w.sendSandboxResourceReady({html:f.text,csp:f._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});let v=new ResizeObserver(()=>w.setHostContext(_(l)));try{await Promise.all([w.connect(s?void 0:new Ve(l.contentWindow,l.contentWindow)),x]),v.observe(l),await w.sendToolInput({arguments:{}}),await w.sendToolResult(i)}catch(b){throw v.disconnect(),l.remove(),await w.close(),b}finally{clearTimeout(k)}return{updateResult:(b)=>w.sendToolResult(b),refreshContext:()=>w.setHostContext(_(l)),receiveBuild:(b,C)=>w.receiveBuild?.(b,C),reconcileBuild:()=>w.reconcileBuild?.(),async close(){g=!0,v.disconnect();try{await w.teardownResource({},{timeout:500})}catch{}await w.close(),l.remove()}}}function Ke(e,t){return t===e||t.startsWith(e+"/")||t.startsWith(e+".")}function ca(e,t,a,s=new Map){let r=new Map(a.map(({id:_,title:u,revision:c,state:p,preview:g})=>[_,{id:_,title:u,revision:c,state:p,...g?{preview:g}:{}}])),i=new Map(e.map((_)=>[_.id,{..._,drafts:(_.drafts??[]).flatMap((u)=>r.has(u.id)?[r.get(u.id)]:[])}]));for(let _ of t){let u=i.get(_.id);i.set(_.id,{...u,..._,kind:"tokens",drafts:u?.drafts??[]})}let n=(_,u)=>_==="assets/pictograms"&&u.kind==="pictograms"||_==="tokens"&&u.kind==="tokens"||(u.unit?u.unit===_:Ke(_,u.id)),o=(_,u)=>{if(!_.drafts.some((c)=>c.id===u.id))_.drafts.push(r.get(u.id))};for(let _ of a){let u=s.get(_.id);for(let c of u?.scenarios??[]){if(!_.units.some((g)=>n(g,c)))continue;let p=i.get(c.id);if(!p)p={...c,draftOnly:!0,drafts:[]},i.set(c.id,p);o(p,_)}}for(let _ of a)for(let u of _.units){let c=u==="assets/pictograms"?"pictograms":u.split("/")[0];if(!["brand","pictograms","tokens","components","patterns","composition"].includes(c))continue;let p=[...i.values()].filter((g)=>n(u,g));if(p.length)for(let g of p)o(g,_);else i.set(u,{id:u,unit:u,title:u.split("/").at(-1),kind:c,draftOnly:!0,pendingDraftScenario:!0,drafts:[r.get(_.id)]})}return{scenarios:[...i.values()],categories:[...i.values()].filter((_)=>_.kind==="tokens")}}var Ri=(e)=>e==="assets/pictograms"?"pictograms":e==="assets/glyphs"||e==="assets/logos"?"icons":e==="assets/brand"?"brand":e==="foundation"?"tokens":["brand","tokens","icons","components","patterns","composition"].includes(e.split("/")[0])?e.split("/")[0]:"other",Je={brand:"Brand",icons:"Icons",pictograms:"Pictograms",tokens:"Tokens",components:"Components",patterns:"Patterns",composition:"Compositions",other:"Other"};function la(e,t){let a=[];for(let s of t){let r=e.filter((i)=>i.drafts?.some((n)=>n.id===s.id));for(let i of r)a.push({...i,id:`drafts/${encodeURIComponent(s.id)}/${encodeURIComponent(i.id)}`,previewId:i.id,title:`${s.title||s.id} · ${i.title}`,group:Je[i.kind]??"Other",drafts:[s]});for(let i of s.units??[]){if(r.some((o)=>i==="tokens"&&o.kind==="tokens"||o.unit===i||!o.unit&&Ke(i,o.id)))continue;let n=Ri(i);a.push({id:`drafts/${encodeURIComponent(s.id)}/${encodeURIComponent(i)}`,unit:i,kind:n,title:`${s.title||s.id} · ${i.split("/").at(-1)}`,group:Je[n],drafts:[s]})}if(!r.length&&!s.units?.length)a.push({id:`drafts/${encodeURIComponent(s.id)}`,kind:"other",title:s.title||s.id,group:"Other",drafts:[s]})}return a}var Ai=["off","hover","always"],Ii=["bounds","tracks","gaps","padding","margins","mini"],ma=Object.freeze({mode:"off",bounds:!0,tracks:!1,gaps:!1,padding:!0,margins:!0,mini:!1});function Te(e){return{mode:Ai.includes(e?.mode)?e.mode:e?.all===!0?"always":"off",...Object.fromEntries(Ii.map((a)=>[a,e?.[a]===!0]))}}function fa(e){let{mode:t,...a}=Te(e);return{all:t==="always",...a}}function pa(e){let{mode:t,...a}=Te(e);return t!=="off"&&Object.values(a).some(Boolean)}function yt(e,t,a){let s=e.drafts?.find((_)=>_.id===a)??e.drafts?.[0],r=s&&(t?.drafts?.find((_)=>_.id===s.id)??s.preview),i=s?r?.scenarios?.find((_)=>_.id===e.id)??r:t?.previews?.find((_)=>_.id===e.id)??e.build,n=i?.state==="error"?"error":i?.state==="checking"||i?.live?"checking":i?.building||["queued","building"].includes(i?.state)?"building":i?.current?"ready":i?.stale?"stale":"unreported",o={error:Fe(i),checking:"Preview compiled; checking changes",building:"Preview build in progress",ready:"Preview build complete",stale:"Previous preview; current source not built",unreported:"Preview not built"};return{state:n,label:`${s?"Draft · ":""}${o[n]}${s&&n==="ready"?" · unaccepted":""}`}}var j,Pa,te,ga,tt,$a,Ye,Ra,St,jt,at={},it=[],Hi=/^m(i|n|o|s|text|space)$/,Et=Array.isArray,Aa=it.slice,ce=Object.assign;function st(e){e&&e.parentNode&&e.remove()}function Xe(e,t,a,s,r){var i={type:e,props:t,key:a,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r||++Pa,__i:-1,__u:0};return!r&&j.vnode&&j.vnode(i),i}function J(e){return e.children}function et(e,t){this.props=e,this.context=t,this.__g=0}function ae(e,t){if(t==null)return e.__?ae(e.__,e.__i+1):null;for(var a;t<e.__k.length;t++)if((a=e.__k[t])&&a.__e)return a.__e;return typeof e.type!="function"||e.props.__P?null:ae(e)}function Ia(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Ia(e)}function ha(e){(8&e.__g||!(e.__g|=8)||!te.push(e)||tt++)&&ga==j.debounceRendering||((ga=j.debounceRendering)||queueMicrotask)(Oi)}function Oi(){var e,t,a,s,r,i,n,o,_;try{for(t=1;te.length;)te.length>t&&te.sort($a),e=te.shift(),t=te.length,8&e.__g&&(s=void 0,r=void 0,i=(r=(a=e).__v).__e,n=[],o=[],(_=a.__P)&&((s=ce({constructor:void 0},r)).__v=r.__v+1,j.vnode&&j.vnode(s),Nt(_,s,r,a.__n,_.namespaceURI,32&r.__u?[i]:null,n,i||ae(r),32&r.__u,o),s.__v=r.__v,s.__.__k[s.__i]=s,Da(n,s,o),r.__=r.__e=null,s.__e!=i&&Ia(s)))}finally{te.length=tt=0}}function Ha(e,t,a,s,r,i,n,o,_,u,c){var p,g,h,f,l,w,k=s.__k||it,x=t.length;for(_=Bi(a,t,k,_,x),p=0;p<x;p++)(h=a.__k[p])!=null&&(g=~h.__i&&k[h.__i]||at,h.__i=p,w=Nt(e,h,g,r,i,n,o,_,u,c),f=h.__e,(g.ref!=h.ref||8&g.__u)&&(g.ref&&Mt(g.ref,null,h,g),h.ref&&c.push(h.ref,h.__c||f,h)),l=l||f,4&h.__u?(_=Oa(h,_,e,!g.__v),g.__e&&(g.__e=null)):typeof h.type=="function"&&w!==void 0?_=w:f&&(_=f.nextSibling),h.__u&=-7);return a.__e=l,_}function Bi(e,t,a,s,r){var i,n,o,_,u,c,p,g,h,f,l=a.length,w=l,k=0,x=!1,v=e.__k=Array(r);for(i=0;i<r;i++)(n=t[i])!=null&&typeof n!="boolean"&&typeof n!="function"?(typeof n!="object"||n.constructor==String?n=v[i]=Xe(null,n):Et(n)?n=v[i]=Xe(J,{children:n}):n.constructor===void 0&&n.__b?n=v[i]=Xe(n.type,n.props,n.key,n.ref,n.__v):v[i]=n,_=i+k,n.__=e,n.__b=e.__b+1,o=null,~(u=n.__i=Di(n,a,_,w))&&(w--,(o=a[u])&&(o.__u|=2)),o&&o.__v?(n.__u|=2,u==_-1?k--:u==_+1?k++:u!=_&&(u>_?k--:k++,x=!0)):(~u||(r>l?k--:r<l&&k++),typeof n.type!="function"&&(n.__u|=4))):v[i]=null;if(x){for(c=[],p=[],i=0;i<r;i++)if((n=v[i])&&2&n.__u){for(g=0,h=c.length;g<h;)c[f=g+h>>1]<n.__i?g=f+1:h=f;c[g]=n.__i,p[i]=g+1}for(k=c.length;i--;)p[i]&&(p[i]==k?k--:v[i].__u|=4)}if(w)for(i=0;i<l;i++)!(o=a[i])||2&o.__u||(o.__e==s&&(s=ae(o)),Tt(o,o));return s}function Oa(e,t,a,s){var r,i,n;if(typeof e.type=="function"){if(e.props.__P)return t;if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&(r[i].__=e,t=Oa(r[i],t,a,!1));return t}for(t&&!t.parentNode&&(t=ae(e))&&!t.parentNode&&(t=null),n=t;n&&n.nodeType==8;)n=n.nextSibling;for(e.__e!=n&&(!s&&a.moveBefore&&e.__e.parentNode?a.moveBefore(e.__e,t):a.insertBefore(e.__e,t||null)),t=e.__e;(t=t&&t.nextSibling)&&t.nodeType==8;);return t}function Di(e,t,a,s){var r,i,n,{key:o,type:_}=e,u=t[a],c=u&&!(2&u.__u);if(u===null&&o==null||c&&o==u.key&&_==u.type)return a;if(s>(c?1:0)){for(r=a-1,i=a+1;r>=0||i<t.length;)if((u=t[n=r>=0?r--:i++])&&!(2&u.__u)&&o==u.key&&_==u.type)return n}return-1}function wa(e,t,a){a==null&&(a=""),t[0]=="-"?e.setProperty(t,a):e[t]=a}function Qe(e,t,a,s,r){var i,n;e:if(t=="style")if(typeof a=="string")e.style.cssText=a;else{if(typeof s=="string"&&(e.style.cssText=s=""),s)for(t in s)a&&t in a||wa(e.style,t,"");if(a)for(t in a)s&&a[t]==s[t]||wa(e.style,t,a[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=a,a&&s||(n=jt[t]||(jt[t]=Li(t)),(e.__a||(e.__a={}))[t]=St,i=t!=(t=t.replace(Ra,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),a?e.addEventListener(t,n,i):e.removeEventListener(t,n,i));else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=a==null?"":a;break e}catch(o){}typeof a=="function"||(a==null||a===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&a==1?"":a))}}function Li(e){return function(t){if(this.__e){var a=this.__e[e];if(t[Ye]==null)t[Ye]=St++;else if(t[Ye]<this.__a[e])return;return a(j.event?j.event(t):t)}}}function Nt(e,t,a,s,r,i,n,o,_,u){var c,p,g,h,f,l,w,k,x,v,b,C,_e,Ee,ta,Ue,Ne,We,X,ee,Z=t.type;if(t.constructor!==void 0)return null;if(128&a.__u&&(_=32&a.__u,c=a.__c.__z)){if(t.__u|=_,p=i=[],c.nodeType==8)for(g=1,h=c.nextSibling;h;h=h.nextSibling){if(h.nodeType==8){if(h.data.startsWith("$s"))g++;else if(h.data.startsWith("/$s")&&!--g)break}i.push(h)}else i.push(c);o=i[0]}(c=j.__b)&&c(t);e:if(typeof Z=="function"){f=n.length;try{if(v=t.props,b=(c=Z.prototype)&&c.render,C=(c=Z.contextType)&&s[c.__c],_e=c?C?C.props.value:c.__:s,a.__c?2&(l=t.__c=a.__c).__g&&(l.__g|=1):(b?t.__c=l=new Z(v,_e):(t.__c=l=new et(v,_e),l.constructor=Z,l.render=Wi),C&&C.sub(l),l.state||(l.state={}),l.__n=s,l.__g|=8,l.__h=[],l.__k=[]),b&&(l.__s||(l.__s=l.state),Z.getDerivedStateFromProps&&(l.__s==l.state&&(l.__s=ce({},l.__s)),ce(l.__s,Z.getDerivedStateFromProps(v,l.__s)))),w=l.props,k=l.state,l.__v=t,a.__c){if(b&&!Z.getDerivedStateFromProps&&v!==w&&l.componentWillReceiveProps&&l.componentWillReceiveProps(v,_e),t.__v==a.__v&&!(8&l.__g)||!(4&l.__g)&&l.shouldComponentUpdate&&l.shouldComponentUpdate(v,l.__s,_e)===!1){t.__v!=a.__v&&(l.props=v,l.state=l.__s,l.__g&=-9),t.__e=a.__e,t.__k=a.__k,t.__k.some(function(W){W&&(W.__=t)}),it.push.apply(l.__h,l.__k),l.__k=[],l.__h.length&&n.push(l),o=ae(a);break e}l.componentWillUpdate&&l.componentWillUpdate(v,l.__s,_e),b&&l.componentDidUpdate&&l.__h.push(function(){l.componentDidUpdate(w,k,x)})}else b&&!Z.getDerivedStateFromProps&&l.componentWillMount&&l.componentWillMount(),b&&l.componentDidMount&&l.__h.push(l.componentDidMount);if(l.context=_e,l.props=v,l.__P=e,l.__g&=-5,Ee=j.__r,ta=0,b)l.state=l.__s,l.__g&=-9,Ee&&Ee(t),c=l.render(l.props,l.state,l.context),it.push.apply(l.__h,l.__k),l.__k=[];else do l.__g&=-9,Ee&&Ee(t),c=l.render(l.props,l.state,l.context),l.state=l.__s;while(8&l.__g&&++ta<25);l.state=l.__s,l.getChildContext&&(s=ce({},s,l.getChildContext())),b&&a.__c&&l.getSnapshotBeforeUpdate&&(x=l.getSnapshotBeforeUpdate(w,k)),Ue=c&&c.type===J&&c.key==null?c.props.children:c,v.__P&&(c=o,r=(e=v.__P).namespaceURI,_=i=null,a.props&&a.props.__P!=e&&(a.__k.some(function(W){W&&Tt(W,W)}),a.__k=null),o=a.__k?ae(a,0):null),o=Ha(e,Et(Ue)?Ue:[Ue],t,a,s,r,i,n,o,_,u),v.__P&&(t.__e=null,o=c),t.__u&=-161,128&a.__u&&(l.__z=null),p&&p.some(st),l.__h.length&&n.push(l),1&l.__g&&(l.__g&=-4)}catch(W){if(n.length=f,t.__v=null,_||i)if(W.then){if(Ne=0,t.__u|=_?160:128,i){for(~(X=i.indexOf(o||void 0))||(X=i.length);(ee=i[X-1])&&ee.nodeType==8;)X--;for(;X<i.length;X++)if(ee=i[X]){if(i[X]=null,ee.nodeType==8){if(ee.data.startsWith("$s"))Ne++||(We=ee);else if(Ne&&ee.data.startsWith("/$s")&&!--Ne){o=ee;break}}else if(!Ne)break}}if(!We){for(;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;We=o}t.__c.__z||(t.__c.__z=We),t.__e=o}else i&&i.some(st);else t.__e=a.__e;t.__k||(t.__k=a.__k||[]),W.then||Ba(t),j.__e(W,t,a)}}else o=t.__e=Ui(a.__e,t,a,s,r,i,n,_,u,e);return(c=j.diffed)&&c(t),128&t.__u?void 0:o}function Ba(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Ba))}function Da(e,t,a){for(var s=0;s<a.length;)Mt(a[s++],a[s++],a[s++]);j.__c&&j.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){j.__e(i,r.__v)}})}function Ui(e,t,a,s,r,i,n,o,_,u){var c,p,g,h,f,l,w,k,x,v=a.props||at,{props:b,type:C}=t;if(C=="svg"?r="http://www.w3.org/2000/svg":C=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i){for(c=0;c<i.length;c++)if((f=i[c])&&(C?f.localName==C:f.nodeType==3)){e=f,i[c]=null;break}}if(!e){if(k=u.ownerDocument||document,!C)return k.createTextNode(b);e=k.createElementNS(r,C,b.is&&b),o&&(j.__m&&j.__m(t,i),o=!1),i=null}if(C){if(u=C=="template"?e.content:e,i=C=="textarea"&&b.defaultValue!=null?null:i&&Aa.call(u.childNodes),!o&&i)for(v={},c=0;c<e.attributes.length;c++)v[(f=e.attributes[c]).name]=f.value;for(c in v)f=v[c],c=="dangerouslySetInnerHTML"?g=f:c=="children"||(c in b)||c=="value"&&("defaultValue"in b)||c=="checked"&&("defaultChecked"in b)||Qe(e,c,null,f,r);for(c in x=1&a.__u,b)f=b[c],c=="children"?h=f:c=="dangerouslySetInnerHTML"?p=f:c=="value"?l=f:c=="checked"?w=f:o&&typeof f!="function"||!(v[c]!==f||x&&f!=null)||Qe(e,c,f,v[c],r);p?(o||g&&(p.__html==g.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[]):(g&&(e.textContent=""),(C=="foreignObject"||r=="http://www.w3.org/1998/Math/MathML"&&Hi.test(C))&&(r="http://www.w3.org/1999/xhtml"),Ha(u,Et(h)?h:[h],t,a,s,r,i,n,i?i[0]:a.__k&&ae(a,0),o,_),i&&i.some(st)),o&&C!="textarea"||(c="value",C=="progress"&&l==null?e.removeAttribute(c):l==null||l===e[c]&&(C!="progress"||l)||Qe(e,c,l,v[c],r),c="checked",w!=null&&w!=e[c]&&Qe(e,c,w,v[c],r))}else v===b||o&&e.data==b||(e.data=b);return e}function Mt(e,t,a,s){try{typeof e=="function"?t?t.__x=e(t)||1:s&&(s=s.__c||s.__e)&&(t=s.__x)&&(s.__x=null,typeof t=="function"?t():e(null)):e.current=t}catch(r){j.__e(r,a)}}function Tt(e,t,a){var s,r;if(j.unmount&&j.unmount(e),!(s=e.ref)||s.current&&s.current!=e.__e||Mt(s,null,t,e),s=e.__c){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(i){j.__e(i,t)}s.__P=s.__n=null}if(s=e.__k)for(r=0;r<s.length;r++)s[r]&&Tt(s[r],t,typeof e.type!="function"||a&&!e.props.__P);(s=e.__e)&&(a||st(s),s.__e&&(s.__e=null)),e.__e=e.__c=e.__=null}function Wi(e,t,a){return this.constructor(e,a)}function le(e,t){var a,s,r,i;j.__&&j.__(e,t),t.nodeType==9&&(t=t.documentElement),s=(a=e&&32&e.__u)?null:t.__k,t.__k=Xe(J,{children:[e]}),r=[],i=[],Nt(t,t.__k,s||at,at,t.namespaceURI,s?null:t.firstChild?Aa.call(t.childNodes):null,r,s?s.__e:t.firstChild,a,i),Da(r,t.__k,i),t.__k.props.children=null}j={__e:function(e,t,a,s){for(var r,i,n;t=t.__;)if((r=t.__c)&&!(1&r.__g)){r.__g|=4;try{if((i=r.constructor)&&i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),n=8&r.__g),r.componentDidCatch&&(r.componentDidCatch(e,s||{}),n=8&r.__g),n)return void(r.__g|=2)}catch(o){e=o,n=0}}throw tt=0,e}},Pa=0,et.prototype.setState=function(e,t){var a=this.__s;a&&a!=this.state||(a=this.__s=ce({},this.state)),typeof e=="function"&&(e=e(ce({},a),this.props)),e&&(ce(a,e),this.__v&&(t&&this.__k.push(t),ha(this)))},et.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),ha(this))},et.prototype.render=J,te=[],tt=0,$a=function(e,t){return e.__v.__b-t.__v.__b},Ye=Symbol(),Ra=/(PointerCapture)$|Capture$/i,St=0,jt={};var Fi=0;function d(e,t,a,s,r,i){t||(t={});var n,o,_=t;if("ref"in _&&typeof e!="function")for(o in _={},t)o=="ref"?n=t[o]:_[o]=t[o];var u={type:e,props:_,key:a,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Fi,__i:-1,__u:0};return j.vnode&&j.vnode(u),u}var Gi=function(){let t=Array.prototype.slice.call(arguments).filter(Boolean),a={},s=[];t.forEach((i)=>{(i?i.split(" "):[]).forEach((o)=>{if(o.startsWith("atm_")){let[,_]=o.split("_");a[_]=o}else s.push(o)})});let r=[];for(let i in a)if(Object.prototype.hasOwnProperty.call(a,i))r.push(a[i]);return r.push(...s),r.join(" ")},q=Gi,Vi="atm_adsuimk_stnw88 atm_adsuif3_idpfg4 atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v",Zi="atm_adsui9s_1ulexfb atm_adsuimj_glywfm atm_adsuiy1254f_icygq7 atm_adsui1s0cpq2_1y4oovw atm_adsui11bgp38_ltqb7t atm_adsuiylp9lw_1627y59 atm_adsuig6en28_1ohcsmr";function Ji({box:e,preserveAspectRatio:t="xMidYMid meet",axes:a=!0,overlay:s=!1}){if(![e.x,e.y,e.width,e.height].every(Number.isFinite)||e.width<=0||e.height<=0)return null;let r=Math.max(1,Math.ceil(Math.max(e.width,e.height)/48)),i=(n)=>[...new Set([...Array.from({length:Math.floor(n/r)+1},(o,_)=>_*r),...a?[n/2]:[],n])].sort((o,_)=>o-_);return d("svg",{className:q("ds-artwork-grid",Zi,s&&Vi),viewBox:`${e.x} ${e.y} ${e.width} ${e.height}`,"data-step":r,preserveAspectRatio:t,"aria-hidden":"true",focusable:"false",children:[i(e.width).map((n)=>d("line",{className:a&&n*2===e.width?"mid":void 0,x1:e.x+n,x2:e.x+n,y1:e.y,y2:e.y+e.height},`x${n}`)),i(e.height).map((n)=>d("line",{className:a&&n*2===e.height?"mid":void 0,x1:e.x,x2:e.x+e.width,y1:e.y+n,y2:e.y+n},`y${n}`))]})}var Ki="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='%23b4b4b4'%3e%3ctitle%3eADS%20—%20Eye%20in%20the%20grid,%20greyscale%20small%20size%3c/title%3e%3cpath%20d='M1%201h4v4H1zM6%201h4v4H6zM11%201h4v4H11zM1%206h4v4H1zM11%206h4v4H11zM1%2011h4v4H1zM6%2011h4v4H6zM11%2011h4v4H11z'/%3e%3cpath%20d='M6%206h4v4H6z'%20fill='%23444444'/%3e%3cpath%20d='M7%207h2v2H7z'%20fill='%23fafafa'/%3e%3c/svg%3e",Qi="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='%235c5c5c'%3e%3ctitle%3eADS%20—%20Eye%20in%20the%20grid,%20greyscale%20small%20size%3c/title%3e%3cpath%20d='M1%201h4v4H1zM6%201h4v4H6zM11%201h4v4H11zM1%206h4v4H1zM11%206h4v4H11zM1%2011h4v4H1zM6%2011h4v4H6zM11%2011h4v4H11z'/%3e%3cpath%20d='M6%206h4v4H6z'%20fill='%23dddddd'/%3e%3cpath%20d='M7%207h2v2H7z'%20fill='%231b1b1b'/%3e%3c/svg%3e",Yi="atm_adsui9s_116y0ak atm_adsuibb_idpfg4 atm_adsuivy_1aou828 atm_adsuie2_1aou828 atm_adsui1w_kb7nvz",va="atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v",Xi="atm_adsui9s_o8hunj",es="atm_adsui9s_1a9ryah";function ts({label:e}){return d("span",{className:q("ds-brand-mark",Yi),role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:!0,children:[d("img",{className:q(va,Xi),loading:"eager",src:Ki,width:16,height:16,alt:""}),d("img",{className:q(va,es),loading:"eager",src:Qi,width:16,height:16,alt:""})]})}var as="atm_adsui9s_116y0ak atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuicx_tx1for atm_adsuij6_1wdkmbo atm_adsuilh_dcxj7s atm_adsuilb_tx1for atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuics_el7ql6 atm_adsuic8_1m800s6 atm_adsuig3_3szr2b atm_adsuird_glywfm atm_adsui9j_tlke0l atm_adsuibb_idpfg4 atm_adsuiv6g6dd_pt45zb atm_adsuit4h5aw_1wskm3t atm_adsui15xrhy7_pt45zb atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45 atm_adsui1jhk75u_1mfz0iu atm_adsui174zlj6_73adwj atm_adsui1tcisp7_glywfm",is="atm_adsui4b_1627y59 atm_adsui26_1u3842e atm_adsui7l_1r1dq30 atm_adsuics_1d1fc98 atm_adsuiv6g6dd_1wskm3t atm_adsui168r6ku_8o97w",ss="atm_adsuivy_alpu0l atm_adsuie2_alpu0l atm_adsuij6_alpu0l atm_adsuilh_idpfg4 atm_adsuilb_idpfg4";function P({id:e,label:t,iconOnly:a,children:s,disabled:r,hidden:i,pressed:n,current:o,expanded:_,controls:u,popoverTarget:c,section:p,phase:g,variant:h="quiet",onClick:f}){return d("button",{id:e,type:"button",className:q("ds-toolbar-button",as,h==="outlined"&&is,a&&ss),"aria-label":a?t:void 0,title:a?t:void 0,disabled:r,hidden:i,"aria-pressed":n,"aria-current":o?"page":void 0,"aria-expanded":_,"aria-controls":u,popovertarget:c,"data-section":p,"data-phase":g,onClick:f,children:[s,!a&&t]})}var ns="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuicx_tx1for atm_adsuijb_idpfg4 atm_adsuil8_1lr73f0 atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1mqbmot atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_3szr2b atm_adsuir3_1h6ojuz atm_adsui9j_tlke0l atm_adsuiv6g6dd_pt45zb atm_adsui1qpv5ur_1r1dq30 atm_adsui1p5227w_pt45zb atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45 atm_adsui1jhk75u_1mfz0iu atm_adsui174zlj6_73adwj";function rs({id:e,label:t,pressed:a=!1,disabled:s,children:r,onClick:i}){return d("button",{id:e,type:"button",className:q("ds-toggle-tile",ns),"aria-pressed":a,disabled:s,onClick:i,children:[r,d("span",{children:t})]})}var La={brand:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M8 1.5 9.9 5.6l4.4.5-3.3 3 .9 4.4L8 11.3l-3.9 2.2.9-4.4-3.3-3 4.4-.5L8 1.5Z"/></svg>',"chevron-left":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 4l-4 4 4 4"/></svg>',"chevron-right":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 4 4 4-4 4"/></svg>',"chevron-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 10 4-4 4 4"/></svg>',close:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 4 8 8M12 4l-8 8"/></svg>',components:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 1 6 3.5v7L8 15l-6-3.5v-7L8 1Zm-6 3.5 6 3.5 6-3.5M8 8v7"/></svg>',composition:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 2h4v4H2zM10 2h4v4h-4zM2 10h4v4H2zM10 10h4v4h-4z"/></svg>',drafts:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 1h7l3 3v11H3zM10 1v4h3M5 8h6M5 11h4"/></svg>',"guide-bounds":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3.5" width="12" height="9"/></svg>',"guide-gaps":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="3" width="3.5" height="10"/><rect x="6.25" y="3" width="3.5" height="10"/><rect x="11" y="3" width="3.5" height="10"/></svg>',"guide-margins":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="2.5" width="13" height="11" stroke-dasharray="1.5 1.5"/><rect x="4.5" y="5.5" width="7" height="5"/></svg>',"guide-mini":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 2v12M6 2v12M10 2v12M14 2v12M2 2h12M2 6h12M2 10h12M2 14h12" stroke-width="1"/></svg>',"guide-padding":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="2.5" width="13" height="11"/><rect x="4.5" y="5.5" width="7" height="5" stroke-dasharray="1.5 1.5"/></svg>',"guide-tracks":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 2v12M6 2v12M10 2v12M13.5 2v12"/></svg>',icons:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="5" cy="5" r="2.5"/><rect x="9.5" y="2.5" width="4" height="5" rx="1"/><path d="m2.5 13.5 2.5-4 2.5 4ZM9.5 11.5h4M11.5 9.5v4"/></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 2v12M6.5 2v12M9.5 2v12M13 2v12"/></svg>',moon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg>',patterns:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="5" height="5"/><rect x="10" y="2" width="4" height="5"/><rect x="2" y="10" width="5" height="4"/><rect x="10" y="10" width="4" height="4"/></svg>',phone:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="1" width="8" height="14" rx="1.5"/><path d="M7 12.5h2"/></svg>',pictograms:'<svg fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect x="1.5" y="2.5" width="13" height="11" rx="1"/><circle cx="5" cy="6" r="1"/><path d="m2 12 4-3 3 2 3-4 2 2"/></svg>',source:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m5 4-4 4 4 4m6-8 4 4-4 4M9 2 7 14"/></svg>',split:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="2" width="14" height="12" rx="1"/><path d="M8 2v12"/></svg>',sun:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/></svg>',tokens:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 2 6 3-6 3-6-3 6-3Zm-6 6 6 3 6-3M2 11l6 3 6-3"/></svg>',warning:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 2 7 12H1L8 2Z"/><path d="M8 6v3M8 11v.5"/></svg>'},ya={};Object.keys(La).sort();var os="atm_adsui9s_116y0ak atm_adsuiam_glywfm atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuivh_nkobfv atm_adsui7l_1kw7nm4 atm_adsuix4ub3y_1ulexfb atm_adsuivskwj7_1osqo2v atm_adsui158k9f9_1osqo2v",ds={sm:"atm_adsuivy_1aou828 atm_adsuie2_1aou828",md:"atm_adsuivy_fjcok3 atm_adsuie2_fjcok3",lg:"atm_adsuivy_14k5dlv atm_adsuie2_14k5dlv",xl:"atm_adsuivy_1j39cg3 atm_adsuie2_1j39cg3"};function A({name:e,size:t="sm",label:a}){let s=e in ya?ya[e]:e;return d("span",{className:q("ds-icon",os,ds[t]),...a?{role:"img","aria-label":a}:{"aria-hidden":!0},dangerouslySetInnerHTML:{__html:La[s]}})}var us="atm_adsui9s_1txwivl atm_adsuih_1h6ojuz atm_adsuicx_tx1for atm_adsuij6_1wdkmbo atm_adsuil8_kr1xch atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuics_el7ql6 atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsuird_glywfm atm_adsuikz_fg65tv atm_adsui1e7xapd_1wugsn5 atm_adsui1cc01an_1m800s6 atm_adsuiz89mj4_el7ql6 atm_adsui19izows_1mqbmot atm_adsui1a1iq7z_1q9ccgz atm_adsui18vqbco_pt45zb atm_adsuisrk7fl_pt45zb atm_adsui1dpiaj6_1wskm3t atm_adsuizrwyxp_1d1fc98 atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45";function _s({label:e,href:t,current:a,previewState:s,previewLabel:r,draftLabel:i,draftDescription:n,onClick:o}){return d("a",{className:q("ds-navigation-item",us),href:t,"aria-current":a?"page":void 0,"aria-description":r,onClick:o,children:[e,i&&d("span",{className:"draft-badge",title:n,children:[" ",i]}),s&&d(Wa,{state:s})]})}var cs="atm_adsuimk_1n9t6rb atm_adsuif3_aqos4q atm_adsui73_usvi9m atm_adsuigi_idpfg4 atm_adsuiiy_102o88r atm_adsuiks_1wugsn5 atm_adsuil8_1aqtv8w atm_adsui3f_m9afv7 atm_adsui5j_idpfg4 atm_adsui26_1bplolx atm_adsui7l_1wskm3t atm_adsui70_1fjsgd1 atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsuiarf92d_1txwivl atm_adsui1qpaa0x_1bp4okc",ls="atm_adsuil8_idpfg4",ms={narrow:"atm_adsuivy_hvzi4f",wide:"atm_adsuivy_1risgsc atm_adsuij3_1y8qh3w"},fs="atm_adsuimk_pfqszd atm_adsuiiy_glywfm atm_adsuij3_1osqo2v";function Ua({id:e,label:t,role:a,width:s="narrow",inline:r=!1,flush:i=!1,children:n}){return d("div",{id:e,className:q("ds-popover",cs,ms[s],i&&ls,r&&fs),popover:r?void 0:"auto",role:a,"aria-label":t,children:n})}var ps="atm_adsui9s_116y0ak atm_adsuiam_glywfm atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuivy_1aou828 atm_adsuie2_1aou828 atm_adsui7l_1mqbmot atm_adsuivskwj7_1osqo2v atm_adsui158k9f9_1osqo2v atm_adsuio2zchm_glywfm atm_adsuibupyu4_1r31cwp atm_adsui91z0ma_c484nn atm_adsuieyuh4p_glywfm atm_adsuis7vg1k_1ulexfb atm_adsui1a7gqnz_glywfm atm_adsui1ypv4g8_glywfm atm_adsuisc4h6w_116y0ak";function Wa({state:e="unreported",variant:t="navigation",label:a}){return d("span",{className:q("ds-preview-indicator",t==="navigation"&&"entry-preview",ps),"data-state":e,"data-variant":t,role:a?"img":void 0,"aria-label":a,"aria-hidden":a?void 0:!0,title:a,children:[d("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[d("circle",{"data-mark":"unreported",cx:"8",cy:"8",r:"3"}),d("circle",{"data-mark":"building",cx:"8",cy:"8",r:"5","stroke-dasharray":"22 10"}),d("circle",{"data-mark":"checking",cx:"8",cy:"8",r:"5","stroke-dasharray":"3 3"}),d("circle",{"data-mark":"ready",cx:"8",cy:"8",r:"5"}),d("circle",{"data-mark":"stale",cx:"8",cy:"8",r:"5","stroke-dasharray":"2 3"}),d("circle",{"data-mark":"error",cx:"8",cy:"8",r:"5",fill:"currentColor",stroke:"none"})]}),t==="toolbar"&&d("span",{className:"preview-warning",children:d(A,{name:"warning"})})]})}var gs="atm_adsuig1e7fr_1hh10yn atm_adsuina064p_1c8rstr atm_adsuibyi8sh_1d1fc98 atm_adsuit8tn60_1r1dq30 atm_adsui18xy9f7_1txwivl atm_adsui1kvotse_1xi6ry0 atm_adsui13bcc9y_q4j4l1 atm_adsui9ht5kt_1iwn3l9 atm_adsuiw49f19_1m800s6 atm_adsui1mb7f0m_1mqbmot atm_adsui1o7g9kp_sqnntc atm_adsuicsppdr_11p5wf0 atm_adsui156xhju_13mtsfm atm_adsui2uzat_iqvn5y atm_adsuizf04m1_1mfz0iu atm_adsuil2ckyf_1txwivl atm_adsuim3rxq9_1h6ojuz atm_adsuilfeyld_iqvn5y atm_adsuidl3q2m_ynj908 atm_adsui12er3fd_tx1for atm_adsui8e79fz_m9afv7 atm_adsui1qnfl3r_1m800s6 atm_adsui1sj4mjq_1mqbmot atm_adsui6ql2ro_iqvn5y",kt=[{name:"off",label:"Off",hint:"Guides are hidden. Your layer choice is kept."},{name:"hover",label:"Hover",hint:"Point at or focus an element to see the selected layers."},{name:"always",label:"Always",hint:"Every element shows the selected layers."}],Fa=[{name:"bounds",label:"Bounds"},{name:"tracks",label:"Columns and rows"},{name:"gaps",label:"Gaps and gutters"},{name:"padding",label:"Padding"},{name:"margins",label:"Margins"},{name:"mini",label:"Mini-unit grid"}],Ga=[{name:"spacing",label:"Spacing",layers:["padding","margins","gaps"]},{name:"grid",label:"Grid",layers:["tracks","mini"]},{name:"all",label:"All",layers:["bounds","tracks","gaps","padding","margins","mini"]}];function Va(e){var t;let a=((t=Ga.find((s)=>s.name===e))==null?void 0:t.layers)??[];return Object.fromEntries(Fa.map((s)=>[s.name,a.includes(s.name)]))}function hs({id:e="grid-options",inline:t=!1,mode:a="off",layers:s={},onModeChange:r,onLayerChange:i,onPreset:n}){var o;let _=(o=kt.find((u)=>u.name===a))==null?void 0:o.hint;return d(Ua,{id:e,label:"Layout guides",role:"dialog",inline:t,children:d("div",{id:`${e}-content`,className:q("ux-guide-options",gs),"data-mode":a,children:[d("h2",{children:"Layout guides"}),d("div",{className:"ux-guide-modes",role:"group","aria-label":"Show guides",children:kt.map((u)=>d(P,{id:`${e}-mode-${u.name}`,label:u.label,pressed:a===u.name,onClick:()=>r==null?void 0:r(u.name)},u.name))}),d("p",{id:`${e}-hint`,className:"ux-guide-hint","aria-live":"polite",...Object.fromEntries(kt.map((u)=>[`data-${u.name}`,u.hint])),children:_}),d("div",{className:"ux-guide-layers",role:"group","aria-label":"Layers",children:Fa.map((u)=>d(rs,{id:`${e}-layer-${u.name}`,label:u.label,pressed:s[u.name]===!0,onClick:()=>i==null?void 0:i(u.name,s[u.name]!==!0),children:d(A,{name:`guide-${u.name}`,size:"lg"})},u.name))}),d("div",{className:"ux-guide-presets",role:"group","aria-label":"Presets",children:[d("span",{children:"Presets"}),Ga.map((u)=>d(P,{id:`${e}-preset-${u.name}`,label:u.label,onClick:()=>n==null?void 0:n(u.name)},u.name))]})]})})}var $e,T,bt,ka,qt=Object.is,nt=0,Za=[],zt=[],E=j,{__b:ba,__r:xa,diffed:ja,__c:qa,unmount:za,__:Ca}=E;function Pt(e,t){E.__h&&E.__h(T,e,nt||t),nt=0;var a=T.__H||(T.__H={__:[],__h:[]});return e>=a.__.length&&a.__.push({}),a.__[e]}function ws(e){return nt=1,vs(Ka,e)}function vs(e,t,a){var s=Pt($e++,2);if(s.t=e,!s.__c&&(s.__=[Ka(void 0,t),function(i){var n=s.__N?s.__N[0]:s.__[0],o=s.t(n,i);qt(n,o)||(s.__N=[o,s.__[1]],s.__c.setState({}))}],s.__c=T,!T.__f)){T.__f=!0;var r=T.shouldComponentUpdate;T.shouldComponentUpdate=function(i,n,o){var _=this.__H;if(!_)return!0;var u=!1,c=this.props!=i;if(_.__.some(function(g){g.__N&&(u=!0,qt(g.__[0],g.__N[0])||(c=!0))}),r){var p=r.call(this,i,n,o);return u?p||c:p}return!u||c}}return s.__}function ys(e,t){var a=Pt($e++,4);!E.__s&&Ja(a.__H,t)&&(a.__P=!1,a.__=e,a.u=t,T.__h.push(a))}function ks(e){return nt=5,bs(function(){return{current:e}},[])}function bs(e,t){var a=Pt($e++,7);return Ja(a.__H,t)&&(a.__=e(),a.__H=t),a.__}function xs(){var e;do{for(;e=zt.shift();)try{Pe(e)}catch(a){E.__e(a,{__:(e=e.__P)&&e.__v})}for(;e=Za.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Pe),t.__h.some(Ct),t.__h=[]}catch(a){t.__h=[],E.__e(a,e.__v)}}}while(zt.length)}E.__b=function(e){T=null,ba&&ba(e)},E.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ca&&Ca(e,t)},E.__r=function(e){xa&&xa(e),$e=0;var t=(T=e.__c).__H;t&&(bt==T?T.__h=[]:(t.__h.some(Pe),t.__h.some(Ct),$e=0),t.__h=[],t.__.some(function(a){a.__N&&(a.__=a.__N),a.u=a.__N=void 0})),bt=T},E.diffed=function(e){ja&&ja(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Ea(Za.push(t)),t.__H.__.some(function(a){a.u&&(a.__H=a.u)})),bt=T=null},E.__c=function(e,t){t.some(function(a){try{a.__h.some(Pe),a.__h=a.__h.filter(function(s){return!s.__||Ct(s)})}catch(s){t.some(function(r){r.__h&&(r.__h=[])}),t=[],E.__e(s,a.__v)}}),qa&&qa(e,t)},E.unmount=function(e){za&&za(e);var t,a,s=e.__c;s&&s.__H&&(s.__H.__.some(function(r){try{if(r.__P&&r.__c){if(a===void 0){for(a=e.__;a&&(!a.__c||!a.__c.__P);)a=a.__;a=a&&a.__c}r.__P=a,Ea(zt.push(r))}else Pe(r)}catch(i){t=i}}),s.__H=void 0,t&&E.__e(t,s.__v))};var Sa=typeof requestAnimationFrame=="function";function js(e){var t,a=function(){clearTimeout(s),Sa&&cancelAnimationFrame(t),setTimeout(e)},s=setTimeout(a,35);Sa&&(t=requestAnimationFrame(a))}function Ea(e){e!=1&&ka==E.requestAnimationFrame||((ka=E.requestAnimationFrame)||js)(xs)}function Pe(e){var t=T,a=e.__c;typeof a=="function"&&(e.__c=void 0,a()),T=t}function Ct(e){var t=T;e.__c=e.__(),T=t}function Ja(e,t){return!e||e.length!=t.length||t.some(function(a,s){return!qt(a,e[s])})}function Ka(e,t){return typeof t=="function"?t(e):t}var Na="atm_adsuie2_1osqo2v atm_adsuiks_1wugsn5 atm_adsuil8_1ru0ig4 atm_adsuibx_rhlbdi atm_adsuic8_1c8rstr atm_adsuig3_sqnntc atm_adsui7l_an4usv atm_adsui1s9zg6e_idpfg4 atm_adsui1y1itgh_1heflvk atm_adsui124toe7_1d1fc98 atm_adsui1ajpmqv_3szr2b atm_adsuig1e7fr_81zv9y atm_adsuina064p_1ye8rbs atm_adsuibyi8sh_1d1fc98 atm_adsui1t8i83k_1ulexfb atm_adsui1t4u5ad_iqvn5y atm_adsui1ucxlaq_1m800s6 atm_adsuicqysi0_el7ql6 atm_adsuiugp1nr_1mqbmot atm_adsuimzw80z_1txwivl atm_adsuims933x_v2br90 atm_adsuikqzblj_1yb4nlp atm_adsui157qtsd_1doep66 atm_adsuipps9nr_1g80g66 atm_adsui1696orj_6e9m65 atm_adsui1kwsnex_1mqbmot atm_adsui1749l82_1m800s6 atm_adsui1pm6vxp_fg65tv atm_adsui1985805_rhlbdi atm_adsuifgvpx0_1m800s6 atm_adsui1f7jbwv_1wdkmbo atm_adsui4v11ke_13r6pey atm_adsui1ph4l26_kr1xch atm_adsui1td1et_58tz3v atm_adsui16q9e9r_idpfg4 atm_adsui1e1cn77_1u3842e atm_adsui1ok557x_an4usv atm_adsui8oqreq_16x0t2t atm_adsuidogt2j_15wi45 atm_adsui1ha57is_1txwivl atm_adsui154gtli_1g80g66 atm_adsui1m0o9p4_1doep66 atm_adsuitul8sy_116y0ak atm_adsuid9rgyl_1h6ojuz atm_adsui1ew4plt_1h6ojuz atm_adsui44kz9m_tx1for atm_adsui1l2cw9c_116y0ak atm_adsui1p2daoe_glywfm atm_adsui1lrgcs0_1kw7nm4 atm_adsui21ajbm_1ulexfb atm_adsuiv4i7ad_glywfm atm_adsui18exmc6_11p5wf0 atm_adsuinrahr7_14kz4g7 atm_adsui1sapuqh_1ak2vn7 atm_adsuia9snxg_v2br90 atm_adsuic1efku_idpfg4 atm_adsui1s5glk1_1h6ojuz atm_adsui4zbjz7_1txwivl atm_adsui1nrl83w_1h6ojuz atm_adsuidcq6po_1h6ojuz atm_adsuiodevil_1g80g66 atm_adsui15luuzb_tx1for atm_adsuiy20kxr_idpfg4 atm_adsui1pfuy6w_l6f2xw atm_adsuifo0n28_1m800s6 atm_adsui1yka5lj_sqnntc atm_adsuiazx38y_19dj2kj atm_adsuildippw_fg65tv atm_adsui2kz6ah_177qeyn atm_adsui5go7c5_1m800s6 atm_adsui12ii74i_1q4684i atm_adsui1t756hg_1mqbmot atm_adsui1n1nucf_h2mmj6 atm_adsuis5orb_qpi3z3 atm_adsui1maakrc_qpi3z3 atm_adsui3jvufv_6g0xcp atm_adsui1a6bvuq_6lcubb atm_adsui7le0qg_stnw88 atm_adsuikc8k8m_idpfg4 atm_adsui10ojrnp_1le1gz4 atm_adsuimhax7p_moqrwa atm_adsui1eq72d_1txwivl atm_adsuitglio1_1g80g66 atm_adsui1uq2nym_1h6ojuz atm_adsui1g6vde0_esu3gu atm_adsui1lgf0nm_1aqtv8w atm_adsui1e184xh_1txwivl atm_adsuila89rv_1bp4okc atm_adsui3c75k5_1h6ojuz atm_adsuihmh6q_tx1for atm_adsui1gfpqoj_1m800s6 atm_adsui1lezx94_1mqbmot atm_adsui1fnmsk6_b6kj4x atm_adsuip4zrj7_1le1gz4 atm_adsui1lf327s_1m800s6 atm_adsui10hei5o_glywfm atm_adsui11ndfci_12j2sah atm_adsuiewnzgi_1r3tyjr atm_adsuincp59s_19dj2kj atm_adsui5aykc5_ynj908 atm_adsui1z5d1z_1vz6rot atm_adsui1w4ry55_mrub5a atm_adsuinfdfyh_fg65tv atm_adsui1d1ue3r_1mqbmot atm_adsui1m3cqh4_1txwivl atm_adsuijhqbse_1g80g66 atm_adsui1y90xlu_1doep66 atm_adsui1konks8_idpfg4 atm_adsuirgczd9_1txwivl atm_adsui1tv24b1_1h6ojuz atm_adsui1adwpcp_ynj908 atm_adsui61s2ls_1m800s6 atm_adsui7olkud_116y0ak atm_adsuiu2kdnu_tx1for atm_adsuiv7vy6e_qm87f6 atm_adsuin0y7c7_1ivmhas atm_adsui1mpi4sj_1ulexfb atm_adsuit6wwae_1f51e7f",Ma="http://www.w3.org/2000/svg";function xt({item:e,size:t,label:a}){let s=ks(null);return ys(()=>{var r;let i=new DOMParser().parseFromString(e.svg,"image/svg+xml").documentElement;if(i.namespaceURI!==Ma||i.localName!=="svg")return;for(let o of i.querySelectorAll("*"))if(["script","foreignObject","iframe","image","a","animate","set","animateTransform","animateMotion"].includes(o.localName)||o.namespaceURI!==Ma)o.remove();for(let o of[i,...i.querySelectorAll("*")])for(let _ of Array.from(o.attributes))if(/^on/i.test(_.name)||/href$/i.test(_.name)&&!_.value.trim().startsWith("#"))o.removeAttribute(_.name);let n=document.importNode(i,!0);return n.removeAttribute("class"),n.setAttribute("width",String(t)),n.setAttribute("height",String(t)),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),(r=s.current)==null||r.replaceChildren(n),()=>{var o;return(o=s.current)==null?void 0:o.replaceChildren()}},[e.svg,t]),d("span",{className:"icons-glyph",ref:s,role:a?"img":void 0,"aria-label":a,title:a,"aria-hidden":a?void 0:"true"})}function Ta({finding:e}){return d("p",{className:"icons-finding",title:e.file,children:[d("strong",{children:e.rule})," ",e.message]})}function qs({data:e}){var t;let[a,s]=ws("");if(!e.configured)return d("section",{className:q("icons-view",Na),"aria-label":"Icons",children:[d("h1",{children:"Icons"}),d("p",{className:"icons-summary",children:"The project configures no glyph set."})]});let r=e.glyphs.filter((i)=>[i.name,...i.aliases].some((n)=>n.toLowerCase().includes(a.trim().toLowerCase())));return d("section",{className:q("icons-view",Na),"aria-label":"Icons",children:[d("div",{className:"icons-head",children:[d("div",{children:[d("h1",{children:"Icons"}),d("p",{className:"icons-summary",children:[e.source," · ",e.glyphs.length," glyphs",e.grid?` · ${e.grid.width} × ${e.grid.height} grid`:e.mixed?" · Mixed grids":""," · ",e.aliasCount," aliases"]})]}),d("input",{type:"search",value:a,onInput:(i)=>s(i.currentTarget.value),placeholder:"Search name or alias","aria-label":"Search glyphs by name or alias"})]}),e.findings.map((i,n)=>d(Ta,{finding:i},n)),d("h2",{children:["The set",d("small",{children:["Every glyph at ",((t=e.textSize)==null?void 0:t.px)??16,"px, the size used beside text"]})]}),d("div",{className:"icons-set",role:"list","aria-label":"The set",children:r.map((i)=>{var n;return d("span",{className:"icons-set-item","data-glyph":i.name,role:"listitem",children:d(xt,{item:i,size:((n=e.textSize)==null?void 0:n.px)??16,label:i.name})},i.name)})}),d("h2",{children:["Glyphs",d("small",{children:"Enlarged construction grid and actual icon sizes"})]}),!r.length&&d("p",{className:"icons-empty",children:e.glyphs.length?`No glyph matches “${a.trim()}”.`:"No glyphs in this set."}),d("div",{className:"icons-cards",children:r.map((i)=>d("article",{className:"icons-card","data-glyph":i.name,"data-findings":i.findings.length||void 0,"aria-label":i.name,children:[d("div",{className:"icons-card-head",children:[d("h3",{children:i.name}),i.findings.length>0&&d("span",{className:"icons-badge",children:[i.findings.length," ",i.findings.every((n)=>n.severity==="error")?"error":"issue",i.findings.length===1?"":"s"]})]}),d("p",{className:"icons-alias",children:i.aliases.length?`alias: ${i.aliases.join(", ")}`:""}),d("div",{className:"icons-mag",children:[i.grid&&d(Ji,{box:i.grid,overlay:!0}),d(xt,{item:i,size:96})]}),d("div",{className:"icons-sizes",children:e.sizes.map((n)=>d("span",{className:"icons-size",children:[d(xt,{item:i,size:n.px}),d("small",{title:n.token,children:n.px})]},n.token))}),i.findings.map((n,o)=>d(Ta,{finding:n},o))]},i.name))}),e.logos&&d(J,{children:[d("h2",{children:["Other products’ logos",d("small",{children:e.logos.source})]}),d("div",{className:"icons-logos",children:e.logos.files.map((i)=>d("figure",{className:"icons-logo","data-logo":i.name,children:i.tooLarge?d("figcaption",{children:[i.name," (over 1 MB; not shown)"]}):d(J,{children:[d("span",{className:"icons-logo-tile",children:d("img",{src:i.src,alt:i.name,title:i.file,width:24,height:24,loading:"lazy",decoding:"async"})}),d("span",{className:"icons-logo-tile icons-logo-tile-black",children:d("img",{src:i.src,alt:"",width:24,height:24,loading:"lazy",decoding:"async"})}),d("figcaption",{children:i.name})]})},i.name))})]})]})}var zs="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuicx_idpfg4 atm_adsuijb_idpfg4",Cs="atm_adsuijb_idpfg4 atm_adsui1pqo7b0_1txwivl atm_adsuiywbgd0_1h6ojuz atm_adsui1a6nw8z_tx1for atm_adsui1vu1bue_kr1xch atm_adsuiyzr3rh_1wdkmbo atm_adsuila54r4_glywfm atm_adsui10x1lus_tlke0l atm_adsui107eb71_1m800s6 atm_adsuir3v91m_1d1fc98 atm_adsui3vd9bk_1wskm3t atm_adsui1pvchle_glywfm atm_adsui93k5wf_1aou828 atm_adsui1jhtvjp_1aou828 atm_adsuixwcn1n_glywfm atm_adsuiaxt0xi_1r31cwp atm_adsuiu9ecgn_c484nn atm_adsui1rd1yp5_glywfm atm_adsuir4atoz_14w8a5s atm_adsuikwnb5l_16x0t2t atm_adsui1b3ry6x_xrd58z atm_adsui9abqyk_1txwivl atm_adsui152ylkv_1bp4okc atm_adsui4nxdgq_idpfg4 atm_adsui1jf9b6q_1aqtv8w";function Ss({id:e,label:t,children:a}){return d("nav",{id:e,className:q("ux-navigation-menu",zs),"aria-label":t,children:a})}function Es({label:e,open:t=!0,children:a}){return d("details",{className:q("entry-group",Cs),open:t,children:[d("summary",{children:[d(A,{name:"chevron-right"}),d("span",{children:e})]}),d("div",{role:"group","aria-label":e,"data-slot":"entries",children:a})]})}var Ns="atm_adsui9s_116y0ak atm_adsuih_1h6ojuz",Ms="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuij6_idpfg4 atm_adsuiam_kb7nvz atm_adsui1swzw65_glywfm atm_adsui1n6gq6x_idpfg4 atm_adsui1ew16gs_fg65tv atm_adsuilt2xkg_1txwivl atm_adsuicvgua_1bp4okc atm_adsuiibt2oz_idpfg4 atm_adsui13rscvo_kb7nvz atm_adsuifaj8v5_1txwivl atm_adsui1x9f3se_1h6ojuz atm_adsui7ff47s_1aqtv8w atm_adsui19ywhw4_5z7wz8 atm_adsuik8mrq7_m9afv7 atm_adsuitx6td0_glywfm atm_adsui24gkm1_kb7nvz atm_adsuibo9v2x_1mqbmot atm_adsuiof0hc7_1wugsn5",Ts="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuij6_idpfg4 atm_adsuiam_kb7nvz atm_adsui1n6gq6x_idpfg4 atm_adsui1ew16gs_fg65tv atm_adsui18hfcpa_5z7wz8 atm_adsui15kvw8j_1d1fc98 atm_adsuiput1jn_1r1dq30 atm_adsuiwst7e9_tx1for atm_adsuidds7x8_el7ql6 atm_adsuilhyqxr_1mqbmot atm_adsui10yw2xd_idpfg4 atm_adsui1womkjg_idpfg4 atm_adsui108aoln_glywfm atm_adsuirdnh25_1wugsn5 atm_adsuiiq3m8p_m9afv7 atm_adsui17tjeyp_5z7wz8 atm_adsui1s7p0pk_m9afv7 atm_adsuiq065rl_idpfg4 atm_adsui132u42p_1txwivl atm_adsuiy4slwo_1g80g66 atm_adsui41lbvx_1q9ycp6 atm_adsui1gu70gy_4baac9 atm_adsui3ffk06_iqvn5y atm_adsuiy5406h_l6f2xw atm_adsui1t4fsou_10of7rf atm_adsui1kdkncg_1mqbmot atm_adsuizdczfh_fg65tv atm_adsui1fkhvt8_1k2i9i8 atm_adsui1jjfms9_m9afv7 atm_adsuixcw6qj_l6f2xw atm_adsui1l7l6jv_10of7rf atm_adsui1n2a233_1wskm3t atm_adsui1gqwc3l_1r1dq30 atm_adsui1sox6pi_iqvn5y atm_adsuib4u3xt_1mqbmot atm_adsui14bm868_tlke0l atm_adsuiix7db5_1risgsc atm_adsui6nxdxv_16x0t2t atm_adsui1ouftwa_15wi45 atm_adsui1spa2l4_iqvn5y atm_adsui10ldf3v_ofj6oc atm_adsui167gjxu_1mqbmot";function Ps(e){let[t="",...a]=e.split(`
|
|
3
|
+
`),s=/^(.+?\.)\s+(.+)$/.exec(t),r=s?s[1]:t,i=[],n=[];for(let o of[...s?[s[2]]:[],...a].map((_)=>_.trim()).filter(Boolean)){let _=/^(\S+?:\d+(?::\d+)?|[\w./-]+\.\w+):\s+(?:([a-z][a-z0-9-]*):\s+)?(.+)$/.exec(o);if(!_){n.push(o);continue}let u=_[3],c=/^(.+?[.!?])\s+(.+)$/.exec(u);i.push({location:_[1],rule:_[2],summary:c?c[1]:u,detail:c==null?void 0:c[2]})}return{title:r,problems:i,notes:n}}function Qa({message:e}){let{title:t,problems:a,notes:s}=Ps(e);return d("div",{className:q("ux-status-content",Ts),children:[d("p",{className:"ux-status-title",children:[t,a.length>1&&d("span",{className:"ux-status-count",children:[a.length," problems"]})]}),a.length>0&&d("ul",{className:"ux-status-problems",children:a.map((r,i)=>d("li",{className:"ux-status-problem",children:[d("div",{className:"ux-status-where",children:[r.location&&d("span",{className:"ux-status-file",children:r.location}),r.rule&&d("span",{className:"ux-status-rule",children:r.rule})]}),d("p",{className:"ux-status-summary",children:r.summary}),r.detail&&d("details",{children:[d("summary",{children:"Why and how to fix"}),d("p",{children:r.detail})]})]},i))}),s.map((r,i)=>d("p",{className:"ux-status-note",children:r},i))]})}function $s({idPrefix:e="",phase:t="ready",message:a="Preview is up to date.",warmup:s,onRetry:r}){let i=(n)=>e+n;return d("div",{className:q("ux-preview-status",Ns),children:[d(P,{id:i("preview-status"),label:`Preview status: ${a.split(`
|
|
4
|
+
`)[0]}`,phase:t,iconOnly:!0,popoverTarget:i("status-details"),children:d(Wa,{variant:"toolbar",state:t==="reloading"?"building":t})}),d(Ua,{id:i("status-details"),width:"wide",flush:!0,children:d("div",{className:q("ux-status-details",Ms),children:[d("div",{id:i("status"),className:"ux-status-message",role:t==="error"?"alert":"status",children:d(Qa,{message:a})}),d("div",{className:"ux-status-footer",children:[d("p",{id:i("warmup-status"),className:"ux-status-warmup",hidden:!s,children:s}),d("div",{id:i("preview-error"),className:"preview-retry",hidden:t!=="error",children:d(P,{id:i("retry-preview"),label:"Retry preview",variant:"outlined",onClick:r})})]})]})})]})}var Rs="atm_adsuijb_idpfg4 atm_adsuij6_1osqo2v atm_adsuil8_1ru0ig4 atm_adsui7l_an4usv atm_adsuibx_rhlbdi atm_adsuic8_1c8rstr atm_adsuig3_sqnntc atm_adsui3z5xaq_d3l4uo atm_adsui1wgjgno_idpfg4 atm_adsuip5t3iw_glywfm atm_adsuixo4njo_uqc78k atm_adsui5o4a8h_rfutky atm_adsui1fodpaq_1g68hxi atm_adsuiw6dnwv_1j28jx2 atm_adsuigj0umz_1ru0ig4 atm_adsui12f0w6t_1txwivl atm_adsui1gdpbuc_1g80g66 atm_adsuiuqbam3_1h6ojuz atm_adsuio8ubsb_1aqtv8w atm_adsui5ug4ic_1wdkmbo atm_adsui1w6vi1x_13r6pey atm_adsuiz9prp4_kr1xch atm_adsuiwdfvbd_m9afv7 atm_adsui13fkfdg_idpfg4 atm_adsui1do7trk_1j28jx2 atm_adsui1rlis1a_an4usv atm_adsuizf9kzn_rhlbdi atm_adsuii5gv9h_1m800s6 atm_adsuindj6xq_16x0t2t atm_adsuitdd4i9_15wi45 atm_adsui11chkp6_irm9pb atm_adsui10tyobk_1heflvk atm_adsui1h392tq_3szr2b atm_adsuiatrpru_1d1fc98 atm_adsuiwv6oyq_1r1dq30 atm_adsui1wjk0g8_6e9m65 atm_adsui1bmpb92_cpeews atm_adsui1lgjzhx_1m800s6 atm_adsuijzdzyy_1mqbmot";function As({title:e,description:t,onSearch:a,children:s}){return d("section",{className:q("ux-specimen-page",Rs),"aria-label":e,children:[d("header",{children:[d("div",{className:"ux-specimen-heading",children:[d("h1",{children:e}),a&&d("input",{type:"search","aria-label":"Find token",placeholder:"Find a token",onInput:(r)=>a(r.currentTarget.value)})]}),t&&d("p",{children:t})]}),d("div",{"data-slot":"content",children:s})]})}var Ya="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_1y3gjcq atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsuimrwrxb_1210cad atm_adsui165a258_idpfg4 atm_adsuindcbtc_idpfg4 atm_adsui1ywdvs7_idpfg4 atm_adsui7bg9zp_107lskt atm_adsuiqjzyof_idpfg4 atm_adsui15n9hsn_idpfg4 atm_adsuigpq1w8_idpfg4 atm_adsui1ts7i44_1gr7bv3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuilz7qdd_6s8zn8 atm_adsui134y5xe_1ncjpb7 atm_adsui1nznzd5_1gr7bv3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsui1iqqh5c_6s8zn8 atm_adsui1j124uw_1ncjpb7 atm_adsui1qgxgro_1gr7bv3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui8dg1eh_6s8zn8 atm_adsui1t5abo5_1ncjpb7 atm_adsui1pcy8k9_1gr7bv3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiv4wfzc_6s8zn8 atm_adsuiln2feu_1ncjpb7",Xa="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_kyo2w3 atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsuimrwrxb_6s8zn8 atm_adsui165a258_idpfg4 atm_adsuindcbtc_idpfg4 atm_adsui1ywdvs7_idpfg4 atm_adsui7bg9zp_h3ouum atm_adsuiqjzyof_idpfg4 atm_adsui15n9hsn_idpfg4 atm_adsuigpq1w8_idpfg4 atm_adsui1ts7i44_kyo2w3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuilz7qdd_6s8zn8 atm_adsui134y5xe_h3ouum atm_adsui1nznzd5_kyo2w3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsui1iqqh5c_6s8zn8 atm_adsui1j124uw_h3ouum atm_adsui1qgxgro_kyo2w3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui8dg1eh_6s8zn8 atm_adsui1t5abo5_h3ouum atm_adsui1pcy8k9_kyo2w3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiv4wfzc_6s8zn8 atm_adsuiln2feu_h3ouum",ei="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_1y3gjcq atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsui1xr9v27_1210cad atm_adsuif3wayr_idpfg4 atm_adsuimgqw9w_idpfg4 atm_adsui8iopdn_idpfg4 atm_adsuix9z4xg_107lskt atm_adsui1wohlm_idpfg4 atm_adsuiu9g1y7_idpfg4 atm_adsui1orm0qo_idpfg4 atm_adsuiskdtbx_15wbn57 atm_adsuip945hm_1pzsloo atm_adsui1ts7i44_1gr7bv3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuizryume_6s8zn8 atm_adsui1ngmxnq_1ncjpb7 atm_adsui1nznzd5_1gr7bv3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsuin783i1_6s8zn8 atm_adsui1l75c4v_1ncjpb7 atm_adsui1qgxgro_1gr7bv3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui1i44mqh_6s8zn8 atm_adsuivsouqh_1ncjpb7 atm_adsui1pcy8k9_1gr7bv3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiehc6gd_6s8zn8 atm_adsuittpjm6_1ncjpb7",ti="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_dk28gj atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsui1xr9v27_6s8zn8 atm_adsuif3wayr_idpfg4 atm_adsuimgqw9w_idpfg4 atm_adsui8iopdn_idpfg4 atm_adsuix9z4xg_h3ouum atm_adsui1wohlm_idpfg4 atm_adsuiu9g1y7_idpfg4 atm_adsui1orm0qo_idpfg4 atm_adsuiskdtbx_15wbn57 atm_adsuip945hm_1pzsloo atm_adsui1ts7i44_dk28gj atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuizryume_6s8zn8 atm_adsui1ngmxnq_h3ouum atm_adsui1nznzd5_dk28gj atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsuin783i1_6s8zn8 atm_adsui1l75c4v_h3ouum atm_adsui1qgxgro_dk28gj atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui1i44mqh_6s8zn8 atm_adsuivsouqh_h3ouum atm_adsui1pcy8k9_dk28gj atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiehc6gd_6s8zn8 atm_adsuittpjm6_h3ouum",Is="atm_adsui9s_116y0ak atm_adsuiar_vrvcex atm_adsuih_1h6ojuz atm_adsui1xk5jbi_1aou828 atm_adsui15ztyo3_1wugsn5 atm_adsuiya8ym_12336oc atm_adsuiou0xue_1h6ojuz atm_adsuip2cq0w_idpfg4 atm_adsui3y46a7_pfqszd atm_adsui1e8hxr8_1f51e7f atm_adsui1w4yjon_1wugsn5 atm_adsui1fm6vu0_1aou828 atm_adsuieb1l7_1wugsn5 atm_adsuiu4pov9_1f51e7f atm_adsuibd751w_1wugsn5 atm_adsuip12vv8_1aou828 atm_adsui119azkn_1wugsn5 atm_adsuidutd7r_1f51e7f atm_adsuivm5w66_1wugsn5 atm_adsui7msh7_116y0ak atm_adsuijq6hmp_1q9ycp6 atm_adsuiqu4bbn_1h6ojuz atm_adsui1450k7n_1ulexfb atm_adsui7bxzlg_h68d5v atm_adsuin2zkk7_24x154 atm_adsuicx_tx1for atm_adsuijb_idpfg4";function ai(e=!1,t=!1){return{header:q("ux-workspace-header",e?Xa:Ya),main:q("ux-workspace-main",e||t?ti:ei)}}var Hs="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v atm_adsuij6_idpfg4 atm_adsui26_1bplolx atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsui1swzw65_glywfm atm_adsuitwidkn_1eorbtc atm_adsui9sygfm_idpfg4 atm_adsui12bw0u4_10rgqv3 atm_adsuilgsf2q_1bplolx atm_adsui1czrkxg_m9afv7 atm_adsui1xxn05p_1txwivl atm_adsuijvq3zr_tx1for atm_adsui192tkol_1h6ojuz atm_adsui1uphbw0_1aqtv8w atm_adsui18j3xf2_1txwivl atm_adsuiv4kl24_1fhbwtr atm_adsui7tg88j_116y0ak atm_adsui3hsxdi_116y0ak atm_adsuiw4isa_1q9ycp6 atm_adsui1e372br_tx1for atm_adsuiol208p_idpfg4 atm_adsui1hwqkvt_14k5dlv atm_adsui1brizz9_1d1fc98 atm_adsui1qytvf8_1r1dq30 atm_adsui1i52crn_idpfg4 atm_adsui1rva9te_15vqwwr atm_adsui1ux9w3e_1l2sidv atm_adsui16phkqt_1q9ccgz atm_adsui11e3yb3_1wugsn5 atm_adsui121hswv_1txwivl atm_adsuikokisn_iqvn5y atm_adsui1xmdvl_1h6ojuz atm_adsuidgi0se_idpfg4 atm_adsui1106ncu_1wugsn5 atm_adsuiu6bb7r_tx1for atm_adsui1nngew9_1txwivl atm_adsui1hijnjn_1h6ojuz atm_adsui14yqywo_idpfg4 atm_adsui1n3v6f3_1wugsn5 atm_adsuibmhjpv_tx1for atm_adsuitwhtux_idpfg4 atm_adsui1t7jlm4_kb7nvz atm_adsuigr19py_idpfg4 atm_adsui1r3dd4x_1txwivl atm_adsui1dr8vx7_1bp4okc atm_adsui12n32ac_idpfg4 atm_adsui15x0kgb_m9afv7 atm_adsuixqxvxy_15vqwwr atm_adsuivq6bgu_ynj908 atm_adsui1o135n7_1bplolx atm_adsui7r55s8_kb7nvz atm_adsuiwklih5_idpfg4 atm_adsuixjj1j1_1wugsn5 atm_adsuirae8ic_1txwivl atm_adsui16ywoy7_kb7nvz atm_adsui3zzzu1_1bp4okc atm_adsuioe3i46_idpfg4 atm_adsuigjcmck_h2mmj6 atm_adsui16iisfr_15vqwwr atm_adsui1jwmmnn_idpfg4 atm_adsuiobixd9_kb7nvz atm_adsui1bb1xke_idpfg4 atm_adsuivnahyn_idpfg4 atm_adsui1xr98ve_1bgihbq atm_adsui18tesp1_1ulexfb atm_adsui3im4ne_idpfg4 atm_adsui3aiucy_1osqo2v atm_adsui1rjdu20_1osqo2v atm_adsuitmy5t6_1txwivl atm_adsui1dgldxt_esu3gu atm_adsui1ggjjzu_iqvn5y atm_adsui138t24g_4baac9 atm_adsui1qnyawd_m9afv7 atm_adsui4v0vbm_1bplolx atm_adsui1jhz6h2_glywfm atm_adsui1chybqy_stnw88 atm_adsui1br56z7_idpfg4 atm_adsui888a6e_o2ms3 atm_adsui1xuvgmd_11p5wf0 atm_adsuirxsuh_1h6ojuz atm_adsui1mqap2g_1bplolx atm_adsui1xhqumc_14k5dlv atm_adsuirc18cp_14k5dlv atm_adsuirrx08l_moeofi atm_adsuiey7ewl_nqa18y atm_adsuigux95j_7uy8cq atm_adsui1fe4k5a_12j2sah atm_adsuig4uoah_1v7nmpu atm_adsui11rdqaw_1wdkmbo atm_adsui18vvlvy_19uah5m atm_adsui1cw8iwc_dcxj7s atm_adsui1x2b1m8_1kw7nm4 atm_adsuitbv4yw_1bplolx atm_adsuizgbt4v_1wskm3t atm_adsui17eejsz_m9afv7 atm_adsuid87q3_idpfg4 atm_adsuitcdkhm_glywfm atm_adsui1xeiopu_1h6ojuz atm_adsui1ggp9a3_idpfg4 atm_adsui1k34kje_glywfm atm_adsui1gdfntm_idpfg4 atm_adsuiz1ci95_1knmvda atm_adsuiiqm1lt_1wugsn5 atm_adsuiez3a21_15vqwwr atm_adsui8ru30r_glywfm atm_adsui1b3wxlc_1osqo2v atm_adsui129m0mj_11p5wf0 atm_adsui5w99fc_cmo227 atm_adsuirt32k7_idpfg4 atm_adsui1bb439o_1uq4mm2 atm_adsui1azndq0_1txwivl atm_adsui1ef74b0_1bp4okc atm_adsui1r8nml_idpfg4 atm_adsui1oioy44_idpfg4 atm_adsui4s98mp_m9afv7 atm_adsuipkg9do_1m800s6 atm_adsui805znv_19dj2kj atm_adsui1uyulxv_8p4f3e atm_adsuiwjjjyp_idpfg4 atm_adsuii2eazt_m9afv7 atm_adsui1gx3q7f_kb7nvz atm_adsui1adcp8o_idpfg4 atm_adsui3micw4_1txwivl atm_adsui1q69jt1_1h6ojuz atm_adsui12dg9uo_1osqo2v atm_adsuia71lpn_1knmvda atm_adsuim1gh36_glywfm atm_adsui10vojm5_glywfm";function Os({loading:e=!1,collapsed:t=!1,capture:a=!1,brand:s,sections:r,actions:i,navigation:n,overlays:o,previewOverlay:_,previewTools:u,children:c}){return d("div",{id:"workspace","data-loading":e,"data-collapsed":t,"data-capture":a,"aria-busy":e,className:q("ux-workspace",Hs),children:[d("header",{id:"header",className:q("ux-workspace-header",t?Xa:Ya),children:[d("div",{id:"brand",className:"ux-workspace-brand",children:s}),d("div",{className:"ux-workspace-bar",children:[d("nav",{id:"sections",className:"ux-workspace-sections","aria-label":"Showcase sections",children:r}),d("div",{className:"ux-workspace-actions",children:i})]})]}),o,d("main",{className:q("ux-workspace-main",t||a?ti:ei),children:[d("aside",{id:"sidebar",className:"ux-workspace-sidebar",children:n}),d("section",{id:"preview-workspace",className:"ux-workspace-content","aria-label":"Preview workspace",children:d("section",{id:"preview",className:"ux-workspace-preview","aria-label":"Preview",children:[_,u&&d("div",{className:"ux-workspace-preview-tools",role:"toolbar","aria-label":"Preview tools",children:u}),d("div",{id:"frame-slot",className:"ux-workspace-slot",children:c})]})})]})]})}function Bs({title:e="Design system",loading:t=!1,section:a="tokens",previewStatus:s,guidesAvailable:r=!1,guideOptions:i,navigation:n,children:o}){return d(Os,{loading:t,brand:d(J,{children:[d("span",{className:q("ux-workspace-name",Is),children:[d("span",{className:"ux-workspace-logo",children:d(ts,{})}),d("span",{className:"ux-workspace-name-text",children:[d("span",{className:"ux-workspace-mark",children:"ADS"}),d("span",{id:"title",className:"ux-workspace-title",children:e})]})]}),d(P,{id:"pane-toggle",label:"Hide navigation pane",iconOnly:!0,expanded:!0,controls:"sidebar",children:d(A,{name:"chevron-left"})})]}),sections:d(J,{children:[d(P,{label:"Brand",section:"brand",current:a==="brand",children:d(A,{name:"brand"})}),d(P,{label:"Icons",section:"icons",current:a==="icons",children:d(A,{name:"icons"})}),d(P,{label:"Pictograms",section:"pictograms",current:a==="pictograms",children:d(A,{name:"pictograms"})}),d(P,{label:"Tokens",section:"tokens",current:a==="tokens",children:d(A,{name:"tokens"})}),d(P,{label:"Components",section:"components",current:a==="components",children:d(A,{name:"components"})}),d(P,{label:"Patterns",section:"patterns",current:a==="patterns",children:d(A,{name:"patterns"})}),d(P,{label:"Composition",section:"composition",current:a==="composition",children:d(A,{name:"composition"})}),d(P,{label:"Drafts",section:"drafts",current:a==="drafts",children:d(A,{name:"drafts"})})]}),actions:d(J,{children:[d($s,{...s}),d(P,{id:"viewport",label:"Phone viewport",iconOnly:!0,pressed:!1,controls:"frame-slot",children:d(A,{name:"phone"})}),d(P,{id:"grid-overlay",label:"Layout guides",iconOnly:!0,controls:"grid-options",popoverTarget:"grid-options",hidden:!r,children:d(A,{name:"layout"})}),d("select",{id:"brand-select",className:"ux-workspace-brand-select","aria-label":"Preview brand",hidden:!0}),d(P,{id:"theme",label:"Use dark theme",iconOnly:!0,children:d(A,{name:"moon"})}),d(P,{id:"minimize",label:"Minimize showcase menu",iconOnly:!0,children:d(A,{name:"chevron-up"})})]}),overlays:d(hs,{...i}),navigation:d(Ss,{id:"entries",label:"Entries",children:n}),previewTools:d(P,{id:"split-view",label:"Split view",iconOnly:!0,pressed:!1,disabled:!0,hidden:!0,children:d(A,{name:"split"})}),previewOverlay:d("div",{id:"loader",className:"ux-workspace-loader",role:"status","aria-label":"Loading preview",hidden:!0,children:d("span",{className:"ux-workspace-spinner","aria-hidden":"true"})}),children:o})}function $t(e,t){let a=document.createElement("div");return le(d(e,{...t}),a),a.firstElementChild}function ii(e){return le(d(Bs,{title:"",loading:!0}),e),()=>le(null,e)}var si=(e)=>$t(Es,e),ni=(e)=>$t(_s,e),ri=(e)=>$t(As,e);var Re=new WeakMap;function rt(e){let t=Re.get(e);return!!t&&t.parentNode===e&&!!t.firstElementChild}function Rt(e,t){let a=Re.get(e);if(!a||a.parentNode!==e){if(a)le(null,a);a=document.createElement("div"),a.className="ux-icons-mount",Re.set(e,a),e.replaceChildren(a)}return le(d(qs,{data:t}),a),a.firstElementChild}function At(e){let t=Re.get(e);if(!t)return;le(null,t),t.remove(),Re.delete(e)}function oi(e,t){le(d(Qa,{message:t}),e)}var ot="ads://project/icons";ii(document.getElementById("app"));var m=(e)=>document.getElementById(e),I=new URLSearchParams(location.search),di=I.get("scenario"),Ds=["brand","icons","pictograms","tokens","components","patterns","composition","drafts"],_t=!1,fe=[],N,pe=I.get("draft"),Ut=[],ci=[],Wt=new Map,re=I.get("split")==="1",Ot,G=[],F=0,ft;async function Be(){let e=G;G=[],await Promise.allSettled(e.map((t)=>t.close()))}var ve=m("split-view"),y="brand",R={},ui=new Map,he=!0,pt=[],je=[],gt=[],B,ze,M,S,we,Ie,ke,ct,ye,H=0,be=I.get("capture")!=="1"&&I.get("viewport")==="phone",D=[{name:"light",scheme:"light"},{name:"dark",scheme:"dark"}],oe=I.get("capture")==="1"&&I.get("theme")||"light";if(I.get("capture")==="1")m("workspace").dataset.capture="true",Si();var Bt=()=>D.find((e)=>e.name===oe)?.scheme??"light";function li(){document.documentElement.dataset.theme=Bt();let e=D[(D.findIndex((a)=>a.name===oe)+1)%D.length],t=D.length>1?`Use ${e.name} theme`:`Theme: ${oe}`;m("theme").setAttribute("aria-label",t),m("theme").title=t,m("theme").disabled=D.length<2,m("theme").querySelector("svg").innerHTML=Bt()==="dark"?'<circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/>':'<path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/>'}document.documentElement.dataset.theme="light";var me=[],Q=I.get("capture")==="1"&&I.get("brand")||null;function mi(){let e=m("brand-select");if(e.hidden=!me.length,e.options.length!==me.length||me.some((t,a)=>e.options[a].value!==t.name))e.replaceChildren(...me.map((t)=>Object.assign(document.createElement("option"),{value:t.name,textContent:t.name})));if(Q)e.value=Q,e.title=`Brand: ${Q}`}var ht=oa(async(e)=>{if(e)await Kt();await V(),await Ci()},{onError:O}),Dt,De=!1,qe=!1,Ft=!1,se,K,It=0,Ae,ie=!1,ge=new AbortController;window.addEventListener("blur",()=>setTimeout(()=>{if(document.activeElement?.tagName==="IFRAME")for(let e of document.querySelectorAll(":popover-open"))e.hidePopover()},0));var L=sa(),fi=(e,t={},a={})=>L.callTool({name:e,arguments:t},{signal:ge.signal,...a}),lt=ra((e)=>L.readResource(e,{signal:ge.signal}),{signal:ge.signal,onDiagnostic:(e)=>{if(e.state==="retry")document.documentElement.dataset.adsResourceRetries=String(Number(document.documentElement.dataset.adsResourceRetries??0)+1);console.warn("ADS resource transport",e)}}),Gt=async(e)=>JSON.parse((await lt({uri:e})).contents.find((t)=>typeof t.text==="string").text);function pi(e){let t=gt.find((a)=>a.name===e.name);if(!t||!(t._meta?.ui?.visibility??["model","app"]).includes("app"))throw Error("This tool is not callable from an App.");return L.callTool(e)}var Vt="";function z(e,t=!1,a=t?"error":e?"checking":"ready"){if(Ft)e="Connection interrupted. Reconnecting… The retained preview may be stale.",t=!0,a="error";let s=e||"Preview is up to date.";if(m("preview-error").hidden=!t,oi(m("status"),s),Vt=s,m("status").dataset.error=String(t),!t)for(let r of["errorCategory","errorCode","resourceUri"])delete m("status").dataset[r];m("status").setAttribute("role",t?"alert":"status"),m("preview-status").dataset.phase=a,m("preview-status").querySelector(".ds-preview-indicator").dataset.state=["reloading","compiling","reverting"].includes(a)?"building":a,m("preview-status").title=s,m("preview-status").setAttribute("aria-label",`Preview status: ${s.split(`
|
|
5
|
+
`)[0]}`),gi()}function gi(){let e=ze?.warmup,t=e?`Background views: ${e.completed}/${e.total} compiled${e.failed?`; ${e.failed} failed`:""}.`:"";m("warmup-status").hidden=!e,m("warmup-status").textContent=t,m("preview-status").dataset.warmup=e?.state??"disabled",m("preview-status").title=[Vt,t].filter(Boolean).join(`
|
|
6
|
+
`)}function hi(){z(M?"Updating preview…":"Opening preview…",!1,"reloading")}function de(){return ue().find((e)=>e.id===R[y])}function Ce(e=de()){let t=fe.find((a)=>a.id===pe&&Wt.get(a.id)?.scenario===e?.id);return e?.drafts?.find((a)=>a.id===pe)??t??e?.drafts?.[0]}function Zt(){return Boolean(Ce()&&(y==="drafts"||de()?.draftOnly||re))}function He(){return y==="drafts"?de()?.previewId:R[y]}function Oe(){return`${y}:${R[y]}${Zt()?`:draft:${Ce().id}:split:${re}`:""}`}function dt(e=M){return e?.key===Oe()}function wi(e=ze){if(Zt()){let t=e?.drafts?.find((a)=>a.id===Ce()?.id);return t?.scenarios?.find((a)=>a.id===He())??t}return e?.previews?.find((t)=>t.id===He())}var vi=(e)=>JSON.stringify(e&&[e.session,e.revision,e.current,e.live]);function yi(){({scenarios:je,categories:pt}=ca(Ut,ci,fe,Wt))}function Ls(e){Wt.set(e.structuredContent.id,e.structuredContent),yi()}async function Lt(e,t,a=ge.signal){let s=(B?.compiler?.buildTimeoutMs??30000)+15000;try{return await fi(e,t,{signal:AbortSignal.any([ge.signal,a]),timeout:s})}catch(r){if(r.code!=="REQUEST_TIMEOUT")throw r;throw Object.assign(Error(`The preview request timed out after ${Math.ceil(s/1000)} seconds. No preview result was received. Retry the preview.`,{cause:r}),{code:"ADS_PREVIEW_REQUEST_TIMEOUT",category:"transport"})}}async function Jt(e,t,a){let s=(de()?.id===t||y==="drafts")&&de()?.pendingDraftScenario||e.units?.includes(t)&&!Ut.some((i)=>i.id===t),r=await Lt("ads_show_draft",{id:e.id,...!s&&t?{scenario:t}:{}},a);if(r.isError)throw Error(r.content?.find((i)=>i.type==="text")?.text??"Draft preview failed.");if(s){let i=r.structuredContent.scenarios.find((n)=>t==="tokens"?n.kind==="tokens":n.unit?n.unit===t:Ke(t,n.id));if(!i)throw Error("Draft owner has no scenario yet. Add an independently mountable scenario before previewing it.");if(i.id!==r.structuredContent.scenario)r=await Lt("ads_show_draft",{id:e.id,scenario:i.id},a);if(r.isError)throw Error(r.content?.find((n)=>n.type==="text")?.text??"Draft preview failed.")}return Ls(r),r}function Y(e=!1){if(e)ye=M?.key;ke=void 0,m("loader").hidden=!0,m("preview").setAttribute("aria-busy","false")}function Ht(e){let t=new URL(location.href);for(let r of["scenario","draft","split","section"])t.searchParams.delete(r);if(y==="icons")return t.searchParams.set("section","icons"),t.pathname+t.search+t.hash;if(y==="drafts"){t.searchParams.set("section","drafts");let r=ue().find((i)=>i.id===e);if(r?.drafts?.[0])t.searchParams.set("draft",r.drafts[0].id);if(r?.previewId)t.searchParams.set("scenario",r.previewId);if(re)t.searchParams.set("split","1");return t.pathname+t.search+t.hash}if(e)t.searchParams.set("scenario",e);let a=ue().find((r)=>r.id===e),s=Ce(a);if(s&&(a.draftOnly||re)){if(t.searchParams.set("draft",s.id),!a.draftOnly)t.searchParams.set("split","1")}return t.pathname+t.search+t.hash}function ue(){return y==="drafts"?la(je,fe):y==="tokens"?pt:y==="icons"?[{id:"icons",kind:"icons",title:"All icons"}]:je.filter((e)=>e.kind===y)}function ki(e,t){if(t.kind==="icons"&&y==="icons")return;let{state:a,label:s}=yt(t.previewId?{...t,id:t.previewId}:t,ze,pe),r=e.querySelector(".entry-preview");if(!r)return;r.dataset.state=a,r.title=s,e.dataset.buildState=a,e.setAttribute("aria-description",s)}var xe={...ma},_i=()=>y==="drafts"?de()?.kind:y,bi=()=>["components","patterns","composition"].includes(_i())||_i()==="tokens"&&He()==="tokens/Layout";function Le(){return xe}function Us(){return fa(Le())}function xi(){return pa(Le())}function ji(){let e=bi(),t=Le(),a=xi();m("grid-overlay").hidden=!e,m("grid-overlay").dataset.enabled=String(e&&a),m("grid-options-content").dataset.mode=t.mode;for(let s of m("grid-options").querySelectorAll('[id^="grid-options-mode-"]'))s.setAttribute("aria-pressed",String(s.id==="grid-options-mode-"+t.mode));for(let s of m("grid-options").querySelectorAll('[id^="grid-options-layer-"]'))s.setAttribute("aria-pressed",String(t[s.id.slice(19)]===!0));if(m("grid-options-hint").textContent=m("grid-options-hint").dataset[t.mode]??"",!e&&m("grid-options").matches(":popover-open"))m("grid-options").hidePopover()}var ut;function U(){return{...ut&&ut.target===He()?{adsFocus:ut}:{},theme:Bt(),adsTheme:oe,...Q?{adsBrand:Q}:{},gridOverlay:bi()&&xi(),gridGuides:Us(),gridGuideChoices:Le(),displayMode:"inline",containerDimensions:{width:m("frame-slot").clientWidth,height:m("frame-slot").clientHeight}}}function Se(){m("workspace").dataset.loading="false",m("workspace").setAttribute("aria-busy","false");let e=je.some((n)=>n.kind==="brand");if(m("sections").querySelector('[data-section="brand"]').hidden=!e,y==="brand"&&!e)y="tokens";if(m("sections").querySelector('[data-section="icons"]').hidden=!B?.icons,y==="icons"&&!B?.icons)y="tokens";let t=je.some((n)=>n.kind==="pictograms");if(m("sections").querySelector('[data-section="pictograms"]').hidden=!t,y==="pictograms"&&!t)y="tokens";document.body.dataset.activeSection=y;let a=ue();if(!a.some((n)=>n.id===R[y]))R[y]=a[0]?.id??null;ji(),S?.setHostContext(U()),history.replaceState(null,"",Ht(R[y]));let s=m("entries").scrollTop;m("entries").setAttribute("aria-label",y[0].toUpperCase()+y.slice(1));let r=(n)=>{let o=n.kind==="icons"&&y==="icons"?void 0:yt(n.previewId?{...n,id:n.previewId}:n,ze,pe),_=n.drafts?.length&&y!=="drafts",u=ni({label:n.title,href:Ht(n.id),current:n.id===R[y],previewState:o?.state,previewLabel:o?.label,draftLabel:_?n.drafts.length>1?`Drafts ${n.drafts.length}`:"Draft":void 0,draftDescription:_?n.draftOnly?"Draft only; no accepted version yet":"Draft available; use Split view to compare":void 0});if(u.href=Ht(n.id),u.dataset.scenario=n.id,ki(u,n),n.id===R[y])u.setAttribute("aria-current","page");return u.addEventListener("click",(c)=>{if(c.button||c.metaKey||c.ctrlKey||c.shiftKey||c.altKey)return;c.preventDefault(),R[y]=n.id,Se(),V().catch(O)}),u},i=da(a);if(y==="drafts"){let n=Object.values(Je);i.sort((o,_)=>n.indexOf(o.label)-n.indexOf(_.label))}m("entries").replaceChildren(...i.flatMap((n)=>{if(!n.label)return n.entries.map(r);let o=`${y}:${n.label}`,_=si({label:n.label,open:ui.get(o)??!0});return _.querySelector('[data-slot="entries"]').append(...n.entries.map(r)),_.addEventListener("toggle",()=>{if(_.isConnected)ui.set(o,_.open)}),[_]})),m("entries").scrollTop=s;for(let n of m("sections").querySelectorAll("button"))if(n.dataset.section===y)n.setAttribute("aria-current","page");else n.removeAttribute("aria-current");mt()}function O(e){if(!De&&!qe)Y(),m("status").dataset.errorCategory=e.category??(e.code==="ADS_RESOURCE_TRANSPORT"?"transport":"runner"),m("status").dataset.errorCode=e.code??"ADS_HOST_STARTUP",z(`${e.message}${M?`
|
|
7
|
+
The retained preview is not verified against the current source.`:""}`,!0)}async function ne(e){if(!e)return;try{await e.teardownResource({},{timeout:500})}catch{}await e.close()}function qi(){if(De||qe)return;Ft=!1,qe=!0,ge.abort(),++H,ht.close(),Y(),z(`${Me?"HTTP showcase":"MCP"} disconnected. The retained preview is stale. Refresh the page after restarting ADS.`,!0);let e=S;S=void 0,ne(e),++F,Be()}async function Kt(){let e=await Gt("ads://project/explorer");if(B=e.status,ze=B.build,gt=e.tools,B.themes?.length){if(D=B.themes,!D.some((i)=>i.name===oe))oe=D[0].name;li(),S?.setHostContext(U())}me=B.brands??[],Q=me.some((i)=>i.name===Q)?Q:me[0]?.name??null,mi(),S?.setHostContext(U()),ci=e.categories,Ut=e.scenarios,fe=e.drafts,m("title").textContent=(B.drafts?.previewOnly?"Draft · ":"")+B.project.showcase.title,m("title").title=B.projectRoot,yi();let t=he?di:R[y],a=he&&fe.find((i)=>i.id===pe),s=M?.draft&&fe.find((i)=>i.id===M.draftId);if(a||s&&N&&(s.revision!==N.revision||N.discovery?.state==="pending")){let i=await Jt(a||s,a?di:N.scenario);if(a)t=i.structuredContent.scenario;if(M?.draft&&s){N=i.structuredContent,ft=i;for(let n of G)if(n.side==="draft")await n.updateResult(i)}}let r=je.find((i)=>i.id===t);if(y==="drafts"||he&&I.get("section")==="drafts"){y="drafts";let i=ue(),n=i.find((o)=>o.drafts?.[0].id===pe&&o.previewId===t)??i.find((o)=>o.id===R.drafts)??i.find((o)=>o.drafts?.[0].id===pe);R.drafts=n?.id??i[0]?.id}else if(r&&Ds.includes(r.kind))y=r.kind,R[y]=r.id;else if(he&&pt.some((i)=>i.id===t))y="tokens",R.tokens=t;else if(he&&I.get("section")==="icons"&&B.icons)y="icons";he=!1,Se()}function V({force:e=!1}={}){if(qe)return Promise.resolve();if(y==="icons")return Fs(e);_t=!1,At(m("frame-slot"));let t=He(),a=Oe();if(we?.key===a)return we.promise;if(!e&&Ie?.key===a)return Promise.resolve();if(!e&&!we&&M?.key===a)return Promise.resolve();Ie=void 0;let s={key:a};return we=s,s.promise=Ws(t,a).finally(()=>{if(we===s)we=void 0}),s.promise}async function Ws(e,t){ct?.abort();let a=ct=new AbortController,s=++H;ke=!0,m("loader").hidden=t===ye,m("preview").setAttribute("aria-busy","true");try{if(++F,await Be(),s!==H)return;if(Zt()){await ne(S),S=void 0,se=void 0,K=void 0;let _=Ce(),u=await Jt(_,e,a.signal);if(s!==H)return;if(N=u.structuredContent,ft=u,y==="drafts"){let c=ue().find((p)=>p.drafts?.[0].id===_.id&&p.previewId===N.scenario);if(c)R.drafts=c.id}else if(de()?.pendingDraftScenario||!ue().some((c)=>c.id===e))R[y]=N.scenario;M={key:Oe(),id:N.scenario,draftId:_.id,generation:s,draft:!0},mt(),await Vs(),Se(),Y(!0),z("Draft preview only. Acceptance checks have not run.",!1,"ready");return}if(N=void 0,mt(),!e){if(await ne(S),s!==H)return;if(S=void 0,M=void 0,ye=void 0,se=void 0,K=void 0,m("frame-slot").replaceChildren(),Y(),y==="drafts"){m("frame-slot").append(ri({title:"Drafts",description:"No active drafts."})),z("");return}z("No scenarios discovered. Colocate an independently mountable scenario and fixture with the public implementation.");return}let r=gt.find((_)=>_.name==="ads_show_scenario");if(!r?._meta?.ui?.resourceUri)throw Error("The server did not expose a preview App tool.");let i={id:e};if(r.inputSchema?.properties?.waitFor)i.waitFor=I.get("capture")==="1"||I.get("waitFor")==="verified"?"verified":"compiled";hi();let n=await Lt(r.name,i,a.signal);if(s!==H)return;if(n.isError)throw Object.assign(Error(n.content?.find((_)=>_.type==="text")?.text??"Preview build failed."),n.structuredContent?.failure);M={key:t,id:e,generation:s,build:n.structuredContent?.build,manifestRevision:n.structuredContent?.manifestRevision};let o=await Gs(r._meta.ui.resourceUri);if(s!==H)return;if(se==="ui://ads/preview"&&!M.manifestRevision)throw Error("The resource preview has no manifest revision.");if(ye!==t)ye=void 0;if(await o.sendToolInput({arguments:i}),await o.sendToolResult(n),s===H&&!n.structuredContent?.manifestUri)Y(!0),z("")}catch(r){if(s===H)Ie={key:Oe(),build:vi(wi())},O(r)}}async function Fs(e){if(_t&&!e&&rt(m("frame-slot")))return;ct?.abort();let t=++H;if(!rt(m("frame-slot"))){m("loader").hidden=!1,++F,await Be();let a=S;S=void 0,M=void 0,ye=void 0,se=void 0,K=void 0,N=void 0,await ne(a)}try{let a=await Gt(ot);if(t!==H||y!=="icons")return;Rt(m("frame-slot"),a),_t=!0,Y(),z(""),mt()}catch(a){if(t===H)O(a)}}async function Gs(e){if(se===e&&K)return K;let t=++It,a=S;S=void 0,se=e,K=(async()=>{await ne(a);let s=ie?void 0:await lt({uri:e});if(t!==It||De||qe)throw Error("Preview opening was superseded.");let r=s?.contents.find((u)=>u.mimeType==="text/html;profile=mcp-app"&&typeof u.text==="string");if(!ie&&!r)throw Error("The preview resource contains no MCP App.");let i=document.createElement("iframe");if(i.title="Design-system preview",i.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),!ie)i.src=Ae;m("frame-slot").replaceChildren(i);let n=ie?Ze({frame:i,context:U()}):new Ge(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:U()});S=n,n.onreadresource=(u)=>lt(u),n.oncalltool=pi,n.onloggingmessage=(u)=>{if(n!==S||u.logger!=="ads-preview"||M?.generation!==H||!dt()||u.data?.id!==M?.id)return;if(u.data.state==="guide-options"){xe=Te(u.data.options),ea();return}if(u.data.state==="navigate"){let p=pt.find((g)=>g.id===u.data.target);if(!p)return;if(ut={target:p.id,token:typeof u.data.token==="string"?u.data.token:void 0,nonce:Date.now()},R.tokens===p.id&&y==="tokens"){S?.setHostContext(U());return}y="tokens",R.tokens=p.id,Se(),V().catch(O);return}let c=u.data.revision===M.manifestRevision||u.data.selectionRevision===M.manifestRevision;if(u.data.state==="ready"&&c)M.manifestRevision=u.data.revision,Y(!0),z("");else if(u.data.state==="checking"&&(!ke||c))Y(!0),z("Checking changes…");else if(u.data.state==="loading")z("Updating preview…",!1,"reloading");else if(u.data.state==="reverting")z("Restoring the last verified preview…",!1,"reverting");else if(u.data.code==="ADS_PREVIEW_REOPEN")S=void 0,se=void 0,K=void 0,hi(),ne(n).then(()=>V({force:!0})).catch(O);else if(u.data.state==="error"){if(Y(),m("status").dataset.errorCategory=u.data.category??"build",m("status").dataset.errorCode=u.data.code??"ADS_PREVIEW_BUILD",u.data.resourceUri)m("status").dataset.resourceUri=u.data.resourceUri;else delete m("status").dataset.resourceUri;z([u.data.message,u.data.code,u.data.resourceUri].filter(Boolean).join(`
|
|
8
|
+
`),!0)}},n.onerror=O;let o,_=new Promise((u,c)=>{o=setTimeout(()=>c(Error("MCP App initialization timed out.")),15000),n.oninitialized=()=>{clearTimeout(o),u()}});if(!ie)n.onsandboxready=()=>n.sendSandboxResourceReady({html:r.text,csp:r._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});try{await Promise.all([n.connect(ie?void 0:new Ve(i.contentWindow,i.contentWindow)),_])}catch(u){throw await ne(n),u}finally{clearTimeout(o)}return n})();try{return await K}catch(s){if(t===It)se=void 0,K=void 0;throw s}}function zi(e,t){S?.receiveBuild?.(e,t);for(let a of G)a.receiveBuild?.(e,t)}async function Ci(e){let t=M,a=e??await Gt("ads://project/build");zi("ads://project/build",a),ze=a,gi();for(let r of m("entries").querySelectorAll("a[data-scenario]")){let i=ue().find((n)=>n.id===r.dataset.scenario);if(i)ki(r,i)}if(Ie?.key===Oe()){let r=wi(a);if(r&&(r.current||r.live)&&vi(r)!==Ie.build)await V({force:!0});return}if(!t||ke||!dt(t))return;if(t.draft){let r=a.drafts?.find((o)=>o.id===t.draftId),i=r?.scenarios?.find((o)=>o.id===N?.scenario)??r,n=i&&JSON.stringify([r?.session,i.revision,i.live?.revision,i.current]);if(i&&(i.current||i.live)&&t.buildSignature!==n){t.buildSignature=n;let o=fe.find((_)=>_.id===t.draftId);if(o){let _=await Jt(o,N.scenario);if(M!==t||ke||!dt(t))return;N=_.structuredContent,ft=_;for(let u of G)if(u.side==="draft")await u.updateResult(_)}}if(i?.state==="error")z("Draft preview build failed. Showing the previous preview.",!0);else if(i?.building)z(i.live||i.state==="checking"?"Draft preview compiled; checking changes…":"Building draft preview… Showing the previous preview.",!1,i.live||i.state==="checking"?"checking":"compiling");else if(i?.current&&Ot?.state==="ready")z("Draft preview ready · unaccepted.");return}if(M!==t||ke||!dt(t))return;let s=a.previews.find((r)=>r.id===t.id);if(!s){z("The selected scenario is no longer registered.",!0);return}if(["idle","building"].includes(s.state)&&t.build?.current&&s.session===t.build.session&&s.revision<=t.build.revision)return;if(s.state==="error"){z(`${Fe(s)}. Showing an earlier view.
|
|
9
|
+
${aa(s.diagnostics)}`,!0);return}if(["idle","building"].includes(s.state)){z(s.live?"Checking changes…":"Compiling changes… The current view is the previous preview.",!1,s.live?"checking":"compiling");return}if(s.current&&(s.revision!==t.build?.revision||s.session!==t.build?.session))await V({force:!0});else if(s.current&&document.documentElement.dataset.adsConnection==="connected"&&Vt.startsWith("Connection restored."))z("")}function wt(e=!1){ht.schedule(e)}async function Vs(){if(!N)return;let e=N,t=ft;Ot=void 0;let a=++F;if(await Be(),a!==F)return;let s=re&&e.acceptedExists;ve.setAttribute("aria-pressed",String(s));let r=document.createElement("div");r.className="draft-comparison",r.dataset.split=String(s);for(let i of s?["accepted","draft"]:["draft"]){let n=document.createElement("section");n.className="draft-version";let o=document.createElement("h2");o.dataset.version=i,o.textContent=i==="accepted"?"Accepted":"Draft · unaccepted";let _=document.createElement("div");_.className="draft-stage",_.dataset.version=i,n.append(o,_),r.append(n)}m("frame-slot").replaceChildren(r),await Promise.all([...r.querySelectorAll(".draft-stage")].map(async(i)=>{let n=i.dataset.version,o=n==="draft"?t:await fi("ads_show_scenario",{id:e.scenario,waitFor:"compiled"});if(o.isError)throw Error(o.content?.find((c)=>c.type==="text")?.text??"Comparison build failed.");if(a!==F)return;let _=gt.find((c)=>c.name===(n==="draft"?"ads_show_draft":"ads_show_scenario")),u=await _a({slot:i,title:n==="draft"?"Draft version":"Accepted version",sandboxUrl:Ae,httpPreview:ie,resourceUri:_._meta.ui.resourceUri,result:o,readResource:lt,callTool:pi,context:(c)=>({...U(),containerDimensions:{width:c.clientWidth,height:c.clientHeight}}),onError:(c)=>{if(a===F)O(c)},onState:(c)=>{if(a!==F)return;if(c.state==="guide-options"){xe=Te(c.options),ea();return}if(n!=="draft")return;if(Ot=c,c.state==="ready")z("Draft preview ready · unaccepted.");else if(c.state==="checking")z("Draft preview compiled; checking changes…",!1,"checking");else if(["loading","reverting"].includes(c.state))z("Updating draft preview…",!1,"reloading")}});if(a!==F)await u.close();else G.push({...u,side:n})}))}function mt(){let e=de(),t=Boolean(Ce(e))&&!e?.draftOnly;ve.disabled=!t,ve.hidden=!t,ve.title=e?.draftOnly?"No accepted version yet":t?"Compare accepted and draft versions":"No draft for this entry",ve.setAttribute("aria-pressed",String(t&&re));let a=document.querySelector('.draft-version h2[data-version="draft"]');if(a&&N){let s={draft:"unaccepted",checking:"checking acceptance",failed:"acceptance failed",conflict:"source conflict",interrupted:"acceptance interrupted","dependency-error":"dependency needs attention"};a.textContent=`Draft · ${s[N.state]??N.state}`,a.title=N.dependencies?.length?`Draft dependencies: ${N.dependencies.join(", ")}`:""}}ve.addEventListener("click",()=>{re=!re,Se(),V().catch(O)});for(let e of m("sections").querySelectorAll("button"))e.addEventListener("click",()=>{y=e.dataset.section,Se(),V().catch(O)});var Qt=window.matchMedia("(max-width: 760px)");function Si(){let e=m("workspace"),t=ai(e.dataset.collapsed==="true",e.dataset.capture==="true");m("header").className=t.header,e.querySelector(":scope > main").className=t.main}function Yt(e){m("workspace").dataset.collapsed=String(e),Si(),m("pane-toggle").setAttribute("aria-expanded",String(!e)),m("pane-toggle").setAttribute("aria-label",e?"Show navigation pane":"Hide navigation pane"),m("pane-toggle").title=e?"Show navigation pane":"Hide navigation pane",m("pane-toggle").querySelector("path").setAttribute("d",e?"M6 4l4 4-4 4":"M10 4l-4 4 4 4")}var Xt=()=>Yt(Qt.matches||m("header").hidden);Xt();Qt.addEventListener("change",Xt);m("pane-toggle").addEventListener("click",()=>Yt(m("workspace").dataset.collapsed!=="true"));function Ei(){m("workspace").dataset.viewport=be?"phone":"auto",m("viewport").setAttribute("aria-pressed",String(be)),m("viewport").title=be?"Use available preview width":"Preview at phone width (390 px)"}Ei();m("viewport").addEventListener("click",()=>{be=!be,Ei();let e=new URL(location.href);if(be)e.searchParams.set("viewport","phone");else e.searchParams.delete("viewport");history.replaceState(null,"",e.pathname+e.search+e.hash)});m("theme").addEventListener("click",()=>{oe=D[(D.findIndex((e)=>e.name===oe)+1)%D.length].name,li(),S?.setHostContext(U())});m("theme").addEventListener("click",()=>{for(let e of G)e.refreshContext()});m("brand-select").addEventListener("change",()=>{Q=m("brand-select").value,mi(),S?.setHostContext(U());for(let e of G)e.refreshContext()});m("grid-options").addEventListener("click",(e)=>{let[,t,a]=/^grid-options-(mode|layer|preset)-(.+)$/.exec(e.target.closest("button")?.id??"")??[],s=Le();if(t==="mode")xe={...s,mode:a};else if(t==="layer")xe={...s,[a]:s[a]!==!0};else if(t==="preset")xe={...s,...Va(a),mode:s.mode==="off"?"hover":s.mode};else return;ea()});function ea(){ji(),S?.setHostContext(U());for(let e of G)e.refreshContext()}m("grid-options").addEventListener("toggle",(e)=>m("grid-overlay").setAttribute("aria-expanded",String(e.newState==="open")));m("minimize").addEventListener("click",()=>{m("header").hidden=!0,Yt(!0)});var Ni=new ResizeObserver(()=>S?.setHostContext(U()));Ni.observe(m("frame-slot"));m("retry-preview").addEventListener("click",()=>{(async()=>{await Kt(),await V({force:!0})})().catch(O)});window.addEventListener("pagehide",()=>{De=!0,ct?.abort(),ge.abort(),ht.close(),Ni.disconnect(),Qt.removeEventListener("change",Xt),ne(S),++F,Be(),Dt?.close(),L.close()},{once:!0});L.onclose=qi;L.onconnectionchange=({connected:e,reconnected:t})=>{if(De||qe)return;if(Ft=!e,document.documentElement.dataset.adsConnection=e?"connected":"reconnecting",!e){z("");return}if(t){z("Connection restored. Checking the current preview…",!1,"checking"),wt(!0),S?.reconcileBuild?.();for(let a of G)a.reconcileBuild?.()}};L.onBuildReport?.((e,t)=>{if(e==="ads://project/build")Ci(t).catch(O);else zi(e,t)});L.setNotificationHandler("notifications/resources/list_changed",()=>wt(!0));L.setNotificationHandler("notifications/tools/list_changed",()=>wt(!0));L.setNotificationHandler("notifications/resources/updated",({params:e})=>{if(Me&&e.uri==="ads://project/build")return;if(e.uri===ot)_t=!1;wt(e.uri==="ads://project/explorer")});try{let e=await fetch("host.json").then((t)=>t.json());if(Ae=e.sandboxUrl,ie=Me,Me&&!e.httpPreview)throw Error("HTTP showcase delivery is unavailable.");if(!Ae||new URL(Ae).origin===location.origin)throw Error("The separate-origin preview sandbox is unavailable.");await ia(L),Dt=await L.listen({resourcesListChanged:!0,toolsListChanged:!0,resourceSubscriptions:["ads://project/build","ads://project/tokens","ads://project/explorer",ot]}),Dt.closed.then((t)=>{if(t!=="local")qi()}),await Kt(),ht.start(),await V()}catch(e){O(e)}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { httpResourcePath } from "../src/showcase-http-routes.mjs";
|
|
2
|
+
|
|
3
|
+
export const httpTransport = true;
|
|
4
|
+
// These branches are never used by the HTTP shell; no MCP SDK is imported or bundled.
|
|
5
|
+
export const AppBridge = undefined, PostMessageTransport = undefined;
|
|
6
|
+
export const connectClient = async () => {};
|
|
7
|
+
|
|
8
|
+
/** Adapts ordinary JSON/HTTP to the shared shell's internal preview model. */
|
|
9
|
+
export function createClient() {
|
|
10
|
+
const lifetime = new AbortController(), handlers = new Map();
|
|
11
|
+
const buildListeners = new Set(), buildReads = new Map();
|
|
12
|
+
let subscription;
|
|
13
|
+
async function request(path, { body, signal, timeout = 45000 } = {}) {
|
|
14
|
+
const limit = AbortSignal.timeout(timeout);
|
|
15
|
+
const combined = AbortSignal.any([lifetime.signal, limit, ...(signal ? [signal] : [])]);
|
|
16
|
+
try {
|
|
17
|
+
const response = await fetch(new URL(`api/${path}`, location.href), {
|
|
18
|
+
signal: combined, ...(body === undefined ? {} : { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) }),
|
|
19
|
+
});
|
|
20
|
+
const data = await response.json();
|
|
21
|
+
if (!response.ok) throw Object.assign(new Error(data.error?.message ?? "Showcase HTTP request failed."), data.error);
|
|
22
|
+
return data;
|
|
23
|
+
} catch (error) {
|
|
24
|
+
if (limit.aborted && !signal?.aborted && !lifetime.signal.aborted) throw Object.assign(new Error("Showcase HTTP request timed out."), { code: "REQUEST_TIMEOUT" });
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const client = {
|
|
29
|
+
async readResource({ uri }, options) {
|
|
30
|
+
const path = httpResourcePath(uri);
|
|
31
|
+
const read = async () => ({ contents: [{ uri, mimeType: "application/json", text: JSON.stringify(await request(path, options)) }] });
|
|
32
|
+
if (!/(?:^|\/)build$/.test(path)) return read();
|
|
33
|
+
const previous = buildReads.get(uri);
|
|
34
|
+
if (previous && previous.signal === options?.signal) return previous.task;
|
|
35
|
+
const entry = { signal: options?.signal, task: read() };
|
|
36
|
+
buildReads.set(uri, entry);
|
|
37
|
+
const done = () => { if (buildReads.get(uri) === entry) buildReads.delete(uri); };
|
|
38
|
+
entry.task.then(done, done);
|
|
39
|
+
return entry.task;
|
|
40
|
+
},
|
|
41
|
+
onBuildReport(listener) { buildListeners.add(listener); return () => buildListeners.delete(listener); },
|
|
42
|
+
async callTool({ name, arguments: args = {} }, options) {
|
|
43
|
+
let path, body;
|
|
44
|
+
if (name === "ads_show_scenario") { path = "previews"; body = args; }
|
|
45
|
+
else if (name === "ads_show_draft" && /^[a-zA-Z0-9_-]+$/.test(args.id)) {
|
|
46
|
+
path = `drafts/${args.id}/preview`; body = { ...args }; delete body.id;
|
|
47
|
+
} else throw new Error("This action is not available in the HTTP showcase.");
|
|
48
|
+
return { structuredContent: await request(path, { ...options, body }) };
|
|
49
|
+
},
|
|
50
|
+
setNotificationHandler(name, handler) { handlers.set(name, handler); },
|
|
51
|
+
async listen({ resourceSubscriptions = [] } = {}) {
|
|
52
|
+
const wanted = new Set(resourceSubscriptions);
|
|
53
|
+
const source = new EventSource(new URL("api/events", location.href));
|
|
54
|
+
let finish, ready, fail, initialized = false, disconnected = false;
|
|
55
|
+
const closed = new Promise(resolve => { finish = resolve; });
|
|
56
|
+
const connected = new Promise((resolve, reject) => { ready = resolve; fail = reject; });
|
|
57
|
+
const timer = setTimeout(() => { source.close(); fail(new Error("Showcase event stream timed out.")); finish("remote"); }, 15000);
|
|
58
|
+
source.onmessage = event => {
|
|
59
|
+
const value = JSON.parse(event.data);
|
|
60
|
+
if (value.type === "ready") {
|
|
61
|
+
clearTimeout(timer); ready();
|
|
62
|
+
client.onconnectionchange?.({ connected: true, reconnected: initialized });
|
|
63
|
+
disconnected = false;
|
|
64
|
+
initialized = true;
|
|
65
|
+
} else if (value.type === "build") { for (const listener of buildListeners) listener(value.uri, value.report); }
|
|
66
|
+
else if (value.type === "resources") handlers.get("notifications/resources/list_changed")?.();
|
|
67
|
+
else if (value.type === "tools") handlers.get("notifications/tools/list_changed")?.();
|
|
68
|
+
else if (value.type === "resource" && wanted.has(value.uri)) handlers.get("notifications/resources/updated")?.({ params: { uri: value.uri } });
|
|
69
|
+
};
|
|
70
|
+
source.onerror = () => {
|
|
71
|
+
// EventSource reconnects the stream. Do not turn a transient network
|
|
72
|
+
// failure into permanent shutdown or a second status polling loop.
|
|
73
|
+
if (!disconnected) client.onconnectionchange?.({ connected: false });
|
|
74
|
+
disconnected = true;
|
|
75
|
+
if (source.readyState === EventSource.CLOSED) {
|
|
76
|
+
clearTimeout(timer); fail(new Error("Showcase event stream closed.")); finish("remote");
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
subscription = { closed, close() { source.close(); clearTimeout(timer); fail(new DOMException("Showcase closed", "AbortError")); finish("local"); } };
|
|
80
|
+
await connected;
|
|
81
|
+
return subscription;
|
|
82
|
+
},
|
|
83
|
+
async close() { subscription?.close(); lifetime.abort(); buildListeners.clear(); buildReads.clear(); },
|
|
84
|
+
};
|
|
85
|
+
return client;
|
|
86
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const isHttpPreviewControlResource = uri => typeof uri === "string" &&
|
|
2
|
+
/^(?:ads:\/\/project\/build|ads:\/\/preview\/(?:manifest|live)(?:\?from=[a-f0-9]{64})?)$/.test(uri);
|
|
3
|
+
|
|
4
|
+
/** The local showcase's narrow control connection; all rendering lives in preview-client/runtime.mjs. */
|
|
5
|
+
export function httpPreviewBridge({ frame, context, draftScope }) {
|
|
6
|
+
let instance, epoch = 0, closed = false, initialize, timer, selected;
|
|
7
|
+
const controller = new AbortController();
|
|
8
|
+
async function control(input, keepalive = false) {
|
|
9
|
+
const response = await fetch("preview-http", { method: "POST", headers: { "Content-Type": "application/json" },
|
|
10
|
+
body: JSON.stringify(input), ...(keepalive ? { keepalive: true } : { signal: controller.signal }) });
|
|
11
|
+
const result = await response.json();
|
|
12
|
+
if (!response.ok) throw Object.assign(new Error(result.error ?? "HTTP preview control failed."), { code: result.code });
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
function post(method, params, extra = {}) {
|
|
16
|
+
if (!closed && instance) frame.contentWindow?.postMessage({ channel: "ads-preview-http", instance: instance.id, epoch, method, params, ...extra }, "*");
|
|
17
|
+
}
|
|
18
|
+
async function receive(event) {
|
|
19
|
+
const value = event.data;
|
|
20
|
+
if (closed || event.source !== frame.contentWindow || event.origin !== "null" || value?.channel !== "ads-preview-http" || value.instance !== instance?.id) return;
|
|
21
|
+
if (value.method === "ready") { post("init", context); clearTimeout(timer); initialize?.(); bridge.oninitialized?.(); return; }
|
|
22
|
+
if (value.epoch !== epoch) return;
|
|
23
|
+
if (value.method === "log") { bridge.onloggingmessage?.(value.params); return; }
|
|
24
|
+
if (!["read", "prepare"].includes(value.method) || !Number.isSafeInteger(value.request)) return;
|
|
25
|
+
const observed = epoch;
|
|
26
|
+
try {
|
|
27
|
+
let result;
|
|
28
|
+
if (value.method === "prepare") result = await control({ ...value.params, op: "prepare", id: instance.id });
|
|
29
|
+
else {
|
|
30
|
+
const uri = value.params?.uri;
|
|
31
|
+
const unscoped = draftScope && typeof uri === "string" && uri.startsWith(draftScope) ? decodeURIComponent(uri.slice(draftScope.length)) : uri;
|
|
32
|
+
if (!isHttpPreviewControlResource(unscoped) || (draftScope && uri === unscoped)) throw new Error("Unexpected HTTP preview control resource.");
|
|
33
|
+
result = await bridge.onreadresource({ uri });
|
|
34
|
+
}
|
|
35
|
+
if (!closed && epoch === observed) post("response", undefined, { request: value.request, result });
|
|
36
|
+
} catch (error) { if (!closed && epoch === observed) post("response", undefined, { request: value.request, error: error.message, code: error.code }); }
|
|
37
|
+
}
|
|
38
|
+
const bridge = {
|
|
39
|
+
async reconcileBuild() {
|
|
40
|
+
if (closed || !instance) return;
|
|
41
|
+
try {
|
|
42
|
+
await control({ op: "keepalive", id: instance.id });
|
|
43
|
+
const uri = draftScope ? draftScope + encodeURIComponent("ads://project/build") : "ads://project/build";
|
|
44
|
+
const result = await bridge.onreadresource({ uri });
|
|
45
|
+
bridge.receiveBuild(uri, JSON.parse(result.contents.find(item => typeof item.text === "string").text));
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (closed) return;
|
|
48
|
+
if (error.code === "ADS_PREVIEW_REOPEN") bridge.onloggingmessage?.({ logger: "ads-preview", data: { state: "error", id: selected, code: error.code } });
|
|
49
|
+
else bridge.onerror?.(error);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
receiveBuild(uri, report) {
|
|
53
|
+
const expected = draftScope ? draftScope + encodeURIComponent("ads://project/build") : "ads://project/build";
|
|
54
|
+
if (uri === expected) post("build", report);
|
|
55
|
+
},
|
|
56
|
+
setHostContext(value) { context = value; post("context", value); },
|
|
57
|
+
async sendToolInput() {},
|
|
58
|
+
async sendToolResult(value) {
|
|
59
|
+
if (value.structuredContent?.draftScope !== draftScope) throw new Error("Cannot change the scope of an HTTP preview instance.");
|
|
60
|
+
selected = (value.structuredContent?.previewResult?.structuredContent ?? value.structuredContent)?.scenario?.id;
|
|
61
|
+
epoch++; post("select", value);
|
|
62
|
+
},
|
|
63
|
+
async connect() {
|
|
64
|
+
instance = await control({ op: "open", draftScope });
|
|
65
|
+
if (closed) { await control({ op: "close", id: instance.id }, true); return; }
|
|
66
|
+
window.addEventListener("message", receive);
|
|
67
|
+
const ready = new Promise((resolve, reject) => { initialize = resolve; timer = setTimeout(() => reject(new Error("HTTP preview initialization timed out.")), 15000); });
|
|
68
|
+
frame.setAttribute("sandbox", "allow-scripts allow-forms"); frame.dataset.previewDelivery = "http"; frame.src = instance.url;
|
|
69
|
+
await ready;
|
|
70
|
+
},
|
|
71
|
+
async teardownResource() { post("teardown"); },
|
|
72
|
+
async close() {
|
|
73
|
+
if (closed) return;
|
|
74
|
+
post("teardown"); closed = true; clearTimeout(timer);
|
|
75
|
+
window.removeEventListener("message", receive); controller.abort();
|
|
76
|
+
if (instance) await control({ op: "close", id: instance.id }, true).catch(() => {});
|
|
77
|
+
frame.remove();
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
return bridge;
|
|
81
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Explicit browser reads. These paths are not a generic resources/read tunnel.
|
|
2
|
+
const reads = new Map([
|
|
3
|
+
["explorer", "ads://project/explorer"], ["build", "ads://project/build"],
|
|
4
|
+
["icons", "ads://project/icons"], ["tokens", "ads://project/tokens"],
|
|
5
|
+
["scenarios", "ads://project/scenarios"], ["drafts", "ads://project/drafts"],
|
|
6
|
+
["previews/manifest", "ads://preview/manifest"], ["previews/live", "ads://preview/live"],
|
|
7
|
+
]);
|
|
8
|
+
const draftId = "[a-zA-Z0-9_-]+";
|
|
9
|
+
export function httpResourcePath(uri, allowDraft = true) {
|
|
10
|
+
const scoped = new RegExp(`^ads://drafts/(${draftId})/resource\\?uri=(.+)$`).exec(uri);
|
|
11
|
+
if (scoped && allowDraft) return `drafts/${scoped[1]}/${httpResourcePath(decodeURIComponent(scoped[2]), false)}`;
|
|
12
|
+
const [base, ...queries] = uri.split("?"), query = queries.length ? queries.join("?") : undefined;
|
|
13
|
+
const route = [...reads].find(([, value]) => value === base)?.[0];
|
|
14
|
+
if (!route || (query !== undefined && (!route.startsWith("previews/") || !/^from=[a-f0-9]{64}$/.test(query)))) throw new Error("Unsupported showcase HTTP resource.");
|
|
15
|
+
return route + (query ? `?${query}` : "");
|
|
16
|
+
}
|
|
17
|
+
export function httpResourceUri(path, allowDraft = true) {
|
|
18
|
+
const scoped = new RegExp(`^drafts/(${draftId})/(.+)$`).exec(path);
|
|
19
|
+
if (scoped && allowDraft) return `ads://drafts/${scoped[1]}/resource?uri=${encodeURIComponent(httpResourceUri(scoped[2], false))}`;
|
|
20
|
+
const [route, ...queries] = path.split("?"), query = queries.length ? queries.join("?") : undefined;
|
|
21
|
+
const uri = reads.get(route);
|
|
22
|
+
if (!uri || (query !== undefined && (!route.startsWith("previews/") || !/^from=[a-f0-9]{64}$/.test(query)))) throw new Error("Unsupported showcase HTTP route.");
|
|
23
|
+
return uri + (query ? `?${query}` : "");
|
|
24
|
+
}
|
|
25
|
+
export function httpPreviewAction(path, body) {
|
|
26
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) throw new Error("Expected a preview request object.");
|
|
27
|
+
if (path === "previews") return { name: "ads_show_scenario", arguments: body };
|
|
28
|
+
const draft = new RegExp(`^drafts/(${draftId})/preview$`).exec(path);
|
|
29
|
+
if (!draft || Object.hasOwn(body, "id")) throw new Error("Unsupported showcase HTTP action.");
|
|
30
|
+
return { name: "ads_show_draft", arguments: { ...body, id: draft[1] } };
|
|
31
|
+
}
|
package/dist/skills/README.md
CHANGED
|
@@ -48,7 +48,7 @@ the browser, and provides a running URL or exact command for review. See the
|
|
|
48
48
|
| [ads-designer](ads-designer/SKILL.md) | Bootstrap or build UI using the local ADS, with layout, motion, stress-testing and craft/mobile guidance | `$ads-designer build a settings page using this project's ADS`, `$ads-designer stress-test AppShell +fix`, `$ads-designer review Toast motion` |
|
|
49
49
|
| [ads-import](ads-import/SKILL.md) | Check destination compatibility, then integrate selected ADS source, artwork or theme values | `$ads-import /path/to/source-repo component Toast` |
|
|
50
50
|
| [ads-port](ads-port/SKILL.md) | Port library capabilities into a coherent ADS using shared tokens and primitives | `$ads-port https://github.com/emilkowalski/sonner` |
|
|
51
|
-
| [ads-migrate](ads-migrate/SKILL.md) | Upgrade an existing design system between ADS versions using version-specific migration guides | `$ads-migrate upgrade this project from ADS 0.4.
|
|
51
|
+
| [ads-migrate](ads-migrate/SKILL.md) | Upgrade an existing design system between ADS versions using version-specific migration guides | `$ads-migrate upgrade this project from ADS 0.4.3 to 0.4.4` |
|
|
52
52
|
|
|
53
53
|
For token values, use `$ads-import /path/to/source-repo tokens`; for original
|
|
54
54
|
artwork and its guidance, use `$ads-import /path/to/source-repo brand`. ADS token
|
|
@@ -68,9 +68,9 @@ each folder retains the upstream MIT notice. Preserve those notices when
|
|
|
68
68
|
redistributing the skills. Component-library notices belong beside the imported component in its receiving
|
|
69
69
|
project, separate from these skill notices.
|
|
70
70
|
|
|
71
|
-
The showcase is a tool-owned
|
|
71
|
+
The showcase is a tool-owned HTTP shell with an isolated persistent preview.
|
|
72
72
|
Its Brand, Tokens, Components, Patterns and Composition sections discover token
|
|
73
|
-
categories and scenario entries through
|
|
73
|
+
categories and scenario entries through the local ADS service; its Icons tab shows the glyph set.
|
|
74
74
|
The skills use the connected runtime URL, or `ads showcase` for browser-only work;
|
|
75
75
|
they do not generate page browsers or duplicate the tool shell. Scenarios,
|
|
76
76
|
fixtures and adapters remain colocated with their owners; larger entries live in
|
|
@@ -434,7 +434,11 @@ installed `ads showcase` or the project's `dev:showcase` script. Do not launch a
|
|
|
434
434
|
second runtime/compiler for the same connected project. ADS's managed Bun
|
|
435
435
|
preview compiler publishes a shared graph on first demand and after source
|
|
436
436
|
changes. The built-in client refreshes discovery and the active scenario in the
|
|
437
|
-
same App
|
|
437
|
+
same App; compatible watched edits preserve state and focus. Incompatible edits
|
|
438
|
+
or rollback can reset the frame. Compiled feedback can appear before checks pass:
|
|
439
|
+
use current verified output for captures and acceptance. See
|
|
440
|
+
[runtime guidance](references/runtimes.md) for updates and upgrade behavior.
|
|
441
|
+
Shared runtime, foundation CSS, fonts and
|
|
438
442
|
selected scenario modules load through MCP
|
|
439
443
|
resources inside the sandboxed App. Never inject project styles/runtime into
|
|
440
444
|
the outer host. Keep the declared framework and its native mount/unmount adapter
|
|
@@ -49,9 +49,13 @@ name the text token and the background source. Transparent wrappers do not hide
|
|
|
49
49
|
ancestor background; a text node using the same token as its backdrop is still a failure.
|
|
50
50
|
No explicit pair contract is required. Keep decorative brand colors separate from text
|
|
51
51
|
roles when their contrast is insufficient.
|
|
52
|
+
String/number text props are covered, as are literal hooks with no captured paint selector
|
|
53
|
+
targeting them and optional classes whose alternatives have identical paint/visibility.
|
|
54
|
+
For example, an optional card class that only changes padding does not hide the card's
|
|
55
|
+
background from the contrast check.
|
|
52
56
|
|
|
53
|
-
The composition check deliberately leaves unknown prop spreads, differing
|
|
54
|
-
competing/conditional/descendant styles,
|
|
57
|
+
The composition check deliberately leaves unknown prop spreads, differing paint branches,
|
|
58
|
+
competing/conditional/descendant paint styles, unresolved class values, gradients, opacity, filters,
|
|
55
59
|
transforms, text shadows, dynamic visibility and missing backdrops
|
|
56
60
|
unverified (`component-contrast-unresolved`). Keep legitimate component APIs; do not
|
|
57
61
|
flatten them or add paint to satisfy the checker. Audit the actual composed scenario,
|