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"),o=[];t&&(t.id||(t.id=contourId("hint")),o.push(t.id)),a&&(a.id||(a.id=contourId("err")),o.push(a.id)),o.length&&e.setAttribute("aria-describedby",o.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 o=t.querySelector(e);o&&o.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 o=e[0],r=e[e.length-1];t.shiftKey&&a()===o?(t.preventDefault(),r.focus()):t.shiftKey||a()!==r||(t.preventDefault(),o.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};const splitCodeLines=t=>{const e=[[]];let s=e[0];const a=(t,o)=>{if(3===t.nodeType)return void String(t.textContent||"").split("\n").forEach((t,a)=>{a&&(s=[],e.push(s)),t&&s.push({chain:o,text:t})});if(1!==t.nodeType)return;const r=o.concat(t);Array.from(t.childNodes).forEach(t=>a(t,r))};Array.from(t.childNodes).forEach(t=>a(t,[]));if(!e[e.length-1].length&&e.length>1&&e.pop(),!e.length)return;const o=document.createDocumentFragment();e.forEach((t,e)=>{const s=document.createElement("span");s.className="c-code__line",s.setAttribute("data-contour-generated","line");const a=[];for(const e of t){for(let t=0;t<e.chain.length;t++)if(!a[t]||a[t]._contourSrc!==e.chain[t]){const o=e.chain[t].cloneNode(!1);o._contourSrc=e.chain[t],0===t?s.appendChild(o):a[t-1].appendChild(o),a[t]=o,a.length=t+1}(e.chain.length?a[e.chain.length-1]:s).appendChild(document.createTextNode(e.text))}const r=document.createElement("span");r.className="c-code__line-number",r.setAttribute("aria-hidden","true"),r.textContent=String(e+1),s.prepend(r),o.appendChild(s)}),t.textContent="",t.appendChild(o)},joinCodeLines=t=>{const e=document.createDocumentFragment();Array.from(t.querySelectorAll(".c-code__line")).forEach(t=>{Array.from(t.childNodes).forEach(t=>{t.classList&&t.classList.contains("c-code__line-number")||e.appendChild(t)}),e.appendChild(document.createTextNode("\n"))}),t.textContent="",t.appendChild(e)};class ContourCard extends ContourBase{static get observed(){return["title","variant","heading"]}static get properties(){return{title:{attribute:"title"},variant:{attribute:"variant"}}}render(){this.classList.add("c-card");const t=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-card--")&&this.classList.remove(t)}),t&&this.classList.add("c-card--"+t);const e=this.getAttribute("title");if(e){const t=this.ensure(".c-card__title",()=>{const t=document.createElement(headingTag(this,"h3"));return t.className="c-card__title",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),t.textContent=e}else{const t=this.querySelector(".c-card__title");t&&t.remove()}}}define("contour-card",ContourCard);class ContourFeature extends ContourBase{static get observed(){return["index","title","body","heading"]}static get properties(){return{index:{attribute:"index"},title:{attribute:"title"},body:{attribute:"body"}}}render(){this.classList.add("c-feature");const t=this.getAttribute("index"),e=this.getAttribute("title"),s=this.getAttribute("body");if(t){this.ensure(".c-feature__index",()=>{const t=document.createElement("span");return t.className="c-feature__index",t}).textContent=t}else{const t=this.querySelector(".c-feature__index");t&&t.remove()}if(e){this.ensure(".c-feature__title",()=>{const t=document.createElement(headingTag(this,"h3"));return t.className="c-feature__title",t}).textContent=e}else{const t=this.querySelector(".c-feature__title");t&&t.remove()}if(s){this.ensure(".c-feature__body",()=>{const t=document.createElement("p");return t.className="c-feature__body",t}).textContent=s}else{const t=this.querySelector(".c-feature__body");t&&t.remove()}}}define("contour-feature",ContourFeature);class ContourSteps extends ContourBase{static get observed(){return["steps","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading","cache-key","no-cache"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current",type:Number},src:{attribute:"src"}}}render(){this.classList.add("c-steps");let t=this.querySelector(".c-steps__list");if(t||(t=document.createElement("ol"),t.className="c-steps__list",t.setAttribute("aria-label",this.getAttribute("aria-label")||"Steps"),this.appendChild(t)),wireStates(this),loadRemote(this,"steps"),renderStates(this,"steps"))return;const e=remoteData(this,"steps"),s=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-steps__item"));if(s.forEach(e=>{e.parentNode!==t&&t.appendChild(e)}),e&&!s.length){Array.from(t.querySelectorAll(".c-steps__item")).forEach(t=>t.remove());try{JSON.parse(e).forEach((e,s)=>{const a=document.createElement("li");a.className="c-steps__item",a.tabIndex=-1;const o="string"==typeof e?e:e.title,r="string"==typeof e?"":e.body;if(o){const t=document.createElement(headingTag(this,"h3"));t.className="c-steps__title",t.textContent=o,a.appendChild(t)}if(r){const t=document.createElement("p");t.className="c-steps__body",t.textContent=r,a.appendChild(t)}t.appendChild(a)})}catch(t){warnBadJson(this,"attribute",t)}}else e||s.length||renderEmpty(this,"steps");const a=this.getAttribute("current"),o=null!=this._current?this._current:null!=a?parseInt(a,10):NaN,r=Array.from(this.querySelectorAll(".c-steps__item"));r.forEach((t,e)=>{Number.isFinite(o)&&e===o?t.setAttribute("aria-current","step"):t.removeAttribute("aria-current"),t.tabIndex=Number.isFinite(o)&&e===o?0:-1}),r.length&&!Number.isFinite(o)&&(r[0].tabIndex=0)}enhance(){this._wiredSteps||(this._wiredSteps=!0,this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-steps__item"));e.length&&navKey(t,e,{wrap:!1,homeEnd:!0,rtl:isRtl(this),onNavigate:t=>{this._current=t,e.forEach((e,s)=>{s===t?e.setAttribute("aria-current","step"):e.removeAttribute("aria-current"),e.tabIndex=s===t?0:-1});const s=e[t].querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{index:t,title:s}}))},onKey:()=>{if("Enter"===t.key||" "===t.key){const t=e.indexOf(document.activeElement),s=document.activeElement.querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:!0,composed:!0,detail:{index:t,title:s}}))}}})}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-steps__item"):null;if(!e||!this.contains(e))return;const s=Array.from(this.querySelectorAll(".c-steps__item")),a=s.indexOf(e);if(a<0)return;this._current=a,s.forEach((t,e)=>{e===a?t.setAttribute("aria-current","step"):t.removeAttribute("aria-current"),t.tabIndex=e===a?0:-1});const o=e.querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:!0,composed:!0,detail:{index:a,title:o}}))}))}}define("contour-steps",ContourSteps);class ContourLink extends ContourBase{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-link");const t=this.getAttribute("href"),e=this.getAttribute("label");if(Array.from(this.querySelectorAll("a[data-contour-generated]")).forEach(t=>t.remove()),t&&e){const s=document.createElement("a");s.dataset.contourGenerated="",s.href=safeHref(t),s.textContent=e;const a=this.getAttribute("aria-label");a&&s.setAttribute("aria-label",a),this.appendChild(s)}}}define("contour-link",ContourLink);class ContourBrand extends ContourBase{static get observed(){return["name","tag"]}static get properties(){return{name:{attribute:"name"},tag:{attribute:"tag"}}}render(){this.classList.add("c-brand");const t=this.getAttribute("name"),e=this.getAttribute("tag");if(t){this.ensure(".c-brand__name",()=>{const t=document.createElement("span");return t.className="c-brand__name",t}).textContent=t}else{const t=this.querySelector(".c-brand__name");t&&t.remove()}if(e){this.ensure(".c-brand__tag",()=>{const t=document.createElement("span");return t.className="c-brand__tag",t}).textContent=e}else{const t=this.querySelector(".c-brand__tag");t&&t.remove()}}}define("contour-brand",ContourBrand);class ContourSectionHead extends ContourBase{static get observed(){return["title","desc","heading"]}static get properties(){return{title:{attribute:"title"},desc:{attribute:"desc"}}}render(){this.classList.add("c-section-head");const t=this.getAttribute("title"),e=this.getAttribute("desc");if(!this.querySelector(".c-icon-badge")){const t=document.createElement("div");t.className="c-icon-badge";const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true");const s=document.createElementNS("http://www.w3.org/2000/svg","use");s.setAttribute("href","#i-crosshair"),e.appendChild(s),t.replaceChildren(e),this.prepend(t)}let s=this.querySelector(":scope > div:not(.c-icon-badge)");if(s||(s=document.createElement("div"),this.appendChild(s)),t){const e=this.ensure(".c-section-head__title",()=>{const t=document.createElement(headingTag(this,"h2"));return t.className="c-section-head__title",t});e.textContent=t,e.parentNode!==s&&s.appendChild(e)}else{const t=this.querySelector(".c-section-head__title");t&&t.remove()}if(e){const t=this.ensure(".c-section-head__desc",()=>{const t=document.createElement("p");return t.className="c-section-head__desc",t});t.textContent=e,t.parentNode!==s&&s.appendChild(t)}else{const t=this.querySelector(".c-section-head__desc");t&&t.remove()}}}define("contour-section-head",ContourSectionHead);class ContourDiff extends ContourBase{static get observed(){return["before","after"]}static get properties(){return{before:{attribute:"before"},after:{attribute:"after"}}}render(){this.classList.add("c-diff"),this.setAttribute("role","group"),this.setAttribute("aria-label",labelText(this,"diff","Diff")),Array.from(this.querySelectorAll(".c-diff__line")).forEach(t=>t.remove());const t=(t,e,s,a)=>{const o=document.createElement("div");o.className=t?`c-diff__line c-diff__line--${t}`:"c-diff__line",o.setAttribute("role","listitem"),o.setAttribute("tabindex","0");const r=document.createElement("span");r.className="c-diff__sign",r.textContent=e;const i=document.createElement("span");i.className="c-diff__num",i.setAttribute("aria-hidden","true"),i.textContent=String(a||"");const n=document.createElement("span");return n.textContent=s,o.append(r,i,n),o},e=this.getAttribute("before"),s=this.getAttribute("after");let a=1;e&&String(e).split("\n").forEach(e=>{this.appendChild(t("del","−",e,a++))}),s&&String(s).split("\n").forEach(e=>{this.appendChild(t("add","+",e,a++))})}enhance(){this._wiredDiff||(this._wiredDiff=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-diff__line"):null;if(e&&this.contains(e)){const t=e.classList.contains("c-diff__line--add")?"add":e.classList.contains("c-diff__line--del")?"del":"context",s=e.querySelector("span:last-child")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:diff-activate",{bubbles:!0,composed:!0,detail:{kind:t,text:s}}))}}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-diff__line"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click()))}))}}define("contour-diff",ContourDiff);class ContourDoDont extends ContourBase{static get observed(){return["do","dont"]}static get properties(){return{do:{attribute:"do"},dont:{attribute:"dont"}}}render(){this.classList.add("c-do-dont"),this.setAttribute("role","group"),this.setAttribute("aria-label",labelText(this,"do-and-dont","Do and don't")),Array.from(this.querySelectorAll(".c-do-dont__item")).forEach(t=>t.remove());const t=(t,e,s)=>{const a=document.createElement("div");a.className=`c-do-dont__item c-do-dont__item--${t}`,a.setAttribute("role","button"),a.setAttribute("tabindex","0");const o=document.createElement("p");o.className="c-do-dont__label",o.textContent=e;const r=document.createElement("p");return r.className="u-muted",r.textContent=s,a.append(o,r),a},e=this.getAttribute("do"),s=this.getAttribute("dont");e&&this.appendChild(t("do","Do",e)),s&&this.appendChild(t("dont","Don't",s))}enhance(){this._wiredDoDont||(this._wiredDoDont=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-do-dont__item"):null;if(e&&this.contains(e)){const t=e.classList.contains("c-do-dont__item--do")?"do":"dont",s=e.querySelector(".u-muted")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:do-dont-activate",{bubbles:!0,composed:!0,detail:{kind:t,text:s}}))}}),Array.from(this.querySelectorAll(".c-do-dont__item")).forEach(t=>{t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("role")||t.setAttribute("role","button")}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-do-dont__item"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click()))}))}}define("contour-do-dont",ContourDoDont);class ContourFlag extends ContourBase{static get observed(){return["variant","label"]}static get properties(){return{variant:{attribute:"variant"},label:{attribute:"label"}}}render(){this.classList.add("c-flag");const t=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-flag--")&&this.classList.remove(t)}),t&&this.classList.add("c-flag--"+t);const e=this.getAttribute("label");if(e){let t=Array.from(this.childNodes).find(t=>3===t.nodeType);t||(t=document.createTextNode(""),this.appendChild(t)),t.nodeValue=e}}}define("contour-flag",ContourFlag);class ContourInstallFull extends ContourBase{static get observed(){return["command","prompt","copyable"]}static get properties(){return{command:{attribute:"command"},prompt:{attribute:"prompt"},copyable:{attribute:"copyable"}}}render(){this.classList.add("c-install");const t=this.getAttribute("prompt")||"$",e=this.getAttribute("command")||"";if(e){this.ensure(".c-install__prompt",()=>{const t=document.createElement("span");return t.className="c-install__prompt",t}).textContent=t;if(this.ensure(".c-install__command",()=>{const t=document.createElement("span");return t.className="c-install__command",t}).textContent=e,this.hasAttribute("copyable"))this.ensure(".c-install__copy",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--ghost c-btn--sm c-install__copy",t.type="button",t.setAttribute("aria-label",labelText(this,"copy-command","Copy command")),t.textContent=labelText(this,"copy","Copy"),t});else{const t=this.querySelector(".c-install__copy");t&&t.remove()}}}enhance(){wireCopy(this)}}define("contour-install",ContourInstallFull);class ContourTestimonialFull extends ContourBase{static get observed(){return["quote","name","role"]}static get properties(){return{quote:{attribute:"quote"},name:{attribute:"name"},role:{attribute:"role"}}}render(){this.classList.add("c-testimonial");const t=this.getAttribute("quote");if(t){this.ensure(".c-testimonial__quote",()=>{const t=document.createElement("blockquote");return t.className="c-testimonial__quote",t}).textContent=t}else{const t=this.querySelector(".c-testimonial__quote");t&&t.remove()}const e=this.getAttribute("name"),s=this.getAttribute("role");if(e){const t=this.ensure(".c-testimonial__byline",()=>{const t=document.createElement("figcaption");return t.className="c-testimonial__byline",t}),a=t.querySelector(".c-testimonial__name")||(()=>{const e=document.createElement("cite");return e.className="c-testimonial__name",t.appendChild(e),e})();if(a.className="c-testimonial__name",a.textContent=e,s){const e=t.querySelector(".c-testimonial__role")||(()=>{const e=document.createElement("span");return e.className="c-testimonial__role",t.appendChild(e),e})();e.className="c-testimonial__role",e.textContent=s}else{const e=t.querySelector(".c-testimonial__role");e&&e.remove()}}else{const t=this.querySelector(".c-testimonial__byline");t&&t.remove()}}}define("contour-testimonial",ContourTestimonialFull);class ContourShowcaseFull extends ContourBase{static get observed(){return["title","text","media","reverse","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading","cache-key","no-cache"]}static get properties(){return{title:{attribute:"title"},text:{attribute:"text"},media:{attribute:"media"},reverse:{attribute:"reverse"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-showcase"),this.setAttribute("role","list"),this.hasAttribute("reverse")?this.classList.add("c-showcase--reverse"):this.classList.remove("c-showcase--reverse");const t=this.getAttribute("title");if(t?this.setAttribute("aria-label",t):this.removeAttribute("aria-label"),this.setAttribute("role","region"),wireStates(this),loadRemote(this,"items"),renderStates(this,"showcase"))return;const e=remoteData(this,"items"),s=this.getAttribute("text"),a=this.getAttribute("media");if(a){const e=this.ensure(".c-showcase__media",()=>{const t=document.createElement("figure");return t.className="c-showcase__media",t});if(/^https?:\/\/|^\/|^\.\/|\.(png|jpg|jpeg|svg|webp|gif|avif)$/i.test(a.trim())){let s=e.querySelector("img");s||(s=document.createElement("img"),e.appendChild(s)),s.src=a.trim(),s.alt=t||""}else setHTML(e,sanitizeHtml(a));if(t){let s=e.querySelector(".c-showcase__caption");s||(s=document.createElement("figcaption"),s.className="c-showcase__caption",e.appendChild(s)),s.textContent=t}}else{const t=this.querySelector(".c-showcase__media");t&&t.remove()}if(t){this.ensure(".c-showcase__title",()=>{const t=document.createElement(headingTag(this,"h3"));return t.className="c-showcase__title",t}).textContent=t}else{const t=this.querySelector(".c-showcase__title");t&&t.remove()}if(s){this.ensure(".c-showcase__text",()=>{const t=document.createElement("p");return t.className="c-showcase__text",t}).textContent=s}else{const t=this.querySelector(".c-showcase__text");t&&t.remove()}const o=this.querySelector(".c-showcase__list"),r=o?Array.from(o.children).filter(t=>"LI"===t.tagName):[];if(e&&!r.length)try{const t=JSON.parse(e),s=this.ensure(".c-showcase__list",()=>{const t=document.createElement("ul");return t.className="c-showcase__list",t});s.replaceChildren(),t.forEach(t=>{const e=document.createElement("li");e.textContent="string"==typeof t?t:t.label||t.title||"",s.appendChild(e)})}catch(t){warnBadJson(this,"attribute",t)}else e||r.length||t||s||a?!e&&o&&o.remove():renderEmpty(this,"showcase")}enhance(){this._wiredShowcase||(this._wiredShowcase=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-showcase__media"):null;if(e&&this.contains(e)){const t=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:showcase-activate",{bubbles:!0,composed:!0,detail:{title:t}}))}}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest("button, a, input, select, textarea, [role='button'], [role='link'], [role='checkbox'], [role='menuitem'], [role='option'], [role='tab']"):null;if(!(e&&this.contains(e)||"Enter"!==t.key&&" "!==t.key)){if(this.querySelector(".c-showcase__media")){t.preventDefault();const e=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:showcase-activate",{bubbles:!0,composed:!0,detail:{title:e}}))}}}))}}define("contour-showcase",ContourShowcaseFull);class ContourPricingFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-pricing")}}define("contour-pricing",ContourPricingFull);class ContourRecipeFull extends ContourBase{static get observed(){return["title","body","canvas","heading","url","tags","head","index"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},canvas:{attribute:"canvas"},url:{attribute:"url"},tags:{attribute:"tags"},head:{attribute:"head"},index:{attribute:"index"}}}render(){this.classList.add("c-recipe");const t=this.getAttribute("url");let e=this.querySelector(".c-recipe__frame");if(t){if(!e){e=document.createElement("div"),e.className="c-recipe__frame";const t=document.createElement("div");t.className="c-recipe__frame-bar";for(let e=0;e<3;e++){const e=document.createElement("span");e.className="c-recipe__frame-dot",t.appendChild(e)}const s=document.createElement("span");s.className="c-recipe__frame-url",t.appendChild(s),e.appendChild(t),this.prepend(e)}const s=e.querySelector(".c-recipe__frame-url");s&&(s.textContent=t)}else e&&e.remove();const s=this.getAttribute("head");if(s){this.ensure(".c-recipe__head",()=>{const t=document.createElement("div");return t.className="c-recipe__head",t}).textContent=s}else{const t=this.querySelector(".c-recipe__head");t&&t.remove()}const a=this.getAttribute("title");if(a){this.ensure(".c-recipe__title",()=>{const t=document.createElement(headingTag(this,"h3"));return t.className="c-recipe__title",t}).textContent=a}else{const t=this.querySelector(".c-recipe__title");t&&t.remove()}const o=this.getAttribute("index");if(o){this.ensure(".c-recipe__index",()=>{const t=document.createElement("span");return t.className="c-recipe__index",t}).textContent=o}else{const t=this.querySelector(".c-recipe__index");t&&t.remove()}const r=this.getAttribute("body");if(r){this.ensure(".c-recipe__desc",()=>{const t=document.createElement("p");return t.className="c-recipe__desc",t}).textContent=r}else{const t=this.querySelector(".c-recipe__desc");t&&t.remove()}const i=this.getAttribute("tags");if(i){const t=this.ensure(".c-recipe__tags",()=>{const t=document.createElement("div");return t.className="c-recipe__tags",t});t.innerHTML="",i.split(",").map(t=>t.trim()).filter(Boolean).forEach(e=>{const s=document.createElement("span");s.textContent=e,t.appendChild(s)})}else{const t=this.querySelector(".c-recipe__tags");t&&t.remove()}const n=this.getAttribute("canvas");if(n){const t=this.ensure(".c-recipe__canvas",()=>{const t=document.createElement("div");return t.className="c-recipe__canvas",t});if(/^https?:\/\/|^\/|^\.\/|\.(png|jpg|jpeg|svg|webp|gif|avif)$/i.test(n.trim())){let e=t.querySelector("img");e||(e=document.createElement("img"),t.appendChild(e)),e.src=n.trim(),e.alt=""}else setHTML(t,sanitizeHtml(n))}else{const t=this.querySelector(".c-recipe__canvas");t&&t.remove()}}}define("contour-recipe",ContourRecipeFull);class ContourLogosFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-logos")}}define("contour-logos",ContourLogosFull);class ContourLandingFeaturesFull 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-landing-features"),wireStates(this),loadRemote(this,"items"),renderStates(this,"landing-features"))return;const t=remoteData(this,"items"),e=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-landing-features__item"));if(t&&!e.length)try{const e=JSON.parse(t);this.querySelectorAll(".c-landing-features__item").forEach(t=>t.remove()),e.forEach(t=>{const e=document.createElement("div");if(e.className="c-landing-features__item",t.icon){const s=document.createElement("span");s.className="c-landing-features__icon";const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("aria-hidden","true");const o=document.createElementNS("http://www.w3.org/2000/svg","use");o.setAttribute("href","#"+String(t.icon).replace(/[^a-zA-Z0-9_-]/g,"")),a.appendChild(o),s.appendChild(a),e.appendChild(s)}if(t.title){const s=document.createElement("span");s.className="c-landing-features__title",s.textContent=t.title,e.appendChild(s)}if(t.text){const s=document.createElement("p");s.className="c-landing-features__text",s.textContent=t.text,e.appendChild(s)}this.appendChild(e)})}catch(t){warnBadJson(this,"attribute",t)}else t||e.length||(this.querySelectorAll(".c-landing-features__item").forEach(t=>t.remove()),renderEmpty(this,"landing-features"))}}define("contour-landing-features",ContourLandingFeaturesFull);class ContourLandingHeroFull extends ContourBase{static get observed(){return["actions","title","text","heading","preview"]}static get properties(){return{actions:{attribute:"actions"},title:{attribute:"title"},text:{attribute:"text"},preview:{attribute:"preview"}}}render(){this.classList.add("c-landing-hero");const t=this.getAttribute("preview");let e=this.querySelector(".c-landing-hero__preview");if(t){if(!e){e=document.createElement("div"),e.className="c-landing-hero__preview";const t=document.createElement("div");t.className="c-landing-hero__preview-bar";for(let e=0;e<3;e++){const e=document.createElement("span");e.className="c-landing-hero__preview-dot",t.appendChild(e)}const s=document.createElement("div");s.className="c-landing-hero__preview-body",e.appendChild(t),e.appendChild(s),this.appendChild(e)}const s=e.querySelector(".c-landing-hero__preview-body");if(s)if(/^https?:\/\/|^\/|^\.\/|\.(png|jpg|jpeg|svg|webp|gif|avif)$/i.test(t.trim())){s.innerHTML="";const e=document.createElement("img");e.src=t.trim(),e.alt="",s.appendChild(e)}else setHTML(s,sanitizeHtml(t))}else e&&e.remove();const s=this.getAttribute("title");if(s){this.ensure(".c-landing-hero__title",()=>{const t=document.createElement(headingTag(this,"h2"));return t.className="c-landing-hero__title",t}).textContent=s}const a=this.getAttribute("text");if(a){this.ensure(".c-landing-hero__text",()=>{const t=document.createElement("p");return t.className="c-landing-hero__text",t}).textContent=a}const o=this.getAttribute("actions"),r=this.querySelector(".c-landing-hero__actions"),i=r?Array.from(r.children):[];if(o&&!i.length){const t=this.ensure(".c-landing-hero__actions",()=>{const t=document.createElement("div");return t.className="c-landing-hero__actions",t});try{const e=JSON.parse(o);Array.isArray(e)?(t.replaceChildren(),e.forEach(e=>{const s=document.createElement(e.href?"a":"button");s.className="c-btn"+(e.primary?" c-btn--primary":""),e.href?s.href=safeHref(e.href):s.type="button",s.textContent=e.label||e.text||"",t.appendChild(s)})):setHTML(t,sanitizeHtml(o))}catch(e){setHTML(t,sanitizeHtml(o))}}else o||!r||i.length||r.remove()}}define("contour-landing-hero",ContourLandingHeroFull);class ContourLinkishFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-linkish")}}define("contour-linkish",ContourLinkishFull);class ContourPriceFull extends ContourBase{static get observed(){return["value","format","locale"]}static get properties(){return{value:{attribute:"value"},format:{attribute:"format"},locale:{attribute:"locale"}}}render(){this.classList.add("c-price");const t=this.getAttribute("value");let e=this.querySelector(".c-price__amount");t?(e||(e=document.createElement("span"),e.className="c-price__amount",this.appendChild(e)),e.textContent=formatValue(t,this.getAttribute("format"),this.getAttribute("locale"))):e&&e.remove()}}define("contour-price",ContourPriceFull);class ContourProseFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-prose")}}define("contour-prose",ContourProseFull);class ContourPanel extends ContourBase{static get observed(){return["title","subtitle","status","heading","collapsible","collapsed","flush"]}static get properties(){return{title:{attribute:"title"},subtitle:{attribute:"subtitle"},status:{attribute:"status"},collapsible:{attribute:"collapsible",type:Boolean},collapsed:{attribute:"collapsed",type:Boolean},flush:{attribute:"flush",type:Boolean}}}render(){this.classList.add("c-panel"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Panel");const t=this.getAttribute("title"),e=this.getAttribute("subtitle"),s=this.getAttribute("status");if(t){const e=this.ensure(".c-panel__title",()=>{const t=document.createElement(headingTag(this,"h3"));return t.className="c-panel__title",t});e.parentNode===this&&this.firstChild!==e&&this.prepend(e),e.textContent=t}else{const t=this.querySelector(".c-panel__title");t&&t.remove()}if(e){this.ensure(".c-panel__subtitle",()=>{const t=document.createElement("p");return t.className="c-panel__subtitle",t}).textContent=e}else{const t=this.querySelector(".c-panel__subtitle");t&&t.remove()}if(s){const t=this.ensure(".c-panel__status",()=>{const t=document.createElement("span");return t.className="c-panel__status",t});Array.from(t.classList).forEach(e=>{e.startsWith("c-panel__status--")&&t.classList.remove(e)}),"error"!==s&&"live"!==s||t.classList.add("c-panel__status--"+s),t.textContent=s}else{const t=this.querySelector(".c-panel__status");t&&t.remove()}if(this.hasAttribute("collapsible")){let t=this.querySelector(".c-panel__collapse");t||(t=document.createElement("button"),t.type="button",t.className="c-panel__collapse c-btn c-btn--ghost c-btn--sm",t.setAttribute("aria-label",labelText(this,"collapse","Toggle panel")),setHTML(t,'<svg aria-hidden="true" viewBox="0 0 24 24" width="16" height="16"><use href="#i-chevron-down" /></svg>'),this.appendChild(t)),this.hasAttribute("collapsed")?(this.classList.add("c-panel--collapsed"),t.setAttribute("aria-expanded","false"),setHTML(t,'<svg aria-hidden="true" viewBox="0 0 24 24" width="16" height="16"><use href="#i-chevron-right" /></svg>')):(this.classList.remove("c-panel--collapsed"),t.setAttribute("aria-expanded","true"),setHTML(t,'<svg aria-hidden="true" viewBox="0 0 24 24" width="16" height="16"><use href="#i-chevron-down" /></svg>'))}else{const t=this.querySelector(".c-panel__collapse");t&&t.remove(),this.classList.remove("c-panel--collapsed")}const a=this.ensure(".c-panel__body",()=>{const t=document.createElement("div");return t.className="c-panel__body",t});a.classList.toggle("c-panel__body--flush",this.hasAttribute("flush"));const o=this.querySelector(".c-panel__head"),r=this.querySelector(".c-panel__collapse");Array.from(this.childNodes).forEach(t=>{t!==a&&t!==o&&(1===t.nodeType&&(t.classList.contains("c-panel__title")||t.classList.contains("c-panel__subtitle")||t.classList.contains("c-panel__status"))||t!==r&&a.appendChild(t))}),a.parentNode||this.appendChild(a),o&&o.parentNode===this&&a.parentNode===this&&o.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_PRECEDING&&this.insertBefore(a,o.nextSibling)}enhance(){this._wiredPanel||(this._wiredPanel=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-panel__collapse"):null;e&&this.contains(e)&&(t.preventDefault(),this.toggleAttribute("collapsed"),this.dispatchEvent(new CustomEvent("contour:collapse",{bubbles:!0,composed:!0,detail:{collapsed:this.hasAttribute("collapsed")}})))}))}}define("contour-panel",ContourPanel);class ContourCta extends ContourBase{static get observed(){return["title","text","actions","heading"]}static get properties(){return{title:{attribute:"title"},text:{attribute:"text"},actions:{attribute:"actions"}}}render(){this.classList.add("c-cta");const t=this.getAttribute("title"),e=this.getAttribute("text");if(t){this.ensure(".c-cta__title",()=>{const t=document.createElement(headingTag(this,"h3"));return t.className="c-cta__title",t}).textContent=t}else{const t=this.querySelector(".c-cta__title");t&&t.remove()}if(e){this.ensure(".c-cta__text",()=>{const t=document.createElement("p");return t.className="c-cta__text",t}).textContent=e}else{const t=this.querySelector(".c-cta__text");t&&t.remove()}const s=this.getAttribute("actions"),a=this.querySelector(".c-cta__actions");if(a&&a.remove(),s)try{const t=JSON.parse(s),e=document.createElement("div");e.className="c-cta__actions";let a=!1;t.forEach(t=>{const s="string"==typeof t?t:t.label||t,o="object"==typeof t&&t?t.href:null,r=!("object"!=typeof t||!t)&&t.primary&&!a;r&&(a=!0);const i=document.createElement(o?"a":"button");i.className=r?"c-btn c-btn--primary":"c-btn c-btn--ghost",o?(i.href=safeHref(o),i.setAttribute("role","button")):i.type="button",i.textContent=s,e.appendChild(i)}),this.appendChild(e)}catch(t){warnBadJson(this,"attribute",t)}}}define("contour-cta",ContourCta);class ContourCode extends ContourBase{static get observed(){return["title","copyable","numbered"]}static get properties(){return{title:{attribute:"title"},copyable:{attribute:"copyable",type:Boolean},numbered:{attribute:"numbered",type:Boolean}}}render(){this.classList.add("c-code");const t=this.getAttribute("title");if(t){const e=this.ensure(".c-code__head",()=>{const t=document.createElement("div");return t.className="c-code__head",t});e.parentNode===this&&this.firstChild!==e&&this.prepend(e);(e.querySelector(".c-code__title")||(()=>{const t=document.createElement("div");return t.className="c-code__title",e.appendChild(t),t})()).textContent=t}else{const t=this.querySelector(".c-code__head");t&&t.remove();const e=this.querySelector(".c-code__title");e&&e.remove()}if(this.hasAttribute("copyable")){const t=this.ensure(".c-code__head",()=>{const t=document.createElement("div");return t.className="c-code__head",t});this.ensure(".c-code__copy",()=>{const e=document.createElement("button");return e.className="c-btn c-btn--ghost c-btn--sm c-code__copy",e.type="button",setHTML(e,'<svg aria-hidden="true" viewBox="0 0 24 24" width="14" height="14"><use href="#i-copy" /></svg>'),e.setAttribute("aria-label",labelText(this,"copy","Copy")),t.appendChild(e),e})}else{const t=this.querySelector(".c-code__copy");t&&t.remove()}const e=this.ensure("pre",()=>document.createElement("pre"));if(Array.from(this.childNodes).forEach(t=>{t===e||1===t.nodeType&&(t.classList.contains("c-code__head")||t.classList.contains("c-code__copy"))||e.appendChild(t)}),!e.querySelector("code")){const t=document.createElement("code");for(;e.firstChild;)t.appendChild(e.firstChild);e.appendChild(t)}e.parentNode!==this&&this.appendChild(e);const s=this.querySelector(".c-code__head");s&&s.parentNode===this&&e.parentNode===this&&s.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING&&this.insertBefore(e,s.nextSibling);const a=this.hasAttribute("numbered");this.classList.toggle("c-code--numbered",a);const o=e.querySelector("code");if(o){const t="1"===o.dataset.contourLines;a&&!t?(splitCodeLines(o),o.dataset.contourLines="1"):!a&&t&&(joinCodeLines(o),delete o.dataset.contourLines)}}enhance(){wireCopy(this)}}define("contour-code",ContourCode);class ContourPlate extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-plate")}}define("contour-plate",ContourPlate);class ContourPullquote extends ContourBase{static get observed(){return["quote","name"]}static get properties(){return{quote:{attribute:"quote"},name:{attribute:"name"}}}render(){this.classList.add("c-pullquote");const t=this.getAttribute("quote");if(t){Array.from(this.childNodes).forEach(t=>{3===t.nodeType&&t.remove()});const e=this.querySelector("cite");this.insertBefore(document.createTextNode(t),e)}const e=this.getAttribute("name");if(e){this.ensure("cite",()=>{const t=document.createElement("cite");return this.appendChild(t),t}).textContent=e}else{const t=this.querySelector("cite");t&&t.remove()}}}define("contour-pullquote",ContourPullquote);class ContourAnchor extends ContourBase{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-anchor");const t=this.getAttribute("href"),e=this.getAttribute("label");if(Array.from(this.querySelectorAll("a[data-contour-generated]")).forEach(t=>t.remove()),t&&e){const s=document.createElement("a");s.dataset.contourGenerated="",s.href=safeHref(t),s.textContent=e;const a=this.getAttribute("aria-label");a&&s.setAttribute("aria-label",a),this.appendChild(s)}}}define("contour-anchor",ContourAnchor);class ContourGeocoder extends ContourBase{static get observed(){return["placeholder","value","results","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{placeholder:{attribute:"placeholder"},value:{attribute:"value"},results:{attribute:"results"},src:{attribute:"src"}}}render(){if(this.classList.add("c-geocoder"),wireStates(this),loadRemote(this,["results"]),renderStates(this,"geocoder"))return;let t=this.querySelector(".c-geocoder__input");t||(t=document.createElement("input"),t.type="search",t.className="c-input c-geocoder__input",t.hasAttribute("aria-label")||t.setAttribute("aria-label",this.getAttribute("placeholder")||"Search location"),t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded","false"),this.appendChild(t));const e=this.getAttribute("placeholder");e&&t.setAttribute("placeholder",e);const s=this.getAttribute("value");null!==s&&t.value!==s&&(t.value=s),Array.from(this.querySelectorAll(".c-geocoder__result")).forEach(t=>t.remove()),Array.from(this.querySelectorAll(".c-geocoder__list")).forEach(t=>t.remove());let a=[];const o=this.getAttribute("results");if(o)try{a=JSON.parse(o)}catch(t){a=[]}const r=remoteData(this,"results");if("string"==typeof r)try{const t=JSON.parse(r);Array.isArray(t)&&(a=t)}catch(t){}else Array.isArray(r)&&(a=r);if(Array.isArray(a)&&a.length){this._geocoderIndex=-1,this._geocoderListId||(this._geocoderListId=contourId("geocoder-list"));const e=document.createElement("ul");e.className="c-geocoder__list",e.id=this._geocoderListId,e.setAttribute("role","listbox"),a.forEach((t,s)=>{const a=document.createElement("li");a.className="c-geocoder__result",a.id=this._geocoderListId+"-"+s,a.setAttribute("role","option"),a.setAttribute("aria-selected","false"),a.setAttribute("tabindex","-1"),a.textContent="object"==typeof t?t.label||t.name||"":String(t),"object"==typeof t&&(null!=t.lat&&(a.dataset.lat=String(t.lat)),null!=t.lon&&(a.dataset.lon=String(t.lon))),e.appendChild(a)}),this.appendChild(e),t.setAttribute("aria-controls",this._geocoderListId),t.setAttribute("aria-expanded","true")}else if(t.removeAttribute("aria-controls"),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-activedescendant"),this._geocoderIndex=-1,!this.hasAttribute("loading")&&!this.hasAttribute("error")){const t=this.querySelector(".c-geocoder__input");t&&t.value&&renderEmpty(this,"geocoder")}}enhance(){if(this._wiredGeocoder)return;this._wiredGeocoder=!0;const t=this.querySelector(".c-geocoder__input");"number"!=typeof this._geocoderIndex&&(this._geocoderIndex=-1);const e=()=>Array.from(this.querySelectorAll(".c-geocoder__result")),s=()=>{const t=e(),s=this._geocoderIndex;return s>=0&&s<t.length?t[s]:null},a=s=>{const a=e();if(!a.length)return;const o=Math.max(0,Math.min(a.length-1,Number.isFinite(s)?s:0));a.forEach((t,e)=>t.setAttribute("aria-selected",e===o?"true":"false")),this._geocoderIndex=o,t&&(o>=0?t.setAttribute("aria-activedescendant",a[o].id):t.removeAttribute("aria-activedescendant"))},o=()=>{this._geocoderIndex=-1,e().forEach(t=>t.setAttribute("aria-selected","false")),t&&t.removeAttribute("aria-activedescendant")},r=t=>{if(!t)return;const e={label:t.textContent.trim(),lat:t.dataset.lat?Number(t.dataset.lat):void 0,lon:t.dataset.lon?Number(t.dataset.lon):void 0};this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{result:e}}))};t&&(this.addEventListener("input",e=>{e.target===t&&(o(),this._geocoderTimer&&clearTimeout(this._geocoderTimer),this._geocoderTimer=setTimeout(()=>{this._geocoderTimer=null,this.isConnected&&this.dispatchEvent(new CustomEvent("contour:search",{bubbles:!0,composed:!0,detail:{query:t.value}}))},200))}),this.addEventListener("keydown",i=>{if(i.target!==t)return;const n=e();if("ArrowDown"===i.key||"ArrowUp"===i.key){if(!n.length)return;i.preventDefault();const t=this._geocoderIndex<0?"ArrowDown"===i.key?-1:n.length:this._geocoderIndex;return void a(t+("ArrowDown"===i.key?1:-1))}if("Enter"===i.key){i.preventDefault();const e=s();return void(e?(r(e),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-controls"),o()):this.dispatchEvent(new CustomEvent("contour:search",{bubbles:!0,composed:!0,detail:{query:t.value}})))}if("Escape"===i.key&&n.length&&"true"===t.getAttribute("aria-expanded")){i.preventDefault(),o(),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-controls");const e=this.querySelector(".c-geocoder__list");e&&e.remove()}})),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-geocoder__result"):null;e&&this.contains(e)&&r(e)}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-geocoder__result"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),r(e)))})}disconnectedCallback(){this._geocoderTimer&&(clearTimeout(this._geocoderTimer),this._geocoderTimer=null),super.disconnectedCallback()}}define("contour-geocoder",ContourGeocoder);