PageSourceSearch

https://www.workday.com/etc.clientlibs/atlas/clientlibs/common/pub…/js/4115.dc5d09254ea777227b81.bundle.js

js workday.com collected 2026-09-24 08:26:14 UTC 68,071 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkui_apps=self.webpackChunkui_apps||[]).push([[4115],{4115(__unused_webpack_module,__webpack_exports__,__webpack_require__){eval("{// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, {\n  \"default\": () => (/* binding */ CustomerStories)\n});\n\n// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules\nvar slicedToArray = __webpack_require__(5544);\n// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules\nvar toConsumableArray = __webpack_require__(436);\n// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\nvar asyncToGenerator = __webpack_require__(467);\n// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js\nvar classCallCheck = __webpack_require__(3029);\n// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js\nvar createClass = __webpack_require__(2901);\n// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js\nvar defineProperty = __webpack_require__(4467);\n// EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js\nvar regenerator = __webpack_require__(4756);\nvar regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);\n// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js\nvar esm_typeof = __webpack_require__(2284);\n;// ./src/main/content/jcr_root/apps/atlas/components/content/redesign/customer_stories/customer-stories-search.ts\n/**\n * Customer Stories — Coveo REST Search client.\n *\n * Mirrors the blog `CoveoSearch` utility: a thin wrapper around the Coveo REST\n * Search API v2 (POST /rest/search/v2) driven by data-* config from the DOM.\n * No Coveo Atomic, no Headless controllers — just fetch + a typed response.\n * Facet groups and their values are returned by the API and rendered dynamically.\n *//**\n * Facet fields requested from Coveo. These mirror the facet fields the existing\n * (Atomic) Customer Story search uses, so they are known to be facetable on the\n * \"Martech - Customer Story\" search hub. Group labels fall back to FACET_LABELS.\n */var REQUESTED_FACETS=[{field:'www_industry_id',label:'Industry'},{field:'www_topic_id',label:'Category'},{field:'www_business_size_id',label:'Company Size'},{field:'www_asset_type_id',label:'Type'},{field:'www_business_outcome_id',label:'Business Outcome'}];var FACET_LABELS=REQUESTED_FACETS.reduce(function(acc,f){acc[f.field]=f.label;return acc;},{});/** Fields hydrated onto each result (the card / list row content). */var FIELDS_TO_INCLUDE=['www_customer_name','www_cust_story_image','www_cust_logo_image','www_cust_story_ctalabel','www_cust_story_ctatarget','www_cust_story_ctaicon','www_cust_story_ctaarialabel','www_cust_story_ctaiconalignment','www_industry','www_industry_id','www_business_size','www_business_size_id','www_topic','www_topic_id','www_region','www_region_id','www_publication_date'];var isVideoUrl=function isVideoUrl(url){return!!url&&(url.includes('youtube')||url.includes('youtu.be')||url.includes('brightcove_assets'));};var first=function first(value){if(Array.isArray(value))return value.length?String(value[0]):'';return value==null?'':String(value);};/** Prefer Coveo label field; else localized title from tag id (same map as facets). */var resolveTagDisplay=function resolveTagDisplay(rawLabel,rawId,captions){var label=first(rawLabel);if(label)return label;var id=first(rawId);if(!id)return'';return captions[id]||id;};var joinValues=function joinValues(value){var separator=arguments.length>1&&arguments[1]!==undefined?arguments[1]:', ';if(Array.isArray(value)){return value.map(function(v){return v==null?'':String(v);}).filter(Boolean).join(separator);}if(value==null)return'';// Some multi-value fields come back as a single ';'-delimited string.\nreturn String(value).split(';').map(function(v){return v.trim();}).filter(Boolean).join(separator);};var CustomerStoriesSearch=/*#__PURE__*/function(){function CustomerStoriesSearch(config){(0,classCallCheck/* default */.A)(this,CustomerStoriesSearch);(0,defineProperty/* default */.A)(this,\"config\",void 0);/** Cached tag-caption map (facet value id → localized title). */(0,defineProperty/* default */.A)(this,\"captionsProm
1ise\",null);this.config=config;}/**\n   * Facet fields returned by Coveo (`www_*_id`) carry tag *ids*, not display\n   * titles. Fetch the localized id → title map from the same AEM servlet the\n   * Atomic Customer Story search uses (`/bin/wd/getTagsJsonServlet.<locale>.json`),\n   * so facet values can be shown with their human-readable labels. The result is\n   * cached for the lifetime of the client; failures degrade to raw ids.\n   */return (0,createClass/* default */.A)(CustomerStoriesSearch,[{key:\"getCaptions\",value:function getCaptions(){if(this.captionsPromise)return this.captionsPromise;var locale=(this.config.locale||'en-us').trim();this.captionsPromise=fetch(\"/bin/wd/getTagsJsonServlet.\".concat(locale,\".json\")).then(function(response){return response.ok?response.json():{};}).then(function(data){return data&&(0,esm_typeof/* default */.A)(data)==='object'?data:{};})[\"catch\"](function(){return{};});return this.captionsPromise;}/**\n   * Build the Coveo constant query (cq) that scopes results to the page locale\n   * (and, when present, region). This mirrors the working Atomic Customer Story\n   * search (see coveo-helpers `initialiseQueryExpression`): it uses a single `=`\n   * (loose match) on @www_locale in the *constant* query — NOT an exact `==` in\n   * the advanced query, which over-filters and returns zero results.\n   */},{key:\"buildConstantQuery\",value:function buildConstantQuery(){var locale=(this.config.locale||'').replace(/[^a-zA-Z0-9-]/g,'');if(!locale)return'';var base=\"@www_locale=\".concat(locale);var region=(this.config.region||'').trim();if(region){var regionExpr=region.split(',').map(function(r){return\"@www_region=\".concat(r.trim());}).join(' OR ');return\"\".concat(base,\" OR (\").concat(regionExpr,\")\");}return base;}},{key:\"search\",value:function(){var _search=(0,asyncToGenerator/* default */.A)(/*#__PURE__*/regenerator_default().mark(function _callee(params){var _params$numberOfResul,_params$firstResult,_data$queryCorrection,_data$queryCorrection2,_this=this;var _this$config,orgId,token,searchHub,locale,selectedFacets,cq,body,url,start,captionsPromise,response,detail,data,captions,correctedQuery;return regenerator_default().wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:_this$config=this.config,orgId=_this$config.orgId,token=_this$config.token,searchHub=_this$config.searchHub,locale=_this$config.locale;if(!(!token||!orgId)){_context.next=1;break;}throw new Error(\"Customer Stories: missing Coveo \".concat(!token?'access token':'org id',\". \")+'Check the ACS Commons \"coveo-token\" list (key \"customer-story-<env>\") '+'and the Coveo OSGi config, then confirm data-token / data-org-id are set.');case 1:selectedFacets=params.selectedFacets||{};cq=this.buildConstantQuery();// Facet selections are applied via each facet's currentValues (state:selected),\n// exactly like the Atomic implementation — no aq needed.\nbody={q:params.q||'',searchHub:searchHub,locale:locale,numberOfResults:(_params$numberOfResul=params.numberOfResults)!==null&&_params$numberOfResul!==void 0?_params$numberOfResul:12,firstResult:(_params$firstResult=params.firstResult)!==null&&_params$firstResult!==void 0?_params$firstResult:0,sortCriteria:params.sortCriteria||'relevancy',enableDidYouMean:true,fieldsToInclude:[].concat(FIELDS_TO_INCLUDE),facets:REQUESTED_FACETS.map(function(f){return{facetId:f.field,field:f.field,type:'specific',currentValues:(selectedFacets[f.field]||[]).map(function(value){return{value:value,state:'selected'};}),filterFacetCount:false,numberOfValues:100};})};if(cq)body.cq=cq;if(this.config.isBoosted)body.context={isBoosted:true};url=\"https://\".concat(orgId,\".org.coveo.com/rest/search/v2?organizationId=\").concat(orgId);start=Date.now();// Fetch tag captions in parallel with the search request.\ncaptionsPromise=this.getCaptions();_context.next=2;return fetch(url,{method:'POST',headers:{'Content-Type':'application/json',Authorization:\"Bearer \".concat(token),Accept:'application/json'},body:JSON.stringify(body)});case 2:response=_context.sent;if(response.ok){_context.next=4;break;}_context.next=3;return response.text()[\"catch\"](function(){return'';});case 3:detail=_context.sent;throw new Error(\"Coveo search failed (\".concat(response.status,\"): \").concat(detail));case 4:_context.next=5;return response.json();case 5:data=_context.sent;_context.next=6;
1return captionsPromise;case 6:captions=_context.sent;correctedQuery=Array.isArray(data.queryCorrections)&&((_data$queryCorrection=data.queryCorrections[0])===null||_data$queryCorrection===void 0?void 0:_data$queryCorrection.correctedQuery)||((_data$queryCorrection2=data.queryCorrection)===null||_data$queryCorrection2===void 0?void 0:_data$queryCorrection2.correctedQuery)||'';return _context.abrupt(\"return\",{docs:(data.results||[]).map(function(r){return _this.transform(r,captions);}),total:data.totalCount||0,facets:this.transformFacets(data.facets,selectedFacets,captions),searchUid:data.searchUid||'',pipeline:data.pipeline||'',responseTime:Date.now()-start,correctedQuery:correctedQuery});case 7:case\"end\":return _context.stop();}},_callee,this);}));function search(_x){return _search.apply(this,arguments);}return search;}()/**\n   * Fetch query suggestions (autocomplete) for the search-as-you-type dropdown.\n   * Uses the Coveo REST querySuggest endpoint; failures degrade to no suggestions.\n   */},{key:\"querySuggest\",value:(function(){var _querySuggest=(0,asyncToGenerator/* default */.A)(/*#__PURE__*/regenerator_default().mark(function _callee2(q){var _this$config2,orgId,token,searchHub,locale,url,response,data,_t;return regenerator_default().wrap(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_this$config2=this.config,orgId=_this$config2.orgId,token=_this$config2.token,searchHub=_this$config2.searchHub,locale=_this$config2.locale;if(!(!token||!orgId)){_context2.next=1;break;}return _context2.abrupt(\"return\",[]);case 1:url=\"https://\".concat(orgId,\".org.coveo.com/rest/search/v2/querySuggest?organizationId=\").concat(orgId);_context2.prev=2;_context2.next=3;return fetch(url,{method:'POST',headers:{'Content-Type':'application/json',Authorization:\"Bearer \".concat(token),Accept:'application/json'},body:JSON.stringify({q:q||'',searchHub:searchHub,locale:locale,count:5})});case 3:response=_context2.sent;if(response.ok){_context2.next=4;break;}return _context2.abrupt(\"return\",[]);case 4:_context2.next=5;return response.json();case 5:data=_context2.sent;return _context2.abrupt(\"return\",(data.completions||[]).map(function(c){return c.expression;}).filter(Boolean));case 6:_context2.prev=6;_t=_context2[\"catch\"](2);return _context2.abrupt(\"return\",[]);case 7:case\"end\":return _context2.stop();}},_callee2,this,[[2,6]]);}));function querySuggest(_x2){return _querySuggest.apply(this,arguments);}return querySuggest;}())},{key:\"transform\",value:function transform(result){var captions=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var raw=result.raw||{};var ctaTarget=first(raw.www_cust_story_ctatarget);var clickUri=result.clickUri||result.uri||'';var ctaUrl=ctaTarget||clickUri;return{title:result.title||'',excerpt:result.excerpt||'',clickUri:clickUri,customerName:first(raw.www_customer_name),logoImage:first(raw.www_cust_logo_image),thumbImage:first(raw.www_cust_story_image),ctaLabel:first(raw.www_cust_story_ctalabel),ctaTarget:ctaTarget,ctaAriaLabel:first(raw.www_cust_story_ctaarialabel),isVideo:isVideoUrl(ctaUrl),industry:first(raw.www_industry),companySize:resolveTagDisplay(raw.www_business_size,raw.www_business_size_id,captions),category:joinValues(raw.www_topic),region:first(raw.www_region),source:first(raw.source)};}},{key:\"transformFacets\",value:function transformFacets(facets,selectedFacets){var captions=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!Array.isArray(facets))return[];// Preserve the order the facets were requested in.\nvar order=REQUESTED_FACETS.map(function(f){return f.field;});return facets.filter(function(facet){return Array.isArray(facet.values)&&facet.values.length;}).sort(function(a,b){return order.indexOf(a.field)-order.indexOf(b.field);}).map(function(facet){var selected=selectedFacets[facet.field]||[];return{field:facet.field,label:FACET_LABELS[facet.field]||facet.field,values:facet.values.map(function(v){return{value:v.value,// www_*_id values are tag ids; map to the localized title.\nlabel:captions[v.value]||v.value,count:v.numberOfResults||0,selected:v.state==='selected'||selected.includes(v.value)};})};});}}]);}();
1\n// EXTERNAL MODULE: ../../core/ui.apps/src/main/content/jcr_root/apps/wd-core/components/datalayer/datalayer.js\nvar datalayer = __webpack_require__(5564);\n;// ./src/main/content/jcr_root/apps/atlas/components/content/redesign/customer_stories/customer_stories_analytics.ts\n/**\n * Adobe Analytics for Customer Stories Overview.\n *\n * Coveo `Coveosearch` payloads mirror `success-story-coveo.js`:\n * - Enter search vs suggestion (lines 371–390)\n * - Typed search on Enter (lines 414–432 equivalent; no separate submit button in this UI)\n * - Suggestion list click (lines 464–485)\n *\n * Requirement 28 overview interactions use separate `linkInteraction` beacons\n * with `event79` / `linkInteractionInfo.highValueClick` for CJA parity.\n *\n * @see customer_stories.ts\n * @see success-story-coveo.js\n * @module customer_stories_analytics\n */var PREFIX='Customer Stories Overview';var RULE_VIEW_TOGGLE='Customer Stories Grid/List View Toggle Click';var RULE_SORT='Customer Stories Overview Sort By Selection';var RULE_SHOW_MORE='Customer Stories Overview Show More Stories Click';var RULE_OVERVIEW_RESULT_CLICK='Customer Stories Overview : Search Result Click';var COVEO_SEARCH_RULE='Analytics : Event : Customer coveo search';var COVEO_SUGGESTION_RULE='Analytics : Event : Customer coveo suggestion click';function normalizeText(value){return(value===null||value===void 0?void 0:value.replace(/\\s+/g,' ').trim())||'';}function trackLinkInteraction(ruleName,linkName){var url=arguments.length>2&&arguments[2]!==undefined?arguments[2]:window.location.href;(0,datalayer/* trackAdobeEvent */.F0)('linkInteraction',{eVars:{eVar12:ruleName,eVar59:linkName},events:{event1to100:{event79:{value:1}}},webInteraction:{name:linkName,url:url},pageInfo:{launchRule:ruleName},linkInfo:{linkName:linkName},linkInteractionInfo:{highValueClick:1}});}/** Requirement 28 — grid/list view toggle. */function trackViewToggle(view){var viewLabel=view==='list'?'List':'Grid';var linkName=\"\".concat(PREFIX,\" : \").concat(viewLabel);trackLinkInteraction(RULE_VIEW_TOGGLE,linkName);}/** Requirement 28 — sort-by dropdown selection. */function trackSortSelection(menuSelection){var selection=normalizeText(menuSelection);if(!selection)return;var linkName=\"\".concat(PREFIX,\" : Sort By: \").concat(selection);trackLinkInteraction(RULE_SORT,linkName);}/** Requirement 28 — show more stories button. */function trackShowMoreStories(){var linkName=\"\".concat(PREFIX,\" : Show More Stories\");trackLinkInteraction(RULE_SHOW_MORE,linkName);}/** Requirement 28 — card/list result click (`linkInteraction`). */function trackOverviewSearchResultClick(customerName,headline,url){var name=normalizeText(customerName)||'N/A';var title=normalizeText(headline)||'N/A';var linkName=\"\".concat(PREFIX,\" : \").concat(name,\" : \").concat(title);trackLinkInteraction(RULE_OVERVIEW_RESULT_CLICK,linkName,url||window.location.href);}/**\n * Shared Coveo search-box payload (success-story-coveo.js 371–390, 414–432, 464–485).\n */function trackCoveoSearchBoxEvent(searchTerm,totalCount,eventName){;(0,datalayer/* trackAdobeEvent */.F0)('Coveosearch',{eVars:{eVar5:searchTerm,eVar12:eventName,eVar51:(0,datalayer/* convertCountToString */.$A)(totalCount)},events:{event1to100:{event5:{value:1}}},searchInfo:{onsiteSearchTerm:searchTerm,numberOfSearchResults:(0,datalayer/* convertCountToString */.$A)(totalCount),onsiteSearch:1},pageInfo:{launchRule:eventName},webInteraction:{url:window.location.href}});}/** Coveo suggestion pick from dropdown (464–485). */function trackCoveoSuggestionClick(searchTerm,totalCount){trackCoveoSearchBoxEvent(searchTerm,totalCount,COVEO_SUGGESTION_RULE);}/**\n * Coveo Enter key — typed search (414–432) vs arrow-navigated suggestion (371–390).\n *\n * @param fromSuggestion - `true` when the user navigated suggestions with arrow keys.\n */function trackCoveoSearchOnEnter(searchTerm,totalCount,fromSuggestion){var eventName=fromSuggestion?COVEO_SUGGESTION_RULE:COVEO_SEARCH_RULE;trackCoveoSearchBoxEvent(searchTerm,totalCount,eventName);}\n// EXTERNAL MODULE: ./src/main/content/jcr_root/apps/atlas/components/content/redesign/tabs/tabs.ts + 1 modules\nvar tabs = __webpack_require__(4325);\n// EXTERNAL MODULE: ./src/main/content/jcr_root/apps/atlas/clientlibs/common/publish/src/js/utils/coveo-helpers.js\nvar coveo_helpers = __webpack_require__(5711);\n;// ./src/main/content/jcr_root/apps/atlas/components/content/redesign/customer_stories/customer_stories.ts\n/**\n * Customer Stories (redesign) — client behaviour.\n *\n * Registered in `clientlibs/common/publish/src/js/app.js` as `cmp-customer-stories`.\n * Drives a native HTML/CSS UI from the Coveo REST Search API (see\n * customer-stories-search.ts). Supports grid + list views, a filter drawer with\n * API-driven facets, full-text search, sort, applied-filter chips, \"show more\"\n * pagination, and Coveo usage analytics (reused from the shared coveo-helpers).\n */// eslint-disable-next-line import/no-unresolved\nvar PAGE_SIZE=12;var SUGGEST_DEBOUNCE_MS=150;/** Delay before following a result link so Alloy can send analytics (success-story-coveo). */var RESULT_CLICK_NAV_DELAY_MS=1000;var RECENT_SEARCHES_KEY='cs-recent-searches';var RECENT_SEARCHES_MAX=5;var ICON_SEARCH='<svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><circle cx=\"11\" cy=\"11\" r=\"7\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"m20 20-3.5-3.5\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>';var ICON_CLOCK='<svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"8\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"M12 8v4l3 2\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>';/** Query a required descendant; throws in dev if the shell markup is missing. */var need=function need(root,selector){var el=root.querySelector(selector);if(!el){throw new Error(\"Customer Stories: missing element \\\"\".concat(selector,\"\\\"\"));}return el;};var CustomerStoriesInstance=/*#__PURE__*/function(){function CustomerStoriesInstance(root){(0,classCallCheck/* default */.A)(this,CustomerStoriesInstance);(0,defineProperty/* default */.A)(this,\"root\",void 0);(0,defineProperty/* default */.A)(this,\"client\",void 0);(0,defineProperty/* default */.A)(this,\"originLevel1\",void 0);(0,defineProperty/* default */.A)(this,\"searchHub\",void 0);(0,defineProperty/* default */.A)(this,\"locale\",void 0);// ── State ──\n(0,defineProperty/* default */.A)(this,\"view\",'grid');(0,defineProperty/* default */.A)(this,\"query\",'');(0,defineProperty/* default */.A)(this,\"sort\",'relevancy');(0,defineProperty/* default */.A)(this,\"selected\",{});(0,defineProperty/* default */.A)(this,\"expandedFacets\",new Set());/** Ensures the first facet opens once; not re-seeded after the user collapses it. */(0,defineProperty/* default */.A)(this,\"defaultFacetSeeded\",false);(0,defineProperty/* default */.A)(this,\"firstResult\",0);(0,defineProperty/* default */.A)(this,\"total\",0);(0,defineProperty/* default */.A)(this,\"docs\",[]);(0,defineProperty/* default */.A)(this,\"facetsData\",[]);(0,defineProperty/* default */.A)(this,\"requestToken\",0);(0,defineProperty/* default */.A)(this,\"suggestTimer\",void 0);(0,defineProperty/* default */.A)(this,\"suggestToken\",0);(0,defineProperty/* default */.A)(this,\"activeSuggestion\",-1);(0,defineProperty/* default */.A)(this,\"pendingCorrection\",null);(0,defineProperty/* default */.A)(this,\"lastFocusedFacet\",null);(0,defineProperty/* default */.A)(this,\"pendingChipFocusIndex\",null);/** Coveo Adobe search analytics after the next non-append search completes. */(0,defineProperty/* default */.A)(this,\"pendingSearchEvent\",null);/** Enter was used after arrow-key suggestion navigation (success-story-coveo fromSuggestion). */(0,defineProperty/* default */.A)(this,\"searchFromSuggestion\",false);// ── DOM refs ──\n(0,defineProperty/* default */.A)(this,\"grid\",void 0);(0,defineProperty/* default */.A)(this,\"listWrap\",void 0);(0,defineProperty/* default */.A)(this,\"listBody\",void 0);(0,defineProperty/* default */.A)(this,\"resultsRegion\",void 0);(0,defineProperty/* default */.A)(this,\"emptyEl\",void 0);(0,defineProperty/* default */.A)(this,\"countEl\",void 0);(0,defineProperty/* default */.A)(this,\"footer\",void 0);(0,defineProperty/* default */.A)(this,\"showingEl\",void 0);(0,defineProperty/* default */.A)(this,\"progressEl\",void 0);(0,defineProperty/* default */.A)(this,\"loadMoreBtn\",void 0);(0,defineProperty/* default */.A)(this,\"panel\",void 0);(0,defineProperty/* default */.A)(this,\"layout\",void 0);(0,defineProperty/* default */.A)(this,\"facetsContainer\",void 0);(0,defineProperty/* default */.A)(this,\"searchInput\",void 0);(0,defineProperty/* default */.A)(this,\"searchClearBtn\",void 0);
1(0,defineProperty/* default */.A)(this,\"searchWrap\",void 0);(0,defineProperty/* default */.A)(this,\"suggestionsEl\",void 0);(0,defineProperty/* default */.A)(this,\"didYouMeanEl\",void 0);(0,defineProperty/* default */.A)(this,\"sortWrap\",void 0);(0,defineProperty/* default */.A)(this,\"sortTrigger\",void 0);(0,defineProperty/* default */.A)(this,\"sortMenu\",void 0);(0,defineProperty/* default */.A)(this,\"sortValueEl\",void 0);(0,defineProperty/* default */.A)(this,\"tags\",void 0);(0,defineProperty/* default */.A)(this,\"tagsList\",void 0);(0,defineProperty/* default */.A)(this,\"clearAllBtn\",void 0);(0,defineProperty/* default */.A)(this,\"viewToggle\",void 0);(0,defineProperty/* default */.A)(this,\"srAnnounce\",void 0);(0,defineProperty/* default */.A)(this,\"srAnnouncePanel\",void 0);/** Restores overlay panel after portaling to document.body (<1200px drawer). */(0,defineProperty/* default */.A)(this,\"panelAnchor\",null);(0,defineProperty/* default */.A)(this,\"bodyScrollLocked\",false);(0,defineProperty/* default */.A)(this,\"bodyScrollY\",0);(0,defineProperty/* default */.A)(this,\"tplCard\",void 0);(0,defineProperty/* default */.A)(this,\"tplRow\",void 0);(0,defineProperty/* default */.A)(this,\"tplFacet\",void 0);(0,defineProperty/* default */.A)(this,\"tplFacetValue\",void 0);(0,defineProperty/* default */.A)(this,\"tplChip\",void 0);this.root=root;var ds=root.dataset;this.searchHub=ds.searchHub||'Martech - Customer Story';this.originLevel1=ds.originLevel1||this.searchHub;this.locale=(ds.locale||document.documentElement.lang||'en-us').toLowerCase();var config={orgId:ds.orgId||'',token:ds.token||'',searchHub:this.searchHub,locale:this.locale,isBoosted:ds.isboosted==='true'};// Diagnostic (no secrets): confirms whether AEM supplied the Coveo config.\n// eslint-disable-next-line no-console\nconsole.info('[CustomerStories] config',{orgId:config.orgId||'(empty)',tokenPresent:Boolean(config.token),locale:config.locale,searchHub:config.searchHub});this.client=new CustomerStoriesSearch(config);this.grid=need(root,'[data-cs-grid]');this.listWrap=need(root,'[data-cs-list]');this.listBody=need(root,'[data-cs-list-body]');this.resultsRegion=need(root,'[data-cs-results-region]');this.emptyEl=need(root,'[data-cs-empty]');this.countEl=need(root,'[data-cs-count]');this.footer=need(root,'[data-cs-footer]');this.showingEl=need(root,'[data-cs-showing]');this.progressEl=need(root,'[data-cs-progress]');this.loadMoreBtn=need(root,'[data-cs-load-more]');this.panel=need(root,'[data-cs-panel]');this.layout=need(root,'[data-cs-layout]');this.facetsContainer=need(root,'[data-cs-facets]');this.searchInput=need(root,'[data-cs-search]');this.searchClearBtn=need(root,'[data-cs-search-clear]');this.searchWrap=need(root,'[data-cs-search-wrap]');this.suggestionsEl=need(root,'[data-cs-suggestions]');this.didYouMeanEl=need(root,'[data-cs-didyoumean]');this.sortWrap=need(root,'[data-cs-sort]');this.sortTrigger=need(root,'[data-cs-sort-trigger]');this.sortMenu=need(root,'[data-cs-sort-menu]');this.sortValueEl=need(root,'[data-cs-sort-value]');this.tags=need(root,'[data-cs-tags]');this.tagsList=need(root,'[data-cs-tags-list]');this.clearAllBtn=need(root,'[data-cs-clear-all]');this.viewToggle=need(root,'[data-cs-view-toggle]');this.srAnnounce=need(root,'[data-cs-sr-announce]');this.srAnnouncePanel=need(root,'[data-cs-sr-announce-panel]');this.tplCard=need(root,'[data-cs-tpl-card]');this.tplRow=need(root,'[data-cs-tpl-row]');this.tplFacet=need(root,'[data-cs-tpl-facet]');this.tplFacetValue=need(root,'[data-cs-tpl-facet-value]');this.tplChip=need(root,'[data-cs-tpl-chip]');}return (0,createClass/* default */.A)(CustomerStoriesInstance,[{key:\"init\",value:function init(){var _this=this;if(this.root.dataset.disableSearch==='true'){this.searchWrap.hidden=true;}this.bindEvents();// Set the initial aria-label on the filter button (panel starts closed).\nthis.root.querySelectorAll('[data-cs-filter-open]').forEach(function(btn){return btn.setAttribute('aria-label',_this.i18n('i18nOpenFilters','Open filters'));});(0,coveo_helpers/* setCurrentOriginLevel1 */.vu)(this.originLevel1);// Card (grid) view is the only option below 1200px — enforce it on load and\n// whenever the viewport crosses the breakpoint.\nthis.enforceViewForViewport();this.updateViewIndicator(false);var viewToggleResize=new ResizeObserver(function(){return _this.updateViewIndicator(false);});viewToggleResize.observe(this.viewToggle);window.addEventListener('resize',function(){_this.enforceViewForViewport();_this.syncPanelPlacement();});// Deep linking: restore query / sort / facets from the URL hash, then keep\n// the UI in sync with browser back/forward navigation.\nthis.applyStateFromUrl();this.syncControlsFromState();window.addEventListener('popstate',function(){_this.applyStateFromUrl();_this.syncControlsFromState();_this.firstResult=0;void _this.performSearch(false);});void this.performSearch(false);}// ─────────────────────────────────────────────────────────── events ──\n},{key:\"bindEvents\",value:function bindEvents(){var _this2=this;// Filter drawer open / close\nthis.root.querySelectorAll('[data-cs-filter-open]').forEach(function(btn
1){return btn.addEventListener('click',function(){return _this2.togglePanel(_this2.panel.hidden);});});this.root.querySelectorAll('[data-cs-panel-close]').forEach(function(btn){return btn.addEventListener('click',function(){return _this2.togglePanel(false);});});document.addEventListener('keydown',function(e){if(e.key==='Escape'&&!_this2.panel.hidden)_this2.togglePanel(false);});// Focus trap: keep keyboard focus inside the panel when it's open as a modal overlay.\nthis.panel.addEventListener('keydown',function(e){if(e.key!=='Tab'||_this2.panel.hidden||!_this2.isOverlayViewport())return;var focusable=Array.from(_this2.panel.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])')).filter(function(el){return!el.hidden&&el.offsetParent!==null;});if(!focusable.length)return;var first=focusable[0];var last=focusable[focusable.length-1];if(e.shiftKey&&document.activeElement===first){e.preventDefault();last.focus();}else if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first.focus();}});// Search runs only on Enter (submit); typing just updates the suggestions.\nthis.searchInput.addEventListener('input',function(){_this2.searchFromSuggestion=false;_this2.syncSearchClearVisibility();_this2.scheduleSuggestions();});this.searchClearBtn.addEventListener('click',function(){return _this2.clearSearchInput();});this.searchInput.addEventListener('focus',function(){return _this2.scheduleSuggestions();});this.searchInput.addEventListener('keydown',function(e){return _this2.onSearchKeydown(e);});// Keyboard navigation while focus is on a suggestion item.\nthis.suggestionsEl.addEventListener('keydown',function(e){var options=Array.from(_this2.suggestionsEl.querySelectorAll('[data-cs-suggestion]'));var index=options.indexOf(document.activeElement);if(index<0)return;switch(e.key){case'ArrowDown':{e.preventDefault();var next=(index+1)%options.length;options.forEach(function(o,i){return o.classList.toggle('is-active',i===next);});options[next].focus();break;}case'ArrowUp':{e.preventDefault();if(index===0){// At the top — return focus to the input.\noptions.forEach(function(o){return o.classList.remove('is-active');});_this2.activeSuggestion=-1;_this2.searchInput.focus();}else{var prev=index-1;options.forEach(function(o,i){return o.classList.toggle('is-active',i===prev);});options[prev].focus();}break;}case'Enter':case' ':e.preventDefault();_this2.applySuggestion(options[index].dataset.value||'');break;case'Escape':e.preventDefault();_this2.hideSuggestions();_this2.searchInput.focus();break;default:// Any printable key or Backspace: return focus to the input so the\n// user can keep typing without re-focusing manually.\nif(e.key.length===1||e.key==='Backspace'){_this2.searchInput.focus();}break;}});// Suggestion selection / clear recent (mousedown fires before input blur).\nthis.suggestionsEl.addEventListener('mousedown',function(e){var target=e.target;if(target!==null&&target!==void 0&&target.closest('[data-cs-recent-clear]')){e.preventDefault();return;}var opt=target===null||target===void 0?void 0:target.closest('[data-cs-suggestion]');if(!opt)return;e.preventDefault();_this2.applySuggestion(opt.dataset.value||'');});this.suggestionsEl.addEventListener('click',function(e){var _e$target;if(!((_e$target=e.target)!==null&&_e$target!==void 0&&_e$target.closest('[data-cs-recent-clear]')))return;e.preventDefault();_this2.clearRecentSuggestionsFromDropdown();});// Hide suggestions when focus leaves the search combobox (input, clear, listbox).\nthis.searchWrap.addEventListener('focusout',function(e){var next=e.relatedTarget;window.setTimeout(function(){var active=document.activeElement;if(next&&_this2.searchWrap.contains(next)||active&&_this2.searchWrap.contains(active)){return;}_this2.hideSuggestions();},120);});// Sort (custom dropdown)\nthis.sortTrigger.addEventListener('click',function(e){e.stopPropagation();_this2.toggleSortMenu(_this2.sortMenu.hidden);});// ArrowDown / ArrowUp open the menu straight onto the first / last option.\nthis.sortTrigger.addEventListener('keydown',function(e){if(e.key!=='ArrowDown'&&e.key!=='ArrowUp')return;e.preventDefault();var options=_this2.sortOptions();if(!_this2.sortMenu.hidden){_this2.focusSortOption(e.key==='ArrowDown'?options[0]:options[options.length-1]);return;}_this2.toggleSortMenu(true,{focus:e.key==='ArrowDown'?'first':'last'});});
1this.sortOptions().forEach(function(opt){opt.addEventListener('click',function(){return _this2.selectSortOption(opt);});});this.sortMenu.addEventListener('keydown',function(e){return _this2.onSortMenuKeydown(e);});// Close when focus leaves the whole sort control (e.g. Tab out, click away).\nthis.sortWrap.addEventListener('focusout',function(e){var next=e.relatedTarget;if(next&&_this2.sortWrap.contains(next))return;_this2.closeSortMenu(false);});document.addEventListener('click',function(e){if(!_this2.sortMenu.hidden&&!_this2.sortWrap.contains(e.target)){_this2.closeSortMenu(false);}});document.addEventListener('keydown',function(e){if(e.key!=='Escape'||_this2.sortMenu.hidden)return;// Focus would be orphaned on the hidden option, so hand it back to the trigger.\n_this2.closeSortMenu(_this2.sortWrap.contains(document.activeElement));});// View toggle — click and arrow-key navigation.\nvar viewBtns=Array.from(this.root.querySelectorAll('[data-cs-view]'));viewBtns.forEach(function(btn){btn.addEventListener('click',function(){var next=btn.dataset.csView||'grid';if(next===_this2.view)return;_this2.setView(next);trackViewToggle(next);});btn.addEventListener('keydown',function(e){if(e.key!=='ArrowLeft'&&e.key!=='ArrowRight')return;e.preventDefault();var idx=viewBtns.indexOf(btn);var target=e.key==='ArrowRight'?viewBtns[idx+1]:viewBtns[idx-1];if(!target)return;target.focus();var next=target.dataset.csView||'grid';if(next!==_this2.view){_this2.setView(next);trackViewToggle(next);}});});// Clear all filters\nthis.clearAllBtn.addEventListener('click',function(){Object.keys(_this2.selected).forEach(function(k){return delete _this2.selected[k];});_this2.firstResult=0;_this2.syncUrl(true);void _this2.performSearch(false);});// Load more\nthis.loadMoreBtn.addEventListener('click',function(){trackShowMoreStories();_this2.firstResult+=PAGE_SIZE;void _this2.performSearch(true);});}},{key:\"sortOptions\",value:function sortOptions(){return Array.from(this.sortMenu.querySelectorAll('[data-cs-sort-option]'));}/**\n   * Open/close the sort listbox. While open, focus moves into the menu and the\n   * options carry a roving tabindex so arrow keys walk the list; while closed\n   * every option is removed from the tab order.\n   */},{key:\"toggleSortMenu\",value:function toggleSortMenu(open){var opts=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};this.sortMenu.hidden=!open;this.sortTrigger.setAttribute('aria-expanded',String(open));var options=this.sortOptions();if(!open){options.forEach(function(o){return o.setAttribute('tabindex','-1');});return;}var which=opts.focus||'selected';if(which==='none')return;var selected=options.find(function(o){return o.getAttribute('aria-selected')==='true';});var target=which==='first'?options[0]:which==='last'?options[options.length-1]:selected||options[0];this.focusSortOption(target);}},{key:\"closeSortMenu\",value:function closeSortMenu(returnFocus){if(this.sortMenu.hidden)return;this.toggleSortMenu(false);if(returnFocus)this.sortTrigger.focus();}/** Move the roving tabindex onto `opt` and focus it. */},{key:\"focusSortOption\",value:function focusSortOption(opt){if(!opt)return;this.sortOptions().forEach(function(o){return o.setAttribute('tabindex',o===opt?'0':'-1');});opt.focus();}},{key:\"onSortMenuKeydown\",value:function onSortMenuKeydown(e){var options=this.sortOptions();if(!options.length)return;var index=options.indexOf(document.activeElement);switch(e.key){case'ArrowDown':e.preventDefault();this.focusSortOption(options[(index+1)%options.length]);break;case'ArrowUp':e.preventDefault();this.focusSortOption(options[(index-1+options.length)%options.length]);break;case'Home':e.preventDefault();this.focusSortOption(options[0]);break;case'End':e.preventDefault();this.focusSortOption(options[options.length-1]);break;case'Enter':case' ':e.preventDefault();if(index>=0)this.selectSortOption(options[index]);break;case'Tab':// Hand focus back to the trigger *before* hiding the menu, otherwise the\n// focused option disappears mid-keypress and the browser resets to <body>.\n// Shift+Tab then rests on the trigger; Tab continues past it as usual.\nthis.sortTrigger.focus();this.toggleSortMenu(false);
1if(e.shiftKey)e.preventDefault();break;default:break;}}},{key:\"selectSortOption\",value:function selectSortOption(opt){var value=opt.dataset.value||'relevancy';if(value!==this.sort){this.sort=value;var menuSelection=(opt.textContent||'').trim();this.sortValueEl.textContent=menuSelection;this.sortOptions().forEach(function(o){return o.setAttribute('aria-selected',String(o===opt));});trackSortSelection(menuSelection);this.firstResult=0;this.syncUrl(true);void this.performSearch(false);}this.closeSortMenu(true);}},{key:\"togglePanel\",value:function togglePanel(open){this.panel.hidden=!open;this.panel.setAttribute('aria-hidden',String(!open));this.root.classList.toggle('cs--panel-open',open);var filterLabel=open?this.i18n('i18nCloseFilters','Close filters'):this.i18n('i18nOpenFilters','Open filters');this.root.querySelectorAll('[data-cs-filter-open]').forEach(function(btn){btn.setAttribute('aria-expanded',String(open));btn.setAttribute('aria-label',filterLabel);});this.syncPanelPlacement();if(open){var firstFocusable=this.panel.querySelector('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])');// Defer until after syncPanelPlacement (which may move the panel in the DOM).\nwindow.setTimeout(function(){return firstFocusable===null||firstFocusable===void 0?void 0:firstFocusable.focus();},50);}else{var filterBtn=this.root.querySelector('[data-cs-filter-open]');filterBtn===null||filterBtn===void 0||filterBtn.focus();}}/** Prevent page scroll behind the mobile overlay drawer (modal_redesign pattern). */},{key:\"syncBodyScrollLock\",value:function syncBodyScrollLock(){var shouldLock=this.isOverlayViewport()&&!this.panel.hidden;if(shouldLock===this.bodyScrollLocked)return;this.bodyScrollLocked=shouldLock;if(shouldLock){this.bodyScrollY=window.scrollY;document.body.style.overflow='hidden';document.body.style.position='fixed';document.body.style.top=\"-\".concat(this.bodyScrollY,\"px\");document.body.style.width='100%';document.body.style.minHeight='100%';return;}document.body.style.overflow='';document.body.style.position='';document.body.style.top='';document.body.style.width='';document.body.style.minHeight='';window.scrollTo(0,this.bodyScrollY);}},{key:\"isOverlayViewport\",value:function isOverlayViewport(){return window.innerWidth<1200;}/** Keep the mobile drawer out of transformed / z-indexed section ancestors. */},{key:\"syncPanelPlacement\",value:function syncPanelPlacement(){if(!this.isOverlayViewport()){this.restorePanelToLayout();}else if(!this.panel.hidden){this.portalPanelToBody();}else{this.restorePanelToLayout();}this.syncBodyScrollLock();}},{key:\"portalPanelToBody\",value:function portalPanelToBody(){if(this.panel.parentElement===document.body)return;var parent=this.panel.parentNode;if(!parent)return;if(!this.panelAnchor){this.panelAnchor=document.createComment('cs-panel-anchor');parent.insertBefore(this.panelAnchor,this.panel.nextSibling);}document.body.appendChild(this.panel);}},{key:\"restorePanelToLayout\",value:function restorePanelToLayout(){var _this$panelAnchor;if(!((_this$panelAnchor=this.panelAnchor)!==null&&_this$panelAnchor!==void 0&&_this$panelAnchor.parentNode))return;if(this.panel.parentElement===this.panelAnchor.parentNode)return;this.panelAnchor.parentNode.insertBefore(this.panel,this.panelAnchor);}/**\n   * The Grid/List toggle is hidden below 1200px, so force card (grid) view on\n   * narrow viewports even if list view was selected on a wider screen.\n   */},{key:\"enforceViewForViewport\",value:function enforceViewForViewport(){if(window.innerWidth<1200&&this.view!=='grid'){this.setView('grid');}}},{key:\"setView\",value:function setView(view){this.view=view;this.root.querySelectorAll('[data-cs-view]').forEach(function(btn){var active=btn.dataset.csView===view;btn.classList.toggle('is-active',active);btn.setAttribute('aria-pressed',String(active));});this.renderResults();this.updateViewIndicator(true);}/** Positions the sliding pill over the active grid/list control (tabs indicator API). */},{key:\"updateViewIndicator\",value:function updateViewIndicator(animate){var active=this.viewToggle.querySelector('.cs__view-btn.is-active');if(!active)return;var INSTANT='cs__view-toggle--indicator-instant';if(!animate){this.viewToggle.classList.add(INSTANT);};(0,tabs.updateActiveIndicator)(this.viewToggle,active);if(!animate){void this.viewToggle.offsetWidth;this.viewToggle.classList.remove(INSTANT);}}// ─────────────────────────────────────────────────────────── search ──\n/**\n   * @param append   append page (load more) vs. replace results\n   * @param execQuery when set, the query actually executed differs from the\n   *   user's typed `this.query` — used to transparently re-run an\n   *   auto-corrected \"did you mean\" query while keeping the typed query intact.\n   */},{key:\"performSearch\",value:function(){var _performSearch=(0,asyncToGenerator/* default */.A)(/*#__PURE__*/regenerator_default().mark(function _callee(append,execQuery){var _this3=this;var token,queryText,isCorrectedRun,result,previousCount,loaded,totalLabel,_t;return regenerator_default().wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:token=++this.requestToken;this.resultsRegion.setAttribute('aria-busy','true');this.root.classList.toggle('cs--loading',!append);queryText=execQuery!==null&&execQuery!==void 0?execQuery:this.query;isCorrectedRun=execQuery!==undefined;_context.prev=1;_context.next=2;return this.client.search({q:queryText,firstResult:this.firstResult,numberOfResults:PAGE_SIZE,sortCriteria:this.sort,selectedFacets:this.selected});case 2:result=_context.sent;if(!(token!==this.requestToken)){_context.next=3;break;}return _context.abrupt(\"return\");case 3:if(!(!append&&!isCorrectedRun&&result.total===0&&result.correctedQuery&&result.correctedQuery.toLowerCase()!==this.query.toLowerCase())){_context.next=5;break;}this.pendingCorrection={from:this.query,to:result.correctedQuery};_context.next=4;return this.performSearch(false,result.correctedQuery);case 4:return _context.abrupt(\"return\");case 5:previousCount=append?this.docs.length:0;this.docs=append?this.docs.concat(result.docs):result.docs;this.total=result.total;if(!append)this.facetsData=result.facets;// Analytics (reuse shared Coveo UA helpers)\n(0,coveo_helpers/* setLastSearchQueryUid */.lG)(result.searchUid);(0,coveo_helpers/* setLastQueryPipeline */.Vv)(result.pipeline);(0,coveo_helpers/* logCoveoSearch */.xR)({searchQueryUid:result.searchUid,queryText:queryText,numberOfResults:result.total,responseTime:result.responseTime,queryPipeline:result.pipeline,searchHub:this.searchHub,originLevel1:this.originLevel1,locale:this.locale,actionCause:append?'browseResults':'searchboxSubmit'});if(!append&&this.pendingSearchEvent==='suggestion'){trackCoveoSuggestionClick(this.query.trim(),result.total);this.pendingSearchEvent=null;this.searchFromSuggestion=false;}else if(!append&&this.pendingSearchEvent==='enter'){trackCoveoSearchOnEnter(this.query.trim(),result.total,this.searchFromSuggestion);this.searchFromSuggestion=false;this.pendingSearchEvent=null;}this.renderResults();if(!append){this.renderFacets();this.restoreFacetFocus();if(isCorrectedRun&&this.pendingCorrection){this.renderDidYouMean(this.pendingCorrection);}else{this.pendingCorrection=null;this.renderDidYouMean(null);}}this.renderChips();this.restoreChipFocus();this.updateStatus();if(append&&result.docs.length>0){// Announce the updated count via a dedicated hidden live region, then\n// move focus to the first new result after the announcement has had\n// time to queue with the screen reader.\nloaded=this.docs.length;
1totalLabel=this.total.toLocaleString();this.srAnnounce.textContent=this.i18n('i18nShowingOf','Showing {0} of {1} results',loaded.toLocaleString(),totalLabel);window.setTimeout(function(){_this3.srAnnounce.textContent='';_this3.focusFirstNewResult(previousCount);},500);}_context.next=8;break;case 6:_context.prev=6;_t=_context[\"catch\"](1);if(!(token!==this.requestToken)){_context.next=7;break;}return _context.abrupt(\"return\");case 7:// eslint-disable-next-line no-console\nconsole.error(_t);this.pendingSearchEvent=null;this.searchFromSuggestion=false;if(!append){this.docs=[];this.total=0;this.pendingCorrection=null;this.renderResults();this.renderDidYouMean(null);this.updateStatus();}case 8:_context.prev=8;if(token===this.requestToken){this.resultsRegion.setAttribute('aria-busy','false');this.root.classList.remove('cs--loading');}return _context.finish(8);case 9:case\"end\":return _context.stop();}},_callee,this,[[1,6,8,9]]);}));function performSearch(_x,_x2){return _performSearch.apply(this,arguments);}return performSearch;}()// ───────────────────────────────────── query suggestions (typeahead) ──\n},{key:\"scheduleSuggestions\",value:function scheduleSuggestions(){var _this4=this;window.clearTimeout(this.suggestTimer);var q=this.searchInput.value.trim();this.suggestTimer=window.setTimeout(function(){var token=++_this4.suggestToken;void _this4.client.querySuggest(q).then(function(suggestions){if(token!==_this4.suggestToken)return;// stale\n// Drop a suggestion identical to what's already typed.\nvar querySuggestions=suggestions.filter(function(s){return s.toLowerCase()!==q.toLowerCase();});_this4.renderSuggestions(querySuggestions);});},SUGGEST_DEBOUNCE_MS);}// ── Recent searches (persisted locally) ──\n},{key:\"getRecentSearches\",value:function getRecentSearches(){try{var raw=window.localStorage.getItem(RECENT_SEARCHES_KEY);var list=raw?JSON.parse(raw):[];return Array.isArray(list)?list.filter(function(v){return typeof v==='string';}):[];}catch(_unused){return[];}}},{key:\"addRecentSearch\",value:function addRecentSearch(q){var query=q.trim();if(!query)return;var existing=this.getRecentSearches().filter(function(v){return v.toLowerCase()!==query.toLowerCase();});var next=[query].concat((0,toConsumableArray/* default */.A)(existing)).slice(0,RECENT_SEARCHES_MAX);try{window.localStorage.setItem(RECENT_SEARCHES_KEY,JSON.stringify(next));}catch(_unused2){/* ignore storage failures (private mode, quota, etc.) */}}},{key:\"clearRecentSearches\",value:function clearRecentSearches(){try{window.localStorage.removeItem(RECENT_SEARCHES_KEY);}catch(_unused3){/* ignore */}}/** Clear stored recent searches and refresh the open suggestions dropdown. */},{key:\"clearRecentSuggestionsFromDropdown\",value:function clearRecentSuggestionsFromDropdown(){this.clearRecentSearches();var querySuggestions=Array.from(this.suggestionsEl.querySelectorAll('.cs__suggestion:not(.cs__suggestion--recent)')).map(function(el){return el.dataset.value||'';});this.renderSuggestions(querySuggestions);}}
1,{key:\"renderSuggestions\",value:function renderSuggestions(querySuggestions){var _this$suggestionsEl;this.activeSuggestion=-1;var q=this.searchInput.value.trim().toLowerCase();var recent=this.getRecentSearches()// Hide recent entries that duplicate a shown query suggestion.\n.filter(function(r){return!querySuggestions.some(function(s){return s.toLowerCase()===r.toLowerCase();});})// When typing, only show recent items that match the input.\n.filter(function(r){return!q||r.toLowerCase().includes(q);});if(!querySuggestions.length&&!recent.length){this.hideSuggestions();return;}var children=[];var index=0;var makeOption=function makeOption(text,icon,recentItem){var li=document.createElement('li');li.className=\"cs__suggestion\".concat(recentItem?' cs__suggestion--recent':'');li.setAttribute('role','listitem');li.setAttribute('aria-label',text);li.setAttribute('tabindex','0');li.setAttribute('data-cs-suggestion','');li.id=\"cs-suggestion-\".concat(index++);li.dataset.value=text;// Icon is purely decorative — hidden from the accessibility tree so the\n// option's accessible name is computed solely from the text node below,\n// avoiding the \"1 of N\" only announcement caused by child-span name conflicts.\nvar iconEl=document.createElement('span');iconEl.className='cs__suggestion-icon';iconEl.setAttribute('aria-hidden','true');iconEl.innerHTML=icon;// Plain text node (not a <span>) gives screen readers a clean accessible name.\nvar labelNode=document.createTextNode(text);li.append(iconEl,labelNode);return li;};querySuggestions.forEach(function(s){return children.push(makeOption(s,ICON_SEARCH,false));});if(recent.length){var header=document.createElement('li');header.className='cs__suggestions-header';header.setAttribute('aria-hidden','true');var title=document.createElement('span');title.textContent=this.i18n('i18nRecentSearches','Recent searches');var clear=document.createElement('button');clear.type='button';clear.className='cs__suggestions-clear';clear.setAttribute('data-cs-recent-clear','');clear.textContent=this.i18n('i18nClear','Clear');header.append(title,clear);children.push(header);recent.forEach(function(r){return children.push(makeOption(r,ICON_CLOCK,true));});}(_this$suggestionsEl=this.suggestionsEl).replaceChildren.apply(_this$suggestionsEl,children);this.suggestionsEl.hidden=false;this.searchInput.setAttribute('aria-expanded','true');this.reserveDropdownSpace();}/**\n   * When results are empty the component is short, so an ancestor with\n   * `overflow: hidden` clips the floating suggestions box. Grow the layout to\n   * contain the dropdown while it's open.\n   */},{key:\"reserveDropdownSpace\",value:function reserveDropdownSpace(){var layoutTop=this.layout.getBoundingClientRect().top;var dropdownBottom=this.suggestionsEl.getBoundingClientRect().bottom;var needed=Math.ceil(dropdownBottom-layoutTop+16);if(needed>0)this.layout.style.minHeight=\"\".concat(needed,\"px\");}},{key:\"hideSuggestions\",value:function hideSuggestions(){// Cancel any pending/in-flight suggestion fetch so it can't re-open the box.\nwindow.clearTimeout(this.suggestTimer);this.suggestToken++;if(this.suggestionsEl.hidden)return;this.suggestionsEl.hidden=true;this.suggestionsEl.replaceChildren();this.activeSuggestion=-1;this.layout.style.minHeight='';this.searchInput.setAttribute('aria-expanded','false');this.searchInput.removeAttribute('aria-activedescendant');}},{key:\"applySuggestion\",value:function applySuggestion(value){if(!value)return;this.searchInput.value=value;this.syncSearchClearVisibility();this.query=value;this.firstResult=0;this.pendingSearchEvent='suggestion';this.addRecentSearch(value);this.hideSuggestions();this.syncUrl(true);void this.performSearch(false);}/** Show or hide the keyboard-focusable clear control beside the search input. */},{key:\"syncSearchClearVisibility\",value:function syncSearchClearVisibility(){this.searchClearBtn.hidden=this.searchInput.value.length===0;}/** Clear the search input; re-run search when a query was already submitted. */},{key:\"clearSearchInput\",value:function clearSearchInput(){this.searchInput.value='';this.syncSearchClearVisibility();this.hideSuggestions();if(this.query){this.query='';this.firstResult=0;this.syncUrl(true);void this.performSearch(false);}this.searchInput.focus();}
1/** Submit whatever is currently typed in the search box (on Enter). */},{key:\"submitQuery\",value:function submitQuery(){var q=this.searchInput.value.trim();this.addRecentSearch(q);if(q===this.query){this.hideSuggestions();return;}this.query=q;this.firstResult=0;this.pendingSearchEvent='enter';this.hideSuggestions();this.syncUrl(true);void this.performSearch(false);}},{key:\"onSearchKeydown\",value:function onSearchKeydown(e){var _this5=this;var options=Array.from(this.suggestionsEl.querySelectorAll('[data-cs-suggestion]'));if(e.key==='Escape'){this.hideSuggestions();return;}// Prevent page scroll for arrow keys whenever the dropdown is open,\n// regardless of whether options exist yet.\nif((e.key==='ArrowDown'||e.key==='ArrowUp')&&!this.suggestionsEl.hidden){e.preventDefault();this.searchFromSuggestion=true;if(!options.length)return;var dir=e.key==='ArrowDown'?1:-1;this.activeSuggestion=(this.activeSuggestion+dir+options.length)%options.length;options.forEach(function(o,i){return o.classList.toggle('is-active',i===_this5.activeSuggestion);});options[this.activeSuggestion].focus();return;}if(e.key==='Enter'){e.preventDefault();if(this.activeSuggestion>=0&&options[this.activeSuggestion]){this.applySuggestion(options[this.activeSuggestion].dataset.value||'');}else{this.submitQuery();}this.searchInput.blur();}}},{key:\"renderDidYouMean\",value:function renderDidYouMean(correction){if(!correction){this.didYouMeanEl.hidden=true;this.didYouMeanEl.replaceChildren();return;}var line1=document.createElement('p');line1.className='cs__didyoumean-line';line1.append(\"\".concat(this.i18n('i18nDidyoumeanNotFound','We could not find anything for'),\" \"));var original=document.createElement('strong');original.textContent=correction.from;line1.append(original);var line2=document.createElement('p');line2.className='cs__didyoumean-line';line2.append(\"\".concat(this.i18n('i18nDidyoumeanCorrected','Query was automatically corrected to'),\" \"));var corrected=document.createElement('strong');corrected.textContent=correction.to;line2.append(corrected);this.didYouMeanEl.replaceChildren(line1,line2);this.didYouMeanEl.hidden=false;}// ─────────────────────────────────────────────────────────── render ──\n},{key:\"renderResults\",value:function renderResults(){var _this6=this;var isGrid=this.view==='grid';this.grid.hidden=!isGrid;this.listWrap.hidden=isGrid;this.emptyEl.hidden=this.docs.length>0;if(isGrid){var _this$grid;(_this$grid=this.grid).replaceChildren.apply(_this$grid,(0,toConsumableArray/* default */.A)(this.docs.map(function(doc,i){return _this6.buildCard(doc,i);})));}else{var _this$listBody;(_this$listBody=this.listBody).replaceChildren.apply(_this$listBody,(0,toConsumableArray/* default */.A)(this.docs.map(function(doc,i){return _this6.buildRow(doc,i);})));}}/** Move keyboard focus to the first result added by a \"show more\" append. */},{key:\"focusFirstNewResult\",value:function focusFirstNewResult(startIndex){var container=this.view==='grid'?this.grid:this.listBody;var firstNew=container.children[startIndex];firstNew===null||firstNew===void 0||firstNew.focus();}},{key:\"cloneRoot\",value:function cloneRoot(tpl){return tpl.content.firstElementChild.cloneNode(true);}},{key:\"buildCard\",value:function buildCard(doc,index){var card=this.cloneRoot(this.tplCard);var href=doc.ctaTarget||doc.clickUri||'#';card.href=href;if(doc.ctaAriaLabel||doc.title){card.setAttribute('aria-label',doc.ctaAriaLabel||doc.title);}// Customer Card = logo (top) + description (bottom); no thumbnail or CTA.\nvar logo=card.querySelector('[data-cs-logo]');var customer=card.querySelector('[data-cs-customer]');if(logo&&doc.logoImage){logo.src=doc.logoImage;logo.alt=doc.customerName||doc.title;logo.hidden=false;}else if(customer&&doc.customerName){customer.textContent=doc.customerName;customer.hidden=false;}else if(logo){// No logo: keep a fixed-height placeholder at the top so the description\n// stays anchored to the bottom instead of jumping up.\nvar placeholder=document.createElement('span');placeholder.className='cs-card__logo-placeholder';placeholder.setAttribute('aria-hidden','true');logo.insertAdjacentElement('beforebegin',placeholder);}var desc=card.querySelector('[data-cs-desc]');if(desc)desc.textContent=doc.excerpt||doc.title;this.attachClickAnalytics(card,doc,index);return card;}},{key:\"buildRow\",value:function buildRow(doc,index){var row=this.cloneRoot(this.tplRow);row.href=doc.ctaTarget||doc.clickUri||'#';var set=function set(sel,value){var el=row.querySelector(sel);if(el){var text=value||'—';el.textContent=text;// Show the full value on hover when the cell is truncated to one line.\nel.title=text;}};set('[data-cs-company]',doc.customerName||doc.title);set('[data-cs-industry]',doc.industry);set('[data-cs-size]',doc.companySize);
1set('[data-cs-category]',doc.category);this.attachClickAnalytics(row,doc,index);return row;}},{key:\"attachClickAnalytics\",value:function attachClickAnalytics(link,doc,index){link.addEventListener('click',function(e){var uri=doc.ctaTarget||doc.clickUri;var customerName=doc.customerName||doc.title;var headline=doc.excerpt||doc.title;var interactionUrl=uri||(link instanceof HTMLAnchorElement&&link.href?link.href:window.location.href);var rank=index+1;trackOverviewSearchResultClick(customerName,headline,interactionUrl);if(uri){(0,coveo_helpers/* logCoveoClickForUri */.oC)(uri,doc.title,doc.source,rank);}if(!uri||!(link instanceof HTMLAnchorElement)||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey){return;}var href=link.href;if(!href)return;e.preventDefault();if(link.target==='_blank'){var newWin=window.open('about:blank','_blank');if(newWin){newWin.opener=null;window.setTimeout(function(){newWin.location.href=href;},RESULT_CLICK_NAV_DELAY_MS);}return;}window.setTimeout(function(){window.location.href=href;},RESULT_CLICK_NAV_DELAY_MS);});}},{key:\"renderFacets\",value:function renderFacets(){var _this7=this,_this$facetsContainer;// Expand the first facet group on first paint only.\nif(!this.defaultFacetSeeded&&this.facetsData.length){this.expandedFacets.add(this.facetsData[0].field);this.defaultFacetSeeded=true;}var groups=this.facetsData.map(function(group){var groupEl=_this7.cloneRoot(_this7.tplFacet);var label=groupEl.querySelector('[data-cs-facet-label]');if(label)label.textContent=group.label;var toggle=groupEl.querySelector('[data-cs-facet-toggle]');var values=groupEl.querySelector('[data-cs-facet-values]');// Link toggle → values list for screen readers.\nvar valuesId=\"cs-facet-values-\".concat(group.field.replace(/\\W/g,'-'));if(values)values.id=valuesId;if(toggle)toggle.setAttribute('aria-controls',valuesId);// Restore expanded/collapsed state so re-rendering after a facet\n// selection doesn't collapse a group the user had opened.\nvar isExpanded=_this7.expandedFacets.has(group.field);toggle===null||toggle===void 0||toggle.setAttribute('aria-expanded',String(isExpanded));groupEl.classList.toggle('is-collapsed',!isExpanded);var updateFacetToggleLabel=function updateFacetToggleLabel(expanded){if(!toggle)return;var key=expanded?'i18nCollapseFacet':'i18nExpandFacet';var fallback=expanded?'Collapse the {0} facet':'Expand the {0} facet';toggle.setAttribute('aria-label',_this7.i18n(key,fallback,group.label));};updateFacetToggleLabel(isExpanded);toggle===null||toggle===void 0||toggle.addEventListener('click',function(){var expanded=toggle.getAttribute('aria-expanded')==='true';toggle.setAttribute('aria-expanded',String(!expanded));groupEl.classList.toggle('is-collapsed',expanded);if(expanded)_this7.expandedFacets[\"delete\"](group.field);else _this7.expandedFacets.add(group.field);updateFacetToggleLabel(!expanded);});group.values.forEach(function(value){var item=_this7.cloneRoot(_this7.tplFacetValue);var input=item.querySelector('[data-cs-facet-input]');var valueLabel=item.querySelector('[data-cs-facet-value-label]');if(valueLabel)valueLabel.textContent=value.label;if(input){input.dataset.facetField=group.field;input.dataset.facetValue=value.value;input.checked=value.selected;var countStr=String(value.count);var countLabel=value.count===1?_this7.i18n('i18nFilterResult','{0}; {1} result',value.label,countStr):_this7.i18n('i18nFilterResults','{0}; {1} results',value.label,countStr);input.setAttribute('aria-label',_this7.i18n('i18nInclusionFilter','Inclusion filter on {0}',countLabel));input.addEventListener('change',function(){return _this7.onFacetChange(group.field,value.value,input.checked);});}values===null||values===void 0||values.appendChild(item);});return groupEl;});(_this$facetsContainer=this.facetsContainer).replaceChildren.apply(_this$facetsContainer,(0,toConsumableArray/* default */.A)(groups));}},{key:\"onFacetChange\",value:function onFacetChange(field,value,checked){var current=this.selected[field]||[];if(checked){if(!current.includes(value))this.selected[field]=[].concat((0,toConsumableArray/* default */.A)(current),[value]);}else{var next=current.filter(function(v){return v!==value;});if(next.length)this.selected[field]=next;else delete this.selected[field];}this.lastFocusedFacet={field:field,value:value};this.firstResult=0;this.syncUrl(true);void this.performSearch(false);}},{key:\"restoreChipFocus\",value:function restoreChipFocus(){var _this8=this;if(this.pendingChipFocusIndex===null)return;var index=this.pendingChipFocusIndex;this.pendingChipFocusIndex=null;var chips=Array.from(this.tagsList.querySelectorAll('[data-cs-chip]'));// Announce updated result count via the hidden live region.\nvar totalLabel=this.total.toLocaleStr
1ing();this.srAnnounce.textContent=this.total===1?this.i18n('i18nShowingOne','Showing {0} result',totalLabel):this.i18n('i18nShowingMany','Showing {0} results',totalLabel);window.setTimeout(function(){_this8.srAnnounce.textContent='';},1000);if(chips.length===0){var _this$root$querySelec;// All filters cleared — return focus to the filter button.\n(_this$root$querySelec=this.root.querySelector('[data-cs-filter-open]'))===null||_this$root$querySelec===void 0||_this$root$querySelec.focus();}else{var _chips$index;// Focus the chip at the same position, or the last one if removed was last.\n((_chips$index=chips[index])!==null&&_chips$index!==void 0?_chips$index:chips[chips.length-1]).focus();}}},{key:\"restoreFacetFocus\",value:function restoreFacetFocus(){var _Array$from$find;if(!this.lastFocusedFacet)return;var _this$lastFocusedFace=this.lastFocusedFacet,field=_this$lastFocusedFace.field,value=_this$lastFocusedFace.value;var input=(_Array$from$find=Array.from(this.facetsContainer.querySelectorAll('[data-facet-field]')).find(function(el){return el.dataset.facetField===field&&el.dataset.facetValue===value;}))!==null&&_Array$from$find!==void 0?_Array$from$find:null;input===null||input===void 0||input.focus();this.lastFocusedFacet=null;}// ─────────────────────────────────────────────── deep linking (URL) ──\n/**\n   * Serialize the current query / sort / facet selection into the URL hash,\n   * mirroring Coveo's deep-link format (`q`, `sortCriteria`, `f-<field>`).\n   * `push` adds a history entry (explicit actions: facet/sort/clear); otherwise\n   * the current entry is replaced (e.g. while typing in the search box).\n   */},{key:\"syncUrl\",value:function syncUrl(push){var params=[];if(this.query)params.push(\"q=\".concat(encodeURIComponent(this.query)));if(this.sort&&this.sort!=='relevancy'){params.push(\"sortCriteria=\".concat(encodeURIComponent(this.sort)));}Object.entries(this.selected).forEach(function(_ref){var _ref2=(0,slicedToArray/* default */.A)(_ref,2),field=_ref2[0],values=_ref2[1];if(values.length){var encoded=values.map(function(v){return encodeURIComponent(v);}).join(',');
1params.push(\"f-\".concat(field,\"=\").concat(encoded));}});var hash=params.length?\"#\".concat(params.join('&')):'';var url=\"\".concat(window.location.pathname).concat(window.location.search).concat(hash);var current=\"\".concat(window.location.pathname).concat(window.location.search).concat(window.location.hash);if(url===current)return;if(push)History.prototype.pushState.call(history,null,'',url);else History.prototype.replaceState.call(history,null,'',url);}/** Read query / sort / facet selection back out of the URL hash. */},{key:\"applyStateFromUrl\",value:function applyStateFromUrl(){var _this9=this;this.query='';this.sort='relevancy';Object.keys(this.selected).forEach(function(k){return delete _this9.selected[k];});var hash=window.location.hash.replace(/^#/,'');if(!hash)return;hash.split('&').forEach(function(pair){var eq=pair.indexOf('=');if(eq<0)return;var key=pair.slice(0,eq);var raw=pair.slice(eq+1);if(key==='q'){_this9.query=decodeURIComponent(raw);}else if(key==='sortCriteria'){_this9.sort=decodeURIComponent(raw);}else if(key.startsWith('f-')){var field=key.slice(2);var values=raw.split(',').map(function(v){return decodeURIComponent(v);}).filter(Boolean);if(values.length)_this9.selected[field]=values;}});}/** Reflect the restored state onto the search box and sort dropdown UI. */},{key:\"syncControlsFromState\",value:function syncControlsFromState(){var _this0=this;this.searchInput.value=this.query;this.syncSearchClearVisibility();var matched=null;this.sortMenu.querySelectorAll('[data-cs-sort-option]').forEach(function(o){var isMatch=(o.dataset.value||'relevancy')===_this0.sort;o.setAttribute('aria-selected',String(isMatch));if(isMatch)matched=o;});if(matched){this.sortValueEl.textContent=(matched.textContent||'').trim();}}/** Resolve a facet value id to its display label from the current facet data. */},{key:\"facetValueLabel\",value:function facetValueLabel(field,value){var group=this.facetsData.find(function(g){return g.field===field;});var match=group===null||group===void 0?void 0:group.values.find(function(v){return v.value===value;});return(match===null||match===void 0?void 0:match.label)||value;}},{key:\"renderChips\",value:function renderChips(){var _this1=this,_this$tagsList;var chips=[];Object.entries(this.selected).forEach(function(_ref3){var _ref4=(0,slicedToArray/* default */.A)(_ref3,2),field=_ref4[0],values=_ref4[1];values.forEach(function(value){var chip=_this1.cloneRoot(_this1.tplChip);var filterName=_this1.facetValueLabel(field,value);var label=chip.querySelector('[data-cs-chip-label]');if(label)label.textContent=filterName;chip.setAttribute('aria-label',_this1.i18n('i18nRemoveFilter','Remove filter on {0}',filterName));chip.addEventListener('click',function(){var allChips=Array.from(_this1.tagsList.querySelectorAll('[data-cs-chip]'));_this1.pendingChipFocusIndex=allChips.indexOf(chip);_this1.onFacetChange(field,value,false);});chips.push(chip);});});(_this$tagsList=this.tagsList).replaceChildren.apply(_this$tagsList,chips);// Keep \"Clear All\" inline right after the chips (moving the node preserves\n// its click listener; it's re-appended on every render).\nthis.tagsList.appendChild(this.clearAllBtn);this.tags.hidden=chips.length===0;}},{key:\"updateStatus\",value:function updateStatus(){var loaded=this.docs.length;var totalLabel=this.total.toLocaleString();this.countEl.textContent=this.total===1?this.i18n('i18nShowingOne','Showing {0} result',totalLabel):this.i18n('i18nShowingMany','Showing {0} results',totalLabel);var hasResults=this.total>0;this.footer.hidden=!hasResults;if(hasResults){this.showingEl.textContent=this.i18n('i18nShowingOf','Showing {0} of {1} results',loaded.toLocaleString(),totalLabel);var pct=Math.min(100,Math.round(loaded/this.total*100));this.progressEl.style.width=\"\".concat(pct,\"%\");this.loadMoreBtn.hidden=loaded>=this.total;}}/**\n   * Resolve an HTL-translated string from a root data-* attribute, substituting\n   * `{0}`, `{1}`, … placeholders. Falls back to `fallback` when the attribute\n   * is missing (e.g. author preview without dictionary).\n   */},{key:\"i18n\",value:function i18n(key,fallback){var template=this.root.dataset[key]||fallback;for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return args.reduce(function(text,arg,index){return text.split(\"{\".concat(index,\"}\")).join(arg);},template);}}]);}();var CustomerStories=/*#__PURE__*/function(){function CustomerStories(){(0,classCallCheck/* default */.A)(this,CustomerStories);}return (0,createClass/* default */.A)(CustomerStories,[{key:\"run\",value:function run(){if(document.body.classList.contains('is-editor'))return;document.querySelectorAll('.cmp-customer-stories').forEach(function(el){if(el.dataset.csReady==='true')return;el.dataset.csReady='true';try{new CustomerStoriesInstance(el).init();}catch(error){// eslint-disable-next-line no-console\nconsole.error('Customer Stories init failed:',error);}});}}]);}();\n\n//# sourceURL=webpack://ui.apps/./src/main/content/jcr_root/apps/atlas/components/content/redesign/customer_stories/customer_stories.ts_+_2_modules?\n}")}}]);

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