contour-ds 1.7.2 → 1.9.0

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.
Files changed (150) hide show
  1. package/README.md +244 -326
  2. package/dist/agent-cookbook.json +960 -0
  3. package/dist/agent-examples.json +65 -0
  4. package/dist/agent-map-wiring.json +152 -0
  5. package/dist/agent-rules.json +16 -0
  6. package/dist/build-manifest.json +344 -126
  7. package/dist/contour-wc-content.esm.js +1939 -0
  8. package/dist/contour-wc-content.esm.min.js +1 -0
  9. package/dist/contour-wc-core.esm.js +3724 -0
  10. package/dist/contour-wc-core.esm.min.js +1 -0
  11. package/dist/contour-wc-dashboard.esm.js +6986 -0
  12. package/dist/contour-wc-dashboard.esm.min.js +1 -0
  13. package/dist/contour-wc-data.esm.js +6572 -0
  14. package/dist/contour-wc-data.esm.min.js +1 -0
  15. package/dist/contour-wc-docs.esm.js +976 -0
  16. package/dist/contour-wc-docs.esm.min.js +1 -0
  17. package/dist/contour-wc-feedback.esm.js +1742 -0
  18. package/dist/contour-wc-feedback.esm.min.js +1 -0
  19. package/dist/contour-wc-forms.esm.js +2437 -0
  20. package/dist/contour-wc-forms.esm.min.js +1 -0
  21. package/dist/contour-wc-interaction.esm.js +1343 -0
  22. package/dist/contour-wc-interaction.esm.min.js +1 -0
  23. package/dist/contour-wc-layout.esm.js +845 -0
  24. package/dist/contour-wc-layout.esm.min.js +1 -0
  25. package/dist/contour-wc-map.esm.js +2411 -0
  26. package/dist/contour-wc-map.esm.min.js +1 -0
  27. package/dist/contour-wc-misc.esm.js +945 -0
  28. package/dist/contour-wc-misc.esm.min.js +1 -0
  29. package/dist/contour-wc-navigation.esm.js +2842 -0
  30. package/dist/contour-wc-navigation.esm.min.js +1 -0
  31. package/dist/contour-wc-ui.esm.js +6519 -0
  32. package/dist/contour-wc-ui.esm.min.js +1 -0
  33. package/dist/contour-wc.esm.js +14435 -5723
  34. package/dist/contour-wc.esm.min.js +1 -1
  35. package/dist/contour-wc.js +14436 -5725
  36. package/dist/contour-wc.min.js +1 -1
  37. package/dist/contour.a11y.json +402 -0
  38. package/dist/contour.code-snippets +4534 -0
  39. package/dist/contour.components.json +4870 -1222
  40. package/dist/contour.css +6672 -4711
  41. package/dist/contour.d.ts +753 -1085
  42. package/dist/contour.esm.js +440 -18
  43. package/dist/contour.esm.min.js +1 -1
  44. package/dist/contour.html-data.json +11343 -0
  45. package/dist/contour.js +440 -18
  46. package/dist/contour.min.css +1 -1
  47. package/dist/contour.min.js +1 -1
  48. package/dist/contour.react.d.ts +422 -0
  49. package/dist/contour.single.html +17 -0
  50. package/dist/contour.single.min.css +1 -0
  51. package/dist/contour.themes.json +56 -12
  52. package/dist/contour.tokens.json +1318 -1053
  53. package/dist/contour.vue.d.ts +420 -0
  54. package/dist/contour.web-types.json +11703 -0
  55. package/dist/custom-elements.json +36120 -0
  56. package/dist/docs/actions.md +16 -6
  57. package/dist/docs/affordances.md +21 -85
  58. package/dist/docs/apireference.md +9 -5
  59. package/dist/docs/colour.md +10 -4
  60. package/dist/docs/componentindex.md +9 -22
  61. package/dist/docs/data.md +39 -58
  62. package/dist/docs/docs.md +12 -7
  63. package/dist/docs/feedback.md +30 -12
  64. package/dist/docs/field.md +28 -13
  65. package/dist/docs/forms.md +35 -19
  66. package/dist/docs/index.json +70 -61
  67. package/dist/docs/install.md +12 -7
  68. package/dist/docs/landing.md +7 -4
  69. package/dist/docs/mapengine.md +30 -8
  70. package/dist/docs/motion.md +12 -6
  71. package/dist/docs/navigation.md +31 -7
  72. package/dist/docs/overlays.md +32 -25
  73. package/dist/docs/overview.md +3 -2
  74. package/dist/docs/patterns.md +20 -10
  75. package/dist/docs/playground.md +11 -4
  76. package/dist/docs/principles.md +8 -6
  77. package/dist/docs/recipes.md +117 -13
  78. package/dist/docs/space.md +10 -6
  79. package/dist/docs/status.md +13 -14
  80. package/dist/docs/surfaces.md +17 -22
  81. package/dist/docs/theming.md +18 -32
  82. package/dist/docs/type.md +12 -5
  83. package/dist/docs/webcomponents.md +75 -33
  84. package/dist/hljs.css +1 -20
  85. package/dist/map-chrome.mapbox.css +68 -92
  86. package/dist/map-chrome.maplibre.css +68 -92
  87. package/dist/registry/items/contour-core.json +2 -2
  88. package/dist/registry/items/contour-data.json +2 -2
  89. package/dist/registry/items/contour-docs.json +2 -2
  90. package/dist/registry/items/contour-landing.json +2 -2
  91. package/dist/registry/registry.json +8 -8
  92. package/dist/surfaces/contour-core.min.css +1 -1
  93. package/dist/surfaces/contour-data.min.css +1 -1
  94. package/dist/surfaces/contour-docs.min.css +1 -1
  95. package/dist/surfaces/contour-landing.min.css +1 -1
  96. package/dist/svg/icons.svg +367 -0
  97. package/dist/wc/behaviours.mjs +222 -192
  98. package/dist/wc/content.mjs +486 -142
  99. package/dist/wc/core.mjs +917 -395
  100. package/dist/wc/dashboard.mjs +252 -25
  101. package/dist/wc/data-chart.mjs +1333 -0
  102. package/dist/wc/data-export.mjs +391 -0
  103. package/dist/wc/data-gauge.mjs +779 -0
  104. package/dist/wc/data-geo.mjs +696 -0
  105. package/dist/wc/data-glyphs.mjs +133 -0
  106. package/dist/wc/data-legend.mjs +431 -0
  107. package/dist/wc/data-readout.mjs +227 -0
  108. package/dist/wc/data-series.mjs +1004 -0
  109. package/dist/wc/data-table.mjs +751 -0
  110. package/dist/wc/data.mjs +15 -3707
  111. package/dist/wc/docs.mjs +113 -19
  112. package/dist/wc/feedback.mjs +320 -116
  113. package/dist/wc/forms-controls.mjs +635 -0
  114. package/dist/wc/forms-field.mjs +547 -0
  115. package/dist/wc/forms-groups.mjs +347 -0
  116. package/dist/wc/forms-input.mjs +292 -0
  117. package/dist/wc/forms.mjs +10 -1122
  118. package/dist/wc/glyph.mjs +204 -0
  119. package/dist/wc/index.mjs +16 -7
  120. package/dist/wc/interaction.mjs +322 -75
  121. package/dist/wc/layout.mjs +100 -29
  122. package/dist/wc/map.mjs +888 -285
  123. package/dist/wc/misc.mjs +137 -26
  124. package/dist/wc/navigation-menu.mjs +735 -0
  125. package/dist/wc/navigation-shell.mjs +495 -0
  126. package/dist/wc/navigation-tree.mjs +995 -0
  127. package/dist/wc/navigation.mjs +9 -1636
  128. package/dist/wc/registration.mjs +1 -8
  129. package/dist/wc/shadow.mjs +285 -113
  130. package/dist/wc/states.mjs +75 -78
  131. package/dist/wc/svg.mjs +209 -34
  132. package/dist/wc/ui-atoms.mjs +608 -0
  133. package/dist/wc/ui-data.mjs +1404 -0
  134. package/dist/wc/ui-feedback.mjs +419 -0
  135. package/dist/wc/ui-inputs.mjs +1570 -0
  136. package/dist/wc/ui-menus.mjs +307 -0
  137. package/dist/wc/ui-overlays.mjs +1605 -0
  138. package/integrations/README.md +25 -5
  139. package/integrations/ai/CLAUDE.md +6 -3
  140. package/integrations/ai/COPILOT.md +14 -0
  141. package/integrations/ai/GEMINI.md +14 -0
  142. package/integrations/ai/WINDSURF.md +14 -0
  143. package/integrations/ai/v0-prompt.md +13 -1
  144. package/integrations/frameworks/README.md +235 -0
  145. package/integrations/native/README.md +0 -3
  146. package/integrations/native/style-dictionary.config.json +1 -1
  147. package/integrations/tailwind/contour-theme.css +71 -13
  148. package/integrations/validate-markup.mjs +172 -0
  149. package/package.json +103 -39
  150. package/dist/wc/ui.mjs +0 -3560
@@ -0,0 +1 @@
1
+ import{CLASS_ONLY,CONTOUR_EVENTS,ContourBase,MERCATOR_MAX_LAT,MODS,OBSERVED,REGISTERED,applyLabel,bearing,clampLat,contourId,cssLength,define,flagOn,flagOnValue,formatValue,haversine,headingTag,iconMarkup,isRtl,labelText,levelFromAttributes,mercatorResolution,navKey,normaliseLng,onDispose,safeColor,safeHref,sanitizeHtml,setHTML,simple,statusIcon,supportsUntilFound,unwrapBounds,warnBadJson,wcEmitOverlay,withBrownout,MARKER_SHAPES,arcPath,assignMarkers,barRects,compassNeedle,contourPaths,donutSlices,isMissing,marchingSquares,markerStyles,niceTicks,polylinePoints,scaleBarTicks,smoothPath,modalContain,wcReset,wireCombobox,wireCopy,wireMenu,wirePagination,wireRemovable,wireSegmented,wireTabs,wireTree,STATE_FALLBACK,loadRemote,parseArrayAttr,remoteData,remoteInvalidate,remoteRefresh,remoteVisible,renderEmpty,renderStates,stateLabel,watchViewport,wireStates}from"./contour-wc-core.esm.js";define("contour-box",simple(["c-box"])),define("contour-cluster",simple(["c-cluster"])),define("contour-container",simple(["c-container"])),define("contour-row",simple(["c-row"])),define("contour-scrim",simple(["c-scrim"])),define("contour-stack",simple(["c-stack"]));const assignedText=t=>{const e=t.querySelector("slot");return(e?e.assignedElements({flatten:!0}):[]).map(t=>(t.textContent||"").trim()).join(" ").trim()||(t.textContent||"").trim()};let ADOPTED=null,ADOPTED_KEY="";const _hashCss=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0).toString(36)};export const adoptedSheets=()=>{let t=document.styleSheets.length+":";for(const e of document.styleSheets){let s="-1";try{const t=e.cssRules;let a="";for(let e=0;e<t.length;e++)a+=t[e].cssText+"\n";s=t.length+":"+_hashCss(a)}catch(t){}t+=(e.href||"inline")+"~"+s+"|"}if(ADOPTED&&t===ADOPTED_KEY)return ADOPTED;ADOPTED_KEY=t,ADOPTED=[];const e=(t,s)=>{let a;try{a=t.cssRules}catch(t){return}if(a)for(const t of a)if(t instanceof CSSImportRule)t.styleSheet&&e(t.styleSheet,s);else try{s.push(t.cssText)}catch(t){}};for(const t of document.styleSheets)try{if(!t.href||new URL(t.href).origin===location.origin){const s=[];e(t,s);const a=new CSSStyleSheet;s.length&&a.replaceSync(s.join("\n")),ADOPTED.push(a)}}catch(t){}return ADOPTED};const _ShadowParent="undefined"!=typeof HTMLElement?HTMLElement:Object;class ContourShadow extends _ShadowParent{static get observedAttributes(){return MODS.concat("labels")}constructor(){super();let t=this.shadowRoot;t||(t=this.attachShadow({mode:"open"}),this.constructor.contourTemplate&&t.appendChild(this.constructor.contourTemplate.content.cloneNode(!0)));const e=adoptedSheets();if(e.length)try{t.adoptedStyleSheets=e}catch(t){}this._shadowBase=t.firstElementChild?t.firstElementChild.className:""}enhance(t){t||(t=this.shadowRoot),t&&(t.querySelectorAll("details").forEach(t=>{const e=t.querySelector("summary");e&&!e.hasAttribute("aria-expanded")&&(e.setAttribute("aria-expanded",String(t.open)),t.addEventListener("toggle",()=>{e.setAttribute("aria-expanded",String(t.open))}))}),t.querySelectorAll("[data-live]").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","status"),t.hasAttribute("aria-live")||t.setAttribute("aria-live","polite")}),t.querySelectorAll(".c-spinner").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","status"),t.hasAttribute("aria-live")||t.setAttribute("aria-live","polite")}),t.querySelectorAll(".c-toast, .c-toast-host").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","status"),t.hasAttribute("aria-live")||t.setAttribute("aria-live","polite"),t.hasAttribute("aria-atomic")||t.setAttribute("aria-atomic","true")}),t.querySelectorAll("[role='tab']").forEach(e=>{const s=e.getAttribute("aria-controls");if(s){const a=t.querySelector("#"+CSS.escape(s))||document.getElementById(s);a&&!a.hasAttribute("aria-labelledby")&&(e.id||(e.id=contourId("tab")),a.setAttribute("aria-labelledby",e.id))}}),t.querySelectorAll("input, textarea, select").forEach(t=>{if(t.hasAttribute("aria-describedby"))return;const e=t.closest(".c-field");if(e){const s=e.querySelector(".c-field__hint");s&&(s.id||(s.id=contourId("hint")),t.setAttribute("aria-describedby",s.id));const a=e.querySelector(".c-field__error");if(a){a.id||(a.id=contourId("err"));const e=t.getAttribute("aria-describedby")||"";t.setAttribute("aria-describedby",(e+" "+a.id).trim())}}}),t.querySelectorAll(".c-alert").forEach(t=>{const e=t.classList.contains("c-alert--warning")||t.classList.contains("c-alert--danger"),s=e?"alert":"status",a=e?"assertive":"polite";t.hasAttribute("role")&&!t.dataset.contourAutoRole||(t.setAttribute("role",s),t.dataset.contourAutoRole=s),t.hasAttribute("aria-live")&&!t.dataset.contourAutoLive||(t.setAttribute("aria-live",a),t.dataset.contourAutoLive=a)}),t.querySelectorAll("input[required], textarea[required], select[required]").forEach(t=>{t.hasAttribute("aria-required")||t.setAttribute("aria-required","true")}),this._wireLabels(t),this._wireClose(t))}_wireClose(t){if(!t||this._wiredShadowClose)return;const e=t.querySelectorAll(".c-callout__close, .c-alert__close, .c-tag__remove, .c-filter-pill__remove");if(e.length){this._wiredShadowClose=!0;for(const t of e)t.addEventListener("click",()=>{this.hidden=!0,this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))})}}_wireLabels(t){t&&t.querySelectorAll("label").forEach(t=>{const e=t.querySelector("slot"),s=t.closest(".c-field")||t.parentElement,a=[];if(e)for(const t of e.assignedElements({flatten:!0}))t.matches("input, textarea, select")&&a.push(t);if(!a.length&&s){const t=s.querySelector('slot[name="input"]');if(t)for(const e of t.assignedElements({flatten:!0}))e.matches("input, textarea, select")&&a.push(e)}for(const e of a){if(e.id||(e.id=contourId("shadow-input")),t.hasAttribute("for")||t.setAttribute("for",e.id),!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")){const s=assignedText(t);s&&e.setAttribute("aria-label",s)}if(e._contourLabelWired||(e._contourLabelWired=!0,t.addEventListener("click",t=>{if(!t.target.closest("a, button, input, textarea, select"))try{e.click()}catch(t){}})),s&&!e.hasAttribute("aria-describedby")){const t=s.querySelector(".c-field__hint"),a=s.querySelector(".c-field__error"),r=[];t&&(t.id||(t.id=contourId("hint")),r.push(t.id)),a&&(a.id||(a.id=contourId("err")),r.push(a.id)),r.length&&e.setAttribute("aria-describedby",r.join(" "))}}})}connectedCallback(){this.applyMods();try{this.enhance(this.shadowRoot)}catch(t){}this._applyLabels();try{wcReset(this),wireTabs(this),wireSegmented(this),wireCombobox(this),wireTree(this),wireMenu(this),wirePagination(this),wireCopy(this),wireRemovable(this)}catch(t){}this.shadowRoot&&!this._wiredSlotchange&&(this._wiredSlotchange=!0,this.shadowRoot.addEventListener("slotchange",()=>{try{this.enhance(this.shadowRoot),this._applyLabels(),wireTabs(this),wireSegmented(this),wireCombobox(this),wireTree(this),wireMenu(this),wirePagination(this),wireCopy(this),wireRemovable(this)}catch(t){}}))}attributeChangedCallback(){this.applyMods(),this._applyLabels()}_applyLabels(){const t=this.shadowRoot;if(!t)return;const e=(e,s,a)=>{const r=t.querySelector(e);r&&r.setAttribute("aria-label",labelText(this,s,a))};e(".c-callout__close","close","Close"),e(".c-alert__close","close","Close"),e(".c-tag__remove","remove","Remove"),e(".c-filter-pill__remove","remove-filter","Remove filter"),e(".c-breadcrumb","breadcrumb","Breadcrumb"),e(".c-spinner","loading","Loading"),e(".c-install__copy","copy-command","Copy command");const s=t.querySelector(".c-install__copy, .c-code__copy");s&&"Copy"===s.textContent.trim()&&(s.textContent=labelText(this,"copy","Copy"))}applyMods(){const t=this.shadowRoot.firstElementChild;if(!t||!this._shadowBase)return;const e=[];for(const t of MODS){const s=this.getAttribute(t);if(s)for(const t of this._shadowBase.split(/\s+/))t&&e.push("c-"+t.replace(/^c-/,"")+"--"+s)}if(t.className=(this._shadowBase+" "+e.join(" ")).trim(),t.classList.contains("c-alert")){const e=t.classList.contains("c-alert--warning")||t.classList.contains("c-alert--danger"),s=e?"alert":"status",a=e?"assertive":"polite";t.hasAttribute("role")&&!t.dataset.contourAutoRole||(t.setAttribute("role",s),t.dataset.contourAutoRole=s),t.hasAttribute("aria-live")&&!t.dataset.contourAutoLive||(t.setAttribute("aria-live",a),t.dataset.contourAutoLive=a)}}}const SHADOW_PARTS_PUBLIC={},SHADOW_MARKUP={},recordParts=(t,e)=>{SHADOW_PARTS_PUBLIC[t]=[...e.matchAll(/part="([^"]+)"/g)].flatMap(t=>t[1].split(/\s+/)).filter(Boolean)},shadow=(t,e)=>{if(SHADOW_MARKUP[t]=e,recordParts(t,e),"undefined"==typeof document)return;const s=document.createElement("template");setHTML(s,e);const a=class extends ContourShadow{};a.contourTemplate=s,define(t,a)},slotWrapper=(t,e,s)=>"<"+t+' class="c-'+e+'" part="'+(s||e)+'"'+("button"===t?' type="button"':"")+"><slot></slot></"+t+">",SHADOW_SLOTS={div:["accordion","activity","advanced","affordance","affordances","anchor","app","app-body","box","btn-group","chart-grid","catchment","cluster","command","compare","comparison","compass","contour-plot","cta","dash-freshness","dash-kpi-row","dash-shell","dash-toolbar","datamark","delta","draggable","drag-handle","drop-indicator","drop-zone","destructive-hint","docs-shell","drawer","elevation","filter-bar","flow-map","heatmap","hexbin","icon-badge","input-group","instrument","range-scale","resizable","table-wrap","time-range","toast-host","scroll-area","isochrone","landing-features","landing-hero","layer-panel","layer-switch","legend","logos","map-area","map-footer","map-panel","map-slot","measure","metrics","minimap","pager","pagination","panel","plate","price","pricing","progress","prose","pullquote","radio-list","range","readout","recipe","reserved","resize-handle","row","row-action","scale-bar","scrim","segmented","sheet","shortcut-list","shortcut-overlay","shortcut-panel","shortcut-row","showcase","sidebar","skeleton","sparkline","stack","steps","streaming-chart","survey","theme-scope","time-slider","timeline","toast","toolbar","tooltip","tree","version","version-banner"],button:["btn","pressable"],span:["avatar","badge","chip","dot","flag","live-badge","mark","pill"],a:["link","linkish"],kbd:["kbd"],label:["check","radio","switch"],nav:["docs-nav"]},SHADOW_PARTS={"version-banner":"banner","contour-plot":"plot"};for(const[t,e]of Object.entries(SHADOW_SLOTS))for(const s of e){shadow("contour-shadow-"+s,slotWrapper(t,s,SHADOW_PARTS[s]||s))}shadow("contour-shadow-callout",'<div class="c-callout" part="callout"><div class="c-callout__title" part="title"><slot name="title"></slot></div><div class="c-callout__body" part="body"><slot></slot></div><button class="c-callout__close" part="close" type="button" aria-label="Close">×</button></div>'),shadow("contour-shadow-empty",'<div class="c-empty" part="empty"><div class="c-empty__illustration" part="illustration"><slot name="illustration"></slot></div><div class="c-empty__title" part="title"><slot name="title"></slot></div><div class="c-empty__text" part="body"><slot></slot></div><div><slot name="action"></slot></div></div>'),shadow("contour-shadow-feature",'<div class="c-feature" part="feature"><span class="c-feature__index" part="index"><slot name="index"></slot></span><div class="c-feature__title" part="title"><slot name="title"></slot></div><div class="c-feature__body" part="body"><slot></slot></div></div>'),shadow("contour-shadow-kpi",'<div class="c-kpi" part="kpi"><div class="c-kpi__value" part="value"><slot name="value"></slot></div><div class="c-kpi__label" part="label"><slot name="label"></slot></div><div class="c-kpi__foot" part="foot"><slot name="delta"></slot><slot name="note"></slot></div></div>'),shadow("contour-shadow-stat",'<div class="c-stat" part="stat"><div class="c-stat__value" part="value"><slot name="value"></slot></div><div class="c-stat__label" part="label"><slot name="label"></slot></div><div class="c-stat__delta" part="delta"><slot name="delta"></slot></div></div>'),shadow("contour-shadow-meter",'<div class="c-meter" part="meter"><span class="c-meter__core" part="core"><span class="c-meter__value" part="value"><slot name="value"></slot></span><span class="c-meter__label" part="label"><slot name="label"></slot></span></span></div>'),shadow("contour-shadow-brownout",'<div class="c-brownout" part="brownout" data-level="0"><slot></slot></div>'),shadow("contour-shadow-widget-state",'<div class="c-widget-state" part="widget-state"><slot></slot></div>'),shadow("contour-shadow-donut",'<div class="c-donut" part="donut"><svg class="c-donut__ring" part="ring" viewBox="0 0 32 32"></svg><div class="c-donut__center" part="center"><slot name="value"></slot></div><div class="c-donut__list" part="list"><slot></slot></div></div>'),shadow("contour-shadow-axis",'<div class="c-axis" part="axis"><slot></slot></div>'),shadow("contour-shadow-brush",'<div class="c-brush" part="brush"><div class="c-brush__selection" part="selection"></div></div>'),shadow("contour-shadow-stacked-bar",'<div class="c-stacked-bar" part="bar"><slot></slot></div>'),shadow("contour-shadow-category",'<div class="c-category" part="category" role="listbox"><slot></slot></div>'),shadow("contour-shadow-gauge",'<div class="c-gauge" part="gauge"><svg class="c-gauge__dial" part="dial" aria-hidden="true" viewBox="0 0 100 100"><path class="c-gauge__track" part="track" d="M 10 90 A 40 40 0 0 1 90 90"></path><g class="c-gauge__zones"></g><line class="c-gauge__needle" part="needle" x1="50" y1="50" x2="50" y2="15"></line><circle class="c-gauge__hub" part="hub" cx="50" cy="50" r="4"></circle></svg><div class="c-gauge__value" part="value"><slot name="value"></slot></div><div class="c-gauge__band" part="band"><slot name="band"></slot></div></div>'),shadow("contour-shadow-diff",'<div class="c-diff" part="diff"><div class="c-diff__line c-diff__line--del" part="before"><span class="c-diff__sign">−</span><span><slot name="before"></slot></span></div><div class="c-diff__line c-diff__line--add" part="after"><span class="c-diff__sign">+</span><span><slot name="after"></slot></span></div></div>'),shadow("contour-shadow-do-dont",'<div class="c-do-dont" part="do-dont"><div class="c-do-dont__item c-do-dont__item--do" part="do"><slot name="do"></slot></div><div class="c-do-dont__item c-do-dont__item--dont" part="dont"><slot name="dont"></slot></div></div>'),shadow("contour-shadow-threshold",'<div class="c-threshold" part="threshold"><span class="c-threshold__fill" part="value"></span><span class="c-threshold__target" part="target"></span></div>'),shadow("contour-shadow-coordinate",'<div class="c-coordinate" part="coordinate"><span class="c-coordinate__value" part="value"><slot name="value"></slot></span></div>'),shadow("contour-shadow-install",'<div class="c-install" part="install"><span class="c-install__prompt" part="prompt"><slot name="prompt"></slot></span><span class="c-install__command" part="command"><slot name="command"></slot></span><button class="c-btn c-btn--ghost c-btn--sm c-install__copy" part="copy" type="button" aria-label="Copy command">Copy</button></div>'),shadow("contour-shadow-toc",'<div class="c-toc" part="toc"><div class="c-toc__title" part="title"><slot name="title"></slot></div><nav class="c-toc__list" part="list"><slot></slot></nav></div>'),shadow("contour-shadow-testimonial",'<div class="c-testimonial" part="testimonial"><blockquote class="c-testimonial__quote" part="quote"><slot name="quote"></slot></blockquote><div class="c-testimonial__byline" part="byline"><span class="c-testimonial__name" part="name"><slot name="name"></slot></span><span class="c-testimonial__role" part="role"><slot name="role"></slot></span></div></div>'),shadow("contour-shadow-search-trigger",'<button class="c-search-trigger" part="trigger"><span><slot name="label"></slot></span><kbd class="c-search-trigger__kbd"><slot name="shortcut"></slot></kbd></button>'),shadow("contour-shadow-brand",'<a class="c-brand" part="brand"><span class="c-mark" part="mark"><slot name="mark"></slot></span><span class="c-brand__name" part="name"><slot name="name"></slot></span></a>'),shadow("contour-shadow-section-head",'<div class="c-section-head" part="head"><h2 class="c-section-head__title" part="title"><slot name="title"></slot></h2><p class="c-section-head__desc" part="desc"><slot name="desc"></slot></p></div>'),shadow("contour-shadow-loading",'<div class="c-loading" part="loading"><span class="c-spinner" part="spinner"></span><slot></slot></div>'),shadow("contour-shadow-tabs",'<div class="c-tabs" part="tabs"><div class="c-tabs__list" part="list" role="tablist"><slot name="tabs"></slot></div><div class="c-tabs__panels" role="presentation"><slot></slot></div></div>'),shadow("contour-shadow-breadcrumb",'<nav class="c-breadcrumb" part="breadcrumb" aria-label="Breadcrumb"><ol><slot></slot></ol></nav>'),shadow("contour-shadow-menu",'<div class="c-menu" part="menu" role="menu"><slot></slot></div>'),shadow("contour-shadow-combobox",'<div class="c-combobox" part="combobox"><input class="c-combobox__input" part="input" type="text" /><ul class="c-combobox__list" part="list" hidden><slot></slot></ul></div>'),shadow("contour-shadow-chart",'<div class="c-chart" part="chart"><div class="c-chart__plot" part="plot"><slot></slot></div></div>'),shadow("contour-shadow-bivariate",'<div class="c-bivariate" part="bivariate"><div class="c-bivariate__matrix" part="matrix"><slot></slot></div></div>'),shadow("contour-shadow-bivariate-legend",'<div class="c-bivariate-legend" part="legend"><div class="c-bivariate-legend__matrix" part="matrix"><slot></slot></div></div>'),shadow("contour-shadow-expandable",'<details class="c-expandable" part="expandable"><summary class="c-expandable__summary"><slot name="summary"></slot></summary><div class="c-expandable__body" part="body"><slot></slot></div></details>'),shadow("contour-shadow-disclosure",'<details class="c-disclosure" part="disclosure"><summary><slot name="summary"></slot></summary><div class="c-disclosure__body" part="body"><slot></slot></div></details>'),shadow("contour-shadow-faq",'<div class="c-faq" part="faq"><div class="c-faq__question" part="question"><slot name="question"></slot></div><div class="c-faq__answer" part="answer"><slot name="answer"></slot></div></div>'),shadow("contour-shadow-code-tabs",'<div class="c-code-tabs" part="code-tabs"><div class="c-code-tabs__list" part="list" role="tablist"><slot name="tabs"></slot></div><div class="c-code-tabs__panels"><slot></slot></div></div>'),shadow("contour-shadow-header",'<header class="c-header" part="header"><div class="container c-header__inner" part="inner"><a class="c-brand" part="brand"><slot name="brand"></slot></a><nav class="c-header__nav" part="nav"><slot name="nav"></slot></nav><div class="c-header__actions" part="actions"><slot name="actions"></slot></div></div></header>'),shadow("contour-shadow-footer",'<footer class="c-footer" part="footer"><div class="container c-footer__grid" part="grid"><div class="c-footer__brand" part="brand"><slot name="brand"></slot></div><div class="c-footer__links" part="links"><slot name="links"></slot></div></div></footer>'),shadow("contour-shadow-container",'<div class="container" part="container"><slot></slot></div>'),shadow("contour-shadow-spinner",'<span class="c-spinner" part="spinner" aria-label="Loading"></span>'),shadow("contour-shadow-code",'<pre class="c-code" part="code"><code><slot></slot></code><button class="c-code__copy" part="copy" type="button">Copy</button></pre>'),shadow("contour-shadow-card",'<div class="c-card" part="card"> <div class="c-card__title" part="head"><slot name="title">Untitled</slot></div> <div class="c-card__body" part="body"><slot></slot></div> <div class="c-card__foot" part="foot"><slot name="foot"></slot></div> </div>'),shadow("contour-shadow-field",'<div class="c-field" part="field"> <label class="c-field__label" part="label"><slot name="label">Label</slot></label> <slot name="input"></slot> <span class="c-field__hint" part="hint"><slot name="hint"></slot></span> </div>'),shadow("contour-shadow-alert",'<div class="c-alert" part="alert"> <div class="c-alert__title" part="title"><slot name="title"></slot></div> <div class="c-alert__body" part="body"><slot></slot></div> <div class="c-alert__actions" part="actions"><slot name="action"></slot></div> <button class="c-alert__close" part="close" type="button" aria-label="Close">×</button> </div>'),shadow("contour-shadow-tag",'<span class="c-tag" part="tag"><slot></slot><button class="c-tag__remove" part="remove" type="button" aria-label="Remove">×</button></span>'),shadow("contour-shadow-filter-pill",'<span class="c-filter-pill" part="filter-pill"><slot></slot><button class="c-filter-pill__remove" part="remove" type="button" aria-label="Remove filter">×</button></span>');const DIALOG_MARKUP='<dialog class="c-dialog" part="dialog"> <div class="c-dialog__head" part="head"> <slot name="title"></slot> <button class="c-btn c-btn--icon c-btn--ghost" part="close" type="button" aria-label="Close"> <svg aria-hidden="true" viewBox="0 0 24 24"><path d="m18 6-12 12M6 6l12 12" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg> </button> </div> <div class="c-dialog__body" part="body"><slot></slot></div> <div class="c-dialog__foot" part="foot"><slot name="foot"></slot></div> </dialog>';SHADOW_MARKUP["contour-shadow-dialog"]=DIALOG_MARKUP,recordParts("contour-shadow-dialog",DIALOG_MARKUP);class ContourShadowDialog extends ContourShadow{static contourTemplate="undefined"!=typeof document?(()=>{const t=document.createElement("template");return setHTML(t,DIALOG_MARKUP),t})():null;enhance(t){if(super.enhance(t),this._wiredShadowDialog)return;this._wiredShadowDialog=!0;const e=t.querySelector("dialog"),s=t.querySelector('[part="close"]');if(s&&s.addEventListener("click",()=>e?.close()),e){let t=null;e.addEventListener("beforetoggle",s=>{if("open"===s.newState){t=document.activeElement,this._syncingOpenAttr=!0,this.hasAttribute("open")||this.setAttribute("open",""),this._syncingOpenAttr=!1,this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}));const a=e.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(a)try{a.focus()}catch(s){}}else if("closed"===s.newState&&(this._syncingOpenAttr=!0,this.hasAttribute("open")&&this.removeAttribute("open"),this._syncingOpenAttr=!1,this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),t&&"function"==typeof t.focus))try{t.focus()}catch(s){}});const s=()=>{const t="button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])",s=Array.from(e.querySelectorAll(t));for(const a of e.querySelectorAll("slot"))for(const e of a.assignedElements({flatten:!0})){e.matches(t)&&s.push(e);for(const a of e.querySelectorAll(t))s.push(a)}return s},a=()=>this.shadowRoot&&this.shadowRoot.activeElement||document.activeElement;e.addEventListener("keydown",t=>{if("Tab"!==t.key)return;const e=s();if(!e.length)return;const r=e[0],i=e[e.length-1];t.shiftKey&&a()===r?(t.preventDefault(),i.focus()):t.shiftKey||a()!==i||(t.preventDefault(),r.focus())})}}static get observedAttributes(){return[...super.observedAttributes,"open"]}attributeChangedCallback(t,e,s){if(super.attributeChangedCallback(t,e,s),"open"===t&&this.shadowRoot&&!this._syncingOpenAttr){const t=this.shadowRoot.querySelector("dialog");t&&(null===s||t.open?null===s&&t.open&&this.close():this.show())}}connectedCallback(){super.connectedCallback(),this.hasAttribute("open")&&this.show()}show(){if(!this.isConnected)return void(this.hasAttribute("open")||this.setAttribute("open",""));const t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}close(){const t=this.shadowRoot?.querySelector("dialog");t&&t.open&&t.close()}showModal(){this.show()}get open(){return!!this.shadowRoot?.querySelector("dialog")?.open}set open(t){t?this.show():this.close()}get returnValue(){return this.shadowRoot?.querySelector("dialog")?.returnValue??""}set returnValue(t){const e=this.shadowRoot?.querySelector("dialog");e&&(e.returnValue=String(t))}}define("contour-shadow-dialog",ContourShadowDialog);const renderShadowDSD=(t,e="",s="")=>{const a=SHADOW_MARKUP[t];if("string"!=typeof a)return null;return`<${t}${e?e.startsWith(" ")?e:" "+e:""}><template shadowrootmode="open">${a}</template>${s}</${t}>`},FROZEN_SHADOW_MARKUP=Object.freeze({...SHADOW_MARKUP});if("undefined"!=typeof globalThis&&(globalThis.ContourShadowTemplates=FROZEN_SHADOW_MARKUP),"undefined"!=typeof window){window.ContourShadowParts=Object.freeze(Object.fromEntries(Object.entries(SHADOW_PARTS_PUBLIC).map(([t,e])=>[t,Object.freeze([...new Set(e)])]))),window.Contour||(window.Contour={});try{window.Contour.shadowTemplates=FROZEN_SHADOW_MARKUP}catch{}}export{SHADOW_MARKUP,renderShadowDSD};class ContourMenu extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-menu"),this.hasAttribute("role")||this.setAttribute("role","menu"),wireStates(this),loadRemote(this,"items"),renderStates(this,"menu"))return;const t=remoteData(this,"items"),e=Array.from(this.querySelectorAll("li[role='menuitem'], li.c-menu__item, [role='menuitem']")),s=this.querySelector("ul.c-menu");if(e.length){if(s)for(const t of e)t.classList.contains("c-menu__item")||t.classList.add("c-menu__item"),t.getAttribute("role")||t.setAttribute("role","menuitem"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1");else{const t=document.createElement("ul");t.className="c-menu",t.setAttribute("role","menu");for(const s of e)s.parentElement===this&&t.appendChild(s);this.appendChild(t)}const t=e.find(t=>"true"!==t.getAttribute("aria-disabled"));return t&&t.setAttribute("tabindex","0"),this.classList.remove("c-menu"),void(s&&s.classList.add("c-menu"))}if(!s)if(t)try{const e=JSON.parse(t),s=this.ensure("ul.c-menu",()=>{const t=document.createElement("ul");return t.className="c-menu",t.setAttribute("role","menu"),t});s.innerHTML="",s.setAttribute("role","menu"),e.forEach(t=>{if("---"===t||"separator"===t){const t=document.createElement("li");t.className="c-menu__separator",t.setAttribute("role","separator"),s.appendChild(t)}else if("string"==typeof t){const e=document.createElement("li");e.className="c-menu__item",e.setAttribute("role","menuitem"),e.textContent=t,s.appendChild(e)}else if(t.group){const e=document.createElement("li");e.className="c-menu__group",e.setAttribute("role","group"),t.group&&e.setAttribute("aria-label",String(t.group));const a=document.createElement("div");if(a.className="c-menu__group-label",a.textContent=String(t.group),e.appendChild(a),Array.isArray(t.items)){const s=document.createElement("ul");s.className="c-menu",s.setAttribute("role","menu"),t.items.forEach(t=>{const e=document.createElement("li");if(e.className="c-menu__item"+(t.danger?" c-menu__item--danger":"")+(t.disabled?" c-menu__item--disabled":""),e.setAttribute("role","menuitem"),t.disabled&&e.setAttribute("aria-disabled","true"),t.label||t.title){const s=document.createElement("span");s.className="c-menu__label",s.textContent=t.label||t.title||"",e.appendChild(s)}s.appendChild(e)}),e.appendChild(s)}s.appendChild(e)}else{const e=document.createElement("li");e.className="c-menu__item"+(t.danger?" c-menu__item--danger":"")+(t.disabled?" c-menu__item--disabled":"");const a="checkbox"===t.type?"menuitemcheckbox":"radio"===t.type?"menuitemradio":"menuitem";if(e.setAttribute("role",a),"checkbox"!==t.type&&"radio"!==t.type||e.setAttribute("aria-checked",String(!!t.checked)),t.disabled&&e.setAttribute("aria-disabled","true"),t.items&&Array.isArray(t.items)&&(e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false")),t.label||t.title){const s=document.createElement("span");s.className="c-menu__label",s.textContent=t.label||t.title||"",e.appendChild(s)}if(t.shortcut){const s=document.createElement("span");s.className="c-menu__shortcut",s.textContent=t.shortcut,e.appendChild(s)}if(t.items&&Array.isArray(t.items)){const s=document.createElement("ul");s.className="c-menu",s.setAttribute("role","menu"),t.items.forEach(t=>{const e=document.createElement("li");if(e.className="c-menu__item"+(t.danger?" c-menu__item--danger":"")+(t.disabled?" c-menu__item--disabled":""),e.setAttribute("role","menuitem"),t.disabled&&e.setAttribute("aria-disabled","true"),t.label||t.title){const s=document.createElement("span");s.className="c-menu__label",s.textContent=t.label||t.title||"",e.appendChild(s)}s.appendChild(e)}),e.appendChild(s)}s.appendChild(e)}}),s.parentNode!==this&&this.appendChild(s),this.classList.remove("c-menu"),s.classList.add("c-menu")}catch(t){warnBadJson(this,"attribute",t)}else renderEmpty(this,"menu")}enhance(){wireMenu(this)}}define("contour-menu",ContourMenu);class ContourTabs extends ContourBase{static get observed(){return["tabs","items","autoplay","pause","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","orientation","closable","cache-key","no-cache"]}static get properties(){return{tabs:{attribute:"tabs"},autoplay:{attribute:"autoplay",type:Number},pause:{attribute:"pause",type:Boolean},src:{attribute:"src"},orientation:{attribute:"orientation"},closable:{attribute:"closable",type:Boolean}}}render(){if(this.classList.add("c-tabs"),wireStates(this),loadRemote(this,"tabs"),renderStates(this,"tabs"))return;const t=remoteData(this,"tabs")||remoteData(this,"items")||this.getAttribute("tabs")||this.getAttribute("items"),e=Array.from(this.querySelectorAll("[role='tab']")),s=this.querySelector(".c-tabs__list"),a=Array.from(this.querySelectorAll(".c-tabs__panel"));if(e.length){if(!s){const t=document.createElement("div");t.className="c-tabs__list",t.setAttribute("role","tablist");const s="vertical"===this.getAttribute("orientation")?"vertical":"horizontal";t.setAttribute("aria-orientation",s),"vertical"===s?this.classList.add("c-tabs--vertical"):this.classList.remove("c-tabs--vertical");for(const s of e)s.parentElement===this&&t.appendChild(s);this.prepend(t)}const t="vertical"===this.getAttribute("orientation")?"vertical":"horizontal";s&&s.setAttribute("aria-orientation",t),"vertical"===t?this.classList.add("c-tabs--vertical"):this.classList.remove("c-tabs--vertical");const r=e.findIndex(t=>"true"===t.getAttribute("aria-selected"));return void e.forEach((t,e)=>{t.classList.contains("c-tabs__tab")||t.classList.add("c-tabs__tab"),t.getAttribute("role")||t.setAttribute("role","tab");let s=t.getAttribute("aria-controls");if(s){let t=a.find(t=>t.id===s);t||(t=document.createElement("div"),t.className="c-tabs__panel",t.id=s,t.setAttribute("role","tabpanel"),this.appendChild(t))}else{const r=a[e];r&&(s=r.id||contourId("c-tabs-panel"),r.id=s,t.setAttribute("aria-controls",s))}const i=r>=0?e===r:0===e;t.setAttribute("aria-selected",String(i)),t.tabIndex=i?0:-1;const o=t.getAttribute("aria-controls"),n=o?document.getElementById(o):null;n&&(n.hidden=!i)})}if(t&&!e.length)try{const e=JSON.parse(t),s=this.ensure(".c-tabs__list",()=>{const t=document.createElement("div");return t.className="c-tabs__list",t.setAttribute("role","tablist"),t});s.setAttribute("role","tablist");const a="vertical"===this.getAttribute("orientation")?"vertical":"horizontal";s.setAttribute("aria-orientation",a),"vertical"===a?this.classList.add("c-tabs--vertical"):this.classList.remove("c-tabs--vertical");const r=Array.from(s.querySelectorAll("[role='tab']")).findIndex(t=>"true"===t.getAttribute("aria-selected")),i=r>=0?r:0;s.innerHTML="",Array.from(this.querySelectorAll(".c-tabs__panel")).forEach(t=>t.remove()),e.forEach((t,e)=>{const a="string"==typeof t?t:t.label||t.title||"",r=contourId("c-tabs-panel"),o=document.createElement(this.hasAttribute("closable")?"div":"button");o.className="c-tabs__tab","BUTTON"===o.tagName&&(o.type="button"),o.setAttribute("role","tab"),o.setAttribute("aria-selected",String(e===i)),o.setAttribute("aria-controls",r),o.tabIndex=e===i?0:-1;const n=document.createElement("span");if(n.textContent=a,o.textContent="",o.appendChild(n),this.hasAttribute("closable")){const t=document.createElement("button");t.type="button",t.className="c-tabs__close",t.setAttribute("aria-label",labelText(this,"close","Close")+" "+a),t.textContent="×",t.addEventListener("click",t=>{t.stopPropagation();const e=Array.from(s.querySelectorAll("[role='tab']")).indexOf(o),r=o.getAttribute("aria-controls"),i=r?document.getElementById(r):null;o.remove(),i&&i.remove(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0,detail:{index:e,label:a}}));const n=s.querySelectorAll("[role='tab']");n.length&&n[0].click()}),o.appendChild(t)}s.appendChild(o);const l=document.createElement("div");l.className="c-tabs__panel",l.id=r,l.setAttribute("role","tabpanel"),"object"==typeof t&&null!==t&&void 0!==t.content&&(l.textContent=String(t.content)),e!==i&&(l.hidden=!0),this.appendChild(l)}),s.parentNode!==this&&this.prepend(s)}catch(t){warnBadJson(this,"attribute",t)}else if(!t&&!e.length){const t=this.querySelector(".c-tabs__list");t&&t.remove(),renderEmpty(this,"tabs")}}enhance(){wireTabs(this);const t=()=>{const t=parseFloat(this.getAttribute("autoplay")||""),e=this.hasAttribute("pause")||this._tabsHover||this._tabsFocus,s="function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,a=Number.isFinite(t)&&t>0&&!e&&!s;a!==this._tabsAutoplayRunning&&(this._tabsAutoplayRunning=a,void 0!==this._tabsTimer&&(clearInterval(this._tabsTimer),this._tabsTimer=void 0),a&&(this._tabsTimer=setInterval(()=>{if(!this.isConnected||this.hasAttribute("pause")||this._tabsHover||this._tabsFocus)return;const t=this.querySelector(".c-tabs__list"),e=t?Array.from(t.querySelectorAll("[role='tab']")):[];if(!e.length)return;const s=e.findIndex(t=>"true"===t.getAttribute("aria-selected")),a=e[(s+1)%e.length];a&&a.click()},Math.max(1e3,1e3*t))))};t(),this._wiredTabsAutoplay||(this._wiredTabsAutoplay=!0,this.addEventListener("pointerenter",()=>{this._tabsHover=!0,t()}),this.addEventListener("pointerleave",()=>{this._tabsHover=!1,t()}),this.addEventListener("focusin",()=>{this._tabsFocus=!0,t()}),this.addEventListener("focusout",()=>{this._tabsFocus=!1,t()}),onDispose(this,()=>{void 0!==this._tabsTimer&&(clearInterval(this._tabsTimer),this._tabsTimer=void 0)}))}}define("contour-tabs",ContourTabs);class ContourCodeTabs extends ContourBase{static get observed(){return["tabs","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","cache-key","no-cache"]}static get properties(){return{tabs:{attribute:"tabs"},src:{attribute:"src"}}}render(){if(this.classList.add("c-code-tabs"),wireStates(this),loadRemote(this,"tabs"),renderStates(this,"code-tabs"))return;const t=remoteData(this,"tabs"),e=this.querySelector(".c-code-tabs__list"),s=e?Array.from(e.children).filter(t=>t.getAttribute&&"tab"===t.getAttribute("role")):[];if(t&&!s.length)try{const e=JSON.parse(t),s=this.ensure(".c-code-tabs__list",()=>{const t=document.createElement("div");return t.className="c-code-tabs__list",t.setAttribute("role","tablist"),t});s.setAttribute("role","tablist");const a=Array.from(s.querySelectorAll("[role='tab']")).findIndex(t=>"true"===t.getAttribute("aria-selected")),r=a>=0?a:0;s.innerHTML="",Array.from(this.querySelectorAll(".c-code-tabs__panel")).forEach(t=>t.remove()),e.forEach((t,e)=>{const a="string"==typeof t?t:t.label||t.title||"",i=contourId("c-code-tabs-panel"),o=document.createElement("button");o.className="c-code-tabs__tab",o.type="button",o.setAttribute("role","tab"),o.setAttribute("aria-selected",String(e===r)),o.setAttribute("aria-controls",i),o.tabIndex=e===r?0:-1,o.textContent=a,s.appendChild(o);const n=document.createElement("div");if(n.className="c-code-tabs__panel",n.id=i,n.setAttribute("role","tabpanel"),"object"==typeof t&&null!==t&&void 0!==t.content){const e=document.createElement("pre"),s=document.createElement("code");s.textContent=String(t.content),e.appendChild(s),n.appendChild(e);const a=document.createElement("button");a.className="c-btn c-btn--ghost c-btn--sm c-code-tabs__copy",a.type="button",a.textContent=labelText(this,"copy","Copy"),a.setAttribute("aria-label",labelText(this,"copy-code","Copy code")),a.dataset.copy=String(t.content),n.appendChild(a)}e!==r&&(n.hidden=!0),this.appendChild(n)}),s.parentNode!==this&&this.prepend(s)}catch(t){warnBadJson(this,"attribute",t)}else!t&&e?(e.remove(),renderEmpty(this,"code-tabs")):t||e||renderEmpty(this,"code-tabs")}enhance(){wireTabs(this),this._wiredCodeTabs||(this._wiredCodeTabs=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-code-tabs__copy"):null;if(!e||!this.contains(e))return;const s=e.dataset.copy||"";if(s)try{navigator.clipboard.writeText(s),e.textContent=labelText(this,"copied","Copied!"),setTimeout(()=>{e.textContent=labelText(this,"copy","Copy")},2e3)}catch(t){}}))}}define("contour-code-tabs",ContourCodeTabs);class ContourBreadcrumb extends ContourBase{static get observed(){return["items","separator","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},separator:{attribute:"separator"},max:{attribute:"max",type:Number},src:{attribute:"src"}}}render(){if(this.classList.add("c-breadcrumb"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",labelText(this,"breadcrumb","Breadcrumb")),wireStates(this),loadRemote(this,"items"),renderStates(this,"breadcrumb"))return;const t=remoteData(this,"items"),e=this.querySelector("nav"),s=e?e.querySelector("ol"):null,a=s?Array.from(s.children).filter(t=>"LI"===t.tagName):[];if(t&&!a.length)try{const e=JSON.parse(t),s=this.ensure("nav",()=>{const t=document.createElement("nav");return t.setAttribute("aria-label",labelText(this,"breadcrumb","Breadcrumb")),t});s.setAttribute("aria-label",labelText(this,"breadcrumb","Breadcrumb")),s.id||(s.id=contourId("contour-breadcrumb-list")),s.innerHTML="";const a=document.createElement("ol");a.className="c-breadcrumb__list",s.appendChild(a);const r=this.getAttribute("separator")||"/",i=this._overflowExpanded?null:this.max,o=Number.isFinite(i)&&i>1&&e.length>i?e.slice(-i):e;if(Number.isFinite(i)&&i>1&&e.length>i){const t=document.createElement("button");t.type="button",t.className="c-breadcrumb__overflow",t.setAttribute("aria-label",`Show ${e.length-o.length+1} more items`),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls",s.id),t.textContent="…",t.addEventListener("click",()=>{this._overflowExpanded=!0,this.requestRender(),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{expanded:!0}}))});const r=document.createElement("li");r.appendChild(t),a.appendChild(r)}o.forEach((t,e)=>{const s=document.createElement("li");if(e<o.length-1){const e=document.createElement("a");e.href=safeHref(t.href||"#"),e.textContent=t.label||t,s.appendChild(e);const a=document.createElement("span");a.className="c-breadcrumb__sep",a.setAttribute("aria-hidden","true"),a.textContent=r,s.appendChild(a)}else{const e=document.createElement("span");e.textContent=t.label||t,e.setAttribute("aria-current","page"),s.appendChild(e)}a.appendChild(s)})}catch(t){warnBadJson(this,"attribute",t)}else!t&&e?e.remove():t||e||renderEmpty(this,"breadcrumb")}}define("contour-breadcrumb",ContourBreadcrumb);class ContourPagination extends ContourBase{static get observed(){return["pages","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","cache-key","no-cache"]}static get properties(){return{pages:{attribute:"pages"},current:{attribute:"current"},src:{attribute:"src"}}}render(){if(this.classList.add("c-pagination"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",labelText(this,"pagination","Pagination")),wireStates(this),loadRemote(this,"pages"),renderStates(this,"pagination"))return;const t=remoteData(this,"pages");Array.from(this.querySelectorAll(".c-pagination__link")).forEach(t=>t.remove());let e=this.getAttribute("current")||"1";if("storage"===this.getAttribute("persist")&&this.id)try{const t=localStorage.getItem("contour-pagination:"+this.id);null!==t&&(e=t)}catch(t){}else if("url"===this.getAttribute("persist"))try{const t=new URLSearchParams(window.location.search).get("c-pagination");null!==t&&(e=t)}catch(t){}const s=parseInt(e,"10")||1;if(this.setAttribute("page",String(s)),t){let e=parseInt(t,10);if(!Number.isFinite(e)||e<1)try{const s=JSON.parse(t);Array.isArray(s)&&(e=s.length)}catch(t){}const a=document.createElement("button");a.type="button",a.className="c-pagination__link c-pagination__prev",a.setAttribute("data-action","prev"),setHTML(a,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-left" /></svg>'),a.setAttribute("aria-label",labelText(this,"prev","Previous page")),s<=1&&a.setAttribute("disabled",""),this.appendChild(a);const r=new Set([1,e,s]);s>1&&r.add(s-1),s<e&&r.add(s+1);const i=[...r].filter(t=>t>=1&&t<=e).sort((t,e)=>t-e);let o=0;for(const t of i){if(o&&t-o>1){const t=document.createElement("span");t.className="c-pagination__ellipsis",t.textContent="…",t.setAttribute("aria-hidden","true"),this.appendChild(t)}const e=document.createElement("button");e.type="button",e.className="c-pagination__link",e.textContent=String(t),t===s&&e.setAttribute("aria-current","page"),this.appendChild(e),o=t}const n=document.createElement("button");n.type="button",n.className="c-pagination__link c-pagination__next",n.setAttribute("data-action","next"),setHTML(n,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),n.setAttribute("aria-label",labelText(this,"next","Next page")),s>=e&&n.setAttribute("disabled",""),this.appendChild(n)}else renderEmpty(this,"pagination")}enhance(){wirePagination(this)}}define("contour-pagination",ContourPagination);class ContourPagerFull extends ContourBase{static get observed(){return["prev","next"]}static get properties(){return{prev:{attribute:"prev"},next:{attribute:"next"}}}render(){this.classList.add("c-pager"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",labelText(this,"pagination","Pagination")),Array.from(this.querySelectorAll(".c-pager__link")).forEach(t=>t.remove());const t=this.getAttribute("prev"),e=this.getAttribute("next");if(t){const e=document.createElement("a");e.className="c-pager__link",e.href=safeHref(t.split("|")[1]||"#");const s=document.createElement("span");s.className="c-pager__dir",s.textContent=labelText(this,"previous","← Previous"),e.appendChild(s);const a=document.createElement("span");a.className="c-pager__title",a.textContent=t.split("|")[0],e.appendChild(a),this.appendChild(e)}if(e){const t=document.createElement("a");t.className="c-pager__link c-pager__link--next",t.href=safeHref(e.split("|")[1]||"#");const s=document.createElement("span");s.className="c-pager__dir",s.textContent=labelText(this,"next","Next")+" →",t.appendChild(s);const a=document.createElement("span");a.className="c-pager__title",a.textContent=e.split("|")[0],t.appendChild(a),this.appendChild(t)}}}define("contour-pager",ContourPagerFull);class ContourTocFull extends ContourBase{static get observed(){return["title","items","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","empty","no-cache"]}static get properties(){return{title:{attribute:"title"},items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-toc"),this.setAttribute("role","group"),wireStates(this),loadRemote(this,"items"),renderStates(this,"toc"))return;const t=remoteData(this,"items"),e=this.getAttribute("title")||"On this page";this.ensure(".c-toc__title",()=>{const t=document.createElement("div");return t.className="c-toc__title",t}).textContent=e;const s=this.querySelector(".c-toc__list"),a=s?Array.from(s.children).filter(t=>"A"===t.tagName):[];if(t&&!a.length)try{const s=JSON.parse(t),a=this.ensure(".c-toc__list",()=>{const t=document.createElement("nav");return t.className="c-toc__list",t});a.className="c-toc__list",a.setAttribute("aria-label",e),a.innerHTML="",s.forEach((t,e)=>{const s=document.createElement("a");s.className="c-toc__link"+(t.sub?" c-toc__link--sub":""),s.href=safeHref(t.href||"#"),s.textContent=t.label||t,s.tabIndex=0===e?0:-1,t.current&&s.setAttribute("aria-current","true"),a.appendChild(s)})}catch(t){warnBadJson(this,"attribute",t)}else!t&&s?(s.remove(),renderEmpty(this,"toc")):t||s||renderEmpty(this,"toc")}enhance(){if(this._wiredTocSpy)return;const t=()=>Array.from(this.querySelectorAll(".c-toc__link")),e=()=>t().map(t=>{const e=t.getAttribute("href")||"";if(!e.startsWith("#")||e.length<2)return null;const s=document.getElementById(e.slice(1));return s?{a:t,el:s}:null}).filter(Boolean);if(!e().length)return;this._wiredTocSpy=!0;const s=()=>{const s=e();if(!s.length)return;const a=(()=>{const t=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--header-height"));return(Number.isFinite(t)?t:0)+Math.min(120,.2*window.innerHeight)})();let r=s[0];for(const t of s)t.el.getBoundingClientRect().top<=a&&(r=t);document.documentElement.scrollHeight>window.innerHeight+2&&window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-2&&(r=s[s.length-1]);const i=r.el.id;t().forEach(t=>{t.getAttribute("href")==="#"+i?"true"!==t.getAttribute("aria-current")&&t.setAttribute("aria-current","true"):t.hasAttribute("aria-current")&&t.removeAttribute("aria-current")})};let a=0;const r=()=>{a||(a=requestAnimationFrame(()=>{a=0,s()}))};window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),window.addEventListener("hashchange",r),s(),onDispose(this,()=>{window.removeEventListener("scroll",r),window.removeEventListener("resize",r),window.removeEventListener("hashchange",r),a&&cancelAnimationFrame(a)}),this._wiredTocScroll||(this._wiredTocScroll=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-toc__link"):null;if(!e||!this.contains(e))return;const s=e.getAttribute("href")||"";if(!s.startsWith("#")||s.length<2)return;const a=document.getElementById(s.slice(1));if(a){t.preventDefault();try{a.scrollIntoView({behavior:"smooth",block:"start"})}catch(t){a.scrollIntoView()}this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{href:s}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-toc__link"));e.length&&navKey(t,e,{wrap:!0,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}})}))}}define("contour-toc",ContourTocFull);class ContourHeader extends ContourBase{static get observed(){return["brand","brand-href","links"]}static get properties(){return{brand:{attribute:"brand"},"brand-href":{attribute:"brand-href"},links:{attribute:"links"}}}render(){this.classList.add("c-header"),this.hasAttribute("role")||this.setAttribute("role","banner"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("brand")||"Header");const t=this.getAttribute("brand"),e=this.getAttribute("links"),s=this.ensure(".c-header__inner",()=>{const t=document.createElement("div");return t.className="container c-header__inner",t});s.className="container c-header__inner";let a=s.querySelector(".c-brand");if(t){if(!a){a=document.createElement("a"),a.className="c-brand",a.setAttribute("data-contour-generated",""),a.href=safeHref(this.getAttribute("brand-href")||"#"),setHTML(a,'<span class="c-mark"><svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-mark" /></svg></span>');const t=document.createElement("span");t.className="c-brand__name",a.appendChild(t),s.insertBefore(a,s.firstChild)}const e=a.querySelector(".c-brand__name");e&&(e.textContent=t)}else a&&a.hasAttribute("data-contour-generated")&&a.remove();let r=s.querySelector(".c-header__nav");const i=r?Array.from(r.children).filter(t=>"A"===t.tagName):[];if(e&&!i.length)try{const t=JSON.parse(e);r||(r=document.createElement("nav"),r.className="c-header__nav",r.setAttribute("aria-label",labelText(this,"main","Main")),r.setAttribute("data-contour-generated",""),s.appendChild(r)),r.innerHTML="",t.forEach(t=>{const e=document.createElement("a");e.href=safeHref(t.href||"#"),e.textContent=t.label||t,r.appendChild(e)})}catch(t){}else e&&i.length||r&&!e&&!i.length&&r.hasAttribute("data-contour-generated")&&r.remove();if(!s.querySelector(".c-header__actions")){const t=document.createElement("div");t.className="c-header__actions",s.appendChild(t)}const o=s.querySelector(".c-header__nav");if(o){o.id||(o.id=contourId("header-nav"));const t=s.querySelector(".c-header__actions");if(t&&!t.querySelector(".c-header__toggle")){const e=document.createElement("button");e.type="button",e.className="c-header__toggle",e.setAttribute("aria-label",labelText(this,"toggle-navigation","Toggle navigation")),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",o.id),setHTML(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-menu" /></svg>'),t.appendChild(e)}}s.parentNode!==this&&this.appendChild(s)}enhance(){if(this._wiredHeader)return;this._wiredHeader=!0;const t=()=>{const t=window.scrollY||document.documentElement.scrollTop||0;this.classList.toggle("c-header--scrolled",t>8)};t(),window.addEventListener("scroll",t,{passive:!0}),onDispose(this,()=>window.removeEventListener("scroll",t)),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-header__toggle"):null;if(!e||!this.contains(e))return;const s=this.querySelector("#"+CSS.escape(e.getAttribute("aria-controls")||""));if(!s)return;const a=s.classList.toggle("is-open");e.setAttribute("aria-expanded",String(a)),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{open:a}}))}),this.addEventListener("keydown",t=>{if("Escape"!==t.key)return;const e=this.querySelector(".c-header__toggle"),s=e&&this.querySelector("#"+CSS.escape(e.getAttribute("aria-controls")||""));e&&s&&s.classList.contains("is-open")&&(s.classList.remove("is-open"),e.setAttribute("aria-expanded","false"))})}}define("contour-header",ContourHeader);class ContourFooter extends ContourBase{static get observed(){return["brand","note","links","cols","heading"]}static get properties(){return{brand:{attribute:"brand"},note:{attribute:"note"},links:{attribute:"links"},cols:{attribute:"cols"}}}render(){this.classList.add("c-footer"),this.hasAttribute("role")||this.setAttribute("role","contentinfo");const t=this.getAttribute("brand");if(t){this.ensure(".c-footer__brand",()=>{const t=document.createElement("div");return t.className="c-footer__brand",t}).textContent=t}else{const t=this.querySelector(".c-footer__brand");t&&t.remove()}const e=this.getAttribute("note");if(e){this.ensure(".c-footer__note",()=>{const t=document.createElement("p");return t.className="c-footer__note",t}).textContent=e}else{const t=this.querySelector(".c-footer__note");t&&t.remove()}const s=this.getAttribute("links");if(s)try{const t=JSON.parse(s),e=this.ensure(".c-footer__links",()=>{const t=document.createElement("div");return t.className="c-footer__links",t});e.innerHTML="",t.forEach(t=>{const s=document.createElement("a");s.href=safeHref("string"==typeof t?"#":t.href||"#"),s.textContent="string"==typeof t?t:t.label||t,e.appendChild(s)})}catch(t){warnBadJson(this,"attribute",t)}else{const t=this.querySelector(".c-footer__links");t&&t.remove()}const a=this.getAttribute("cols");if(a)try{const t=JSON.parse(a);this.querySelectorAll(".c-footer__col").forEach(t=>t.remove()),t.forEach(t=>{const e=document.createElement("div");if(e.className="c-footer__col",t.title){const s=document.createElement(headingTag(this,"h3"));s.textContent=t.title,e.appendChild(s)}(t.links||[]).forEach(t=>{const s=document.createElement("a");s.href=safeHref("string"==typeof t?"#":t.href||"#"),s.textContent="string"==typeof t?t:t.label||t,e.appendChild(s)}),this.appendChild(e)})}catch(t){warnBadJson(this,"attribute",t)}else this.querySelectorAll(".c-footer__col").forEach(t=>t.remove())}}define("contour-footer",ContourFooter);class ContourSchemeToggle extends ContourBase{static get observed(){return[]}_stored(){try{return localStorage.getItem("contour-scheme")??"light dark"}catch(t){return"light dark"}}_resolved(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}_rendered(){const t=this._stored();return"light dark"===t?this._resolved():t}render(){if(this.classList.add("c-scheme-toggle"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),!this.querySelector(".c-scheme-toggle__icons")&&!this.querySelector(".c-scheme-toggle__glyph")){const t=document.createElement("span");t.className="c-scheme-toggle__glyph",t.setAttribute("aria-hidden","true"),this.appendChild(t)}this._sync()}_sync(){const t=this._rendered(),e="dark"===t?"light":"dark";this.setAttribute("aria-pressed",String("dark"===t)),this.setAttribute("aria-label","dark"===e?"Switch to dark theme":"Switch to light theme");const s=this.querySelector(".c-scheme-toggle__glyph");s&&(s.textContent="dark"===t?"☀":"☾")}_apply(t){const e=document.documentElement,s="light dark"===t?this._resolved():t;e.classList.add("is-theme-switching");const a=document.querySelector('meta[name="color-scheme"]');a&&a.setAttribute("content",t),e.setAttribute("data-theme",s);try{"light dark"===t?localStorage.removeItem("contour-scheme"):localStorage.setItem("contour-scheme",t)}catch(t){}requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("is-theme-switching"))),this._sync(),this.dispatchEvent(new CustomEvent("contour:theme-change",{detail:{theme:s},bubbles:!0,composed:!0}))}enhance(){if(this._wiredScheme)return;this._wiredScheme=!0,this.addEventListener("click",()=>{const t="dark"===this._rendered()?"light":"dark";this._apply(t===this._resolved()?"light dark":t)}),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.click())});const t=window.matchMedia("(prefers-color-scheme: dark)");t.addEventListener&&t.addEventListener("change",()=>{"light dark"===this._stored()&&(document.documentElement.setAttribute("data-theme",this._resolved()),this._sync())});try{const t=localStorage.getItem("contour-theme");t&&(localStorage.getItem("contour-scheme")||"dark"!==t&&"light"!==t||localStorage.setItem("contour-scheme",t),localStorage.removeItem("contour-theme"))}catch(t){}const e=this._stored();"light dark"!==e?this._apply(e):this._sync()}}define("contour-scheme-toggle",ContourSchemeToggle);class ContourSidebar extends ContourBase{static get observed(){return["title","items","collapsed"]}static get properties(){return{title:{attribute:"title"},items:{attribute:"items"},collapsed:{attribute:"collapsed",type:Boolean}}}render(){this.classList.add("c-sidebar"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Sidebar"),this.hasAttribute("collapsed")?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed");const t=this.getAttribute("title");if(t){this.ensure(".c-sidebar__title",()=>{const t=document.createElement("div");return t.className="c-sidebar__title",t}).textContent=t}else{const t=this.querySelector(".c-sidebar__title");t&&t.remove()}const e=this.hasAttribute("collapsed"),s=this.ensure(".c-sidebar__toggle",()=>{const t=document.createElement("button");return t.className="c-sidebar__toggle",t.type="button",t});s.setAttribute("aria-label",e?"Expand sidebar":"Collapse sidebar"),s.setAttribute("aria-pressed",String(e)),setHTML(s,e?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-down" /></svg>');const a=this.getAttribute("items");if(a)try{const t=JSON.parse(a),e=this.ensure("nav.c-sidebar__nav",()=>{const t=document.createElement("nav");return t.className="c-sidebar__nav",t});e.innerHTML="",t.forEach((t,s)=>{const a=document.createElement("a");a.className="c-sidebar__link",a.href=safeHref(t&&t.href||"#"),a.textContent=t&&(t.label||t)||"",a.tabIndex=0===s?0:-1,e.appendChild(a)})}catch(t){warnBadJson(this,"attribute",t)}}enhance(){this._wiredSidebar||(this._wiredSidebar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-sidebar__toggle"):null;e&&this.contains(e)&&(this.toggleAttribute("collapsed"),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{collapsed:this.hasAttribute("collapsed")}})))}),this.addEventListener("keydown",t=>{const e=this.querySelector("nav.c-sidebar__nav");if(!e)return;const s=Array.from(e.querySelectorAll(".c-sidebar__link"));s.length&&navKey(t,s,{wrap:!0,homeEnd:!0,onNavigate:t=>{s.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}})}))}}define("contour-sidebar",ContourSidebar);class ContourToolbar extends ContourBase{static get observed(){return["title","actions","overflow"]}static get properties(){return{title:{attribute:"title"},actions:{attribute:"actions"},overflow:{attribute:"overflow",type:Number}}}render(){this.classList.add("c-toolbar");const t=this.getAttribute("title");this.setAttribute("role","toolbar"),t&&this.setAttribute("aria-label",t);const e=this.getAttribute("actions");if(e)try{const t=JSON.parse(e),s=this.overflow&&this.overflow>0?this.overflow:t.length,a=t.slice(0,s),r=t.slice(s);if(a.forEach((t,e)=>{const s=document.createElement("button");s.className="c-toolbar__btn",s.type="button",s.tabIndex=0===e?0:-1,s.textContent="string"==typeof t?t:t.label||t,("string"==typeof t||t&&t.label)&&s.classList.add("c-toolbar__btn--text"),this.appendChild(s)}),r.length){const t=document.createElement("div");t.className="c-toolbar__overflow";const e=document.createElement("button");e.className="c-toolbar__btn c-toolbar__overflow-btn",e.type="button",e.tabIndex=-1,e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false"),e.textContent="…",e.setAttribute("aria-label",labelText(this,"more-options","More options")),t.appendChild(e);const s=document.createElement("div");s.className="c-toolbar__overflow-menu",s.setAttribute("role","menu"),s.setAttribute("hidden",""),r.forEach(t=>{const e=document.createElement("button");e.className="c-toolbar__btn",e.type="button",e.setAttribute("role","menuitem"),e.textContent="string"==typeof t?t:t.label||t,s.appendChild(e)}),t.appendChild(s),this.appendChild(t)}}catch(t){warnBadJson(this,"attribute",t)}}enhance(){this._wiredToolbar||(this._wiredToolbar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-toolbar__overflow-btn"):null;if(e&&this.contains(e)){const t=e.parentElement&&e.parentElement.querySelector(".c-toolbar__overflow-menu");if(t){const s=t.hasAttribute("hidden");s?t.removeAttribute("hidden"):t.setAttribute("hidden",""),e.setAttribute("aria-expanded",String(s)),e.tabIndex=s?-1:0;const a=Array.from(t.querySelectorAll("[role='menuitem']"));if(a.forEach((t,e)=>t.tabIndex=s&&0===e?0:-1),s)try{a[0]?.focus()}catch(t){}}return}const s=t.target&&t.target.closest?t.target.closest(".c-toolbar__btn"):null;s&&this.contains(s)&&this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0,detail:{label:s.textContent.trim()}}))}),this.addEventListener("keydown",t=>{if("Escape"===t.key){const e=this.querySelector(".c-toolbar__overflow-menu:not([hidden])");if(e){e.setAttribute("hidden","");const s=this.querySelector(".c-toolbar__overflow-btn");return s&&(s.setAttribute("aria-expanded","false"),s.tabIndex=0,s.focus()),void t.preventDefault()}}const e=this.querySelector(".c-toolbar__overflow-menu:not([hidden])");if(e){const s=Array.from(e.querySelectorAll("[role='menuitem']"));if(s.length)return void navKey(t,s,{wrap:!0,homeEnd:!0,onNavigate:t=>{s.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e||" "===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}})}const s=Array.from(this.querySelectorAll(":scope > .c-toolbar__btn"));s.length&&navKey(t,s,{wrap:!0,homeEnd:!0,onNavigate:t=>{s.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e||" "===e){const e=document.activeElement;if(e)if(t.preventDefault(),e.classList.contains("c-toolbar__overflow-btn")){const t=e.parentElement&&e.parentElement.querySelector(".c-toolbar__overflow-menu");if(t){const s=t.hasAttribute("hidden");s?t.removeAttribute("hidden"):t.setAttribute("hidden",""),e.setAttribute("aria-expanded",String(s)),e.tabIndex=s?-1:0;const a=Array.from(t.querySelectorAll("[role='menuitem']"));if(a.forEach((t,e)=>t.tabIndex=s&&0===e?0:-1),s)try{a[0]?.focus()}catch(t){}}}else e.click()}}})}),this.addEventListener("focusout",t=>{if(!this.contains(t.relatedTarget)){const t=this.querySelector(".c-toolbar__overflow-menu:not([hidden])");if(t){t.setAttribute("hidden","");const e=this.querySelector(".c-toolbar__overflow-btn");e&&e.setAttribute("aria-expanded","false")}}}))}}define("contour-toolbar",ContourToolbar);class ContourTree extends ContourBase{static get updateMode(){return"keyed"}static get observed(){return["items","virtual","item-height","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","selectable","cache-key","no-cache","density"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"},"item-height":{attribute:"item-height"}}}_itemHeight(){const t=Number(this.getAttribute("item-height"));return Number.isFinite(t)&&t>0?t:cssLength("--virtual-list-item-height",28)}_labelToPaths(t,e,s){(t||[]).forEach((t,a)=>{const r=e+"."+a,i=String(t.label||t).trim().slice(0,120);s.has(i)||s.set(i,[]),s.get(i).push(r),Array.isArray(t.children)&&this._labelToPaths(t.children,r,s)})}_restoreExpanded(){const t=this.getAttribute("persist");if(!t||!this._treeData)return;let e=null;try{if("storage"===t&&this.id){const t=localStorage.getItem("contour-tree:"+this.id);null!==t&&(e=JSON.parse(t))}else if("url"===t){const t=new URLSearchParams(window.location.search).get("c-tree");null!==t&&(e=JSON.parse(t))}}catch(t){e=null}if(!Array.isArray(e))return;const s=new Set(e.map(t=>String(t))),a=new Map;this._labelToPaths(this._treeData,"",a);const r=this._expanded||(this._expanded=new Set);for(const t of s){const e=a.get(t);e&&e.forEach(t=>r.add(t))}}_persistExpanded(){const t=this.getAttribute("persist");if(!t||!this._expanded)return;const e=new Map,s=(t,a)=>{(t||[]).forEach((t,r)=>{const i=a+"."+r;e.set(i,t),Array.isArray(t.children)&&s(t.children,i)})};s(this._treeData,"");const a=[];for(const t of this._expanded){const s=e.get(t);s&&a.push(String(s.label||s).trim().slice(0,120))}try{if("storage"===t&&this.id)localStorage.setItem("contour-tree:"+this.id,JSON.stringify(a));else if("url"===t){const t=new URL(window.location.href);t.searchParams.set("c-tree",JSON.stringify(a)),window.history.replaceState(null,"",t.toString())}}catch(t){}}_flatten(t,e,s,a,r){(t||[]).forEach((t,i)=>{const o=e+"."+i,n=Array.isArray(t.children)&&t.children.length>0,l=a.has(o);r.push({node:t,path:o,depth:s,hasChildren:n,expanded:l}),n&&l&&this._flatten(t.children,o,s+1,a,r)})}_renderNodeFlat(t,e,s,a){const r=e.node,i=e.depth,o=document.createElement("div");if(o.className="c-tree__node",o.setAttribute("role","treeitem"),o.setAttribute("aria-level",String(i)),o.setAttribute("aria-setsize",String(s)),o.setAttribute("aria-posinset",String(a)),o.dataset.path=e.path,e.hasChildren){o.setAttribute("aria-expanded",String(e.expanded));const t=document.createElement("div");t.className="c-tree__row"+(r.active?" c-tree__row--active":"")+(r.dir?" c-tree__row--dir":""),t.style.paddingInlineStart=`calc(${i-1} * 1rem * var(--density, 1))`;const s=document.createElement("button");s.className="c-tree__toggle",s.setAttribute("type","button"),s.setAttribute("aria-expanded",String(e.expanded)),s.setAttribute("aria-label",labelText(this,"toggle","Toggle")),setHTML(s,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),t.appendChild(s);const a=document.createElement("span");a.textContent=r.label,t.appendChild(a),o.appendChild(t)}else{const t=document.createElement("div");if(t.className="c-tree__leaf"+(r.active?" c-tree__row--active":"")+(r.dir?" c-tree__row--dir":""),t.style.paddingInlineStart=`calc(${i} * 1rem * var(--density, 1))`,this.hasAttribute("selectable")){const s=document.createElement("input");s.type="checkbox",s.className="c-tree__select",s.setAttribute("aria-label",labelText(this,"select","Select")+" "+(r.label||r)),this._selectedTree&&this._selectedTree.has(e.path)&&(s.checked=!0),t.insertBefore(s,t.firstChild)}t.appendChild(document.createTextNode(r.label||r)),o.appendChild(t)}return o}_renderWindow(t,e){if(!this._treeData)return;const s=this._itemHeight(),a=this._expanded||(this._expanded=new Set),r=[];this._flatten(this._treeData,"",1,a,r);const i=r.length,o=t.clientHeight||320,n=Math.ceil(o/s)+6;let l=Math.floor((e||0)/s);l<0&&(l=0),l>Math.max(0,i-n)&&(l=Math.max(0,i-n));const c=Math.min(i,l+n),d=l*s,u=Math.max(0,(i-c)*s);setHTML(t,"");const h=document.createElement("div");h.className="c-tree__spacer c-tree__spacer--top",h.style.height=d+"px",t.appendChild(h);const m=new Map;r.forEach((t,e)=>{const s=t.path.includes(".")?t.path.slice(0,t.path.lastIndexOf(".")):"";let a=m.get(s);a||(a=[],m.set(s,a)),a.push(e)});for(let e=l;e<c;e++){const s=r[e],a=s.path.includes(".")?s.path.slice(0,s.path.lastIndexOf(".")):"",i=m.get(a);t.appendChild(this._renderNodeFlat(t,s,i.length,i.indexOf(e)+1))}const p=document.createElement("div");p.className="c-tree__spacer c-tree__spacer--bottom",p.style.height=u+"px",t.appendChild(p)}render(){this.classList.add("c-tree");const t=Array.from(this.children).filter(t=>!t.classList||!t.classList.contains("c-tree"));if(wireStates(this),loadRemote(this,"items"),renderStates(this,"tree"))return;const e=remoteData(this,"items");if(e&&!t.length)try{const t=JSON.parse(e),s=this.ensure("div.c-tree",()=>{const t=document.createElement("div");return t.className="c-tree",t.setAttribute("role","tree"),t});setHTML(s,""),s.className="c-tree",s.setAttribute("role","tree");if(this.hasAttribute("virtual")){this._treeData=t,this._expanded=this._expanded||new Set,this._treeRoot=s,this._restoreExpanded(),s.style.maxHeight=s.style.maxHeight||"24rem",s.style.overflow="auto";const e=this._treeScrollTop||0;this._renderWindow(s,e);try{s.scrollTop=e}catch(t){}}else{this._treeData=null;const e=(t,a,r,i)=>{const o=a?document.createElement("div"):s;a&&(o.className="c-tree__children",o.setAttribute("role","group"),supportsUntilFound()?o.setAttribute("hidden","until-found"):o.setAttribute("hidden","")),t.forEach((s,a)=>{const n=(i||"")+"."+a,l=document.createElement("div");if(l.className="c-tree__node",l.setAttribute("role","treeitem"),l.setAttribute("aria-level",String(r)),l.setAttribute("aria-setsize",String(t.length)),l.setAttribute("aria-posinset",String(a+1)),l.dataset.path=n,s.children){l.setAttribute("aria-expanded","false");const t=document.createElement("div");if(t.className="c-tree__row"+(s.active?" c-tree__row--active":"")+(s.dir?" c-tree__row--dir":""),s.indent){const e=document.createElement("span");e.className="c-tree__indent",e.style.inlineSize=1*s.indent+"rem",t.appendChild(e)}const a=document.createElement("button");a.className="c-tree__toggle",a.setAttribute("type","button"),a.setAttribute("aria-expanded","false"),a.setAttribute("aria-label",labelText(this,"toggle","Toggle")),setHTML(a,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),t.appendChild(a);const i=document.createElement("span");i.textContent=s.label,t.appendChild(i),l.appendChild(t),e(s.children,l,r+1,n)}else{const t=document.createElement("div");if(t.className="c-tree__leaf"+(s.active?" c-tree__row--active":"")+(s.dir?" c-tree__row--dir":""),s.indent){const e=document.createElement("span");e.className="c-tree__indent",e.style.inlineSize=1*s.indent+"rem",t.appendChild(e)}if(this.hasAttribute("selectable")){const e=document.createElement("input");e.type="checkbox",e.className="c-tree__select",e.setAttribute("aria-label",labelText(this,"select","Select")+" "+(s.label||s)),this._selectedTree&&this._selectedTree.has(n)&&(e.checked=!0),t.insertBefore(e,t.firstChild)}t.appendChild(document.createTextNode(s.label||s)),l.appendChild(t)}o.appendChild(l)}),a&&a.appendChild(o)};e(t,null,1,"")}this.classList.remove("c-tree"),s.classList.add("c-tree"),s.parentNode!==this&&this.appendChild(s)}catch(t){warnBadJson(this,"attribute",t)}else e||t.length||renderEmpty(this,"tree")}enhance(){if(this._wiredTreeToggle||(this._wiredTreeToggle=!0,this.addEventListener("click",t=>{if(!this.hasAttribute("virtual"))return;let e=t.target&&t.target.closest?t.target.closest(".c-tree__toggle"):null;if(!e){const s=t.target&&t.target.closest?t.target.closest(".c-tree__row"):null;s&&(e=s.querySelector(":scope > .c-tree__toggle"))}if(!e||!this.contains(e))return;t.stopPropagation();const s=e.closest(".c-tree__node"),a=s&&s.dataset?s.dataset.path:null,r="true"===e.getAttribute("aria-expanded");a&&this._expanded&&(r?this._expanded.delete(a):this._expanded.add(a)),e.setAttribute("aria-expanded",String(!r));const i=e.closest(".c-tree__row");if(i&&i.setAttribute("aria-expanded",String(!r)),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{path:a,expanded:!r}})),this.hasAttribute("virtual")&&this._treeRoot){const t=this._treeRoot;this._treeScrollTop=t.scrollTop||0,this._renderWindow(t,this._treeScrollTop);try{t.scrollTop=this._treeScrollTop}catch(t){}this._persistExpanded()}})),this.hasAttribute("virtual")&&!this._wiredTreeScroll){this._wiredTreeScroll=!0;const t=()=>{const t=this.querySelector(".c-tree");if(!t||t._treeScrollWired)return;t._treeScrollWired=!0;let e=0;const s=()=>{e||(e=requestAnimationFrame(()=>{e=0,this._treeScrollTop=t.scrollTop||0,this._renderWindow(t,this._treeScrollTop);try{t.scrollTop=this._treeScrollTop}catch(t){}}))};t.addEventListener("scroll",s,{passive:!0}),onDispose(this,()=>{t.removeEventListener("scroll",s),e&&cancelAnimationFrame(e)})};if(t(),!this.querySelector(".c-tree")){const e=new MutationObserver(()=>{this.querySelector(".c-tree")&&(t(),e.disconnect())});e.observe(this,{childList:!0,subtree:!0}),onDispose(this,()=>e.disconnect())}}if(this.hasAttribute("virtual")&&!this._wiredTreeDragScroll){this._wiredTreeDragScroll=!0;let t=0,e=0;const s=()=>{if(!e)return void(t=0);const a=this._treeRoot;a&&(a.scrollTop+=8*e,this._treeScrollTop=a.scrollTop,this._renderWindow(a,this._treeScrollTop)),t=requestAnimationFrame(s)};this.addEventListener("dragover",a=>{const r=this._treeRoot;if(!r)return;const i=r.getBoundingClientRect();e=a.clientY<i.top+40?-1:a.clientY>i.bottom-40?1:0,e&&!t&&(t=requestAnimationFrame(s))});const a=()=>{e=0,t&&(cancelAnimationFrame(t),t=0)};this.addEventListener("dragend",a),this.addEventListener("drop",a)}wireTree(this)}}define("contour-tree",ContourTree);class ContourFilterBar extends ContourBase{static get observed(){return["label","divider","items","input","placeholder","mode","modes","scope","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","count","clearable","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},divider:{attribute:"divider"},items:{attribute:"items"},src:{attribute:"src"},count:{attribute:"count"},clearable:{attribute:"clearable"},scope:{attribute:"scope"}}}render(){if(this.classList.add("c-filter-bar"),wireStates(this),loadRemote(this,"items"),renderStates(this,"filter-bar"))return;const t=this.getAttribute("label");if(t){this.ensure(".c-filter-bar__label",()=>{const t=document.createElement("span");return t.className="c-filter-bar__label",t}).textContent=t}else{const t=this.querySelector(".c-filter-bar__label");t&&t.remove()}if(this.hasAttribute("divider"))this.ensure(".c-filter-bar__divider",()=>{const t=document.createElement("span");return t.className="c-filter-bar__divider",t});else{const t=this.querySelector(".c-filter-bar__divider");t&&t.remove()}if(this.hasAttribute("input")||this.hasAttribute("placeholder")){let t=this.querySelector(".c-filter-bar__input");t||(t=document.createElement("input"),t.type="search",t.className="c-filter-bar__input",this.appendChild(t));const e=this.getAttribute("placeholder");e&&t.setAttribute("placeholder",e)}else{const t=this.querySelector(".c-filter-bar__input");t&&t.remove()}const e=this.getAttribute("modes");let s=null;if(e)try{s=JSON.parse(e)}catch(t){s=e.split(",").map(t=>t.trim())}if(s||this.hasAttribute("mode")){let e=this.querySelector(".c-filter-bar__modes");e||(e=document.createElement("div"),e.className="c-filter-bar__modes",e.setAttribute("role","toolbar"),e.setAttribute("aria-label",t||"Filter modes"),this.appendChild(e)),setHTML(e,"");const a=this.getAttribute("mode");(Array.isArray(s)?s:["draw","erase","select"]).forEach(t=>{const s="string"==typeof t?t:t.label||t.value||t,r="string"==typeof t?t:t.value||t.label||t,i=document.createElement("button");i.type="button",i.className="c-filter-bar__mode",i.textContent=s,i.dataset.mode=r,a&&a===r&&i.setAttribute("aria-pressed","true"),e.appendChild(i)})}else{const t=this.querySelector(".c-filter-bar__modes");t&&t.remove()}const a=this.getAttribute("scope");if("viewport"===a||"global"===a){Array.from(this.querySelectorAll(".c-filter-bar__scope")).forEach(t=>t.remove());const t=document.createElement("div");t.className="c-filter-bar__modes c-filter-bar__scope",t.setAttribute("role","toolbar"),t.setAttribute("aria-label",labelText(this,"data-scope","Data scope")),["viewport","global"].forEach(e=>{const s=document.createElement("button");s.type="button",s.className="c-filter-bar__mode c-filter-bar__scope-btn",s.textContent="viewport"===e?"Viewport":"Global",s.dataset.scope=e,a===e&&s.setAttribute("aria-pressed","true"),t.appendChild(s)}),this.appendChild(t)}else{const t=this.querySelector(".c-filter-bar__scope");t&&t.remove()}Array.from(this.querySelectorAll(".c-filter-pill")).forEach(t=>t.remove());const r=remoteData(this,"items"),i=Array.from(this.querySelectorAll(":scope > .c-filter-pill"));let o=null;if(i.length)o=i.map(t=>t.textContent.trim()),i.forEach(t=>t.remove());else if(r)try{o=JSON.parse(r)}catch(t){o=null}if(Array.isArray(o)&&o.forEach(t=>{const e=document.createElement("span");e.className="c-filter-pill";const s="object"==typeof t&&null!==t,a="string"==typeof t?t:t.label||t.value||"",r=s?t.key:null,i=s?t.value:t;if(null!=r&&""!==r&&e.setAttribute("key",String(r)),null!=i&&""!==i&&e.setAttribute("value",String(i)),e.textContent=a,!s||!1!==t.removable){const t=document.createElement("button");t.className="c-filter-pill__remove",t.type="button",t.setAttribute("aria-label",labelText(this,"remove","Remove")+" "+a),t.textContent="×",e.appendChild(t)}this.appendChild(e)}),Array.from(this.querySelectorAll(".c-filter-bar__clear-all")).forEach(t=>t.remove()),this.hasAttribute("clearable")){const t=document.createElement("button");t.type="button",t.className="c-btn c-btn--ghost c-btn--sm c-filter-bar__clear-all";const e=this.getAttribute("count");setHTML(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),t.appendChild(document.createTextNode(" "+(e?labelText(this,"clear-all","Clear all")+" ("+e+")":labelText(this,"clear-all","Clear all")))),this.appendChild(t)}o||t||renderEmpty(this,"filter-bar")}enhance(){if(wireRemovable(this),this._wiredFilterBar)return;this._wiredFilterBar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-filter-bar__mode"):null;if(e&&this.contains(e))if(e.classList.contains("c-filter-bar__scope-btn")){const t=e.dataset.scope||null;Array.from(this.querySelectorAll(".c-filter-bar__scope-btn")).forEach(t=>t.setAttribute("aria-pressed",String(t===e))),t&&this.setAttribute("scope",t),this.dispatchEvent(new CustomEvent("contour:scope-change",{bubbles:!0,composed:!0,detail:{scope:t}}))}else{const t=e.dataset.mode||e.textContent.trim();Array.from(this.querySelectorAll(".c-filter-bar__mode:not(.c-filter-bar__scope-btn)")).forEach(t=>t.setAttribute("aria-pressed",String(t===e))),this.dispatchEvent(new CustomEvent("contour:mode-change",{bubbles:!0,composed:!0,detail:{mode:t}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-filter-bar__mode"));navKey(t,e,{wrap:!1,onKey:()=>{document.activeElement.click()}})});const t=this.querySelector(".c-filter-bar__input");t&&!t._wiredFilterInput&&(t._wiredFilterInput=!0,t.addEventListener("input",()=>{this.dispatchEvent(new CustomEvent("contour:input",{bubbles:!0,composed:!0,detail:{value:t.value}}))}),t.addEventListener("change",()=>{this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t.value}}))})),this._wiredClearAll||(this._wiredClearAll=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-filter-bar__clear-all"):null;e&&this.contains(e)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:clear-all",{bubbles:!0,composed:!0,detail:{}})))}))}}define("contour-filter-bar",ContourFilterBar);class ContourCommand extends ContourBase{static get observed(){return["placeholder","items","recent","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache","anchor"]}static get properties(){return{placeholder:{attribute:"placeholder"},items:{attribute:"items"},recent:{attribute:"recent"},empty:{attribute:"empty"},src:{attribute:"src"}}}render(){if(this.classList.add("c-command"),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",labelText(this,"command-palette","Command palette")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),wireStates(this),loadRemote(this,"items"),renderStates(this,"command"))return;const t=this.getAttribute("placeholder")||"Search…",e=this.ensure(".c-command__input",()=>{const t=document.createElement("div");return t.className="c-command__input",t}),s=this.ensure(".c-command__field",()=>{const t=document.createElement("input");return t.className="c-command__field",t.type="text",t});e.contains(s)||e.appendChild(s),s.type="text",s.placeholder=t,s.setAttribute("aria-label",labelText(this,"command","Command")),s.setAttribute("role","combobox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-expanded","true");const a=this.querySelector(".c-command__list");a&&!a.id&&(a.id=contourId("c-command-list")),a&&a.id&&s.setAttribute("aria-controls",a.id),this._applyCommandAnchor();const r=remoteData(this,"items"),i=this.querySelector(".c-command__list"),o=i?Array.from(i.children).filter(t=>t.classList&&t.classList.contains("c-command__item")||t.classList&&t.classList.contains("c-command__group")):[];if(r&&!o.length)try{const t=JSON.parse(r),e=this.ensure(".c-command__list",()=>{const t=document.createElement("div");return t.className="c-command__list",t.setAttribute("role","listbox"),t.id=contourId("c-command-list"),t});e.setAttribute("role","listbox"),setHTML(e,"");const s=this.getAttribute("recent");if(s)try{const t=JSON.parse(s),a=document.createElement("div");a.className="c-command__group";const r=document.createElement("div");r.className="c-command__group-title",r.textContent=labelText(this,"recent","Recent"),a.appendChild(r),t.forEach(t=>{const e=document.createElement("div");e.className="c-command__item",e.setAttribute("role","option");const s=document.createElement("div");s.className="c-command__item-body";const r=document.createElement("div");r.className="c-command__item-title",r.textContent="string"==typeof t?t:t.title||t.label||"",s.appendChild(r),e.appendChild(s),a.appendChild(e)}),e.appendChild(a)}catch(t){}t.forEach(t=>{if(t.group){const s=document.createElement("div");s.className="c-command__group";const a=document.createElement("div");a.className="c-command__group-title",a.textContent=t.group,s.appendChild(a);const r=document.createElement("div");if(r.className="c-command__item",r.setAttribute("role","option"),t.icon){const e=document.createElement("span");e.className="c-command__item-icon",e.textContent=t.icon,r.appendChild(e)}const i=document.createElement("div");if(i.className="c-command__item-body",t.title||t.label){const e=document.createElement("div");e.className="c-command__item-title",e.textContent=t.title||t.label,i.appendChild(e)}if(t.hint){const e=document.createElement("span");e.className="c-command__item-hint",e.textContent=t.hint,i.appendChild(e)}if(t.shortcut){const e=document.createElement("kbd");e.className="c-command__item-shortcut",e.textContent=t.shortcut,r.appendChild(e)}r.appendChild(i),s.appendChild(r),e.appendChild(s)}else{const s=document.createElement("div");if(s.className="c-command__item",s.setAttribute("role","option"),t.icon){const e=document.createElement("span");e.className="c-command__item-icon",e.textContent=t.icon,s.appendChild(e)}const a=document.createElement("div");if(a.className="c-command__item-body",t.title||t.label){const e=document.createElement("div");e.className="c-command__item-title",e.textContent=t.title||t.label,a.appendChild(e)}if(t.hint){const e=document.createElement("span");e.className="c-command__item-hint",e.textContent=t.hint,a.appendChild(e)}if(t.shortcut){const e=document.createElement("kbd");e.className="c-command__item-shortcut",e.textContent=t.shortcut,s.appendChild(e)}s.appendChild(a),e.appendChild(s)}})}catch(t){warnBadJson(this,"attribute",t)}else!r&&a&&a.remove();const n=this.getAttribute("empty");if(n){const t=this.ensure(".c-command__empty",()=>{const t=document.createElement("div");return t.className="c-command__empty",t});t.textContent=n,t.hidden=this.querySelectorAll(".c-command__item").length>0}else{const t=this.querySelector(".c-command__empty");t&&t.remove()}this.ensure(".c-command__status",()=>{const t=document.createElement("div");return t.className="c-command__status",t.setAttribute("role","status"),t}).textContent="",r||a||renderEmpty(this,"command")}_applyCommandAnchor(){const t=this.getAttribute("anchor"),e=t?t.startsWith("#")?document.getElementById(t.slice(1)):document.querySelector(t):null;if(this._commandAnchorEl&&this._commandAnchorEl!==e&&(this._commandAnchorEl.style.removeProperty("anchor-name"),this._commandAnchorEl.removeAttribute("aria-controls"),this._commandAnchorEl.removeAttribute("aria-expanded")),this._commandAnchorEl=e||null,e){const t="--command-"+this.id;e.style.setProperty("anchor-name",t),this.style.setProperty("position-anchor",t),e.setAttribute("aria-controls",this.id),this._commandAnchorDispose||(this._commandAnchorDispose=!0,onDispose(this,()=>{this._commandAnchorEl&&(this._commandAnchorEl.style.removeProperty("anchor-name"),this._commandAnchorEl.removeAttribute("aria-controls"),this._commandAnchorEl.removeAttribute("aria-expanded")),this._commandAnchorDispose=!1}))}else this.style.removeProperty("position-anchor")}show(){if(this.matches(":popover-open"))return void(this.hasAttribute("open")||this.setAttribute("open",""));if("function"==typeof this.showPopover)try{this.showPopover()}catch(t){}this.classList.add("is-open");const t=this.querySelector(".c-command__field");t&&t.setAttribute("aria-expanded","true"),this.hasAttribute("open")||this.setAttribute("open",""),this._setCommandTriggerExpanded(!0)}hide(){if(!this.matches(":popover-open"))return void(this.hasAttribute("open")&&this.removeAttribute("open"));if("function"==typeof this.hidePopover)try{this.hidePopover()}catch(t){}this.classList.remove("is-open");const t=this.querySelector(".c-command__field");t&&t.setAttribute("aria-expanded","false"),this.hasAttribute("open")&&this.removeAttribute("open"),this._setCommandTriggerExpanded(!1)}toggle(){this.matches(":popover-open")?this.hide():this.show()}_setCommandTriggerExpanded(t){const e=this._commandAnchorEl;e&&(e.setAttribute("aria-controls",this.id),e.setAttribute("aria-expanded",String(!!t)))}enhance(){if(this._wiredCommand)return;this._wiredCommand=!0,this.addEventListener("beforetoggle",t=>{if("open"===t.newState){this.classList.add("is-open"),wcEmitOverlay(this,"contour:open",{});const e=this.querySelector(".c-command__field");if(e){e.setAttribute("aria-expanded","true");try{e.focus()}catch(t){}}this._setCommandTriggerExpanded(!0)}else this.classList.remove("is-open"),wcEmitOverlay(this,"contour:close",{}),this._setCommandTriggerExpanded(!1)}),this.addEventListener("toggle",t=>{"open"===t.newState&&requestAnimationFrame(()=>{this._applyCommandAnchor()})});const t=()=>this.querySelector(".c-command__field"),e=()=>Array.from(this.querySelectorAll(".c-command__item")),s=()=>e().filter(t=>!t.hidden&&!t.closest("[hidden]"));let a=-1;const r=()=>{if(s().forEach((e,s)=>{if(e.classList.toggle("c-command__item--active",s===a),e.setAttribute("aria-selected",String(s===a)),s===a){e.id||(e.id=contourId("contour-command-option"));const s=t();s&&s.setAttribute("aria-activedescendant",e.id)}}),a<0){const e=t();e&&e.removeAttribute("aria-activedescendant")}};this.addEventListener("keydown",i=>{const o=t();if(!o||i.target!==o)return;const n=s();if(n.length)if("ArrowDown"===i.key)i.preventDefault(),a=Math.min(a+1,n.length-1),r();else if("ArrowUp"===i.key)i.preventDefault(),a=Math.max(a-1,0),r();else if("Home"===i.key)i.preventDefault(),a=0,r();else if("End"===i.key)i.preventDefault(),a=n.length-1,r();else if("Enter"===i.key){if(i.preventDefault(),a>=0&&n[a]){const t=n[a],s=e().indexOf(t);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:s,label:t.textContent.trim()},bubbles:!0,composed:!0})),this.hide()}}else"Escape"===i.key&&this.hide()}),this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-command__item"):null;if(s&&this.contains(s)){const t=e().indexOf(s);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:t,label:s.textContent.trim()},bubbles:!0,composed:!0})),this.hide()}}),this.addEventListener("input",s=>{const i=t();if(!i||s.target!==i)return;const o=i.value.trim().toLowerCase(),n=e();let l=0;n.forEach(t=>{const e=!o||(t.textContent||"").toLowerCase().includes(o);t.hidden=!e,e&&(l+=1)}),this.querySelectorAll(".c-command__group").forEach(t=>{const e=Array.from(t.querySelectorAll(".c-command__item")).some(t=>!t.hidden);t.hidden=!e});const c=n.findIndex(t=>!t.hidden);a=c>=0?0:-1,r();const d=this.querySelector(".c-command__empty");d&&(d.hidden=0!==l);const u=this.querySelector(".c-command__status");u&&(u.textContent=o?`${l} of ${n.length}`:"")})}}define("contour-command",ContourCommand);class ContourSpatialFilter extends ContourBase{static get observed(){return["modes","mode","active","bounds","operator","loading","error","retry","cache-key","skeleton","src"]}static get properties(){return{modes:{attribute:"modes"},mode:{attribute:"mode"},active:{attribute:"active"},bounds:{attribute:"bounds"},operator:{attribute:"operator"}}}render(){if(this.classList.add("c-spatial-filter"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",labelText(this,"spatial-filter","Spatial filter")),wireStates(this),renderStates(this,"spatial-filter"))return;const t=this.getAttribute("modes");let e=null;if(t)try{e=JSON.parse(t)}catch(s){e=t.split(",").map(t=>t.trim())}const s=Array.isArray(e)?e:["rect","circle","polygon","clear"];let a=this.querySelector(".c-spatial-filter__modes");a||(a=document.createElement("div"),a.className="c-spatial-filter__modes",a.setAttribute("role","toolbar"),a.setAttribute("aria-label",labelText(this,"spatial-filter-modes","Spatial filter modes")),this.appendChild(a)),setHTML(a,"");const r=this.getAttribute("mode");r!==this._spatialSeenMode&&(this._spatialMode=null,this._spatialSeenMode=r);const i=null!=this._spatialMode?this._spatialMode:r;s.forEach(t=>{const e="string"==typeof t?t:t.label||t.value||t,s="string"==typeof t?t:t.value||t.label||t,r=document.createElement("button");r.type="button",r.className="c-spatial-filter__mode c-btn c-btn--ghost c-btn--sm";const o={rect:"i-square",circle:"i-circle",polygon:"i-triangle",lasso:"i-lasso",clear:"i-x"}[s];o&&setHTML(r,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+o+'" /></svg>'),r.appendChild(document.createTextNode((o?" ":"")+e)),r.dataset.mode=s,i&&i===s&&r.setAttribute("aria-pressed","true"),a.appendChild(r)});let o=this.querySelector(".c-spatial-filter__operator");o||(o=document.createElement("div"),o.className="c-spatial-filter__operator",this.appendChild(o));const n=this.getAttribute("operator")||"intersects";setHTML(o,"");const l=document.createElement("span");l.textContent=labelText(this,"operator","Operator")+":",o.appendChild(l);const c=document.createElement("select");c.className="c-spatial-filter__operator-select",c.setAttribute("aria-label",labelText(this,"operator","Operator")),c.setAttribute("data-contour-label","true"),["intersects","contains","within","disjoint"].forEach(t=>{const e=document.createElement("option");e.value=t,e.textContent=t,t===n&&e.setAttribute("selected",""),c.appendChild(e)}),o.appendChild(c);let d=this.querySelector(".c-spatial-filter__readout");d||(d=document.createElement("div"),d.className="c-spatial-filter__readout",this.appendChild(d));const u=this.getAttribute("bounds");d.textContent=u||"—";let h=this.querySelector(".c-spatial-filter__clear-all");h||(h=document.createElement("button"),h.type="button",h.className="c-spatial-filter__clear-all",this.appendChild(h)),applyLabel(h,this,"clear-all","Clear all");const m=this.hasAttribute("active");m!==this._spatialSeenActive&&(this._spatialActive=null,this._spatialSeenActive=m),(null!=this._spatialActive?this._spatialActive:m)?this.classList.add("c-spatial-filter--active"):this.classList.remove("c-spatial-filter--active")}enhance(){this._wiredSpatialFilter||(this._wiredSpatialFilter=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("button"):null;if(!e||!this.contains(e))return;if(e.classList.contains("c-spatial-filter__clear-all"))return this.classList.remove("c-spatial-filter--active"),Array.from(this.querySelectorAll(".c-spatial-filter__mode")).forEach(t=>t.setAttribute("aria-pressed","false")),this._spatialActive=!1,this._spatialMode=null,this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0,detail:{}})),void this.dispatchEvent(new CustomEvent("contour:spatial-filter",{bubbles:!0,composed:!0,detail:{action:"clear-all"}}));const s=e.closest(".c-spatial-filter__mode");if(!s)return;const a=s.dataset.mode||s.textContent.trim();if("clear"===a)return this.classList.remove("c-spatial-filter--active"),Array.from(this.querySelectorAll(".c-spatial-filter__mode")).forEach(t=>t.setAttribute("aria-pressed","false")),this._spatialActive=!1,this._spatialMode=null,void this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0,detail:{}}));this.classList.add("c-spatial-filter--active"),Array.from(this.querySelectorAll(".c-spatial-filter__mode")).forEach(t=>t.setAttribute("aria-pressed",String(t===s))),this._spatialActive=!0,this._spatialMode=a,this.dispatchEvent(new CustomEvent("contour:draw-start",{bubbles:!0,composed:!0,detail:{mode:a}})),this.dispatchEvent(new CustomEvent("contour:spatial-filter",{bubbles:!0,composed:!0,detail:{action:"draw-start",mode:a}}))}),this.addEventListener("change",t=>{const e=t.target;e&&e.classList.contains("c-spatial-filter__operator-select")&&(this.setAttribute("operator",e.value),this.dispatchEvent(new CustomEvent("contour:spatial-filter",{bubbles:!0,composed:!0,detail:{action:"operator",operator:e.value}})))}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-spatial-filter__mode"));navKey(t,e,{wrap:!1,onKey:()=>{document.activeElement.click()}})}))}}define("contour-spatial-filter",ContourSpatialFilter);