@constructor-io/constructorio-ui-quizzes 1.12.6 → 1.13.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.
@@ -34,12 +34,12 @@ Error generating stack: `+o.message+`
34
34
  --primary-color-h: ${e["--primary-color-h"]};
35
35
  --primary-color-s: ${e["--primary-color-s"]};
36
36
  --primary-color-l: ${e["--primary-color-l"]};
37
- }`}function xh(){var r;const{state:e,getOpenTextInputProps:t}=j.useContext(Ee);let n;if(e!=null&&e.quiz.currentQuestion&&(n=e==null?void 0:e.quiz.currentQuestion.next_question),n){const i=(r=n==null?void 0:n.images)==null?void 0:r.primary_url;return T.createElement("div",{className:`
37
+ }`}function xh(e,t,n){return!e.length||!t||!n?"":[e.slice(0,-1).join(t),n,e.at(-1)].join("")}function Rh(){var r;const{state:e,getOpenTextInputProps:t}=j.useContext(Ee);let n;if(e!=null&&e.quiz.currentQuestion&&(n=e==null?void 0:e.quiz.currentQuestion.next_question),n){const i=(r=n==null?void 0:n.images)==null?void 0:r.primary_url;return T.createElement("div",{className:`
38
38
  cio-container${i?"--with-image":""}
39
39
  cio-open-text-question-container${i?"--with-image":""}
40
- `,"data-question-key":n.key},i?Ki(n.images,"cio-question-image-container"):"",T.createElement("div",{className:"cio-question-content"},T.createElement(Bl,{title:n.title}),T.createElement(Ul,{description:n.description}),t&&T.createElement("input",{...t()})))}return null}function Rh(){var r;const{state:e}=j.useContext(Ee);let t;e!=null&&e.quiz.currentQuestion&&(t=e==null?void 0:e.quiz.currentQuestion.next_question);const n=(r=t==null?void 0:t.images)==null?void 0:r.primary_url;return t?T.createElement("div",{className:`
40
+ `,"data-question-key":n.key},i?Ki(n.images,"cio-question-image-container"):"",T.createElement("div",{className:"cio-question-content"},T.createElement(Bl,{title:n.title}),T.createElement(Ul,{description:n.description}),t&&T.createElement("input",{...t()})))}return null}function zh(){var r;const{state:e}=j.useContext(Ee);let t;e!=null&&e.quiz.currentQuestion&&(t=e==null?void 0:e.quiz.currentQuestion.next_question);const n=(r=t==null?void 0:t.images)==null?void 0:r.primary_url;return t?T.createElement("div",{className:`
41
41
  cio-container${n?"--with-image":""}
42
42
  cio-cover-question-container${n?"--with-image":""}
43
- `,"data-question-key":t.key},n?Ki(t.images,"cio-question-image-container"):"",T.createElement("div",{className:"cio-question-content"},T.createElement(Bl,{title:t==null?void 0:t.title}),T.createElement(Ul,{description:t.description}))):null}function zh(){var o;const{state:e,getSelectInputProps:t}=j.useContext(Ee);let n,r=!1,i;return e!=null&&e.quiz.currentQuestion&&(n=e.quiz.currentQuestion.next_question,r=n==null?void 0:n.options.some(s=>s.images),i=(n==null?void 0:n.type)===Q.MultipleSelect&&"Select one or more options"),n?T.createElement("div",{className:"cio-select-question-container","data-question-key":n.key},T.createElement("div",{className:"cio-select-question-text"},T.createElement(Bl,{title:n.title}),n!=null&&n.description?T.createElement(Ul,{description:n.description}):""),i&&T.createElement("div",{className:"cio-select-question-instructions"},i),T.createElement("div",{className:`${r?"cio-question-options-container":"cio-question-options-container-text-only"}`},(o=n==null?void 0:n.options)==null?void 0:o.map(s=>t&&T.createElement("div",{...t(s)},s.images?Ki(s.images,"cio-question-option-image"):"",T.createElement("div",{className:"cio-question-option-value"},s==null?void 0:s.value))))):null}function Nh(){var r;const{state:e}=j.useContext(Ee),t=(r=e==null?void 0:e.quiz.currentQuestion)==null?void 0:r.next_question,n=Df(t==null?void 0:t.type);return t?T.createElement(T.Fragment,null,n.isOpenQuestion&&T.createElement(xh,{key:t==null?void 0:t.id}),n.isCoverQuestion&&T.createElement(Rh,{key:t==null?void 0:t.id}),n.isSelectQuestion&&T.createElement(zh,{key:t==null?void 0:t.id})):null}function Th(){return T.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M10.5026 6.00201H11.7529C12.0845 6.00201 12.4025 6.13374 12.637 6.36821C12.8714 6.60268 13.0032 6.92069 13.0032 7.25229V13.2536C13.0032 13.5852 12.8714 13.9032 12.637 14.1377C12.4025 14.3721 12.0845 14.5039 11.7529 14.5039H4.25125C3.91966 14.5039 3.60164 14.3721 3.36717 14.1377C3.1327 13.9032 3.00098 13.5852 3.00098 13.2536V7.25229C3.00098 6.92069 3.1327 6.60268 3.36717 6.36821C3.60164 6.13374 3.91966 6.00201 4.25125 6.00201H5.50152",stroke:"#101010",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M10.5026 4.00116L8.00201 1.50061L5.50146 4.00116",stroke:"#101010",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M8.00146 10.0337V1.50061",stroke:"#101010",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"}))}function qh(e){const{shareText:t="Share Results",disabled:n,onClick:r,...i}=e,{getShareResultsButtonProps:o}=j.useContext(Ee);return o?T.createElement("button",{...i,...o(),type:"button",onClick:r},T.createElement(Th,null),T.createElement("span",null,t)):null}function Ph({onShare:e,numberOfResults:t,showShareButton:n}){var o;const{state:r}=j.useContext(Ee),i=((o=r==null?void 0:r.quiz)==null?void 0:o.matchedOptions)||[];return T.createElement("div",{className:"cio-results-filter-and-redo-container cio-results-button-group"},T.createElement("div",{className:"cio-results-filter-container"},!!i.length&&T.createElement("p",{className:"cio-results-explanation"},"Based on your answers ",T.createElement("span",null,i.join(", "))," we recommend these matches.")),T.createElement("div",{className:"cio-results-number-and-share-button-group"},t," ",t===1?"result":"results",n&&T.createElement(qh,{onClick:e})))}function Pi(e){const{propsGetters:t,ctaText:n="Continue",disabled:r,className:i="cio-button-container",...o}=e;return T.createElement("div",{className:`${i||""}`},t&&T.createElement("button",{...o,...t()},n||"Continue"))}function Ih(){const{getResetQuizButtonProps:e}=j.useContext(Ee);return T.createElement("div",{className:"cio-zero-results"},T.createElement("h3",{className:"cio-zero-results-subtitle"},"Sorry, we couldn’t find products that perfectly match your preferences."),T.createElement(Pi,{ctaText:"Retake Quiz",propsGetters:e}))}function Oh(e){const{item:t,price:n}=e,{getAddToCartButtonProps:r}=j.useContext(Ee);return r?T.createElement("button",{...r(t,n)},"Add to Cart"):null}function Lh(e){const{item:t,price:n}=e,{getAddToFavoritesButtonProps:r}=j.useContext(Ee);return r?T.createElement("button",{...r(t,n)},T.createElement("svg",{width:"21",height:"21",viewBox:"0 0 24 24",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},T.createElement("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"}))):null}function Ah(e){var p,C,z,_;const{result:t,salePriceKey:n,regularPriceKey:r,resultPosition:i,ratingCountKey:o,ratingScoreKey:s,renderResultCardPriceDetails:l}=e,{customAddToFavoritesCallback:u,customClickItemCallback:d,getQuizResultButtonProps:m,getQuizResultLinkProps:w}=j.useContext(Ee),S=n&&((p=t==null?void 0:t.data)==null?void 0:p[n]),E=r&&((C=t==null?void 0:t.data)==null?void 0:C[r]),y=o&&((z=t==null?void 0:t.data)==null?void 0:z[o]),a=s&&((_=t==null?void 0:t.data)==null?void 0:_[s]),h=()=>{var g;return T.createElement(T.Fragment,null,T.createElement("div",{className:"cio-result-card-image"},T.createElement("img",{src:(g=t.data)==null?void 0:g.image_url,alt:"product"})),T.createElement("div",{className:"cio-result-card-text"},T.createElement("p",{className:"cio-result-card-title"},t.value),T.createElement("div",{className:"cio-result-card-details"},T.createElement("div",{className:"cio-result-card-rating"},a&&T.createElement("span",{className:"cio-result-card-rating-score"},Array(Number(a)).fill("★"),Array(5-Number(a)).fill("☆")),y&&T.createElement("span",{className:"cio-result-card-rating-count"},"(",y,")")),l?l(t):T.createElement("div",{className:"cio-result-card-prices"},S&&T.createElement("span",{className:"cio-result-card-sale-price"},"$",S),E&&T.createElement("span",{className:`cio-result-card-regular-price${S?"--strike-through":""}`},"$",E)))))},f=()=>m&&T.createElement("div",{...m({result:t,position:i,type:"button"})},h()),c=()=>w&&T.createElement("a",{className:"cio-result-card-anchor",rel:"noreferrer",target:"_blank",...w({result:t,position:i,type:"link"})},h());return T.createElement("div",{className:"cio-result-card"},u&&T.createElement(Lh,{item:t,price:S||E}),d?f():c(),T.createElement(Oh,{item:t,price:S||E}))}function Bh(e){var l,u,d,m;const{resultCardSalePriceKey:t,resultCardRegularPriceKey:n,resultCardRatingCountKey:r,resultCardRatingScoreKey:i,renderResultCardPriceDetails:o}=e,{state:s}=j.useContext(Ee);return T.createElement("div",{className:"cio-results"},(m=(d=(u=(l=s==null?void 0:s.quiz)==null?void 0:l.results)==null?void 0:u.response)==null?void 0:d.results)==null?void 0:m.map((w,S)=>{var E;return T.createElement(Ah,{result:w,key:(E=w.data)==null?void 0:E.id,salePriceKey:t,regularPriceKey:n,ratingCountKey:r,ratingScoreKey:i,renderResultCardPriceDetails:o,resultPosition:S+1})}))}function Hf(){return T.createElement("div",{className:"cio-spinner"},T.createElement("div",null),T.createElement("div",null),T.createElement("div",null),T.createElement("div",null))}function Uh({resultsConfig:e}){var i,o;let t="",n="";return e===null&&(t="Here are your results"),(i=e==null?void 0:e.desktop.title)!=null&&i.is_active&&(t=e.desktop.title.text??""),(o=e==null?void 0:e.desktop.description)!=null&&o.is_active&&(n=e.desktop.description.text??""),!!(t||n)?T.createElement("div",{className:"cio-results-title-container"},T.createElement("h1",{className:"cio-results-title"},t),T.createElement("p",{className:"cio-results-description"},n)):null}function Fh(){return T.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("g",{clipPath:"url(#clip0_7495_177230)"},T.createElement("path",{d:"M0.667969 2.66699V6.66699H4.66797",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M15.332 13.333V9.33301H11.332",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M13.6613 6.00038C13.3232 5.0449 12.7485 4.19064 11.991 3.51732C11.2334 2.844 10.3177 2.37355 9.32911 2.14988C8.34056 1.92621 7.31147 1.9566 6.33784 2.23823C5.36422 2.51985 4.4778 3.04352 3.7613 3.76038L0.667969 6.66704M15.3346 9.33371L12.2413 12.2404C11.5248 12.9572 10.6384 13.4809 9.66476 13.7625C8.69114 14.0441 7.66204 14.0745 6.67349 13.8509C5.68495 13.6272 4.76917 13.1568 4.01161 12.4834C3.25406 11.8101 2.67941 10.9559 2.3413 10.0004",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"})),T.createElement("defs",null,T.createElement("clipPath",{id:"clip0_7495_177230"},T.createElement("rect",{width:"16",height:"16",fill:"white"}))))}function Mh(e){const{redoText:t="Retake Quiz",disabled:n,...r}=e,{getResetQuizButtonProps:i}=j.useContext(Ee);return i?T.createElement("button",{...r,...i("secondary")},T.createElement(Fh,null),T.createElement("span",null,t)):null}function jh(e){var E,y,a;const{resultCardOptions:t,onShare:n,resultsPageOptions:r}=e,{state:i}=j.useContext(Ee),{resultCardSalePriceKey:o,resultCardRegularPriceKey:s,resultCardRatingCountKey:l,resultCardRatingScoreKey:u,renderResultCardPriceDetails:d}=t||{},m=(a=(y=(E=i==null?void 0:i.quiz.results)==null?void 0:E.response)==null?void 0:y.results)==null?void 0:a.length,w=i==null?void 0:i.quiz.resultsConfig,S=!m;return i!=null&&i.quiz.results?T.createElement("div",{className:"cio-results-container"},!S&&T.createElement(Uh,{resultsConfig:w}),!S&&T.createElement(Ph,{numberOfResults:m,onShare:n,showShareButton:!!(r!=null&&r.showShareResultsButton)}),!S&&T.createElement(Bh,{resultCardSalePriceKey:o,resultCardRegularPriceKey:s,resultCardRatingCountKey:l,resultCardRatingScoreKey:u,renderResultCardPriceDetails:d}),S&&T.createElement(Ih,null),!S&&T.createElement("div",{className:"cio-redo-button-container"},T.createElement(Mh,null))):T.createElement("div",{className:"cio-results-container"},T.createElement(Hf,null))}function Dh(){const{getPreviousQuestionButtonProps:e}=j.useContext(Ee);return e?e&&T.createElement("button",{...e()},T.createElement("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M6.06313 1.06268L0.964522 5.43176C0.882383 5.50218 0.816449 5.58954 0.771245 5.68785C0.726041 5.78615 0.702637 5.89306 0.702637 6.00126C0.702637 6.10946 0.726041 6.21637 0.771245 6.31467C0.816449 6.41297 0.882383 6.50033 0.964522 6.57076L6.06313 10.9398C6.5498 11.3568 7.30153 11.0111 7.30153 10.3703V1.63093C7.30153 0.990168 6.5498 0.644468 6.06313 1.06268Z",fill:"currentColor"}))):null}function Hh(e){const{propsGetters:t,skipQuestionButtonText:n,className:r="cio-button-container",...i}=e,o=n||"Skip";return T.createElement("div",{className:`${r||""}`},t&&T.createElement("button",{...i,...t(),title:o},o))}function bh(e){const{ctaButtonText:t,skipQuestionButtonText:n}=e,{getNextQuestionButtonProps:r,getSkipQuestionButtonProps:i}=j.useContext(Ee);return T.createElement("div",{className:"cio-question-buttons-container"},T.createElement(Dh,null),T.createElement("div",{className:"cio-question-buttons-group"},T.createElement(Hh,{skipQuestionButtonText:n,propsGetters:i}),T.createElement(Pi,{ctaText:t,propsGetters:r})))}const Vh="constructorIOQuizState";var gt=(e=>(e.Stale="STALE",e.Loading="LOADING",e.Success="SUCCESS",e.Error="ERROR",e))(gt||{}),bf={exports:{}};(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(bf);var Ye=bf.exports,So={exports:{}},ea;function ft(){return ea||(ea=1,function(e){function t(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(So)),So.exports}var Eo={exports:{}},Co={exports:{}},xo={exports:{}},ta;function Un(){return ta||(ta=1,function(e){function t(n){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(xo)),xo.exports}var Ro={exports:{}},na;function Qh(){return na||(na=1,function(e){var t=Un().default;function n(r,i){if(t(r)!=="object"||r===null)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var s=o.call(r,i||"default");if(t(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Ro)),Ro.exports}var ra;function Vf(){return ra||(ra=1,function(e){var t=Un().default,n=Qh();function r(i){var o=n(i,"string");return t(o)==="symbol"?o:String(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Co)),Co.exports}var ia;function dt(){return ia||(ia=1,function(e){var t=Vf();function n(i,o){for(var s=0;s<o.length;s++){var l=o[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(i,t(l.key),l)}}function r(i,o,s){return o&&n(i.prototype,o),s&&n(i,s),Object.defineProperty(i,"prototype",{writable:!1}),i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Eo)),Eo.exports}function Wh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zo={exports:{}},oa;function Kh(){return oa||(oa=1,function(e){(function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n==null)throw new TypeError("Cannot convert first argument to object");for(var r=Object(n),i=1;i<arguments.length;i++){var o=arguments[i];if(o!=null){o=Object(o);for(var s=Object.keys(Object(o)),l=0,u=s.length;u>l;l++){var d=s[l],m=Object.getOwnPropertyDescriptor(o,d);m!==void 0&&m.enumerable&&(r[d]=o[d])}}}return r}});var t=function(n){var r={user_agent:null,persist:!0,cookie_name_client_id:"ConstructorioID_client_id",cookie_name_session_id:"ConstructorioID_session_id",cookie_name_session_data:"ConstructorioID_session",cookie_domain:null,cookie_secure:null,cookie_samesite:null,cookie_days_to_live:365,local_name_client_id:"_constructorio_search_client_id",local_name_session_id:"_constructorio_search_session_id",local_name_session_data:"_constructorio_search_session",on_node:typeof window>"u",session_is_new:null,new_to_beacon:null,client_id_storage_location:"cookie",session_id_storage_location:"local"};if(Object.assign(this,r,n),!this.client_id)if(!this.on_node&&this.persist){var i;this.client_id_storage_location==="cookie"&&(i=this.get_cookie(this.cookie_name_client_id)),this.client_id_storage_location==="local"&&(i=this.get_local_object(this.local_name_client_id)),this.client_id=i||this.generate_client_id()}else this.client_id=this.generate_client_id();this.session_id||(!this.on_node&&this.persist?this.session_id=this.generate_session_id():this.session_id=1),this.on_node||(this.user_agent=this.user_agent||window&&window.navigator&&window.navigator.userAgent)};t.prototype.set_cookie=function(n,r){if(!this.on_node&&this.persist){var i=new Date(Date.now()+this.cookie_days_to_live*24*60*60*1e3),o=n+"="+r+"; expires="+i.toUTCString()+"; path=/";return this.cookie_domain&&(o+="; domain="+this.cookie_domain),this.cookie_secure&&(o+="; secure"),this.cookie_samesite&&(o+="; samesite="+this.cookie_samesite),document.cookie=o,o}return null},t.prototype.get_cookie=function(n){for(var r=n+"=",i=document.cookie.split(";"),o=0;o<i.length;o++){var s=i[o];try{for(var l=decodeURIComponent(s);l.charAt(0)===" ";)l=l.substring(1);if(l.indexOf(r)===0)return l.substring(r.length,l.length)}catch{}}},t.prototype.delete_cookie=function(n){document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"},t.prototype.generate_client_id=function(){var n;if(!this.on_node){var r=this.get_cookie(this.cookie_name_client_id),i=this.get_local_object(this.local_name_client_id);this.client_id_storage_location==="cookie"&&i&&(n=i,this.set_cookie(this.cookie_name_client_id,n),this.delete_local_object(this.local_name_client_id)),this.client_id_storage_location==="local"&&r&&(n=r,this.set_local_object(this.local_name_client_id,n),this.delete_cookie(this.cookie_name_client_id))}return n||(n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(o){var s=Math.random()*16|0,l=o==="x"?s:s&3|8;return l.toString(16)}),this.client_id_storage_location==="cookie"&&this.set_cookie(this.cookie_name_client_id,n),this.client_id_storage_location==="local"&&this.set_local_object(this.local_name_client_id,n)),n},t.prototype.get_local_object=function(n){var r,i=window&&window.localStorage;if(i&&typeof n=="string")try{r=JSON.parse(i.getItem(n))}catch{r=i.getItem(n)}return r},t.prototype.set_local_object=function(n,r){var i=window&&window.localStorage;if(i&&typeof n=="string"){if(typeof r=="object")try{i.setItem(n,JSON.stringify(r))}catch{}if(typeof r=="string"||typeof r=="number")try{i.setItem(n,r)}catch{}}},t.prototype.delete_local_object=function(n){var r=window&&window.localStorage;if(r&&typeof n=="string")try{r.removeItem(n)}catch{}},t.prototype.generate_session_id=function(){var n=this.get_cookie(this.cookie_name_session_data),r=this.get_local_object(this.local_name_session_data),i=Date.now(),o=1e3*60*30,s;if(this.session_id_storage_location==="local"&&(s=this.get_local_object(this.local_name_session_data),!s&&n&&(s=n,this.delete_cookie(this.cookie_name_session_data))),this.session_id_storage_location==="cookie"){s=this.get_cookie(this.cookie_name_session_data);try{s=JSON.parse(s)}catch{}!s&&r&&(s=r,this.delete_local_object(this.local_name_session_data))}var l=1,u=1;s&&typeof s=="object"&&(u=parseInt(s.sessionId,10)||1,s.lastTime>i-o?l=u:l=u+1),this.session_id=l,this.session_is_new=!(s&&u===l),s&&s.newToBeacon&&(this.new_to_beacon=!0);const d={sessionId:l,lastTime:i};return this.session_is_new&&(d.newToBeacon=!0),this.session_id_storage_location==="local"&&(this.set_local_object(this.local_name_session_id,l),this.set_local_object(this.local_name_session_data,d)),this.session_id_storage_location==="cookie"&&(this.set_cookie(this.cookie_name_session_id,l),this.set_cookie(this.cookie_name_session_data,JSON.stringify(d))),l},typeof Wh<"u"&&(e.exports=t)})()}(zo)),zo.exports}var Wr={exports:{}},sa;function Gh(){return sa||(sa=1,function(e,t){(function(n){function r(i){var o=i&&i.Promise||n.Promise,s=i&&i.XMLHttpRequest||n.XMLHttpRequest;return function(){var l=Object.create(n,{fetch:{value:void 0,writable:!0}});return function(u,d){d(t)}(this,function(u){var d=typeof l<"u"&&l||typeof self<"u"&&self||typeof d<"u"&&d,m={searchParams:"URLSearchParams"in d,iterable:"Symbol"in d&&"iterator"in Symbol,blob:"FileReader"in d&&"Blob"in d&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in d,arrayBuffer:"ArrayBuffer"in d};function w(x){return x&&DataView.prototype.isPrototypeOf(x)}if(m.arrayBuffer)var S=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],E=ArrayBuffer.isView||function(x){return x&&S.indexOf(Object.prototype.toString.call(x))>-1};function y(x){if(typeof x!="string"&&(x=String(x)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(x)||x==="")throw new TypeError("Invalid character in header field name");return x.toLowerCase()}function a(x){return typeof x!="string"&&(x=String(x)),x}function h(x){var R={next:function(){var I=x.shift();return{done:I===void 0,value:I}}};return m.iterable&&(R[Symbol.iterator]=function(){return R}),R}function f(x){this.map={},x instanceof f?x.forEach(function(R,I){this.append(I,R)},this):Array.isArray(x)?x.forEach(function(R){this.append(R[0],R[1])},this):x&&Object.getOwnPropertyNames(x).forEach(function(R){this.append(R,x[R])},this)}f.prototype.append=function(x,R){x=y(x),R=a(R);var I=this.map[x];this.map[x]=I?I+", "+R:R},f.prototype.delete=function(x){delete this.map[y(x)]},f.prototype.get=function(x){return x=y(x),this.has(x)?this.map[x]:null},f.prototype.has=function(x){return this.map.hasOwnProperty(y(x))},f.prototype.set=function(x,R){this.map[y(x)]=a(R)},f.prototype.forEach=function(x,R){for(var I in this.map)this.map.hasOwnProperty(I)&&x.call(R,this.map[I],I,this)},f.prototype.keys=function(){var x=[];return this.forEach(function(R,I){x.push(I)}),h(x)},f.prototype.values=function(){var x=[];return this.forEach(function(R){x.push(R)}),h(x)},f.prototype.entries=function(){var x=[];return this.forEach(function(R,I){x.push([I,R])}),h(x)},m.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function c(x){if(x.bodyUsed)return o.reject(new TypeError("Already read"));x.bodyUsed=!0}function p(x){return new o(function(R,I){x.onload=function(){R(x.result)},x.onerror=function(){I(x.error)}})}function C(x){var R=new FileReader,I=p(R);return R.readAsArrayBuffer(x),I}function z(x){var R=new FileReader,I=p(R);return R.readAsText(x),I}function _(x){for(var R=new Uint8Array(x),I=new Array(R.length),L=0;L<R.length;L++)I[L]=String.fromCharCode(R[L]);return I.join("")}function g(x){if(x.slice)return x.slice(0);var R=new Uint8Array(x.byteLength);return R.set(new Uint8Array(x)),R.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(x){this.bodyUsed=this.bodyUsed,this._bodyInit=x,x?typeof x=="string"?this._bodyText=x:m.blob&&Blob.prototype.isPrototypeOf(x)?this._bodyBlob=x:m.formData&&FormData.prototype.isPrototypeOf(x)?this._bodyFormData=x:m.searchParams&&URLSearchParams.prototype.isPrototypeOf(x)?this._bodyText=x.toString():m.arrayBuffer&&m.blob&&w(x)?(this._bodyArrayBuffer=g(x.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):m.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(x)||E(x))?this._bodyArrayBuffer=g(x):this._bodyText=x=Object.prototype.toString.call(x):this._bodyText="",this.headers.get("content-type")||(typeof x=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):m.searchParams&&URLSearchParams.prototype.isPrototypeOf(x)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},m.blob&&(this.blob=function(){var x=c(this);if(x)return x;if(this._bodyBlob)return o.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return o.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var x=c(this);return x||(ArrayBuffer.isView(this._bodyArrayBuffer)?o.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):o.resolve(this._bodyArrayBuffer))}else return this.blob().then(C)}),this.text=function(){var x=c(this);if(x)return x;if(this._bodyBlob)return z(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(_(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return o.resolve(this._bodyText)},m.formData&&(this.formData=function(){return this.text().then(q)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function k(x){var R=x.toUpperCase();return N.indexOf(R)>-1?R:x}function P(x,R){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R=R||{};var I=R.body;if(x instanceof P){if(x.bodyUsed)throw new TypeError("Already read");this.url=x.url,this.credentials=x.credentials,R.headers||(this.headers=new f(x.headers)),this.method=x.method,this.mode=x.mode,this.signal=x.signal,!I&&x._bodyInit!=null&&(I=x._bodyInit,x.bodyUsed=!0)}else this.url=String(x);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new f(R.headers)),this.method=k(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(I),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var L=/([?&])_=[^&]*/;if(L.test(this.url))this.url=this.url.replace(L,"$1_="+new Date().getTime());else{var F=/\?/;this.url+=(F.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function q(x){var R=new FormData;return x.trim().split("&").forEach(function(I){if(I){var L=I.split("="),F=L.shift().replace(/\+/g," "),U=L.join("=").replace(/\+/g," ");R.append(decodeURIComponent(F),decodeURIComponent(U))}}),R}function O(x){var R=new f,I=x.replace(/\r?\n[\t ]+/g," ");return I.split("\r").map(function(L){return L.indexOf(`
44
- `)===0?L.substr(1,L.length):L}).forEach(function(L){var F=L.split(":"),U=F.shift().trim();if(U){var V=F.join(":").trim();R.append(U,V)}}),R}v.call(P.prototype);function M(x,R){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R||(R={}),this.type="default",this.status=R.status===void 0?200:R.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in R?R.statusText:"",this.headers=new f(R.headers),this.url=R.url||"",this._initBody(x)}v.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},M.error=function(){var x=new M(null,{status:0,statusText:""});return x.type="error",x};var H=[301,302,303,307,308];M.redirect=function(x,R){if(H.indexOf(R)===-1)throw new RangeError("Invalid status code");return new M(null,{status:R,headers:{location:x}})},u.DOMException=d.DOMException;try{new u.DOMException}catch{u.DOMException=function(R,I){this.message=R,this.name=I;var L=Error(R);this.stack=L.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function A(x,R){return new o(function(I,L){var F=new P(x,R);if(F.signal&&F.signal.aborted)return L(new u.DOMException("Aborted","AbortError"));var U=new s;function V(){U.abort()}U.onload=function(){var b={status:U.status,statusText:U.statusText,headers:O(U.getAllResponseHeaders()||"")};b.url="responseURL"in U?U.responseURL:b.headers.get("X-Request-URL");var K="response"in U?U.response:U.responseText;setTimeout(function(){I(new M(K,b))},0)},U.onerror=function(){setTimeout(function(){L(new TypeError("Network request failed"))},0)},U.ontimeout=function(){setTimeout(function(){L(new TypeError("Network request failed"))},0)},U.onabort=function(){setTimeout(function(){L(new u.DOMException("Aborted","AbortError"))},0)};function W(b){try{return b===""&&d.location.href?d.location.href:b}catch{return b}}U.open(F.method,W(F.url),!0),F.credentials==="include"?U.withCredentials=!0:F.credentials==="omit"&&(U.withCredentials=!1),"responseType"in U&&(m.blob?U.responseType="blob":m.arrayBuffer&&F.headers.get("Content-Type")&&F.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(U.responseType="arraybuffer")),R&&typeof R.headers=="object"&&!(R.headers instanceof f)?Object.getOwnPropertyNames(R.headers).forEach(function(b){U.setRequestHeader(b,a(R.headers[b]))}):F.headers.forEach(function(b,K){U.setRequestHeader(K,b)}),F.signal&&(F.signal.addEventListener("abort",V),U.onreadystatechange=function(){U.readyState===4&&F.signal.removeEventListener("abort",V)}),U.send(typeof F._bodyInit>"u"?null:F._bodyInit)})}A.polyfill=!0,d.fetch||(d.fetch=A,d.Headers=f,d.Request=P,d.Response=M),u.Headers=f,u.Request=P,u.Response=M,u.fetch=A,Object.defineProperty(u,"__esModule",{value:!0})}),{fetch:l.fetch,Headers:l.Headers,Request:l.Request,Response:l.Response,DOMException:l.DOMException}}()}e.exports=r})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Jn)}(Wr,Wr.exports)),Wr.exports}var No={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */var la;function Zh(){return la||(la=1,function(e){(function(t){t(typeof DO_NOT_EXPORT_CRC>"u"?e:{})})(function(t){t.version="1.2.2";function n(){for(var v=0,N=new Array(256),k=0;k!=256;++k)v=k,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,N[k]=v;return typeof Int32Array<"u"?new Int32Array(N):N}var r=n();function i(v){var N=0,k=0,P=0,q=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(P=0;P!=256;++P)q[P]=v[P];for(P=0;P!=256;++P)for(k=v[P],N=256+P;N<4096;N+=256)k=q[N]=k>>>8^v[k&255];var O=[];for(P=1;P!=16;++P)O[P-1]=typeof Int32Array<"u"?q.subarray(P*256,P*256+256):q.slice(P*256,P*256+256);return O}var o=i(r),s=o[0],l=o[1],u=o[2],d=o[3],m=o[4],w=o[5],S=o[6],E=o[7],y=o[8],a=o[9],h=o[10],f=o[11],c=o[12],p=o[13],C=o[14];function z(v,N){for(var k=N^-1,P=0,q=v.length;P<q;)k=k>>>8^r[(k^v.charCodeAt(P++))&255];return~k}function _(v,N){for(var k=N^-1,P=v.length-15,q=0;q<P;)k=C[v[q++]^k&255]^p[v[q++]^k>>8&255]^c[v[q++]^k>>16&255]^f[v[q++]^k>>>24]^h[v[q++]]^a[v[q++]]^y[v[q++]]^E[v[q++]]^S[v[q++]]^w[v[q++]]^m[v[q++]]^d[v[q++]]^u[v[q++]]^l[v[q++]]^s[v[q++]]^r[v[q++]];for(P+=15;q<P;)k=k>>>8^r[(k^v[q++])&255];return~k}function g(v,N){for(var k=N^-1,P=0,q=v.length,O=0,M=0;P<q;)O=v.charCodeAt(P++),O<128?k=k>>>8^r[(k^O)&255]:O<2048?(k=k>>>8^r[(k^(192|O>>6&31))&255],k=k>>>8^r[(k^(128|O&63))&255]):O>=55296&&O<57344?(O=(O&1023)+64,M=v.charCodeAt(P++)&1023,k=k>>>8^r[(k^(240|O>>8&7))&255],k=k>>>8^r[(k^(128|O>>2&63))&255],k=k>>>8^r[(k^(128|M>>6&15|(O&3)<<4))&255],k=k>>>8^r[(k^(128|M&63))&255]):(k=k>>>8^r[(k^(224|O>>12&15))&255],k=k>>>8^r[(k^(128|O>>6&63))&255],k=k>>>8^r[(k^(128|O&63))&255]);return~k}t.table=r,t.bstr=z,t.buf=_,t.str=g})}(No)),No}var To,ua;function Fl(){if(ua)return To;ua=1;var e={overflow:{},get:function(i){var o=this.overflow[i];if(o)return o;if(typeof sessionStorage>"u")return null;var s=sessionStorage.getItem(i);if(s)try{return JSON.parse(s)}catch{return s}return null},set:function(i,o){try{sessionStorage.setItem(i,JSON.stringify(o))}catch{this.overflow[i]=o}},remove:function(i){var o;(o=this.overflow)!==null&&o!==void 0&&o[i]&&delete this.overflow[i],typeof sessionStorage<"u"&&sessionStorage.removeItem(i)},key:function(i){var o,s;if(typeof sessionStorage>"u"){var l;return(l=Object.keys(this.overflow))===null||l===void 0?void 0:l[i]}var u=(o=sessionStorage)===null||o===void 0?void 0:o.key(i),d=((s=sessionStorage)===null||s===void 0?void 0:s.length)||0;if(i>=d){var m,w=i-d;return(m=Object.keys(this.overflow))===null||m===void 0?void 0:m[w]}return u},length:function(){var i=Object.keys(this.overflow).length;return typeof sessionStorage>"u"?i:sessionStorage.length+i},clear:function(){this.overflow={},typeof sessionStorage<"u"&&sessionStorage.clear()}},t={overflow:{},get:function(i){var o=this.overflow[i];if(o)return o;if(typeof localStorage>"u")return null;var s=localStorage.getItem(i);if(s)try{return JSON.parse(s)}catch{return s}return null},set:function(i,o){try{localStorage.setItem(i,JSON.stringify(o))}catch{this.overflow[i]=o}},remove:function(i){var o;(o=this.overflow)!==null&&o!==void 0&&o[i]&&delete this.overflow[i],typeof localStorage<"u"&&localStorage.removeItem(i)},key:function(i){var o,s;if(typeof localStorage>"u"){var l;return(l=Object.keys(this.overflow))===null||l===void 0?void 0:l[i]}var u=(o=localStorage)===null||o===void 0?void 0:o.key(i),d=((s=localStorage)===null||s===void 0?void 0:s.length)||0;if(i>=d){var m,w=i-d;return(m=Object.keys(this.overflow))===null||m===void 0?void 0:m[w]}return u},length:function(){var i=Object.keys(this.overflow).length;return typeof localStorage>"u"?i:localStorage.length+i},clear:function(){this.overflow={},typeof localStorage<"u"&&localStorage.clear()}},n={local:t,session:e};return To=n,To}var qo,aa;function ot(){if(aa)return qo;aa=1;var e=Ye,t=e(Un()),n=Zh(),r=Fl(),i="_constructorio_purchase_order_ids",o=[{pattern:/^[\w\-+\\.]+@([\w-]+\.)+[\w-]{2,4}$/,replaceBy:"<email_omitted>"},{pattern:/^(?:\+\d{11,12}|\+\d{1,3}\s\d{3}\s\d{3}\s\d{3,4}|\(\d{3}\)\d{7}|\(\d{3}\)\s\d{3}\s\d{4}|\(\d{3}\)\d{3}-\d{4}|\(\d{3}\)\s\d{3}-\d{4})$/,replaceBy:"<phone_omitted>"},{pattern:/^(?:4[0-9]{15}|(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})$/,replaceBy:"<credit_omitted>"}],s={trimNonBreakingSpaces:function(u){return u.replace(/\s/g," ").trim()},encodeURIComponentRFC3986:function(u){return encodeURIComponent(u).replace(/[!'()*]/g,function(d){return"%".concat(d.charCodeAt(0).toString(16).toUpperCase())})},cleanParams:function(u){var d={};return Object.keys(u).forEach(function(m){var w=u[m];typeof w=="string"?d[m]=s.trimNonBreakingSpaces(w):d[m]=w}),d},throwHttpErrorFromResponse:function(u,d){return d.json().then(function(m){throw u.message=m.message,u.status=d.status,u.statusText=d.statusText,u.url=d.url,u.headers=d.headers,u})},canUseDOM:function(){return!!(typeof window<"u"&&window.document&&window.document.createElement)},addEventListener:function(u,d,m){s.canUseDOM()&&window.addEventListener(u,d,m)},removeEventListener:function(u,d,m){s.canUseDOM()&&window.removeEventListener(u,d,m)},getNavigator:function(){return s.canUseDOM()?window.navigator:{userAgent:"",webdriver:!1}},isNil:function(u){return u==null},getWindowLocation:function(){return s.canUseDOM()?window.location:{}},dispatchEvent:function(u){s.canUseDOM()&&window.dispatchEvent(u)},createCustomEvent:function(u,d){if(s.canUseDOM())try{return new window.CustomEvent(u,{detail:d})}catch{var m=document.createEvent("CustomEvent");return m.initCustomEvent(u,!1,!1,d),m}return null},hasOrderIdRecord:function(u){var d=n.str(u.toString()),m=r.local.get(i);return typeof m=="string"&&(m=JSON.parse(m)),m&&m.includes(d)?!0:null},addOrderIdRecord:function(u){var d=n.str(u.toString()),m=r.local.get(i);if(typeof m=="string"&&(m=JSON.parse(m)),m){if(m.includes(d))return;m.length>=10&&(m=m.slice(-9)),m.push(d)}else m=[d];r.local.set(i,m)},applyNetworkTimeout:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,w=u&&u.networkParameters&&u.networkParameters.timeout,S=d&&d.timeout,E=S||w;typeof E=="number"&&m&&setTimeout(function(){return m.abort()},E)},stringify:function(u,d,m){if(!u)return"";var w=[];return Object.keys(u).forEach(function(S){var E=u[S],y=s.encodeURIComponentRFC3986(S),a;if(E!=null){var h=d?"".concat(d,"%5B").concat(y,"%5D"):y;Array.isArray(E)?a=s.stringify(E,h,"array"):(0,t.default)(E)==="object"?a=s.stringify(E,h,"object"):m==="object"?a="".concat(h,"=").concat(s.encodeURIComponentRFC3986(E)):a="".concat(d||y,"=").concat(s.encodeURIComponentRFC3986(E)),w.push(a)}}),w.join("&")},toSnakeCase:function(u){return u.replace(/[A-Z]/g,function(d){return"_".concat(d.toLowerCase())})},toSnakeCaseKeys:function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,m={};return Object.keys(u).forEach(function(w){var S=s.toSnakeCase(w);m[S]=d&&(0,t.default)(u[w])==="object"&&!Array.isArray(u[w])?s.toSnakeCaseKeys(u[w],d):u[w]}),m},containsPii:function(u,d){var m=u.toLowerCase();return d.test(m)},obfuscatePiiRequest:function(u){var d=u;try{var m,w,S=new URL(u),E=(m=decodeURI(S==null?void 0:S.pathname))===null||m===void 0?void 0:m.split("/"),y=(w=decodeURIComponent(S==null?void 0:S.search))===null||w===void 0?void 0:w.split("&").map(function(a){var h;return a==null||(h=a.split("="))===null||h===void 0?void 0:h[1]});o.forEach(function(a){E.forEach(function(h){s.containsPii(h,a.pattern)&&(d=d.replaceAll(h,a.replaceBy))}),y.forEach(function(h){s.containsPii(h,a.pattern)&&(d=d.replaceAll(h,a.replaceBy))})})}catch{}return d}};return qo=s,qo}var Po,ca;function Fn(){if(ca)return Po;ca=1;var e=Ye,t=e(ft()),n=e(dt()),r=ot(),i=function(){function o(s){var l=this;(0,t.default)(this,o),this.events=[],this.enabled=!(s&&s.enabled===!1),this.waitForBeacon=!(s&&s.waitForBeacon===!1),this.active=this.enabled,this.waitForBeacon&&(this.active=!1,r.canUseDOM()&&(window.ConstructorioAutocomplete||window.ConstructorioBeacon||window.ConstructorioTracker)&&this.enabled&&(this.active=!0,this.dispatchEvents()),r.addEventListener("cio.beacon.loaded",function(){l.enabled&&(l.active=!0,l.dispatchEvents())}))}return(0,n.default)(o,[{key:"queue",value:function(l,u){this.events.push({name:l,data:u}),this.active&&this.dispatchEvents()}},{key:"dispatchEvents",value:function(){for(;this.events.length;){var l=this.events.shift(),u=l.name,d=l.data,m="cio.client.".concat(u);r.dispatchEvent(r.createCustomEvent(m,d))}}}]),o}();return Po=i,Po}var Io,fa;function Yh(){if(fa)return Io;fa=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fn(),i=ot();function o(l,u,d){var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,w=d.apiKey,S=d.version,E=d.serviceUrl,y=d.sessionId,a=d.clientId,h=d.userId,f=d.segments,c=d.testCells,p={c:S};if(p.key=w,p.i=a,p.s=y,!l||typeof l!="string")throw new Error("query is a required parameter of type string");if(c&&Object.keys(c).forEach(function(I){p["ef-".concat(I)]=c[I]}),f&&f.length&&(p.us=f),h&&(p.ui=String(h)),u){var C=u.offset,z=u.page,_=u.resultsPerPage,g=u.filters,v=u.sortBy,N=u.sortOrder,k=u.section,P=u.fmtOptions,q=u.hiddenFields,O=u.hiddenFacets,M=u.variationsMap,H=u.qsParam,A=u.preFilterExpression;i.isNil(C)||(p.offset=C),i.isNil(z)||(p.page=z),i.isNil(_)||(p.num_results_per_page=_),g&&(p.filters=g),v&&(p.sort_by=v),N&&(p.sort_order=N),k&&(p.section=k),P&&(p.fmt_options=P),q&&(p.fmt_options?p.fmt_options.hidden_fields=q:p.fmt_options={hidden_fields:q}),O&&(p.fmt_options?p.fmt_options.hidden_facets=O:p.fmt_options={hidden_facets:O}),M&&(p.variations_map=JSON.stringify(M)),A&&(p.pre_filter_expression=JSON.stringify(A)),H&&(p.qs=JSON.stringify(H))}p._dt=Date.now(),p=i.cleanParams(p);var x=i.stringify(p),R=m?"search/natural_language":"search";return"".concat(E,"/").concat(R,"/").concat(i.encodeURIComponentRFC3986(i.trimNonBreakingSpaces(l)),"?").concat(x)}var s=function(){function l(u){(0,t.default)(this,l),this.options=u||{},this.eventDispatcher=new r(u.eventDispatcher)}return(0,n.default)(l,[{key:"getSearchResults",value:function(d,m){var w=this,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E,y=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,S,h)}try{E=o(d,m,this.options)}catch(f){return Promise.reject(f)}return y(E,{signal:a}).then(function(f){return f.ok?f.json():i.throwHttpErrorFromResponse(new Error,f)}).then(function(f){if(f.response&&f.response.results)return f.result_id&&f.response.results.forEach(function(c){c.result_id=f.result_id}),w.eventDispatcher.queue("search.getSearchResults.completed",f),f;if(f.response&&f.response.redirect)return w.eventDispatcher.queue("search.getSearchResults.completed",f),f;throw new Error("getSearchResults response data is malformed")})}},{key:"getVoiceSearchResults",value:function(d,m){var w=this,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E,y=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,S,h)}try{var f=!0;E=o(d,m,this.options,f)}catch(c){return Promise.reject(c)}return y(E,{signal:a}).then(function(c){return c.ok?c.json():i.throwHttpErrorFromResponse(new Error,c)}).then(function(c){if(c.response&&c.response.results)return c.result_id&&c.response.results.forEach(function(p){p.result_id=c.result_id}),w.eventDispatcher.queue("search.getVoiceSearchResults.completed",c),c;if(c.response&&c.response.redirect)return w.eventDispatcher.queue("search.getVoiceSearchResults.completed",c),c;throw new Error("getVoiceSearchResults response data is malformed")})}}]),l}();return Io=s,Io}var Oo={exports:{}},da;function Qf(){return da||(da=1,function(e){var t=Vf();function n(r,i,o){return i=t(i),i in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Oo)),Oo.exports}var Lo,pa;function Jh(){if(pa)return Lo;pa=1;var e=Ye,t=e(ft()),n=e(dt()),r=e(Qf());function i(y,a){var h=Object.keys(y);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(y);a&&(f=f.filter(function(c){return Object.getOwnPropertyDescriptor(y,c).enumerable})),h.push.apply(h,f)}return h}function o(y){for(var a=1;a<arguments.length;a++){var h=arguments[a]!=null?arguments[a]:{};a%2?i(Object(h),!0).forEach(function(f){(0,r.default)(y,f,h[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(h)):i(Object(h)).forEach(function(f){Object.defineProperty(y,f,Object.getOwnPropertyDescriptor(h,f))})}return y}var s=Fn(),l=ot();function u(y,a){var h=a.apiKey,f=a.version,c=a.sessionId,p=a.clientId,C=a.userId,z=a.segments,_=a.testCells,g={c:f};if(g.key=h,g.i=p,g.s=c,_&&Object.keys(_).forEach(function(F){g["ef-".concat(F)]=_[F]}),z&&z.length&&(g.us=z),C&&(g.ui=String(C)),y){var v=y.page,N=y.offset,k=y.resultsPerPage,P=y.filters,q=y.sortBy,O=y.sortOrder,M=y.section,H=y.fmtOptions,A=y.hiddenFields,x=y.hiddenFacets,R=y.variationsMap,I=y.qsParam,L=y.preFilterExpression;l.isNil(v)||(g.page=v),l.isNil(N)||(g.offset=N),l.isNil(k)||(g.num_results_per_page=k),P&&(g.filters=P),q&&(g.sort_by=q),O&&(g.sort_order=O),M&&(g.section=M),H&&(g.fmt_options=H),A&&(g.fmt_options?g.fmt_options.hidden_fields=A:g.fmt_options={hidden_fields:A}),x&&(g.fmt_options?g.fmt_options.hidden_facets=x:g.fmt_options={hidden_facets:x}),R&&(g.variations_map=JSON.stringify(R)),L&&(g.pre_filter_expression=JSON.stringify(L)),I&&(g.qs=JSON.stringify(I))}return g._dt=Date.now(),g=l.cleanParams(g),g}function d(y,a,h,f){var c=f.serviceUrl;if(!y||typeof y!="string")throw new Error("filterName is a required parameter of type string");if(!a||typeof a!="string")throw new Error("filterValue is a required parameter of type string");var p=u(h,f),C=l.stringify(p);return"".concat(c,"/browse/").concat(l.encodeURIComponentRFC3986(l.trimNonBreakingSpaces(y)),"/").concat(l.encodeURIComponentRFC3986(l.trimNonBreakingSpaces(a)),"?").concat(C)}function m(y,a,h){var f=h.serviceUrl;if(!y||!Array.isArray(y)||!y.length)throw new Error("ids is a required parameter of type array");var c=o(o({},u(a,h)),{},{ids:y}),p=l.stringify(c);return"".concat(f,"/browse/items?").concat(p)}function w(y,a){var h=a.serviceUrl,f=o({},u(y,a));delete f._dt;var c=l.stringify(f);return"".concat(h,"/browse/facets?").concat(c)}function S(y,a,h){var f=h.serviceUrl;if(!y||typeof y!="string")throw new Error("facetName is a required parameter of type string");var c=o({},u(a,h));c.facet_name=y,delete c._dt;var p=l.stringify(c);return"".concat(f,"/browse/facet_options?").concat(p)}var E=function(){function y(a){(0,t.default)(this,y),this.options=a||{},this.eventDispatcher=new s(a.eventDispatcher)}return(0,n.default)(y,[{key:"getBrowseResults",value:function(h,f,c){var p=this,C=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},z,_=this.options.fetch,g;if(typeof AbortController=="function"){var v=new AbortController;g=v&&v.signal,l.applyNetworkTimeout(this.options,C,v)}try{z=d(h,f,c,this.options)}catch(N){return Promise.reject(N)}return _(z,{signal:g}).then(function(N){return N.ok?N.json():l.throwHttpErrorFromResponse(new Error,N)}).then(function(N){if(N.response&&N.response.results)return N.result_id&&N.response.results.forEach(function(k){k.result_id=N.result_id}),p.eventDispatcher.queue("browse.getBrowseResults.completed",N),N;throw new Error("getBrowseResults response data is malformed")})}},{key:"getBrowseResultsForItemIds",value:function(h,f){var c=this,p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C,z=this.options.fetch,_;if(typeof AbortController=="function"){var g=new AbortController;_=g&&g.signal,l.applyNetworkTimeout(this.options,p,g)}try{C=m(h,f,this.options)}catch(v){return Promise.reject(v)}return z(C,{signal:_}).then(function(v){return v.ok?v.json():l.throwHttpErrorFromResponse(new Error,v)}).then(function(v){if(v.response&&v.response.results)return v.result_id&&v.response.results.forEach(function(N){N.result_id=v.result_id}),c.eventDispatcher.queue("browse.getBrowseResultsForItemIds.completed",v),v;throw new Error("getBrowseResultsForItemIds response data is malformed")})}},{key:"getBrowseGroups",value:function(h){var f=this,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=this.options.fetch,C=this.options.serviceUrl,z=u(h,this.options),_;if(typeof AbortController=="function"){var g=new AbortController;_=g&&g.signal,l.applyNetworkTimeout(this.options,c,g)}delete z._dt;var v=l.stringify(z),N="".concat(C,"/browse/groups?").concat(v);return p(N,{signal:_}).then(function(k){return k.ok?k.json():l.throwHttpErrorFromResponse(new Error,k)}).then(function(k){if(k.response&&k.response.groups)return f.eventDispatcher.queue("browse.getBrowseGroups.completed",k),k;throw new Error("getBrowseGroups response data is malformed")})}},{key:"getBrowseFacets",value:function(h,f){var c=this,p,C=this.options.fetch,z;if(typeof AbortController=="function"){var _=new AbortController;z=_&&_.signal,l.applyNetworkTimeout(this.options,f,_)}try{p=w(h,this.options)}catch(g){return Promise.reject(g)}return C(p,{signal:z}).then(function(g){return g.ok?g.json():l.throwHttpErrorFromResponse(new Error,g)}).then(function(g){if(g.response&&g.response.facets)return c.eventDispatcher.queue("browse.getBrowseFacets.completed",g),g;throw new Error("getBrowseFacets response data is malformed")})}},{key:"getBrowseFacetOptions",value:function(h){var f=this,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C,z=this.options.fetch,_;if(typeof AbortController=="function"){var g=new AbortController;_=g&&g.signal,l.applyNetworkTimeout(this.options,p,g)}try{C=S(h,c,this.options)}catch(v){return Promise.reject(v)}return z(C,{signal:_}).then(function(v){return v.ok?v.json():l.throwHttpErrorFromResponse(new Error,v)}).then(function(v){if(v.response&&v.response.facets)return f.eventDispatcher.queue("browse.getBrowseFacetOptions.completed",v),v;throw new Error("getBrowseFacetOptions response data is malformed")})}}]),y}();return Lo=E,Lo}var Ao,ha;function Xh(){if(ha)return Ao;ha=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fn(),i=ot(),o=i.throwHttpErrorFromResponse,s=i.cleanParams,l=i.applyNetworkTimeout,u=i.trimNonBreakingSpaces,d=i.encodeURIComponentRFC3986,m=i.stringify;function w(E,y,a){var h=a.apiKey,f=a.version,c=a.serviceUrl,p=a.sessionId,C=a.clientId,z=a.userId,_=a.segments,g=a.testCells,v={c:f};if(v.key=h,v.i=C,v.s=p,!E||typeof E!="string")throw new Error("query is a required parameter of type string");if(g&&Object.keys(g).forEach(function(x){v["ef-".concat(x)]=g[x]}),_&&_.length&&(v.us=_),z&&(v.ui=String(z)),y){var N=y.numResults,k=y.resultsPerSection,P=y.filters,q=y.filtersPerSection,O=y.hiddenFields,M=y.variationsMap;N&&(v.num_results=N),k&&Object.keys(k).forEach(function(x){v["num_results_".concat(x)]=k[x]}),P&&(v.filters=P),q&&Object.keys(q).forEach(function(x){v["filters[".concat(x,"]")]=q[x]}),O&&(v.fmt_options?v.fmt_options.hidden_fields=O:v.fmt_options={hidden_fields:O}),M&&(v.variations_map=JSON.stringify(M))}v._dt=Date.now(),v=s(v);var H=m(v),A=E.replace(/^\//,"|");return"".concat(c,"/autocomplete/").concat(d(u(A)),"?").concat(H)}var S=function(){function E(y){(0,t.default)(this,E),this.options=y||{},this.eventDispatcher=new r(y.eventDispatcher)}return(0,n.default)(E,[{key:"getAutocompleteResults",value:function(a,h){var f=this,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},p,C=this.options.fetch,z;if(typeof AbortController=="function"){var _=new AbortController;z=_&&_.signal,l(this.options,c,_)}try{p=w(a,h,this.options)}catch(g){return Promise.reject(g)}return C(p,{signal:z}).then(function(g){return g.ok?g.json():o(new Error,g)}).then(function(g){if(g.sections){if(g.result_id){var v=Object.keys(g.sections);v.forEach(function(N){var k=g.sections[N];k.length&&k.forEach(function(P){P.result_id=g.result_id})})}return f.eventDispatcher.queue("autocomplete.getAutocompleteResults.completed",g),g}throw new Error("getAutocompleteResults response data is malformed")})}}]),E}();return Ao=S,Ao}var Bo,va;function $h(){if(va)return Bo;va=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fn(),i=ot();function o(l,u,d){var m=d.apiKey,w=d.version,S=d.serviceUrl,E=d.sessionId,y=d.userId,a=d.clientId,h=d.segments,f={c:w};if(f.key=m,f.i=a,f.s=E,!l||typeof l!="string")throw new Error("podId is a required parameter of type string");if(h&&h.length&&(f.us=h),y&&(f.ui=String(y)),u){var c=u.numResults,p=u.itemIds,C=u.section,z=u.term,_=u.filters,g=u.variationsMap,v=u.hiddenFields;i.isNil(c)||(f.num_results=c),p&&(f.item_id=p),C&&(f.section=C),z&&(f.term=z),_&&(f.filters=_),v&&(f.fmt_options?f.fmt_options.hidden_fields=v:f.fmt_options={hidden_fields:v}),g&&(f.variations_map=JSON.stringify(g))}f=i.cleanParams(f);var N=i.stringify(f);return"".concat(S,"/recommendations/v1/pods/").concat(i.encodeURIComponentRFC3986(i.trimNonBreakingSpaces(l)),"?").concat(N)}var s=function(){function l(u){(0,t.default)(this,l),this.options=u||{},this.eventDispatcher=new r(u.eventDispatcher)}return(0,n.default)(l,[{key:"getRecommendations",value:function(d,m){var w=this,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E,y=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,S,h)}try{E=o(d,m,this.options)}catch(f){return Promise.reject(f)}return y(E,{signal:a}).then(function(f){return f.ok?f.json():i.throwHttpErrorFromResponse(new Error,f)}).then(function(f){if(f.response&&f.response.results)return f.result_id&&f.response.results.forEach(function(c){c.result_id=f.result_id}),w.eventDispatcher.queue("recommendations.getRecommendations.completed",f),f;throw new Error("getRecommendations response data is malformed")})}}]),l}();return Bo=s,Bo}var Kr={exports:{}},ga;function ev(){if(ga)return Kr.exports;ga=1;var e=Ye,t=e(Un()),n=(typeof Reflect>"u"?"undefined":(0,t.default)(Reflect))==="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(g,v,N){return Function.prototype.apply.call(g,v,N)},i;n&&typeof n.ownKeys=="function"?i=n.ownKeys:Object.getOwnPropertySymbols?i=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:i=function(g){return Object.getOwnPropertyNames(g)};function o(_){console&&console.warn&&console.warn(_)}var s=Number.isNaN||function(g){return g!==g};function l(){l.init.call(this)}Kr.exports=l,Kr.exports.once=p,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var u=10;function d(_){if(typeof _!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+(0,t.default)(_))}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(g){if(typeof g!="number"||g<0||s(g))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+g+".");u=g}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||s(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function m(_){return _._maxListeners===void 0?l.defaultMaxListeners:_._maxListeners}l.prototype.getMaxListeners=function(){return m(this)},l.prototype.emit=function(g){for(var v=[],N=1;N<arguments.length;N++)v.push(arguments[N]);var k=g==="error",P=this._events;if(P!==void 0)k=k&&P.error===void 0;else if(!k)return!1;if(k){var q;if(v.length>0&&(q=v[0]),q instanceof Error)throw q;var O=new Error("Unhandled error."+(q?" ("+q.message+")":""));throw O.context=q,O}var M=P[g];if(M===void 0)return!1;if(typeof M=="function")r(M,this,v);else for(var H=M.length,A=h(M,H),N=0;N<H;++N)r(A[N],this,v);return!0};function w(_,g,v,N){var k,P,q;if(d(v),P=_._events,P===void 0?(P=_._events=Object.create(null),_._eventsCount=0):(P.newListener!==void 0&&(_.emit("newListener",g,v.listener?v.listener:v),P=_._events),q=P[g]),q===void 0)q=P[g]=v,++_._eventsCount;else if(typeof q=="function"?q=P[g]=N?[v,q]:[q,v]:N?q.unshift(v):q.push(v),k=m(_),k>0&&q.length>k&&!q.warned){q.warned=!0;var O=new Error("Possible EventEmitter memory leak detected. "+q.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");O.name="MaxListenersExceededWarning",O.emitter=_,O.type=g,O.count=q.length,o(O)}return _}l.prototype.addListener=function(g,v){return w(this,g,v,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(g,v){return w(this,g,v,!0)};function S(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E(_,g,v){var N={fired:!1,wrapFn:void 0,target:_,type:g,listener:v},k=S.bind(N);return k.listener=v,N.wrapFn=k,k}l.prototype.once=function(g,v){return d(v),this.on(g,E(this,g,v)),this},l.prototype.prependOnceListener=function(g,v){return d(v),this.prependListener(g,E(this,g,v)),this},l.prototype.removeListener=function(g,v){var N,k,P,q,O;if(d(v),k=this._events,k===void 0)return this;if(N=k[g],N===void 0)return this;if(N===v||N.listener===v)--this._eventsCount===0?this._events=Object.create(null):(delete k[g],k.removeListener&&this.emit("removeListener",g,N.listener||v));else if(typeof N!="function"){for(P=-1,q=N.length-1;q>=0;q--)if(N[q]===v||N[q].listener===v){O=N[q].listener,P=q;break}if(P<0)return this;P===0?N.shift():f(N,P),N.length===1&&(k[g]=N[0]),k.removeListener!==void 0&&this.emit("removeListener",g,O||v)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(g){var v,N,k;if(N=this._events,N===void 0)return this;if(N.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):N[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete N[g]),this;if(arguments.length===0){var P=Object.keys(N),q;for(k=0;k<P.length;++k)q=P[k],q!=="removeListener"&&this.removeAllListeners(q);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(v=N[g],typeof v=="function")this.removeListener(g,v);else if(v!==void 0)for(k=v.length-1;k>=0;k--)this.removeListener(g,v[k]);return this};function y(_,g,v){var N=_._events;if(N===void 0)return[];var k=N[g];return k===void 0?[]:typeof k=="function"?v?[k.listener||k]:[k]:v?c(k):h(k,k.length)}l.prototype.listeners=function(g){return y(this,g,!0)},l.prototype.rawListeners=function(g){return y(this,g,!1)},l.listenerCount=function(_,g){return typeof _.listenerCount=="function"?_.listenerCount(g):a.call(_,g)},l.prototype.listenerCount=a;function a(_){var g=this._events;if(g!==void 0){var v=g[_];if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}l.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function h(_,g){for(var v=new Array(g),N=0;N<g;++N)v[N]=_[N];return v}function f(_,g){for(;g+1<_.length;g++)_[g]=_[g+1];_.pop()}function c(_){for(var g=new Array(_.length),v=0;v<g.length;++v)g[v]=_[v].listener||_[v];return g}function p(_,g){return new Promise(function(v,N){function k(q){_.removeListener(g,P),N(q)}function P(){typeof _.removeListener=="function"&&_.removeListener("error",k),v([].slice.call(arguments))}z(_,g,P,{once:!0}),g!=="error"&&C(_,k,{once:!0})})}function C(_,g,v){typeof _.on=="function"&&z(_,"error",g,v)}function z(_,g,v,N){if(typeof _.on=="function")N.once?_.once(g,v):_.on(g,v);else if(typeof _.addEventListener=="function")_.addEventListener(g,function k(P){N.once&&_.removeEventListener(g,k),v(P)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+(0,t.default)(_))}return Kr.exports}var Uo,ma;function tv(){return ma||(ma=1,Uo=["Googlebot/","Googlebot-Mobile","Googlebot-Image","Googlebot-News","Googlebot-Video","AdsBot-Google([^-]|$)","AdsBot-Google-Mobile","Feedfetcher-Google","Mediapartners-Google","Mediapartners \\(Googlebot\\)","APIs-Google","bingbot","Slurp","[wW]get","curl","LinkedInBot","Python-urllib","python-requests","libwww","httpunit","nutch","Go-http-client","phpcrawl","msnbot","jyxobot","FAST-WebCrawler","FAST Enterprise Crawler","BIGLOTRON","Teoma","convera","seekbot","Gigabot","Gigablast","exabot","ia_archiver","GingerCrawler","webmon ","HTTrack","grub\\.org","UsineNouvelleCrawler","antibot","netresearchserver","speedy","fluffy","bibnum\\.bnf","findlink","msrbot","panscient","yacybot","AISearchBot","ips-agent","tagoobot","MJ12bot","woriobot","yanga","buzzbot","mlbot","YandexBot","yandex\\.com/bots","purebot","Linguee Bot","CyberPatrol","voilabot","Baiduspider","citeseerxbot","spbot","twengabot","postrank","turnitinbot","scribdbot","page2rss","sitebot","linkdex","Adidxbot","blekkobot","ezooms","dotbot","Mail\\.RU_Bot","discobot","heritrix","findthatfile","europarchive\\.org","NerdByNature\\.Bot","sistrix crawler","Ahrefs(Bot|SiteAudit)","fuelbot","CrunchBot","centurybot9","IndeedBot","mappydata","woobot","ZoominfoBot","PrivacyAwareBot","Multiviewbot","SWIMGBot","Grobbot","eright","Apercite","semanticbot","Aboundex","domaincrawler","wbsearchbot","summify","CCBot","edisterbot","seznambot","ec2linkfinder","gslfbot","aiHitBot","intelium_bot","facebookexternalhit","Yeti","RetrevoPageAnalyzer","lb-spider","Sogou","lssbot","careerbot","wotbox","wocbot","ichiro","DuckDuckBot","lssrocketcrawler","drupact","webcompanycrawler","acoonbot","openindexspider","gnam gnam spider","web-archive-net\\.com\\.bot","backlinkcrawler","coccoc","integromedb","content crawler spider","toplistbot","it2media-domain-crawler","ip-web-crawler\\.com","siteexplorer\\.info","elisabot","proximic","changedetection","arabot","WeSEE:Search","niki-bot","CrystalSemanticsBot","rogerbot","360Spider","psbot","InterfaxScanBot","CC Metadata Scaper","g00g1e\\.net","GrapeshotCrawler","urlappendbot","brainobot","fr-crawler","binlar","SimpleCrawler","Twitterbot","cXensebot","smtbot","bnf\\.fr_bot","A6-Indexer","ADmantX","Facebot","OrangeBot/","memorybot","AdvBot","MegaIndex","SemanticScholarBot","ltx71","nerdybot","xovibot","BUbiNG","Qwantify","archive\\.org_bot","Applebot","TweetmemeBot","crawler4j","findxbot","S[eE][mM]rushBot","yoozBot","lipperhey","Y!J","Domain Re-Animator Bot","AddThis","Screaming Frog SEO Spider","MetaURI","Scrapy","Livelap[bB]ot","OpenHoseBot","CapsuleChecker","collection@infegy\\.com","IstellaBot","DeuSu/","betaBot","Cliqzbot/","MojeekBot/","netEstate NE Crawler","SafeSearch microdata crawler","Gluten Free Crawler/","Sonic","Sysomos","Trove","deadlinkchecker","Slack-ImgProxy","Embedly","RankActiveLinkBot","iskanie","SafeDNSBot","SkypeUriPreview","Veoozbot","Slackbot","redditbot","datagnionbot","Google-Adwords-Instant","adbeat_bot","WhatsApp","contxbot","pinterest","electricmonk","GarlikCrawler","BingPreview/","vebidoobot","FemtosearchBot","Yahoo Link Preview","MetaJobBot","DomainStatsBot","mindUpBot","Daum/","Jugendschutzprogramm-Crawler","Xenu Link Sleuth","Pcore-HTTP","moatbot","KosmioBot","pingdom","PhantomJS","Gowikibot","PiplBot","Discordbot","TelegramBot","Jetslide","newsharecounts","James BOT","Barkrowler","TinEye","SocialRankIOBot","trendictionbot","Ocarinabot","epicbot","Primalbot","DuckDuckGo-Favicons-Bot","GnowitNewsbot","Leikibot","LinkArchiver","YaK/","PaperLiBot","Digg Deeper","dcrawl","Snacktory","AndersPinkBot","Fyrebot","EveryoneSocialBot","Mediatoolkitbot","Luminator-robots","ExtLinksBot","SurveyBot","NING/","okhttp","Nuzzel","omgili","PocketParser","YisouSpider","um-LN","ToutiaoSpider","MuckRack","Jamie's Spider","AHC/","NetcraftSurveyAgent","Laserlikebot","Apache-HttpClient","AppEngine-Google","Jetty","Upflow","Thinklab","Traackr\\.com","Twurly","Mastodon","http_get","DnyzBot","botify","007ac9 Crawler","BehloolBot","BrandVerity","check_http","BDCbot","ZumBot","EZID","ICC-Crawler","ArchiveBot","^LCC ","filterdb\\.iss\\.net/crawler","BLP_bbot","BomboraBot","Buck/","Companybook-Crawler","Genieo","magpie-crawler","MeltwaterNews","Moreover","newspaper/","ScoutJet","(^| )sentry/","StorygizeBot","UptimeRobot","OutclicksBot","seoscanners","Hatena","Google Web Preview","MauiBot","AlphaBot","SBL-BOT","IAS crawler","adscanner","Netvibes","acapbot","Baidu-YunGuanCe","bitlybot","blogmuraBot","Bot\\.AraTurka\\.com","bot-pge\\.chlooe\\.com","BoxcarBot","BTWebClient","ContextAd Bot","Digincore bot","Disqus","Feedly","Fetch/","Fever","Flamingo_SearchEngine","FlipboardProxy","g2reader-bot","imrbot","K7MLWCBot","Kemvibot","Landau-Media-Spider","linkapediabot","vkShare","Siteimprove\\.com","BLEXBot/","DareBoost","ZuperlistBot/","Miniflux/","Feedspotbot/","Diffbot/","SEOkicks","tracemyfile","Nimbostratus-Bot","Bytespider"]),Uo}var Fo,ya;function nv(){if(ya)return Fo;ya=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fl(),i=tv(),o=ot(),s="_constructorio_is_human",l=["scroll","resize","touchmove","mouseover","mousemove","keydown","keypress","keyup","focus"],u=function(){function d(){var m=this;(0,t.default)(this,d),this.isHumanBoolean=this.getIsHumanFromSessionStorage();var w=function S(){m.isHumanBoolean=!0,r.session.set(s,!0),l.forEach(function(E){o.removeEventListener(E,S,!0)})};this.isHumanBoolean||l.forEach(function(S){o.addEventListener(S,w,!0)})}return(0,n.default)(d,[{key:"getIsHumanFromSessionStorage",value:function(){return!!r.session.get(s)||!1}},{key:"isHuman",value:function(){return this.isHumanBoolean||!!r.session.get(s)}},{key:"isBot",value:function(){if(this.getIsHumanFromSessionStorage())return!1;var w=o.getNavigator(),S=w.userAgent,E=w.webdriver,y=new RegExp("(".concat(i.join("|"),")"));return!!S.match(y)||!!E}}]),d}();return Fo=u,Fo}var Mo,wa;function rv(){if(wa)return Mo;wa=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fl(),i=nv(),o=ot(),s=ot(),l=s.obfuscatePiiRequest,u="_constructorio_requests",d=18e4,m=function(){function w(S,E){var y=this;(0,t.default)(this,w),this.options=S,this.eventemitter=E,this.humanity=new i,this.requestPending=!1,this.pageUnloading=!1,this.sendTrackingEvents=!!(S&&S.sendTrackingEvents===!0),o.addEventListener("beforeunload",function(){y.pageUnloading=!0}),this.sendTrackingEvents&&this.send()}return(0,n.default)(w,[{key:"queue",value:function(E){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GET",a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};if(this.sendTrackingEvents&&!this.humanity.isBot()){var f=w.get(),c=l(E);f.push({url:c,method:y,body:a,networkParameters:h}),w.set(f)}}},{key:"sendEvents",value:function(){var E=this,y=this.options.fetch,a=w.get();if((!o.canUseDOM()||this.humanity.isHuman())&&!this.requestPending&&!this.pageUnloading&&a.length){var h,f=a.shift(),c=f,p=c.networkParameters,C,z=this;if(w.set(a),p&&typeof AbortController=="function"){var _=new AbortController;C=_.signal,o.applyNetworkTimeout(this.options,p,_)}if(typeof f=="string"&&(f={url:f,method:"GET"}),f.url){var g=f.url.match(/\?.*_dt=([^&]+)/),v=parseInt(g&&g[1],10),N=+new Date;if(v&&Number.isInteger(v)&&N-v>d){this.sendTrackingEvents=!1,w.remove();return}}f.method==="GET"&&(h=y(f.url,{signal:C})),f.method==="POST"&&(h=y(f.url,{method:f.method,body:JSON.stringify(f.body),mode:"cors",headers:{"Content-Type":"text/plain"},signal:C})),h&&(this.requestPending=!0,h.then(function(k){k.ok?(z.eventemitter&&z.eventemitter.emit("success",{url:f.url,method:f.method,message:"ok"}),E.requestPending=!1,E.send()):k.json().then(function(P){z.eventemitter&&z.eventemitter.emit("error",{url:f.url,method:f.method,message:P&&P.message}),E.requestPending=!1,E.send()}).catch(function(P){z.eventemitter&&z.eventemitter.emit("error",{url:f.url,method:f.method,message:P.type}),E.requestPending=!1,E.send()})}).catch(function(k){z.eventemitter&&z.eventemitter.emit("error",{url:f.url,method:f.method,message:k&&k.toString&&k.toString()}),E.requestPending=!1,E.send()}))}}},{key:"send",value:function(){this.sendTrackingEvents&&(this.options&&this.options.trackingSendDelay===0?this.sendEvents():setTimeout(this.sendEvents.bind(this),this.options&&this.options.trackingSendDelay||250))}}],[{key:"get",value:function(){return r.local.get(u)||[]}},{key:"set",value:function(E){!E||Array.isArray(E)&&E.length===0?w.remove():r.local.set(u,E);var y=w.get();Array.isArray(y)&&y.length!==E.length&&(this.sendTrackingEvents=!1,w.remove())}},{key:"remove",value:function(){r.local.remove(u)}}]),w}();return Mo=m,Mo}var jo,_a;function iv(){if(_a)return jo;_a=1;var e=Ye,t=e(Qf()),n=e(Un()),r=e(ft()),i=e(dt());function o(E,y){var a=Object.keys(E);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(E);y&&(h=h.filter(function(f){return Object.getOwnPropertyDescriptor(E,f).enumerable})),a.push.apply(a,h)}return a}function s(E){for(var y=1;y<arguments.length;y++){var a=arguments[y]!=null?arguments[y]:{};y%2?o(Object(a),!0).forEach(function(h){(0,t.default)(E,h,a[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach(function(h){Object.defineProperty(E,h,Object.getOwnPropertyDescriptor(a,h))})}return E}var l=ev(),u=ot(),d=rv();function m(E,y){var a=y.apiKey,h=y.version,f=y.sessionId,c=y.clientId,p=y.userId,C=y.segments,z=y.testCells,_=y.requestMethod,g=y.beaconMode,v=u.getWindowLocation(),N=v.host,k=v.pathname,P=y.sendReferrerWithTrackingEvents!==!1,q=Object.assign(E);return h&&(q.c=h),c&&(q.i=c),f&&(q.s=f),p&&(q.ui=String(p)),C&&C.length&&(q.us=C),a&&(q.key=a),z&&Object.keys(z).forEach(function(O){q["ef-".concat(O)]=z[O]}),g&&_&&_.match(/POST/i)&&(q.beacon=!0),P&&N&&(q.origin_referrer=N,k&&(q.origin_referrer+=k)),q._dt=Date.now(),q=u.cleanParams(q),q}function w(E,y){return u.stringify(m(E,y))}var S=function(){function E(y){(0,r.default)(this,E),this.options=y||{},this.eventemitter=new l,this.requests=new d(y,this.eventemitter),this.behavioralV2Url="https://ac.cnstrc.com/v2/behavioral_action/"}return(0,i.default)(E,[{key:"trackSessionStartV2",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h="".concat(this.behavioralV2Url,"session_start?");return this.requests.queue("".concat(h).concat(w({},this.options)),"POST",void 0,a),this.requests.send(),!0}},{key:"trackSessionStart",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h="".concat(this.options.serviceUrl,"/behavior?"),f={action:"session_start"};return this.requests.queue("".concat(h).concat(w(f,this.options)),void 0,void 0,a),this.requests.send(),!0}},{key:"trackInputFocusV2",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f="".concat(this.behavioralV2Url,"focus?"),c={},p=h,C=a;(0,n.default)(a)==="object"&&(p=a,C=""),c.user_input=C;var z="POST",_=m(c,s(s({},this.options),{},{requestMethod:z}));return this.requests.queue("".concat(f).concat(w({},this.options)),z,_,p),this.requests.send(),!0}},{key:"trackInputFocus",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h="".concat(this.options.serviceUrl,"/behavior?"),f={action:"focus"};return this.requests.queue("".concat(h).concat(w(f,this.options)),void 0,void 0,a),this.requests.send(),!0}},{key:"trackItemDetailLoad",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/item_detail_load?"),c={},p={},C=a.item_name,z=a.name,_=a.item_id,g=a.customer_id,v=a.customerId,N=v===void 0?g:v,k=a.variation_id,P=a.itemName,q=P===void 0?C||z:P,O=a.itemId,M=O===void 0?_||N:O,H=a.variationId,A=H===void 0?k:H,x=a.url;q&&(p.item_name=q),M&&(p.item_id=M),A&&(p.variation_id=A),x&&(p.url=x);var R="".concat(f).concat(w(c,this.options)),I="POST",L=m(p,s(s({},this.options),{},{requestMethod:I}));return this.requests.queue(R,I,L,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackAutocompleteSelectV2",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.behavioralV2Url,"autocomplete_select?"),p=h.original_query,C=h.originalQuery,z=C===void 0?p:C,_=h.user_input,g=h.userInput,v=g===void 0?z||_:g,N=h.original_section,k=h.section,P=k===void 0?N:k,q=h.tr,O=h.group_id,M=h.groupId,H=M===void 0?O:M,A=h.item_id,x=h.itemId,R=x===void 0?A:x,I=h.variation_id,L=h.variationId,F=L===void 0?I:L,U={},V={user_input:v,tr:q,group_id:H,item_id:R,variation_id:F,item_name:a,section:P};P&&(U.section=P);var W="".concat(c).concat(w(U,this.options)),b="POST",K=m(V,s(s({},this.options),{},{requestMethod:b}));return this.requests.queue(W,b,K,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackAutocompleteSelect",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.options.serviceUrl,"/autocomplete/").concat(u.encodeURIComponentRFC3986(u.trimNonBreakingSpaces(a)),"/select?"),p={},C=h.original_query,z=h.originalQuery,_=z===void 0?C:z,g=h.section,v=h.original_section,N=h.originalSection,k=N===void 0?v:N,P=h.tr,q=h.group_id,O=h.groupId,M=O===void 0?q:O,H=h.display_name,A=h.displayName,x=A===void 0?H:A;return _&&(p.original_query=_),P&&(p.tr=P),(k||g)&&(p.section=k||g),M&&(p.group={group_id:M,display_name:x}),this.requests.queue("".concat(c).concat(w(p,this.options)),void 0,void 0,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchSubmitV2",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.behavioralV2Url,"search_submit?"),p=h.original_query,C=h.originalQuery,z=C===void 0?p:C,_=h.user_input,g=h.userInput,v=g===void 0?z||_:g,N=h.group_id,k=h.groupId,P=k===void 0?N:k,q=h.section,O={},M={user_input:v,search_term:a,section:q};P&&(M.filters={group_id:P}),q&&(O.section=q);var H="".concat(c).concat(w(O,this.options)),A="POST",x=m(M,s(s({},this.options),{},{requestMethod:A}));return this.requests.queue(H,A,x,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchSubmit",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.options.serviceUrl,"/autocomplete/").concat(u.encodeURIComponentRFC3986(u.trimNonBreakingSpaces(a)),"/search?"),p={},C=h.original_query,z=h.originalQuery,_=z===void 0?C:z,g=h.group_id,v=h.groupId,N=v===void 0?g:v,k=h.display_name,P=h.displayName,q=P===void 0?k:P;return _&&(p.original_query=_),N&&(p.group={group_id:N,display_name:q}),this.requests.queue("".concat(c).concat(w(p,this.options)),void 0,void 0,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultsLoadedV2",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.behavioralV2Url,"search_result_load?"),p=h.num_results,C=h.numResults,z=C===void 0?p:C,_=h.result_count,g=h.resultCount,v=g===void 0?z||_:g,N=h.customer_ids,k=h.item_ids,P=h.items,q=P===void 0?N||k:P,O=h.result_page,M=h.resultPage,H=M===void 0?O:M,A=h.result_id,x=h.resultId,R=x===void 0?A:x,I=h.sort_order,L=h.sortOrder,F=L===void 0?I:L,U=h.sort_by,V=h.sortBy,W=V===void 0?U:V,b=h.selected_filters,K=h.selectedFilters,X=K===void 0?b:K,ee=h.url,ue=h.section,ae={},Z;q&&Array.isArray(q)&&q.length!==0&&(Z=q,typeof q[0]=="string"||typeof q[0]=="number"?Z=q.map(function(re){return{item_id:String(re)}}):Z=q.map(function(re){return u.toSnakeCaseKeys(re,!1)})),ue&&(ae.section=ue);var Ne={search_term:a,result_count:v,items:Z,result_page:H,result_id:R,sort_order:F,sort_by:W,selected_filters:X,url:ee,section:ue},de="".concat(c).concat(w(ae,this.options)),we="POST",Je=m(Ne,s(s({},this.options),{},{requestMethod:we}));return this.requests.queue(de,we,Je,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultsLoaded",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.options.serviceUrl,"/behavior?"),p={action:"search-results",term:a},C=h.num_results,z=h.numResults,_=z===void 0?C:z,g=h.customer_ids,v=h.customerIds,N=v===void 0?g:v,k=h.item_ids,P=h.itemIds,q=P===void 0?k:P,O;return u.isNil(_)||(p.num_results=_),q&&Array.isArray(q)?O=q:N&&Array.isArray(N)&&(O=N),O&&Array.isArray(O)&&O.length&&(p.customer_ids=O.slice(0,100).join(",")),this.requests.queue("".concat(c).concat(w(p,this.options)),void 0,void 0,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultClickV2",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.behavioralV2Url,"search_result_click?"),p=h.num_results,C=h.customer_id,z=h.item_id,_=h.itemId,g=_===void 0?C||z:_,v=h.name,N=h.item_name,k=h.itemName,P=k===void 0?v||N:k,q=h.variation_id,O=h.variationId,M=O===void 0?q:O,H=h.result_id,A=h.resultId,x=A===void 0?H:A,R=h.result_count,I=h.resultCount,L=I===void 0?p||R:I,F=h.result_page,U=h.resultPage,V=U===void 0?F:U,W=h.result_position_on_page,b=h.resultPositionOnPage,K=b===void 0?W:b,X=h.num_results_per_page,ee=h.numResultsPerPage,ue=ee===void 0?X:ee,ae=h.selected_filters,Z=h.selectedFilters,Ne=Z===void 0?ae:Z,de=h.section,we={item_name:P,item_id:g,variation_id:M,result_id:x,result_count:L,result_page:V,result_position_on_page:K,num_results_per_page:ue,selected_filters:Ne,section:de,search_term:a},Je={};de&&(Je.section=de);var re="".concat(c).concat(w(Je,this.options)),pt="POST",sn=m(we,s(s({},this.options),{},{requestMethod:pt}));return this.requests.queue(re,pt,sn,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultClick",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.options.serviceUrl,"/autocomplete/").concat(u.encodeURIComponentRFC3986(u.trimNonBreakingSpaces(a)),"/click_through?"),p={},C=h.item_name,z=h.name,_=h.itemName,g=_===void 0?C||z:_,v=h.item_id,N=h.itemId,k=N===void 0?v:N,P=h.customer_id,q=h.customerId,O=q===void 0?P||k:q,M=h.variation_id,H=h.variationId,A=H===void 0?M:H,x=h.result_id,R=h.resultId,I=R===void 0?x:R,L=h.item_is_convertible,F=h.itemIsConvertible,U=F===void 0?L:F,V=h.section;return g&&(p.name=g),O&&(p.customer_id=O),A&&(p.variation_id=A),I&&(p.result_id=I),typeof U=="boolean"&&(p.item_is_convertible=U),V&&(p.section=V),this.requests.queue("".concat(c).concat(w(p,this.options)),void 0,void 0,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackConversion",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c=a||"TERM_UNKNOWN",p="".concat(this.options.serviceUrl,"/v2/behavioral_action/conversion?"),C={},z={},_=h.name,g=h.item_name,v=h.itemName,N=v===void 0?g||_:v,k=h.customer_id,P=h.customerId,q=P===void 0?k:P,O=h.item_id,M=h.itemId,H=M===void 0?O||q:M,A=h.variation_id,x=h.variationId,R=x===void 0?A:x,I=h.revenue,L=h.section,F=L===void 0?"Products":L,U=h.display_name,V=h.displayName,W=V===void 0?U:V,b=h.type,K=h.is_custom_type,X=h.isCustomType,ee=X===void 0?K:X;H&&(z.item_id=H),N&&(z.item_name=N),R&&(z.variation_id=R),(I||I===0)&&(z.revenue=I.toString()),F&&(C.section=F,z.section=F),c&&(z.search_term=c),b&&(z.type=b),ee&&(z.is_custom_type=ee),W&&(z.display_name=W);var ue="".concat(p).concat(w(C,this.options)),ae="POST",Z=m(z,s(s({},this.options),{},{requestMethod:ae}));return this.requests.queue(ue,ae,Z,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackPurchase",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/purchase?"),c={},p={},C=a.items,z=a.revenue,_=a.order_id,g=a.orderId,v=g===void 0?_:g,N=a.section;if(v){if(u.hasOrderIdRecord(v))return!1;u.addOrderIdRecord(v),p.order_id=v}C&&Array.isArray(C)&&(p.items=C.slice(0,100).map(function(O){return u.toSnakeCaseKeys(O,!1)})),(z||z===0)&&(p.revenue=z),N?c.section=N:c.section="Products";var k="".concat(f).concat(w(c,this.options)),P="POST",q=m(p,s(s({},this.options),{},{requestMethod:P}));return this.requests.queue(k,P,q,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackRecommendationView",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/recommendation_result_view?"),c={},p=a.result_count,C=a.resultCount,z=C===void 0?p:C,_=a.result_page,g=a.resultPage,v=g===void 0?_:g,N=a.result_id,k=a.resultId,P=k===void 0?N:k,q=a.section,O=a.url,M=a.pod_id,H=a.podId,A=H===void 0?M:H,x=a.num_results_viewed,R=a.numResultsViewed,I=R===void 0?x:R,L=a.items;u.isNil(z)||(c.result_count=z),u.isNil(v)||(c.result_page=v),P&&(c.result_id=P),q?c.section=q:c.section="Products",O&&(c.url=O),A&&(c.pod_id=A),u.isNil(I)||(c.num_results_viewed=I),L&&Array.isArray(L)&&(c.items=L.slice(0,100).map(function(W){return u.toSnakeCaseKeys(W,!1)}));var F="".concat(f).concat(w({},this.options)),U="POST",V=m(c,s(s({},this.options),{},{requestMethod:U}));return this.requests.queue(F,U,V,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackRecommendationClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/recommendation_result_click?"),c={},p=a.variation_id,C=a.variationId,z=C===void 0?p:C,_=a.section,g=_===void 0?"Products":_,v=a.result_id,N=a.resultId,k=N===void 0?v:N,P=a.result_count,q=a.resultCount,O=q===void 0?P:q,M=a.result_page,H=a.resultPage,A=H===void 0?M:H,x=a.result_position_on_page,R=a.resultPositionOnPage,I=R===void 0?x:R,L=a.num_results_per_page,F=a.numResultsPerPage,U=F===void 0?L:F,V=a.pod_id,W=a.podId,b=W===void 0?V:W,K=a.strategy_id,X=a.strategyId,ee=X===void 0?K:X,ue=a.item_id,ae=a.itemId,Z=ae===void 0?ue:ae,Ne=a.item_name,de=a.itemName,we=de===void 0?Ne:de;z&&(c.variation_id=z),g&&(c.section=g),k&&(c.result_id=k),u.isNil(O)||(c.result_count=O),u.isNil(A)||(c.result_page=A),u.isNil(I)||(c.result_position_on_page=I),u.isNil(U)||(c.num_results_per_page=U),b&&(c.pod_id=b),ee&&(c.strategy_id=ee),Z&&(c.item_id=Z),we&&(c.item_name=we);var Je="".concat(f).concat(w({},this.options)),re="POST",pt=m(c,s(s({},this.options),{},{requestMethod:re}));return this.requests.queue(Je,re,pt,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackBrowseResultsLoaded",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/browse_result_load?"),c={},p=a.section,C=p===void 0?"Products":p,z=a.result_count,_=a.resultCount,g=_===void 0?z:_,v=a.result_page,N=a.resultPage,k=N===void 0?v:N,P=a.result_id,q=a.resultId,O=q===void 0?P:q,M=a.selected_filters,H=a.selectedFilters,A=H===void 0?M:H,x=a.url,R=a.sort_order,I=a.sortOrder,L=I===void 0?R:I,F=a.sort_by,U=a.sortBy,V=U===void 0?F:U,W=a.filter_name,b=a.filterName,K=b===void 0?W:b,X=a.filter_value,ee=a.filterValue,ue=ee===void 0?X:ee,ae=a.items;C&&(c.section=C),u.isNil(g)||(c.result_count=g),u.isNil(k)||(c.result_page=k),O&&(c.result_id=O),A&&(c.selected_filters=A),x&&(c.url=x),L&&(c.sort_order=L),V&&(c.sort_by=V),K&&(c.filter_name=K),ue&&(c.filter_value=ue),ae&&Array.isArray(ae)&&(c.items=ae.slice(0,100).map(function(we){return u.toSnakeCaseKeys(we,!1)}));var Z="".concat(f).concat(w({},this.options)),Ne="POST",de=m(c,s(s({},this.options),{},{requestMethod:Ne}));return this.requests.queue(Z,Ne,de,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackBrowseResultClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/browse_result_click?"),c={},p=a.section,C=p===void 0?"Products":p,z=a.variation_id,_=a.variationId,g=_===void 0?z:_,v=a.result_id,N=a.resultId,k=N===void 0?v:N,P=a.result_count,q=a.resultCount,O=q===void 0?P:q,M=a.result_page,H=a.resultPage,A=H===void 0?M:H,x=a.result_position_on_page,R=a.resultPositionOnPage,I=R===void 0?x:R,L=a.num_results_per_page,F=a.numResultsPerPage,U=F===void 0?L:F,V=a.selected_filters,W=a.selectedFilters,b=W===void 0?V:W,K=a.filter_name,X=a.filterName,ee=X===void 0?K:X,ue=a.filter_value,ae=a.filterValue,Z=ae===void 0?ue:ae,Ne=a.customer_id,de=a.customerId,we=de===void 0?Ne:de,Je=a.item_id,re=a.itemId,pt=re===void 0?we||Je:re,sn=a.item_name,Gi=a.name,Dl=a.itemName,Hl=Dl===void 0?sn||Gi:Dl;C&&(c.section=C),g&&(c.variation_id=g),k&&(c.result_id=k),u.isNil(O)||(c.result_count=O),u.isNil(A)||(c.result_page=A),u.isNil(I)||(c.result_position_on_page=I),u.isNil(U)||(c.num_results_per_page=U),b&&(c.selected_filters=b),ee&&(c.filter_name=ee),Z&&(c.filter_value=Z),pt&&(c.item_id=pt),Hl&&(c.item_name=Hl);var td="".concat(f).concat(w({},this.options)),bl="POST",nd=m(c,s(s({},this.options),{},{requestMethod:bl}));return this.requests.queue(td,bl,nd,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackGenericResultClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if((0,n.default)(a)==="object"){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/result_click?"),c={},p=a.item_id,C=a.itemId,z=C===void 0?p:C,_=a.item_name,g=a.itemName,v=g===void 0?_:g,N=a.variation_id,k=a.variationId,P=k===void 0?N:k,q=a.section,O=q===void 0?"Products":q;if(z){c.section=O,c.item_id=z,v&&(c.item_name=v),P&&(c.variation_id=P);var M="".concat(f).concat(w({},this.options)),H="POST",A=m(c,s(s({},this.options),{},{requestMethod:H}));return this.requests.queue(M,H,A,h),this.requests.send(),!0}}return this.requests.send(),new Error('A parameters object with an "itemId" property is required.')}},{key:"trackQuizResultsLoaded",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/quiz_result_load?"),c=a.quiz_id,p=a.quizId,C=p===void 0?c:p,z=a.quiz_version_id,_=a.quizVersionId,g=_===void 0?z:_,v=a.quiz_session_id,N=a.quizSessionId,k=N===void 0?v:N,P=a.url,q=a.section,O=q===void 0?"Products":q,M=a.result_count,H=a.resultCount,A=H===void 0?M:H,x=a.result_id,R=a.resultId,I=R===void 0?x:R,L=a.result_page,F=a.resultPage,U=F===void 0?L:F,V=a.items,W={},b={};if(V&&Array.isArray(V)&&(b.items=V.slice(0,100).map(function(ue){return u.toSnakeCaseKeys(ue,!1)})),typeof C!="string")return new Error('"quizId" is a required parameter of type string');if(typeof g!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof k!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof P!="string")return new Error('"url" is a required parameter of type string');if(b.quiz_id=C,b.quiz_version_id=g,b.quiz_session_id=k,b.url=P,!u.isNil(O)){if(typeof O!="string")return new Error('"section" must be a string');W.section=O,b.section=O}if(!u.isNil(A)){if(typeof A!="number")return new Error('"resultCount" must be a number');b.result_count=A}if(!u.isNil(I)){if(typeof I!="string")return new Error('"resultId" must be a string');b.result_id=I}if(!u.isNil(U)){if(typeof U!="number")return new Error('"resultPage" must be a number');b.result_page=U}var K="".concat(f).concat(w(W,this.options)),X="POST",ee=m(b,s(s({},this.options),{},{requestMethod:X}));return this.requests.queue(K,X,ee,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackQuizResultClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/quiz_result_click?"),c=a.quiz_id,p=a.quizId,C=p===void 0?c:p,z=a.quiz_version_id,_=a.quizVersionId,g=_===void 0?z:_,v=a.quiz_session_id,N=a.quizSessionId,k=N===void 0?v:N,P=a.item_id,q=a.itemId,O=q===void 0?P:q,M=a.item_name,H=a.itemName,A=H===void 0?M:H,x=a.result_count,R=a.resultCount,I=R===void 0?x:R,L=a.result_id,F=a.resultId,U=F===void 0?L:F,V=a.result_page,W=a.resultPage,b=W===void 0?V:W,K=a.num_results_per_page,X=a.numResultsPerPage,ee=X===void 0?K:X,ue=a.result_position_on_page,ae=a.resultPositionOnPage,Z=ae===void 0?ue:ae,Ne=a.section,de=Ne===void 0?"Products":Ne,we=a.variationId,Je={},re={};if(typeof C!="string")return new Error('"quizId" is a required parameter of type string');if(typeof g!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof k!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof O!="string"&&typeof A!="string")return new Error('"itemId" or "itemName" is a required parameter of type string');if(re.quiz_id=C,re.quiz_version_id=g,re.quiz_session_id=k,!u.isNil(O)){if(typeof O!="string")return new Error('"itemId" must be a string');re.item_id=O}if(!u.isNil(A)){if(typeof A!="string")return new Error('"itemName" must be a string');re.item_name=A}if(!u.isNil(we)){if(typeof we!="string")return new Error('"variationId" must be a string');re.variation_id=we}if(!u.isNil(de)){if(typeof de!="string")return new Error('"section" must be a string');Je.section=de}if(!u.isNil(I)){if(typeof I!="number")return new Error('"resultCount" must be a number');re.result_count=I}if(!u.isNil(U)){if(typeof U!="string")return new Error('"resultId" must be a string');re.result_id=U}if(!u.isNil(b)){if(typeof b!="number")return new Error('"resultPage" must be a number');re.result_page=b}if(!u.isNil(ee)){if(typeof ee!="number")return new Error('"numResultsPerPage" must be a number');re.num_results_per_page=ee}if(!u.isNil(Z)){if(typeof Z!="number")return new Error('"resultPositionOnPage" must be a number');re.result_position_on_page=Z}var pt="".concat(f).concat(w(Je,this.options)),sn="POST",Gi=m(re,s(s({},this.options),{},{requestMethod:sn}));return this.requests.queue(pt,sn,Gi,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackQuizConversion",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/quiz_conversion?"),c=a.quiz_id,p=a.quizId,C=p===void 0?c:p,z=a.quiz_version_id,_=a.quizVersionId,g=_===void 0?z:_,v=a.quiz_session_id,N=a.quizSessionId,k=N===void 0?v:N,P=a.item_id,q=a.itemId,O=q===void 0?P:q,M=a.item_name,H=a.itemName,A=H===void 0?M:H,x=a.variation_id,R=a.variationId,I=R===void 0?x:R,L=a.revenue,F=a.section,U=F===void 0?"Products":F,V=a.type,W=a.is_custom_type,b=a.isCustomType,K=b===void 0?W:b,X=a.display_name,ee=a.displayName,ue=ee===void 0?X:ee,ae={},Z={};if(typeof C!="string")return new Error('"quizId" is a required parameter of type string');if(typeof g!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof k!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof O!="string"&&typeof A!="string")return new Error('"itemId" or "itemName" is a required parameter of type string');if(Z.quiz_id=C,Z.quiz_version_id=g,Z.quiz_session_id=k,!u.isNil(O)){if(typeof O!="string")return new Error('"itemId" must be a string');Z.item_id=O}if(!u.isNil(A)){if(typeof A!="string")return new Error('"itemName" must be a string');Z.item_name=A}if(!u.isNil(I)){if(typeof I!="string")return new Error('"variationId" must be a string');Z.variation_id=I}if(!u.isNil(L)){if(typeof L!="string")return new Error('"revenue" must be a string');Z.revenue=L}if(!u.isNil(U)){if(typeof U!="string")return new Error('"section" must be a string');Z.section=U}if(!u.isNil(V)){if(typeof V!="string")return new Error('"type" must be a string');Z.type=V}if(!u.isNil(K)){if(typeof K!="boolean")return new Error('"isCustomType" must be a boolean');Z.is_custom_type=K}if(!u.isNil(ue)){if(typeof ue!="string")return new Error('"displayName" must be a string');Z.display_name=ue}var Ne="".concat(f).concat(w(ae,this.options)),de="POST",we=m(Z,s(s({},this.options),{},{requestMethod:de}));return this.requests.queue(Ne,de,we,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"on",value:function(a,h){return a!=="success"&&a!=="error"?new Error('messageType must be a string of value "success" or "error"'):!h||typeof h!="function"?new Error("callback is required and must be a function"):(this.eventemitter.on(a,h),!0)}}]),E}();return S.RequestQueue=d,jo=S,jo}const ov="@constructor-io/constructorio-client-javascript",sv="2.42.0",lv="Constructor.io JavaScript client",uv="lib/constructorio.js",av="lib/types/index.d.ts",cv={clean:"sudo rm -rf node_modules package-lock.json",version:"npm run verify-node-version && npm run docs && git add ./docs/* && npm run bundle && git add -A ./dist","check-license":"license-checker --production --onlyAllow 'Apache-2.0;BSD-3-Clause;MIT;0BSD;BSD-2-Clause'","verify-node-version":"chmod +x ./scripts/verify-node-version.sh && ./scripts/verify-node-version.sh",lint:"eslint 'src/**/*.js' 'spec/**/*.js' 'src/**/*.d.ts'",test:"npm run compile && mkdir -p test && cp -rf lib/* test && mocha --retries 3 ./spec/*","test:types":"tsd .","test:parallel":"npm run compile && mkdir -p test && cp -rf lib/* test && mocha --parallel --retries 3 ./spec/*","test:src":"mkdir -p test && cp -rf src/* test && mocha --retries 3 ./spec/*","test:src:parallel":"mkdir -p test && cp -rf src/* test && mocha --parallel --retries 3 ./spec/*","test:bundled":"npm run bundle && BUNDLED=true PACKAGE_VERSION=$(echo $npm_package_version) mocha --retries 3 ./spec/*","test:bundled:parallel":"npm run bundle && BUNDLED=true PACKAGE_VERSION=$(echo $npm_package_version) mocha --parallel --retries 3 ./spec/*","test:all":"npm run test && npm run test:bundled","test:all:parallel":"npm run test:parallel && npm run test:bundled:parallel",precoverage:"rm -rf ./coverage && rm -rf ./.nyc_output",coverage:"nyc --all --reporter=html npm run test:src",postcoverage:"open coverage/index.html && rm -rf test",docs:"jsdoc --configure ./.jsdoc.json ./README.md --recurse ./src --destination ./docs",compile:"rm -rf ./lib/* && babel src/ -d lib/ --copy-files && rm -rf ./lib/types/tests",prepublish:"npm run compile",bundle:"rm -rf ./dist/* && npm run compile && node bundle.js",prepare:"husky install"},fv={type:"git",url:"git+https://github.com/Constructor-io/constructorio-client-javascript.git"},dv="constructor.io",pv="MIT",hv={url:"https://github.com/Constructor-io/constructorio-client-javascript/issues"},vv="https://github.com/Constructor-io/constructorio-client-javascript#readme",gv=["lib/**/*"],mv={"@babel/cli":"^7.15.7","@babel/core":"^7.15.8","@babel/plugin-transform-runtime":"^7.16.4","@babel/preset-env":"^7.15.8","@babel/register":"^7.15.3","@cspell/eslint-plugin":"^6.8.2","@typescript-eslint/eslint-plugin":"^5.48.1","@typescript-eslint/parser":"^5.48.1",chai:"^4.2.0","chai-as-promised":"^7.1.1",docdash:"^2.0.1",dotenv:"^8.6.0",esbuild:"^0.12.28",eslint:"^8.17.0","eslint-config-airbnb-base":"^15.0.0","eslint-plugin-import":"^2.25.2",husky:"^7.0.4",jsdoc:"^4.0.2",jsdom:"^16.7.0","license-checker":"^25.0.1","lodash.clonedeep":"^4.5.0",mocha:"^9.1.3",nyc:"^15.1.0",qs:"^6.11.0",sinon:"^7.5.0","sinon-chai":"^3.7.0",tsd:"^0.24.1"},yv={"@constructor-io/constructorio-id":"^2.4.17","crc-32":"^1.2.2","fetch-ponyfill":"^7.1.0"},wv={"@babel/runtime":"^7.19.0"},_v={directory:"src/types/tests"},kv={name:ov,version:sv,description:lv,main:uv,types:av,scripts:cv,repository:fv,author:dv,license:pv,bugs:hv,homepage:vv,files:gv,devDependencies:mv,dependencies:yv,peerDependencies:wv,tsd:_v};var Do={exports:{}},Ho={exports:{}},bo={exports:{}},ka;function Wf(){return ka||(ka=1,function(e){function t(n,r){(r==null||r>n.length)&&(r=n.length);for(var i=0,o=new Array(r);i<r;i++)o[i]=n[i];return o}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(bo)),bo.exports}var Sa;function Sv(){return Sa||(Sa=1,function(e){var t=Wf();function n(r){if(Array.isArray(r))return t(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Ho)),Ho.exports}var Vo={exports:{}},Ea;function Ev(){return Ea||(Ea=1,function(e){function t(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Vo)),Vo.exports}var Qo={exports:{}},Ca;function Cv(){return Ca||(Ca=1,function(e){var t=Wf();function n(r,i){if(r){if(typeof r=="string")return t(r,i);var o=Object.prototype.toString.call(r).slice(8,-1);if(o==="Object"&&r.constructor&&(o=r.constructor.name),o==="Map"||o==="Set")return Array.from(r);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return t(r,i)}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Qo)),Qo.exports}var Wo={exports:{}},xa;function xv(){return xa||(xa=1,function(e){function t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
45
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Wo)),Wo.exports}var Ra;function Rv(){return Ra||(Ra=1,function(e){var t=Sv(),n=Ev(),r=Cv(),i=xv();function o(s){return t(s)||n(s)||r(s)||i()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}(Do)),Do.exports}var Ko,za;function zv(){if(za)return Ko;za=1;var e=Ye,t=e(ft()),n=e(dt()),r=e(Rv()),i=e(Un()),o=Fn(),s=ot();function l(d,m,w,S){var E=w.apiKey,y=w.clientId,a=w.sessionId,h=w.segments,f=w.userId,c=w.version,p=w.quizzesServiceUrl,C={c},z="";if(C.key=E,C.i=y,C.s=a,h&&h.length&&(C.us=h),f&&(C.ui=String(f)),!d||typeof d!="string")throw new Error("quizId is a required parameter of type string");if(S==="results"&&((0,i.default)(m.answers)!=="object"||!Array.isArray(m.answers)||m.answers.length===0))throw new Error("answers is a required parameter of type array");if(m){var _=m.section,g=m.answers,v=m.quizSessionId,N=m.quizVersionId,k=m.page,P=m.resultsPerPage,q=m.filters;_&&(C.section=_),N&&(C.quiz_version_id=N),v&&(C.quiz_session_id=v),g&&g.length&&(z="&".concat(s.stringify({a:g.map(function(M){return(0,r.default)(M).join(",")})}))),s.isNil(k)||(C.page=k),s.isNil(P)||(C.num_results_per_page=P),q&&(C.filters=q)}C._dt=Date.now(),C=s.cleanParams(C);var O=s.stringify(C);return"".concat(p,"/v1/quizzes/").concat(encodeURIComponent(d),"/").concat(encodeURIComponent(S),"/?").concat(O).concat(z)}var u=function(){function d(m){(0,t.default)(this,d),this.options=m||{},this.eventDispatcher=new o(m.eventDispatcher)}return(0,n.default)(d,[{key:"getQuizNextQuestion",value:function(w,S){var E=this,y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,f=new AbortController,c=f.signal;try{a=l(w,S,this.options,"next")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,y,f),h(a,{signal:c}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return E.eventDispatcher.queue("quizzes.getQuizNextQuestion.completed",p),p;throw new Error("getQuizNextQuestion response data is malformed")})}},{key:"getQuizResults",value:function(w,S){var E=this,y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,f=new AbortController,c=f.signal;try{a=l(w,S,this.options,"results")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,y,f),h(a,{signal:c}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return E.eventDispatcher.queue("quizzes.getQuizResults.completed",p),p;throw new Error("getQuizResults response data is malformed")})}},{key:"getQuizResultsConfig",value:function(w,S){var E=this,y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,f=new AbortController,c=f.signal;try{a=l(w,S,this.options,"results_config")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,y,f),h(a,{signal:c}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return E.eventDispatcher.queue("quizzes.getQuizResultsConfig.completed",p),p;throw new Error("getQuizResultsConfig response data is malformed")})}}]),d}();return Ko=u,Ko}var Kf=Ye,Nv=Kf(ft()),Tv=Kf(dt()),qv=Kh(),Pv=Gh(),Iv=Yh(),Ov=Jh(),Lv=Xh(),Av=$h(),Gf=iv(),Bv=Fn(),Ml=ot(),Uv=kv,Fv=Uv.version,Mv=zv(),jv=function(){var t="ciojs-client-",n=[];return Ml.canUseDOM()||n.push("domless"),typeof process<"u"&&typeof process.env<"u"&&{}.BUNDLED&&n.push("bundled"),"".concat(t).concat(n.join("-")).concat(n.length?"-":"").concat(Fv)},jl=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,Nv.default)(this,e);var n=t.apiKey,r=t.version,i=t.serviceUrl,o=t.quizzesServiceUrl,s=t.segments,l=t.testCells,u=t.clientId,d=t.sessionId,m=t.userId,w=t.fetch,S=t.trackingSendDelay,E=t.sendReferrerWithTrackingEvents,y=t.sendTrackingEvents,a=t.eventDispatcher,h=t.idOptions,f=t.beaconMode,c=t.networkParameters;if(!n||typeof n!="string")throw new Error("API key is a required parameter of type string");var p,C,z=typeof Jn<"u"&&Jn.CLIENT_VERSION;if(Ml.canUseDOM()){var _=new qv(h||{});p=_.session_id,C=_.client_id}else{if(!d||typeof d!="number")throw new Error("sessionId is a required user parameter of type number");if(!u||typeof u!="string")throw new Error("clientId is a required user parameter of type string")}this.options={apiKey:n,version:r||z||jv(),serviceUrl:i&&i.replace(/\/$/,"")||"https://ac.cnstrc.com",quizzesServiceUrl:o&&o.replace(/\/$/,"")||"https://quizzes.cnstrc.com",sessionId:d||p,clientId:u||C,userId:m,segments:s,testCells:l,fetch:w||Pv({Promise}).fetch,trackingSendDelay:S,sendTrackingEvents:y,sendReferrerWithTrackingEvents:E,eventDispatcher:a,beaconMode:f!==!1,networkParameters:c||{}},this.search=new Iv(this.options),this.browse=new Ov(this.options),this.autocomplete=new Lv(this.options),this.recommendations=new Av(this.options),this.tracker=new Gf(this.options),this.quizzes=new Mv(this.options),new Bv(t.eventDispatcher).queue("instantiated",this.options)}return(0,Tv.default)(e,[{key:"setClientOptions",value:function(n){if(Object.keys(n).length){var r=n.apiKey,i=n.segments,o=n.testCells,s=n.userId;r&&(this.options.apiKey=r),i&&(this.options.segments=i),o&&(this.options.testCells=o),s&&(this.options.userId=s)}}}]),e}();jl.Tracker=Gf;Ml.canUseDOM()&&(window.ConstructorioClient=jl);var Dv=jl;const Hv=Na(Dv),bv="1.12.6",Vv=e=>{if(e)return new Hv({apiKey:e,sendTrackingEvents:!0,version:`cio-ui-quizzes-${bv}`})},Qv=(e,t,n)=>e==null?void 0:e.quizzes.getQuizNextQuestion(t,n),Wv=async(e,t,n)=>e==null?void 0:e.quizzes.getQuizResults(t,n),Kv=async(e,t,n)=>e==null?void 0:e.quizzes.getQuizResultsConfig(t,n),Gv=async(e,t)=>e==null?void 0:e.browse.getBrowseResultsForItemIds(t),Zv=(e,t)=>{var d;const{quiz_id:n,quiz_session_id:r,quiz_version_id:i,result_id:o,request:s,response:l}=t,u=(d=l==null?void 0:l.results)==null?void 0:d.map(m=>{var w,S;return{itemId:(w=m==null?void 0:m.data)==null?void 0:w.id,variationId:(S=m==null?void 0:m.data)==null?void 0:S.variation_id,itemName:m==null?void 0:m.value}});e==null||e.tracker.trackQuizResultsLoaded({quizId:n,quizVersionId:i,quizSessionId:r,url:window.location.href,section:s==null?void 0:s.section,resultCount:l==null?void 0:l.total_num_results,resultPage:s==null?void 0:s.page,resultId:o,items:u})},Yv=(e,t,n,r)=>{var i,o;if(t.request&&t.response){const{quiz_id:s,quiz_session_id:l,quiz_version_id:u,result_id:d,request:{section:m,page:w,num_results_per_page:S},response:{total_num_results:E}}=t;e==null||e.tracker.trackQuizResultClick({quizId:s,quizVersionId:u,quizSessionId:l,itemId:(i=n.data)==null?void 0:i.id,itemName:n==null?void 0:n.value,variationId:(o=n.data)==null?void 0:o.variation_id,section:m,resultCount:E,resultPage:w,resultId:d,resultPositionOnPage:r,numResultsPerPage:S})}},Zf=(e,t,n,r,i)=>{var o,s;if(t.request){const{quiz_id:l,quiz_session_id:u,quiz_version_id:d,request:{section:m}}=t;e==null||e.tracker.trackQuizConversion({quizId:l,quizVersionId:d,quizSessionId:u,itemId:(o=n.data)==null?void 0:o.id,itemName:n.value,section:m,variationId:(s=n.data)==null?void 0:s.variation_id,revenue:r&&String(r)||void 0,type:i})}},Jv=({apiKey:e,cioJsClient:t})=>{if(!e&&!t)throw new Error("Either apiKey or cioJsClient is required");return j.useMemo(()=>t||Vv(e),[e,t])},Xv=e=>{const{quizId:t,resultsPageOptions:n,callbacks:r}=e;j.useEffect(()=>{t||console.error("quizId is a required field of type string"),r!=null&&r.onAddToCartClick||console.error("callbacks.onAddToCartClick is a required field of type function")},[t,n,r==null?void 0:r.onAddToCartClick])};function $v(e,t,n,r){var S;const i=n==null?void 0:n.type,o=(S=n==null?void 0:n.options)==null?void 0:S.some(E=>E.images),[s,l]=j.useState({}),u=j.useRef({}),d=j.useCallback(E=>{if(i===Q.SingleSelect)u.current=!0,l({[E]:!0});else if(i===Q.MultipleSelect)if(s[E]){const y={...s};delete y[E],l(y)}else l({...s,[E]:!0})},[s,i]),m=(E,y)=>{((E==null?void 0:E.key)===" "||(E==null?void 0:E.key)==="Enter")&&d(y)};return j.useEffect(()=>{var E;if(n!=null&&n.type){const y=n.id,a=r==null?void 0:r[y],h={};Array.isArray(a==null?void 0:a.value)&&((E=a==null?void 0:a.value)==null||E.forEach(f=>{h[Number(f.id)]=!0,l(h)}))}return u.current=!1,function(){l({})}},[n==null?void 0:n.id]),j.useEffect(()=>{var E,y;if((n==null?void 0:n.type)==="multiple"||(n==null?void 0:n.type)==="single"){const a=(y=(E=n==null?void 0:n.options)==null?void 0:E.filter(h=>s[Number(h.id)]))==null?void 0:y.map(h=>({id:h.id,value:h.value}));e(a)}},[s,n==null?void 0:n.id,n==null?void 0:n.type,n==null?void 0:n.options,e]),j.useEffect(()=>{(n==null?void 0:n.type)==="single"&&u.current&&t()},[r]),j.useCallback(E=>({className:`${o?"cio-question-option-container":"cio-question-option-container-text-only"} ${s[E.id]?"selected":""}`,onClick:()=>{d(E.id)},onKeyDown:y=>{m(y,E.id)},role:"button",tabIndex:0,key:E.id}),[n==null?void 0:n.id,s])}function eg(e,t){return j.useEffect(()=>{(t==null?void 0:t.type)==="cover"&&e("")},[e,t]),j.useCallback(()=>({}),[])}function tg(e,t,n,r){const[i,o]=j.useState(""),s=j.useCallback(d=>{o(d.target.value)},[]),l=j.useCallback(d=>{const{key:m}=d;m==="Enter"&&i&&(n==null?void 0:n.type)==="open"&&t()},[n==null?void 0:n.type,i,t]);return j.useEffect(()=>{(n==null?void 0:n.type)==="open"&&e(i)},[i,n==null?void 0:n.type,n==null?void 0:n.id,e]),j.useEffect(()=>{var d;if(r&&(n!=null&&n.id)){const m=(d=r[n.id])==null?void 0:d.value;o(m||"")}},[n==null?void 0:n.id]),j.useCallback(()=>({className:"cio-question-input-text",placeholder:(n==null?void 0:n.input_placeholder)||"Answer here...",value:i,onChange:s,onKeyDown:l}),[n==null?void 0:n.input_placeholder,n==null?void 0:n.id,i,l])}function ng(e,t,n){return j.useCallback(()=>{var s,l,u,d,m,w;const i=(l=(s=t.quizCurrentQuestion)==null?void 0:s.next_question)==null?void 0:l.id;let o;return i&&!((u=t.quizCurrentQuestion)!=null&&u.isCoverQuestion)&&(o=!((d=n.answerInputs[i])!=null&&d.value)||!((w=(m=n.answerInputs[i])==null?void 0:m.value)!=null&&w.length)),{className:o?"cio-question-cta-button disabled":"cio-question-cta-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,n.answerInputs,e])}function rg(e,t){return j.useCallback(()=>{var i;return{title:"Quiz Back Button",role:"button",className:`cio-question-back-button ${((i=e.quizCurrentQuestion)==null?void 0:i.isFirstQuestion)?"disabled":""}`,type:"button",onClick:()=>t()}},[e,t])}function ig(e,t){const n=i=>{var o,s;return((o=i==null?void 0:i.data)==null?void 0:o.id)&&(t==null?void 0:t.includes((s=i==null?void 0:i.data)==null?void 0:s.id))};return j.useCallback((i,o)=>({className:`cio-result-card-favorites-button ${n(i)?"favorited":""}`,onClick:s=>{e(s,i,o,!n(i))},type:"button"}),[e])}function og(e,t){return j.useCallback(()=>{var o,s,l,u;return{className:((s=(o=t.quizCurrentQuestion)==null?void 0:o.next_question)==null?void 0:s.id)&&(((l=t.quizCurrentQuestion)==null?void 0:l.isCoverQuestion)||!((u=t.quizCurrentQuestion)!=null&&u.next_question.is_skippable))?"cio-question-skip-button hide":"cio-question-skip-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,e])}const sg=(e,t,n,r)=>{var O,M,H;const{quizAnswerChanged:i,nextQuestion:o,skipQuestion:s,previousQuestion:l,resetQuiz:u,hydrateQuiz:d,addToCart:m,addToFavorites:w,resultClick:S}=e,E=tg(i,o,(O=t.quizCurrentQuestion)==null?void 0:O.next_question,n.answerInputs),y=eg(i,(M=t.quizCurrentQuestion)==null?void 0:M.next_question),a=$v(i,o,(H=t.quizCurrentQuestion)==null?void 0:H.next_question,n.answerInputs),h=ng(o,t,n),f=og(s,t),c=rg(t,l),p=j.useCallback((A="primary")=>({className:A==="primary"?"cio-question-cta-button":"cio-question-redo-button",type:"button",onClick:()=>u()}),[u]),C=j.useCallback(()=>({className:"cio-question-share-results-button"}),[]),z=j.useCallback(()=>({className:"",type:"button",onClick:()=>d()}),[d]),_=j.useCallback((A,x)=>({className:"cio-result-card-cta-button",type:"button",onClick:R=>m(R,A,x)}),[m]),g=ig(w,r),v=j.useCallback((A,x,R)=>{((A==null?void 0:A.key)===" "||(A==null?void 0:A.key)==="Enter")&&S&&S(x,R)},[S]),N=j.useCallback(({result:A,position:x})=>({className:"cio-result-card-container",role:"button",tabIndex:0,onClick:()=>S(A,x),onKeyDown:R=>v(R,A,x)}),[v,S]),k=j.useCallback(({result:A,position:x})=>{var R;return{href:(R=A.data)==null?void 0:R.url,onClick:()=>S(A,x),onKeyDown:I=>v(I,A,x)}},[v,S]),P=j.useCallback(()=>{var A,x,R,I,L,F;return{src:((R=(x=(A=t.quizCurrentQuestion)==null?void 0:A.next_question)==null?void 0:x.images)==null?void 0:R.primary_url)||void 0,alt:((F=(L=(I=t.quizCurrentQuestion)==null?void 0:I.next_question)==null?void 0:L.images)==null?void 0:F.primary_alt)||void 0}},[t.quizCurrentQuestion]),q=j.useCallback(A=>{var x,R;return{className:"cio-question-option-image",src:((x=A==null?void 0:A.images)==null?void 0:x.primary_url)||void 0,alt:((R=A==null?void 0:A.images)==null?void 0:R.primary_alt)||void 0}},[]);return{getOpenTextInputProps:E,getNextQuestionButtonProps:h,getPreviousQuestionButtonProps:c,getQuizImageProps:P,getSelectQuestionImageProps:q,getSelectInputProps:a,getCoverQuestionProps:y,getResetQuizButtonProps:p,getShareResultsButtonProps:C,getHydrateQuizButtonProps:z,getAddToCartButtonProps:_,getAddToFavoritesButtonProps:g,getQuizResultButtonProps:N,getQuizResultLinkProps:k,getSkipQuestionButtonProps:f}},lg=e=>j.useMemo(()=>{var r;let n={"--primary-color-h":"227","--primary-color-s":"70%","--primary-color-l":"46%"};if(e){const i=/^\s*\(?(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)?/,o=(r=e.trim().match(i))==null?void 0:r.slice(1);if(o&&o.length===3){const[s,l,u]=o,[d,m,w]=Eh(Number(s),Number(l),Number(u));n={"--primary-color-h":`${d}`,"--primary-color-s":`${m}%`,"--primary-color-l":`${w}%`}}}return n},[e]),ug=(e,t,n)=>{j.useEffect(()=>{var r;t.quizResults&&(Zv(e,t.quizResults),n&&Bn(n)&&((r=t.quizResults.response)!=null&&r.results)&&n(t.quizResults.response.results))},[t,e,n])},ag=(e,t,n)=>j.useCallback((i,o)=>{t.quizResults&&(Yv(e,t.quizResults,i,o),Bn(n)&&n(i,o))},[t,e,n]),cg=(e,t,n)=>j.useCallback((i,o,s)=>{i.preventDefault(),t.quizResults&&(Zf(e,t.quizResults,o,s),Bn(n)&&n(o))},[t,e,n]),fg=(e,t)=>j.useCallback(()=>{t&&t({type:Q.Back,payload:e.quizCurrentQuestion})},[t,e.quizCurrentQuestion]),dg=(e,t)=>j.useCallback(r=>{var s,l;const i=(l=(s=e.quizCurrentQuestion)==null?void 0:s.next_question)==null?void 0:l.type,o=e.quizCurrentQuestion;if(o!=null&&o.next_question)switch(i){case Q.Cover:t({type:Q.Cover,payload:{questionId:o.next_question.id,input:""}});break;case Q.OpenText:t({type:Q.OpenText,payload:{questionId:o.next_question.id,input:r}});break;case Q.SingleSelect:case Q.MultipleSelect:t({type:o.next_question.type,payload:{questionId:o.next_question.id,input:r}});break}},[e,t]),pg=(e,t,n,r)=>j.useCallback(()=>{var l,u;const o=(l=e.quizCurrentQuestion)==null?void 0:l.next_question,s=o==null?void 0:o.id;if(n&&s){const d=t.answerInputs[s];((u=d==null?void 0:d.value)!=null&&u.length||(o==null?void 0:o.type)==="cover")&&n({type:Q.Next,payload:e.quizCurrentQuestion}),o&&Bn(r)&&r({...o,answer:d})}},[n,e.quizCurrentQuestion,t.answerInputs,r]),Yf=()=>{const e=o=>{const l=new URLSearchParams(window.location.search).get(o);return l?l==null?void 0:l.split(","):[]},t=e("items"),n=e("attributes"),r=!!t.length&&!!n.length,i=j.useCallback(()=>{const o=new URL(window.location.href);o.searchParams.delete("items"),o.searchParams.delete("attributes"),o.searchParams.toString().length||(o.search=""),window.history.replaceState({},"",o.toString())},[]);return{queryItems:t,queryAttributes:n,isSharedResultsQuery:r,removeSharedResultsQueryParams:i}},hg=e=>{const{resetQuizSessionStorageState:t,dispatchLocalState:n,dispatchApiState:r,quizResults:i}=e,{removeSharedResultsQueryParams:o,isSharedResultsQuery:s}=Yf();return j.useCallback(()=>{i&&(n({type:Q.Reset}),r({type:he.RESET_QUIZ}),t(),s&&o())},[n,r,t,i,o,s])},vg=(e,t)=>{const n=Ds(e);return j.useCallback(()=>{n&&t({type:Q.Hydrate,payload:n})},[t,n])},gg=(e,t,n)=>j.useCallback((i,o,s,l=!0)=>{i.preventDefault(),t.quizResults&&(l&&Zf(e,t.quizResults,o,s,"add_to_wishlist"),Bn(n)&&n(o))},[t,e,n]),mg=(e,t,n,r)=>j.useCallback(()=>{var l;const o=(l=e.quizCurrentQuestion)==null?void 0:l.next_question,s=o==null?void 0:o.id;if(n&&s){(o==null?void 0:o.type)!=="cover"&&n({type:Q.Skip,payload:e.quizCurrentQuestion});const u={...t.answerInputs[s],value:(o==null?void 0:o.type)==="open"?"false":null};o&&Bn(r)&&r({...o,answer:u})}},[n,r,e.quizCurrentQuestion,t.answerInputs]),yg=(e,t,n)=>{const{quizApiState:r,dispatchLocalState:i,dispatchApiState:o,quizLocalState:s,quizSessionStorageState:l}=n,{callbacks:u}=e,{onAddToCartClick:d,onAddToFavoritesClick:m,onQuizNextQuestion:w,onQuizResultClick:S,onQuizResultsLoaded:E,onQuizSkipQuestion:y}=u||{},a=dg(r,i),h=pg(r,s,i,w),f=mg(r,s,i,y),c=fg(r,i),p=cg(t,r,d),C=ag(t,r,S),z=gg(t,r,m);ug(t,r,E);const _=hg({resetQuizSessionStorageState:$u(l.key),dispatchLocalState:i,dispatchApiState:o,quizResults:r.quizResults}),g=vg(l.key,i);return{addToCart:p,addToFavorites:z,resultClick:C,quizAnswerChanged:a,previousQuestion:c,nextQuestion:h,skipQuestion:f,resetQuiz:_,hydrateQuiz:g,resetSessionStorageState:$u(l.key)}},Jf={quizRequestState:gt.Stale};function wg(e,t){var n,r,i,o,s,l,u,d,m,w,S,E,y,a,h;switch(t.type){case he.SET_IS_LOADING:return{...e,quizRequestState:gt.Loading,quizCurrentQuestion:void 0,quizResults:void 0};case he.SET_IS_ERROR:return{...e,quizRequestState:gt.Error,quizCurrentQuestion:void 0,quizResults:void 0,selectedOptionsWithAttributes:void 0,matchedOptions:void 0};case he.SET_CURRENT_QUESTION:{const{isOpenQuestion:f,isCoverQuestion:c,isSingleQuestion:p,isMultipleQuestion:C,isSelectQuestion:z}=Df((i=(r=(n=t.payload)==null?void 0:n.quizCurrentQuestion)==null?void 0:r.next_question)==null?void 0:i.type),_=e.quizFirstQuestion||((o=t.payload)==null?void 0:o.quizCurrentQuestion);return{...e,quizRequestState:gt.Success,quizCurrentQuestion:{...(s=t.payload)==null?void 0:s.quizCurrentQuestion,isFirstQuestion:((l=_==null?void 0:_.next_question)==null?void 0:l.id)===((m=(d=(u=t.payload)==null?void 0:u.quizCurrentQuestion)==null?void 0:d.next_question)==null?void 0:m.id),isOpenQuestion:f,isCoverQuestion:c,isSingleQuestion:p,isMultipleQuestion:C,isSelectQuestion:z},quizFirstQuestion:_,quizResults:void 0,selectedOptionsWithAttributes:void 0,matchedOptions:void 0}}case he.SET_QUIZ_RESULTS:{const f=((w=t.payload)==null?void 0:w.quizResults.quiz_selected_options.filter(p=>p.has_attribute).map(p=>p.value))||[],c=((S=t.payload)==null?void 0:S.quizResults.quiz_selected_options.filter(p=>p.is_matched&&p.has_attribute).map(p=>p.value))||[];return{...e,quizRequestState:gt.Success,quizResults:(E=t.payload)==null?void 0:E.quizResults,quizCurrentQuestion:void 0,selectedOptionsWithAttributes:f,matchedOptions:c}}case he.SET_QUIZ_SHARED_RESULTS:return{...e,quizRequestState:gt.Success,quizResults:(y=t.payload)==null?void 0:y.quizResults,quizCurrentQuestion:void 0,selectedOptionsWithAttributes:(a=t.payload)==null?void 0:a.quizResults.attributes};case he.SET_QUIZ_RESULTS_CONFIG:return{...e,resultsConfig:(h=t.payload)==null?void 0:h.quizResultsConfig.results_config};case he.SET_QUIZ_RESULTS_CONFIG_ERROR:return{...e,resultsConfig:null};case he.RESET_QUIZ:return{...Jf};default:return e}}const _g=(e,t,n,r,i)=>{const[o,s]=j.useReducer(wg,Jf),{quizId:l,quizVersionId:u,resultsPageOptions:d}=e,{queryItems:m,queryAttributes:w,isSharedResultsQuery:S}=Yf(),E=async()=>{try{const h=await Wv(t,l,{answers:n.answers,resultsPerPage:d==null?void 0:d.numResultsToDisplay,quizVersionId:n.quizVersionId,quizSessionId:n.quizSessionId});s({type:he.SET_QUIZ_RESULTS,payload:{quizResults:h}}),n.isQuizCompleted||i({type:Q.Complete})}catch{s({type:he.SET_IS_ERROR})}},y=async()=>{try{const h=await Kv(t,l,{quizVersionId:n.quizVersionId});s({type:he.SET_QUIZ_RESULTS_CONFIG,payload:{quizResultsConfig:h}})}catch{s({type:he.SET_QUIZ_RESULTS_CONFIG_ERROR,payload:{quizResultsConfigError:null}})}},a=async()=>{try{const h=await Gv(t,m);s({type:he.SET_QUIZ_SHARED_RESULTS,payload:{quizResults:{...h,attributes:w}}})}catch{s({type:he.SET_IS_ERROR})}};return j.useEffect(()=>{typeof o.resultsConfig>"u"&&y()},[o.resultsConfig]),j.useEffect(()=>{(async()=>{if(s({type:he.SET_IS_LOADING}),S)await a();else if(r)await E();else try{const h=n.quizVersionId||u,{quizSessionId:f}=n,c=await Qv(t,l,{answers:n.answers,quizVersionId:h,quizSessionId:f});if(!c.next_question){await E();return}(!f&&(c!=null&&c.quiz_session_id)||!h&&c.quiz_version_id)&&i({type:Q.Hydrate,payload:{quizVersionId:c==null?void 0:c.quiz_version_id,quizSessionId:c==null?void 0:c.quiz_session_id}}),s({type:he.SET_CURRENT_QUESTION,payload:{quizCurrentQuestion:c}})}catch{s({type:he.SET_IS_ERROR})}})()},[t,l,n.answers,d==null?void 0:d.numResultsToDisplay,S]),{quizApiState:o,dispatchApiState:s}},Xf={answers:[],answerInputs:{},prevAnswerInputs:{},isQuizCompleted:!1};function Gr(e,t){return{...e,[String(t.payload.questionId)]:{type:t.type,value:t.payload.input}}}function kg(e,t){var n;switch(t.type){case Q.OpenText:return{...e,answerInputs:Gr(e.answerInputs,t),isQuizCompleted:!1};case Q.Cover:return{...e,answerInputs:Gr(e.answerInputs,t),isQuizCompleted:!1};case Q.SingleSelect:return{...e,answerInputs:Gr(e.answerInputs,t),isQuizCompleted:!1};case Q.MultipleSelect:return{...e,answerInputs:Gr(e.answerInputs,t),isQuizCompleted:!1};case Q.Next:{const{answers:r,answerInputs:i}=e,o=[...r],s=r.length,l=(n=Object.values(e.answerInputs))==null?void 0:n[s];switch(l.type){case Q.OpenText:o.push(["true"]);break;case Q.Cover:o.push(["seen"]);break;case Q.SingleSelect:case Q.MultipleSelect:o.push(l.value.map(u=>u.id));break;default:o.push([])}return{...e,prevAnswerInputs:i,answers:o,isQuizCompleted:!1}}case Q.Skip:{const{answers:r,answerInputs:i}=e,o=[...r],s=r.length;switch(Object.values(e.answerInputs)[s].type){case Q.OpenText:o.push(["false"]);break;case Q.Cover:o.push(["seen"]);break;case Q.SingleSelect:case Q.MultipleSelect:default:o.push([])}return{...e,prevAnswerInputs:i,answers:o,isQuizCompleted:!1}}case Q.Back:{const r={...e.prevAnswerInputs};return{...e,answerInputs:r,answers:[...e.answers.slice(0,-1)],isQuizCompleted:!1}}case Q.Reset:return{...Xf};case Q.Hydrate:return{...e,...t.payload};case Q.Complete:return{...e,isQuizCompleted:!0};default:return e}}const Sg=()=>{const[e,t]=j.useReducer(kg,Xf),n=j.useCallback(r=>{Sh(r),t(r)},[]);return{quizLocalState:e,dispatchLocalState:n}},Eg=(e,t,n)=>{var o;const r=(t==null?void 0:t.sessionStateKey)||Vh;return j.useEffect(()=>{var s,l;n&&((s=e==null?void 0:e.answers)!=null&&s.length)&&((l=window==null?void 0:window.sessionStorage)==null||l.setItem(r,JSON.stringify(e)))},[e,r,n]),{skipToResults:!!n&&!!((o=Ds(r))!=null&&o.isQuizCompleted)&&!(t!=null&&t.showSessionModalOnResults),quizSessionStorageStateKey:r,hasSessionStorageState:()=>Ds(r)!==null}},Cg=(e,t)=>{const{sessionStateOptions:n,enableHydration:r}=e,{quizLocalState:i,dispatchLocalState:o}=Sg(),{skipToResults:s,quizSessionStorageStateKey:l,hasSessionStorageState:u}=Eg(i,n,r===void 0?!0:r),{quizApiState:d,dispatchApiState:m}=_g(e,t,i,s,o);return{quizApiState:d,quizLocalState:i,dispatchApiState:m,dispatchLocalState:o,quizSessionStorageState:{skipToResults:s,key:l,hasSessionStorageState:u}}},xg=e=>{const{apiKey:t,cioJsClient:n,primaryColor:r,resultsPageOptions:i}=e;Xv(e);const o=Jv({apiKey:t,cioJsClient:n}),s=Cg(e,o),l=yg(e,o,s),{quizApiState:u,quizLocalState:d,quizSessionStorageState:m}=s,{skipToResults:w}=m,S=sg(l,u,d,i==null?void 0:i.favoriteItems),E=lg(r);return j.useEffect(()=>{w&&l.hydrateQuiz()},[]),{cioClient:o,state:{answers:{inputs:d.answerInputs},quiz:{requestState:u.quizRequestState,versionId:d.quizVersionId,sessionId:d.quizSessionId,currentQuestion:u.quizCurrentQuestion,results:u.quizResults,selectedOptionsWithAttributes:u.selectedOptionsWithAttributes,matchedOptions:u.matchedOptions,resultsConfig:u.resultsConfig??null},quizSessionStorageState:m},events:{...l},...S,primaryColorStyles:E}};function Rg({continueSession:e,resetStoredState:t,setShowSessionPrompt:n,showSessionPrompt:r}){const i=()=>{t(),n(!1)};if(r){const o=()=>({className:"cio-question-cta-button",onClick:()=>{e(),n(!1)}}),s=()=>({className:"cio-question-cta-button",onClick:()=>{t(),n(!1)}});return T.createElement("div",{className:"cio-session-prompt-modal",role:"presentation",onClick:i},T.createElement("div",{className:"cio-session-prompt-container"},T.createElement("div",{className:"cio-session-prompt-content",role:"presentation",onClick:l=>l.stopPropagation()},T.createElement("div",null,"Do you want to continue where you left off?"),T.createElement("div",{className:"cio-session-prompt-controls-container"},T.createElement(Pi,{ctaText:"No",type:"button",propsGetters:s}),T.createElement(Pi,{type:"button",ctaText:"Yes",propsGetters:o})))))}return null}function zg(){return T.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M18.4748 4.11089C18.8653 3.72036 19.4985 3.72036 19.889 4.11089C20.2795 4.50141 20.2795 5.13458 19.889 5.5251L5.52503 19.8891C5.13451 20.2796 4.50134 20.2796 4.11082 19.8891C3.72029 19.4985 3.72029 18.8654 4.11082 18.4748L18.4748 4.11089Z",fill:"#505A75"}),T.createElement("path",{d:"M4.11076 5.5251C3.72024 5.13458 3.72024 4.50141 4.11076 4.11089C4.50129 3.72036 5.13445 3.72036 5.52498 4.11089L19.8889 18.4748C20.2795 18.8654 20.2795 19.4985 19.8889 19.8891C19.4984 20.2796 18.8652 20.2796 18.4747 19.8891L4.11076 5.5251Z",fill:"#505A75"}))}function $f(){return T.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M21.001 12.0001C21.001 7.03137 16.9697 3.00012 12.001 3.00012C7.03223 3.00012 3.00098 7.03137 3.00098 12.0001C3.00098 16.9689 7.03223 21.0001 12.001 21.0001C16.9697 21.0001 21.001 16.9689 21.001 12.0001Z",stroke:"#101010",strokeWidth:"1.33",strokeMiterlimit:"10"}),T.createElement("path",{d:"M16.5005 8.24963L10.2005 15.7496L7.50049 12.7496",stroke:"#101010",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"}))}function ed(){return T.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M21.0009 11.9995C21.0009 7.03076 16.9697 2.99951 12.0009 2.99951C7.03217 2.99951 3.00092 7.03076 3.00092 11.9995C3.00092 16.9683 7.03217 20.9995 12.0009 20.9995C16.9697 20.9995 21.0009 16.9683 21.0009 11.9995Z",stroke:"#101010",strokeWidth:"1.33",strokeMiterlimit:"10"}),T.createElement("path",{d:"M11.7311 7.78322L12.0002 13.4996L12.2688 7.78322C12.2705 7.74667 12.2646 7.71017 12.2517 7.67595C12.2388 7.64173 12.219 7.6105 12.1936 7.58418C12.1682 7.55785 12.1377 7.53699 12.104 7.52285C12.0702 7.50872 12.034 7.50161 11.9974 7.50197V7.50197C11.9612 7.50231 11.9255 7.50993 11.8924 7.52437C11.8593 7.53882 11.8294 7.55979 11.8045 7.58604C11.7797 7.61229 11.7604 7.64328 11.7478 7.67716C11.7352 7.71104 11.7295 7.74711 11.7311 7.78322V7.78322Z",stroke:"#101010",strokeWidth:"1.00189",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M12.0028 17.2505C11.8168 17.2505 11.6351 17.1954 11.4805 17.0921C11.3259 16.9888 11.2054 16.8419 11.1342 16.6702C11.0631 16.4984 11.0444 16.3093 11.0807 16.127C11.117 15.9446 11.2065 15.7771 11.338 15.6456C11.4695 15.5141 11.637 15.4246 11.8194 15.3883C12.0017 15.352 12.1908 15.3706 12.3626 15.4418C12.5343 15.513 12.6812 15.6335 12.7845 15.7881C12.8878 15.9427 12.9429 16.1244 12.9429 16.3104C12.9429 16.5597 12.8439 16.7988 12.6676 16.9752C12.4913 17.1515 12.2521 17.2505 12.0028 17.2505Z",fill:"#101010"}))}function Ng({url:e}){const[t,n]=j.useState(!1),[r,i]=j.useState(!1);return T.createElement("div",{className:"cio-share-results-feature-group"},T.createElement("div",{className:"cio-share-results-description"},"Share by link"),T.createElement("div",{className:"cio-share-results-button-group"},T.createElement("input",{className:"cio-share-results-link-input",value:e,disabled:!0}),T.createElement("button",{className:"cio-share-results-share-button",type:"button",onClick:()=>{try{navigator.clipboard.writeText(e),n(!0)}catch{i(!0)}}},"Copy link")),t&&T.createElement("div",{className:"cio-share-results-notification"},T.createElement($f,null),T.createElement("div",null,"Link copied to clipboard")),r&&T.createElement("div",{className:"cio-share-results-notification"},T.createElement(ed,null),T.createElement("div",null,"Sorry, there was an error copying. Please try again.")))}function Tg({onSubmit:e}){const[t,n]=j.useState(null),[r,i]=j.useState(!1),[o,s]=j.useState(""),l=()=>o.length>0&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)?(n(null),!0):(n({type:"validate",message:"Please enter a valid email address"}),!1),u=async d=>{if(d.preventDefault(),!!l())try{await e(o),i(!0)}catch{n({type:"callback",message:"Sorry, there was an error sending. Please try again."})}};return T.createElement("div",{className:"cio-share-results-feature-group"},T.createElement("form",{onSubmit:u},T.createElement("div",{className:"cio-share-results-description"},"Share by email"),T.createElement("div",{className:"cio-share-results-button-group"},T.createElement("div",{className:"cio-share-results-email-input-group"},T.createElement("input",{className:`cio-share-results-email-input ${t?"cio-share-results-email-input--error":""}`,onChange:d=>s(d.target.value)}),(t==null?void 0:t.type)==="validate"&&T.createElement("div",{className:"cio-share-results-email-input-error-message"},t.message)),T.createElement("button",{className:"cio-share-results-share-button",type:"submit"},"Send"))),r&&T.createElement("div",{className:"cio-share-results-notification"},T.createElement($f,null),T.createElement("div",null,"Email sent")),(t==null?void 0:t.type)==="callback"&&T.createElement("div",{className:"cio-share-results-notification"},T.createElement(ed,null),T.createElement("div",null,t.message)))}function qg(e){var i,o,s;const t=new URL(window.location.href),n=t.searchParams;if(!((o=(i=e.results)==null?void 0:i.response)!=null&&o.results))throw new Error("Can't generate share link without results");return n.set("items",e.results.response.results.filter(l=>{var u;return(u=l.data)==null?void 0:u.id}).map(l=>l.data.id).join(",")||""),n.set("attributes",((s=e.selectedOptionsWithAttributes)==null?void 0:s.map(l=>l).join(","))||""),t.toString()}function Pg({onClose:e,quizState:t,onEmailResults:n}){const r=qg(t);return T.createElement("div",{className:"cio-share-results-modal",role:"presentation",onClick:e},T.createElement("div",{className:"cio-share-results-container"},T.createElement("div",{className:"cio-share-results-content",onClick:i=>i.stopPropagation(),role:"presentation"},T.createElement("div",{className:"cio-share-results-header"},T.createElement("div",{className:"cio-share-results-title"},"Share results"),T.createElement("button",{onClick:e,type:"button",className:"cio-modal-close-button","aria-label":"Close button"},T.createElement(zg,null))),T.createElement("div",null,n?"Share or save your quiz results through email or using the link below.":"Share or save your quiz results with this link."),n&&T.createElement(Tg,{onSubmit:i=>n({email:i,url:r})}),T.createElement(Ng,{url:r}))))}function Ig(){const{state:e}=j.useContext(Ee),t=e==null?void 0:e.quiz.currentQuestion;return t!=null&&t.next_question?T.createElement("div",{className:"cio-question-progress-affixed-container"},T.createElement("div",{className:"cio-question-progress-progress-container"},T.createElement("div",{className:"cio-question-progress-progress-bar",style:{width:`${(t.next_question.id-1)/t.total_questions*100}%`}}))):null}function Og(e){var L;const{cioClient:t,state:n,events:{hydrateQuiz:r,resetSessionStorageState:i},getAddToCartButtonProps:o,getAddToFavoritesButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:d,getSkipQuestionButtonProps:m,getOpenTextInputProps:w,getPreviousQuestionButtonProps:S,getQuizImageProps:E,getQuizResultButtonProps:y,getQuizResultLinkProps:a,getResetQuizButtonProps:h,getSelectInputProps:f,primaryColorStyles:c,getShareResultsButtonProps:p}=xg(e),[C,z]=j.useState(!1),[_,g]=j.useState(!1),{callbacks:v,sessionStateOptions:N,questionsPageOptions:k,resultCardOptions:P,resultsPageOptions:q}=e,{quizSessionStorageState:{hasSessionStorageState:O,skipToResults:M}}=n;j.useEffect(()=>{(N==null?void 0:N.showSessionModal)!==void 0?z((N==null?void 0:N.showSessionModal)&&O()&&!M):z(O()&&!M)},[]);const H={cioClient:t,state:n,getAddToCartButtonProps:o,getAddToFavoritesButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:d,getSkipQuestionButtonProps:m,getOpenTextInputProps:w,getPreviousQuestionButtonProps:S,getQuizImageProps:E,getQuizResultButtonProps:y,getQuizResultLinkProps:a,getResetQuizButtonProps:h,getShareResultsButtonProps:p,getSelectInputProps:f,customClickItemCallback:!!(v!=null&&v.onQuizResultClick),customAddToFavoritesCallback:!!(v!=null&&v.onAddToFavoritesClick),primaryColorStyles:c};if(n.quiz.requestState===gt.Loading)return T.createElement("div",{className:"cio-quiz cio-quiz-loading"},T.createElement(Hf,null));const A=(L=n.quiz.currentQuestion)==null?void 0:L.next_question,x=A==null?void 0:A.type,R=A==null?void 0:A.images,I=(x==="single"||x==="multiple")&&R;return n.quiz.requestState===gt.Success?T.createElement("div",{className:"cio-quiz",style:{overflow:_||C?"hidden":void 0}},I&&Ki(R,"cio-question-background-image"),T.createElement("style",null,".cio-quiz ",Ch(c)),T.createElement(Rg,{resetStoredState:i,continueSession:r,showSessionPrompt:C,setShowSessionPrompt:z}),n.quiz&&_&&T.createElement(Pg,{onClose:()=>g(!1),quizState:n.quiz,onEmailResults:v==null?void 0:v.onEmailResults}),T.createElement(Ee.Provider,{value:H},n.quiz.results||M?T.createElement(jh,{resultCardOptions:P,onShare:()=>g(!0),resultsPageOptions:q}):n.quiz.currentQuestion&&T.createElement(T.Fragment,null,T.createElement(Ig,null),T.createElement(Nh,null),T.createElement(bh,{skipQuestionButtonText:k==null?void 0:k.skipQuestionButtonText,ctaButtonText:(A==null?void 0:A.cta_text)||void 0})))):null}const Lg=({selector:e,includeCSS:t=!0,...n})=>{if(document){const r=document.getElementById("cio-quizzes-styles"),i=document.querySelector(e);if(!i){console.error("CioQuiz: There were no elements found for the provided selector");return}r&&(t?r.disabled=!1:r.disabled=!0),Go.createRoot(i).render(T.createElement(T.StrictMode,null,T.createElement(Og,{...n})))}};window&&(window.CioQuiz=Lg);export{Lg as default};
43
+ `,"data-question-key":t.key},n?Ki(t.images,"cio-question-image-container"):"",T.createElement("div",{className:"cio-question-content"},T.createElement(Bl,{title:t==null?void 0:t.title}),T.createElement(Ul,{description:t.description}))):null}function Nh(){var o;const{state:e,getSelectInputProps:t}=j.useContext(Ee);let n,r=!1,i;return e!=null&&e.quiz.currentQuestion&&(n=e.quiz.currentQuestion.next_question,r=n==null?void 0:n.options.some(s=>s.images),i=(n==null?void 0:n.type)===Q.MultipleSelect&&"Select one or more options"),n?T.createElement("div",{className:"cio-select-question-container","data-question-key":n.key},T.createElement("div",{className:"cio-select-question-text"},T.createElement(Bl,{title:n.title}),n!=null&&n.description?T.createElement(Ul,{description:n.description}):""),i&&T.createElement("div",{className:"cio-select-question-instructions"},i),T.createElement("div",{className:`${r?"cio-question-options-container":"cio-question-options-container-text-only"}`},(o=n==null?void 0:n.options)==null?void 0:o.map(s=>t&&T.createElement("div",{...t(s)},s.images?Ki(s.images,"cio-question-option-image"):"",T.createElement("div",{className:"cio-question-option-value"},s==null?void 0:s.value))))):null}function Th(){var r;const{state:e}=j.useContext(Ee),t=(r=e==null?void 0:e.quiz.currentQuestion)==null?void 0:r.next_question,n=Df(t==null?void 0:t.type);return t?T.createElement(T.Fragment,null,n.isOpenQuestion&&T.createElement(Rh,{key:t==null?void 0:t.id}),n.isCoverQuestion&&T.createElement(zh,{key:t==null?void 0:t.id}),n.isSelectQuestion&&T.createElement(Nh,{key:t==null?void 0:t.id})):null}function qh(){return T.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M10.5026 6.00201H11.7529C12.0845 6.00201 12.4025 6.13374 12.637 6.36821C12.8714 6.60268 13.0032 6.92069 13.0032 7.25229V13.2536C13.0032 13.5852 12.8714 13.9032 12.637 14.1377C12.4025 14.3721 12.0845 14.5039 11.7529 14.5039H4.25125C3.91966 14.5039 3.60164 14.3721 3.36717 14.1377C3.1327 13.9032 3.00098 13.5852 3.00098 13.2536V7.25229C3.00098 6.92069 3.1327 6.60268 3.36717 6.36821C3.60164 6.13374 3.91966 6.00201 4.25125 6.00201H5.50152",stroke:"#101010",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M10.5026 4.00116L8.00201 1.50061L5.50146 4.00116",stroke:"#101010",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M8.00146 10.0337V1.50061",stroke:"#101010",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"}))}function Ph(e){const{shareText:t="Share Results",disabled:n,onClick:r,...i}=e,{getShareResultsButtonProps:o}=j.useContext(Ee);return o?T.createElement("button",{...i,...o(),type:"button",onClick:r},T.createElement(qh,null),T.createElement("span",null,t)):null}const Ih="constructorIOQuizState";var gt=(e=>(e.Stale="STALE",e.Loading="LOADING",e.Success="SUCCESS",e.Error="ERROR",e))(gt||{});const Oh="@matched_options",Lh=({summary:e,matchedOptions:t=[]})=>{if(e===null)return{summaryFirstPart:"Based on your answers ",summaryLastPart:" we recommend these matches.",itemsSeparator:", ",lastSeparator:" and ",isActiveSummary:!0};const{text:n="",is_active:r,items_separator:i,last_separator:o}=e,s=!!r&&!!t.length&&!!(n!=null&&n.length),[l,u]=(n==null?void 0:n.split(Oh))||[];return{summaryFirstPart:l,summaryLastPart:u,itemsSeparator:i,lastSeparator:o,isActiveSummary:s}};function Ah({summary:e,matchedOptions:t=[]}){const{summaryFirstPart:n,summaryLastPart:r,itemsSeparator:i,lastSeparator:o,isActiveSummary:s}=Lh({summary:e,matchedOptions:t}),l=xh(t,i,o);return s?T.createElement("p",{className:"cio-results-explanation"},!!(n!=null&&n.length)&&n,!!l.length&&T.createElement("span",null,l),!!(r!=null&&r.length)&&r):null}function Bh({onShare:e,numberOfResults:t,showShareButton:n}){var s,l,u,d;const{state:r}=j.useContext(Ee),i=(s=r==null?void 0:r.quiz)==null?void 0:s.matchedOptions,o=((d=(u=(l=r==null?void 0:r.quiz)==null?void 0:l.resultsConfig)==null?void 0:u.desktop)==null?void 0:d.response_summary)??null;return T.createElement("div",{className:"cio-results-filter-and-redo-container cio-results-button-group"},T.createElement("div",{className:"cio-results-filter-container"},T.createElement(Ah,{summary:o,matchedOptions:i})),T.createElement("div",{className:"cio-results-number-and-share-button-group"},t," ",t===1?"result":"results",n&&T.createElement(Ph,{onClick:e})))}function Pi(e){const{propsGetters:t,ctaText:n="Continue",disabled:r,className:i="cio-button-container",...o}=e;return T.createElement("div",{className:`${i||""}`},t&&T.createElement("button",{...o,...t()},n||"Continue"))}function Uh(){const{getResetQuizButtonProps:e}=j.useContext(Ee);return T.createElement("div",{className:"cio-zero-results"},T.createElement("h3",{className:"cio-zero-results-subtitle"},"Sorry, we couldn’t find products that perfectly match your preferences."),T.createElement(Pi,{ctaText:"Retake Quiz",propsGetters:e}))}function Fh(e){const{item:t,price:n}=e,{getAddToCartButtonProps:r}=j.useContext(Ee);return r?T.createElement("button",{...r(t,n)},"Add to Cart"):null}function Mh(e){const{item:t,price:n}=e,{getAddToFavoritesButtonProps:r}=j.useContext(Ee);return r?T.createElement("button",{...r(t,n)},T.createElement("svg",{width:"21",height:"21",viewBox:"0 0 24 24",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},T.createElement("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"}))):null}function jh(e){var p,C,z,_;const{result:t,salePriceKey:n,regularPriceKey:r,resultPosition:i,ratingCountKey:o,ratingScoreKey:s,renderResultCardPriceDetails:l}=e,{customAddToFavoritesCallback:u,customClickItemCallback:d,getQuizResultButtonProps:m,getQuizResultLinkProps:w}=j.useContext(Ee),S=n&&((p=t==null?void 0:t.data)==null?void 0:p[n]),E=r&&((C=t==null?void 0:t.data)==null?void 0:C[r]),y=o&&((z=t==null?void 0:t.data)==null?void 0:z[o]),a=s&&((_=t==null?void 0:t.data)==null?void 0:_[s]),h=()=>{var g;return T.createElement(T.Fragment,null,T.createElement("div",{className:"cio-result-card-image"},T.createElement("img",{src:(g=t.data)==null?void 0:g.image_url,alt:"product"})),T.createElement("div",{className:"cio-result-card-text"},T.createElement("p",{className:"cio-result-card-title"},t.value),T.createElement("div",{className:"cio-result-card-details"},T.createElement("div",{className:"cio-result-card-rating"},a&&T.createElement("span",{className:"cio-result-card-rating-score"},Array(Number(a)).fill("★"),Array(5-Number(a)).fill("☆")),y&&T.createElement("span",{className:"cio-result-card-rating-count"},"(",y,")")),l?l(t):T.createElement("div",{className:"cio-result-card-prices"},S&&T.createElement("span",{className:"cio-result-card-sale-price"},"$",S),E&&T.createElement("span",{className:`cio-result-card-regular-price${S?"--strike-through":""}`},"$",E)))))},f=()=>m&&T.createElement("div",{...m({result:t,position:i,type:"button"})},h()),c=()=>w&&T.createElement("a",{className:"cio-result-card-anchor",rel:"noreferrer",target:"_blank",...w({result:t,position:i,type:"link"})},h());return T.createElement("div",{className:"cio-result-card"},u&&T.createElement(Mh,{item:t,price:S||E}),d?f():c(),T.createElement(Fh,{item:t,price:S||E}))}function Dh(e){var l,u,d,m;const{resultCardSalePriceKey:t,resultCardRegularPriceKey:n,resultCardRatingCountKey:r,resultCardRatingScoreKey:i,renderResultCardPriceDetails:o}=e,{state:s}=j.useContext(Ee);return T.createElement("div",{className:"cio-results"},(m=(d=(u=(l=s==null?void 0:s.quiz)==null?void 0:l.results)==null?void 0:u.response)==null?void 0:d.results)==null?void 0:m.map((w,S)=>{var E;return T.createElement(jh,{result:w,key:(E=w.data)==null?void 0:E.id,salePriceKey:t,regularPriceKey:n,ratingCountKey:r,ratingScoreKey:i,renderResultCardPriceDetails:o,resultPosition:S+1})}))}function Hf(){return T.createElement("div",{className:"cio-spinner"},T.createElement("div",null),T.createElement("div",null),T.createElement("div",null),T.createElement("div",null))}function Hh({resultsConfig:e}){var i,o;let t="",n="";return e===null&&(t="Here are your results"),(i=e==null?void 0:e.desktop.title)!=null&&i.is_active&&(t=e.desktop.title.text??""),(o=e==null?void 0:e.desktop.description)!=null&&o.is_active&&(n=e.desktop.description.text??""),!!(t||n)?T.createElement("div",{className:"cio-results-title-container"},T.createElement("h1",{className:"cio-results-title"},t),T.createElement("p",{className:"cio-results-description"},n)):null}function bh(){return T.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("g",{clipPath:"url(#clip0_7495_177230)"},T.createElement("path",{d:"M0.667969 2.66699V6.66699H4.66797",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M15.332 13.333V9.33301H11.332",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M13.6613 6.00038C13.3232 5.0449 12.7485 4.19064 11.991 3.51732C11.2334 2.844 10.3177 2.37355 9.32911 2.14988C8.34056 1.92621 7.31147 1.9566 6.33784 2.23823C5.36422 2.51985 4.4778 3.04352 3.7613 3.76038L0.667969 6.66704M15.3346 9.33371L12.2413 12.2404C11.5248 12.9572 10.6384 13.4809 9.66476 13.7625C8.69114 14.0441 7.66204 14.0745 6.67349 13.8509C5.68495 13.6272 4.76917 13.1568 4.01161 12.4834C3.25406 11.8101 2.67941 10.9559 2.3413 10.0004",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"})),T.createElement("defs",null,T.createElement("clipPath",{id:"clip0_7495_177230"},T.createElement("rect",{width:"16",height:"16",fill:"white"}))))}function Vh(e){const{redoText:t="Retake Quiz",disabled:n,...r}=e,{getResetQuizButtonProps:i}=j.useContext(Ee);return i?T.createElement("button",{...r,...i("secondary")},T.createElement(bh,null),T.createElement("span",null,t)):null}function Qh(e){var E,y,a;const{resultCardOptions:t,onShare:n,resultsPageOptions:r}=e,{state:i}=j.useContext(Ee),{resultCardSalePriceKey:o,resultCardRegularPriceKey:s,resultCardRatingCountKey:l,resultCardRatingScoreKey:u,renderResultCardPriceDetails:d}=t||{},m=(a=(y=(E=i==null?void 0:i.quiz.results)==null?void 0:E.response)==null?void 0:y.results)==null?void 0:a.length,w=i==null?void 0:i.quiz.resultsConfig,S=!m;return i!=null&&i.quiz.results?T.createElement("div",{className:"cio-results-container"},!S&&T.createElement(Hh,{resultsConfig:w}),!S&&T.createElement(Bh,{numberOfResults:m,onShare:n,showShareButton:!!(r!=null&&r.showShareResultsButton)}),!S&&T.createElement(Dh,{resultCardSalePriceKey:o,resultCardRegularPriceKey:s,resultCardRatingCountKey:l,resultCardRatingScoreKey:u,renderResultCardPriceDetails:d}),S&&T.createElement(Uh,null),!S&&T.createElement("div",{className:"cio-redo-button-container"},T.createElement(Vh,null))):T.createElement("div",{className:"cio-results-container"},T.createElement(Hf,null))}function Wh(){const{getPreviousQuestionButtonProps:e}=j.useContext(Ee);return e?e&&T.createElement("button",{...e()},T.createElement("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M6.06313 1.06268L0.964522 5.43176C0.882383 5.50218 0.816449 5.58954 0.771245 5.68785C0.726041 5.78615 0.702637 5.89306 0.702637 6.00126C0.702637 6.10946 0.726041 6.21637 0.771245 6.31467C0.816449 6.41297 0.882383 6.50033 0.964522 6.57076L6.06313 10.9398C6.5498 11.3568 7.30153 11.0111 7.30153 10.3703V1.63093C7.30153 0.990168 6.5498 0.644468 6.06313 1.06268Z",fill:"currentColor"}))):null}function Kh(e){const{propsGetters:t,skipQuestionButtonText:n,className:r="cio-button-container",...i}=e,o=n||"Skip";return T.createElement("div",{className:`${r||""}`},t&&T.createElement("button",{...i,...t(),title:o},o))}function Gh(e){const{ctaButtonText:t,skipQuestionButtonText:n}=e,{getNextQuestionButtonProps:r,getSkipQuestionButtonProps:i}=j.useContext(Ee);return T.createElement("div",{className:"cio-question-buttons-container"},T.createElement(Wh,null),T.createElement("div",{className:"cio-question-buttons-group"},T.createElement(Kh,{skipQuestionButtonText:n,propsGetters:i}),T.createElement(Pi,{ctaText:t,propsGetters:r})))}var bf={exports:{}};(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(bf);var Ye=bf.exports,So={exports:{}},ea;function ft(){return ea||(ea=1,function(e){function t(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(So)),So.exports}var Eo={exports:{}},Co={exports:{}},xo={exports:{}},ta;function Un(){return ta||(ta=1,function(e){function t(n){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(xo)),xo.exports}var Ro={exports:{}},na;function Zh(){return na||(na=1,function(e){var t=Un().default;function n(r,i){if(t(r)!=="object"||r===null)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var s=o.call(r,i||"default");if(t(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Ro)),Ro.exports}var ra;function Vf(){return ra||(ra=1,function(e){var t=Un().default,n=Zh();function r(i){var o=n(i,"string");return t(o)==="symbol"?o:String(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Co)),Co.exports}var ia;function dt(){return ia||(ia=1,function(e){var t=Vf();function n(i,o){for(var s=0;s<o.length;s++){var l=o[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(i,t(l.key),l)}}function r(i,o,s){return o&&n(i.prototype,o),s&&n(i,s),Object.defineProperty(i,"prototype",{writable:!1}),i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Eo)),Eo.exports}function Yh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zo={exports:{}},oa;function Jh(){return oa||(oa=1,function(e){(function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n==null)throw new TypeError("Cannot convert first argument to object");for(var r=Object(n),i=1;i<arguments.length;i++){var o=arguments[i];if(o!=null){o=Object(o);for(var s=Object.keys(Object(o)),l=0,u=s.length;u>l;l++){var d=s[l],m=Object.getOwnPropertyDescriptor(o,d);m!==void 0&&m.enumerable&&(r[d]=o[d])}}}return r}});var t=function(n){var r={user_agent:null,persist:!0,cookie_name_client_id:"ConstructorioID_client_id",cookie_name_session_id:"ConstructorioID_session_id",cookie_name_session_data:"ConstructorioID_session",cookie_domain:null,cookie_secure:null,cookie_samesite:null,cookie_days_to_live:365,local_name_client_id:"_constructorio_search_client_id",local_name_session_id:"_constructorio_search_session_id",local_name_session_data:"_constructorio_search_session",on_node:typeof window>"u",session_is_new:null,new_to_beacon:null,client_id_storage_location:"cookie",session_id_storage_location:"local"};if(Object.assign(this,r,n),!this.client_id)if(!this.on_node&&this.persist){var i;this.client_id_storage_location==="cookie"&&(i=this.get_cookie(this.cookie_name_client_id)),this.client_id_storage_location==="local"&&(i=this.get_local_object(this.local_name_client_id)),this.client_id=i||this.generate_client_id()}else this.client_id=this.generate_client_id();this.session_id||(!this.on_node&&this.persist?this.session_id=this.generate_session_id():this.session_id=1),this.on_node||(this.user_agent=this.user_agent||window&&window.navigator&&window.navigator.userAgent)};t.prototype.set_cookie=function(n,r){if(!this.on_node&&this.persist){var i=new Date(Date.now()+this.cookie_days_to_live*24*60*60*1e3),o=n+"="+r+"; expires="+i.toUTCString()+"; path=/";return this.cookie_domain&&(o+="; domain="+this.cookie_domain),this.cookie_secure&&(o+="; secure"),this.cookie_samesite&&(o+="; samesite="+this.cookie_samesite),document.cookie=o,o}return null},t.prototype.get_cookie=function(n){for(var r=n+"=",i=document.cookie.split(";"),o=0;o<i.length;o++){var s=i[o];try{for(var l=decodeURIComponent(s);l.charAt(0)===" ";)l=l.substring(1);if(l.indexOf(r)===0)return l.substring(r.length,l.length)}catch{}}},t.prototype.delete_cookie=function(n){document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"},t.prototype.generate_client_id=function(){var n;if(!this.on_node){var r=this.get_cookie(this.cookie_name_client_id),i=this.get_local_object(this.local_name_client_id);this.client_id_storage_location==="cookie"&&i&&(n=i,this.set_cookie(this.cookie_name_client_id,n),this.delete_local_object(this.local_name_client_id)),this.client_id_storage_location==="local"&&r&&(n=r,this.set_local_object(this.local_name_client_id,n),this.delete_cookie(this.cookie_name_client_id))}return n||(n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(o){var s=Math.random()*16|0,l=o==="x"?s:s&3|8;return l.toString(16)}),this.client_id_storage_location==="cookie"&&this.set_cookie(this.cookie_name_client_id,n),this.client_id_storage_location==="local"&&this.set_local_object(this.local_name_client_id,n)),n},t.prototype.get_local_object=function(n){var r,i=window&&window.localStorage;if(i&&typeof n=="string")try{r=JSON.parse(i.getItem(n))}catch{r=i.getItem(n)}return r},t.prototype.set_local_object=function(n,r){var i=window&&window.localStorage;if(i&&typeof n=="string"){if(typeof r=="object")try{i.setItem(n,JSON.stringify(r))}catch{}if(typeof r=="string"||typeof r=="number")try{i.setItem(n,r)}catch{}}},t.prototype.delete_local_object=function(n){var r=window&&window.localStorage;if(r&&typeof n=="string")try{r.removeItem(n)}catch{}},t.prototype.generate_session_id=function(){var n=this.get_cookie(this.cookie_name_session_data),r=this.get_local_object(this.local_name_session_data),i=Date.now(),o=1e3*60*30,s;if(this.session_id_storage_location==="local"&&(s=this.get_local_object(this.local_name_session_data),!s&&n&&(s=n,this.delete_cookie(this.cookie_name_session_data))),this.session_id_storage_location==="cookie"){s=this.get_cookie(this.cookie_name_session_data);try{s=JSON.parse(s)}catch{}!s&&r&&(s=r,this.delete_local_object(this.local_name_session_data))}var l=1,u=1;s&&typeof s=="object"&&(u=parseInt(s.sessionId,10)||1,s.lastTime>i-o?l=u:l=u+1),this.session_id=l,this.session_is_new=!(s&&u===l),s&&s.newToBeacon&&(this.new_to_beacon=!0);const d={sessionId:l,lastTime:i};return this.session_is_new&&(d.newToBeacon=!0),this.session_id_storage_location==="local"&&(this.set_local_object(this.local_name_session_id,l),this.set_local_object(this.local_name_session_data,d)),this.session_id_storage_location==="cookie"&&(this.set_cookie(this.cookie_name_session_id,l),this.set_cookie(this.cookie_name_session_data,JSON.stringify(d))),l},typeof Yh<"u"&&(e.exports=t)})()}(zo)),zo.exports}var Wr={exports:{}},sa;function Xh(){return sa||(sa=1,function(e,t){(function(n){function r(i){var o=i&&i.Promise||n.Promise,s=i&&i.XMLHttpRequest||n.XMLHttpRequest;return function(){var l=Object.create(n,{fetch:{value:void 0,writable:!0}});return function(u,d){d(t)}(this,function(u){var d=typeof l<"u"&&l||typeof self<"u"&&self||typeof d<"u"&&d,m={searchParams:"URLSearchParams"in d,iterable:"Symbol"in d&&"iterator"in Symbol,blob:"FileReader"in d&&"Blob"in d&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in d,arrayBuffer:"ArrayBuffer"in d};function w(x){return x&&DataView.prototype.isPrototypeOf(x)}if(m.arrayBuffer)var S=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],E=ArrayBuffer.isView||function(x){return x&&S.indexOf(Object.prototype.toString.call(x))>-1};function y(x){if(typeof x!="string"&&(x=String(x)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(x)||x==="")throw new TypeError("Invalid character in header field name");return x.toLowerCase()}function a(x){return typeof x!="string"&&(x=String(x)),x}function h(x){var R={next:function(){var I=x.shift();return{done:I===void 0,value:I}}};return m.iterable&&(R[Symbol.iterator]=function(){return R}),R}function f(x){this.map={},x instanceof f?x.forEach(function(R,I){this.append(I,R)},this):Array.isArray(x)?x.forEach(function(R){this.append(R[0],R[1])},this):x&&Object.getOwnPropertyNames(x).forEach(function(R){this.append(R,x[R])},this)}f.prototype.append=function(x,R){x=y(x),R=a(R);var I=this.map[x];this.map[x]=I?I+", "+R:R},f.prototype.delete=function(x){delete this.map[y(x)]},f.prototype.get=function(x){return x=y(x),this.has(x)?this.map[x]:null},f.prototype.has=function(x){return this.map.hasOwnProperty(y(x))},f.prototype.set=function(x,R){this.map[y(x)]=a(R)},f.prototype.forEach=function(x,R){for(var I in this.map)this.map.hasOwnProperty(I)&&x.call(R,this.map[I],I,this)},f.prototype.keys=function(){var x=[];return this.forEach(function(R,I){x.push(I)}),h(x)},f.prototype.values=function(){var x=[];return this.forEach(function(R){x.push(R)}),h(x)},f.prototype.entries=function(){var x=[];return this.forEach(function(R,I){x.push([I,R])}),h(x)},m.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function c(x){if(x.bodyUsed)return o.reject(new TypeError("Already read"));x.bodyUsed=!0}function p(x){return new o(function(R,I){x.onload=function(){R(x.result)},x.onerror=function(){I(x.error)}})}function C(x){var R=new FileReader,I=p(R);return R.readAsArrayBuffer(x),I}function z(x){var R=new FileReader,I=p(R);return R.readAsText(x),I}function _(x){for(var R=new Uint8Array(x),I=new Array(R.length),L=0;L<R.length;L++)I[L]=String.fromCharCode(R[L]);return I.join("")}function g(x){if(x.slice)return x.slice(0);var R=new Uint8Array(x.byteLength);return R.set(new Uint8Array(x)),R.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(x){this.bodyUsed=this.bodyUsed,this._bodyInit=x,x?typeof x=="string"?this._bodyText=x:m.blob&&Blob.prototype.isPrototypeOf(x)?this._bodyBlob=x:m.formData&&FormData.prototype.isPrototypeOf(x)?this._bodyFormData=x:m.searchParams&&URLSearchParams.prototype.isPrototypeOf(x)?this._bodyText=x.toString():m.arrayBuffer&&m.blob&&w(x)?(this._bodyArrayBuffer=g(x.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):m.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(x)||E(x))?this._bodyArrayBuffer=g(x):this._bodyText=x=Object.prototype.toString.call(x):this._bodyText="",this.headers.get("content-type")||(typeof x=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):m.searchParams&&URLSearchParams.prototype.isPrototypeOf(x)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},m.blob&&(this.blob=function(){var x=c(this);if(x)return x;if(this._bodyBlob)return o.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return o.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var x=c(this);return x||(ArrayBuffer.isView(this._bodyArrayBuffer)?o.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):o.resolve(this._bodyArrayBuffer))}else return this.blob().then(C)}),this.text=function(){var x=c(this);if(x)return x;if(this._bodyBlob)return z(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(_(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return o.resolve(this._bodyText)},m.formData&&(this.formData=function(){return this.text().then(q)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function k(x){var R=x.toUpperCase();return N.indexOf(R)>-1?R:x}function P(x,R){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R=R||{};var I=R.body;if(x instanceof P){if(x.bodyUsed)throw new TypeError("Already read");this.url=x.url,this.credentials=x.credentials,R.headers||(this.headers=new f(x.headers)),this.method=x.method,this.mode=x.mode,this.signal=x.signal,!I&&x._bodyInit!=null&&(I=x._bodyInit,x.bodyUsed=!0)}else this.url=String(x);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new f(R.headers)),this.method=k(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(I),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var L=/([?&])_=[^&]*/;if(L.test(this.url))this.url=this.url.replace(L,"$1_="+new Date().getTime());else{var F=/\?/;this.url+=(F.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function q(x){var R=new FormData;return x.trim().split("&").forEach(function(I){if(I){var L=I.split("="),F=L.shift().replace(/\+/g," "),U=L.join("=").replace(/\+/g," ");R.append(decodeURIComponent(F),decodeURIComponent(U))}}),R}function O(x){var R=new f,I=x.replace(/\r?\n[\t ]+/g," ");return I.split("\r").map(function(L){return L.indexOf(`
44
+ `)===0?L.substr(1,L.length):L}).forEach(function(L){var F=L.split(":"),U=F.shift().trim();if(U){var V=F.join(":").trim();R.append(U,V)}}),R}v.call(P.prototype);function M(x,R){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R||(R={}),this.type="default",this.status=R.status===void 0?200:R.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in R?R.statusText:"",this.headers=new f(R.headers),this.url=R.url||"",this._initBody(x)}v.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},M.error=function(){var x=new M(null,{status:0,statusText:""});return x.type="error",x};var H=[301,302,303,307,308];M.redirect=function(x,R){if(H.indexOf(R)===-1)throw new RangeError("Invalid status code");return new M(null,{status:R,headers:{location:x}})},u.DOMException=d.DOMException;try{new u.DOMException}catch{u.DOMException=function(R,I){this.message=R,this.name=I;var L=Error(R);this.stack=L.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function A(x,R){return new o(function(I,L){var F=new P(x,R);if(F.signal&&F.signal.aborted)return L(new u.DOMException("Aborted","AbortError"));var U=new s;function V(){U.abort()}U.onload=function(){var b={status:U.status,statusText:U.statusText,headers:O(U.getAllResponseHeaders()||"")};b.url="responseURL"in U?U.responseURL:b.headers.get("X-Request-URL");var K="response"in U?U.response:U.responseText;setTimeout(function(){I(new M(K,b))},0)},U.onerror=function(){setTimeout(function(){L(new TypeError("Network request failed"))},0)},U.ontimeout=function(){setTimeout(function(){L(new TypeError("Network request failed"))},0)},U.onabort=function(){setTimeout(function(){L(new u.DOMException("Aborted","AbortError"))},0)};function W(b){try{return b===""&&d.location.href?d.location.href:b}catch{return b}}U.open(F.method,W(F.url),!0),F.credentials==="include"?U.withCredentials=!0:F.credentials==="omit"&&(U.withCredentials=!1),"responseType"in U&&(m.blob?U.responseType="blob":m.arrayBuffer&&F.headers.get("Content-Type")&&F.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(U.responseType="arraybuffer")),R&&typeof R.headers=="object"&&!(R.headers instanceof f)?Object.getOwnPropertyNames(R.headers).forEach(function(b){U.setRequestHeader(b,a(R.headers[b]))}):F.headers.forEach(function(b,K){U.setRequestHeader(K,b)}),F.signal&&(F.signal.addEventListener("abort",V),U.onreadystatechange=function(){U.readyState===4&&F.signal.removeEventListener("abort",V)}),U.send(typeof F._bodyInit>"u"?null:F._bodyInit)})}A.polyfill=!0,d.fetch||(d.fetch=A,d.Headers=f,d.Request=P,d.Response=M),u.Headers=f,u.Request=P,u.Response=M,u.fetch=A,Object.defineProperty(u,"__esModule",{value:!0})}),{fetch:l.fetch,Headers:l.Headers,Request:l.Request,Response:l.Response,DOMException:l.DOMException}}()}e.exports=r})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Jn)}(Wr,Wr.exports)),Wr.exports}var No={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */var la;function $h(){return la||(la=1,function(e){(function(t){t(typeof DO_NOT_EXPORT_CRC>"u"?e:{})})(function(t){t.version="1.2.2";function n(){for(var v=0,N=new Array(256),k=0;k!=256;++k)v=k,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,N[k]=v;return typeof Int32Array<"u"?new Int32Array(N):N}var r=n();function i(v){var N=0,k=0,P=0,q=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(P=0;P!=256;++P)q[P]=v[P];for(P=0;P!=256;++P)for(k=v[P],N=256+P;N<4096;N+=256)k=q[N]=k>>>8^v[k&255];var O=[];for(P=1;P!=16;++P)O[P-1]=typeof Int32Array<"u"?q.subarray(P*256,P*256+256):q.slice(P*256,P*256+256);return O}var o=i(r),s=o[0],l=o[1],u=o[2],d=o[3],m=o[4],w=o[5],S=o[6],E=o[7],y=o[8],a=o[9],h=o[10],f=o[11],c=o[12],p=o[13],C=o[14];function z(v,N){for(var k=N^-1,P=0,q=v.length;P<q;)k=k>>>8^r[(k^v.charCodeAt(P++))&255];return~k}function _(v,N){for(var k=N^-1,P=v.length-15,q=0;q<P;)k=C[v[q++]^k&255]^p[v[q++]^k>>8&255]^c[v[q++]^k>>16&255]^f[v[q++]^k>>>24]^h[v[q++]]^a[v[q++]]^y[v[q++]]^E[v[q++]]^S[v[q++]]^w[v[q++]]^m[v[q++]]^d[v[q++]]^u[v[q++]]^l[v[q++]]^s[v[q++]]^r[v[q++]];for(P+=15;q<P;)k=k>>>8^r[(k^v[q++])&255];return~k}function g(v,N){for(var k=N^-1,P=0,q=v.length,O=0,M=0;P<q;)O=v.charCodeAt(P++),O<128?k=k>>>8^r[(k^O)&255]:O<2048?(k=k>>>8^r[(k^(192|O>>6&31))&255],k=k>>>8^r[(k^(128|O&63))&255]):O>=55296&&O<57344?(O=(O&1023)+64,M=v.charCodeAt(P++)&1023,k=k>>>8^r[(k^(240|O>>8&7))&255],k=k>>>8^r[(k^(128|O>>2&63))&255],k=k>>>8^r[(k^(128|M>>6&15|(O&3)<<4))&255],k=k>>>8^r[(k^(128|M&63))&255]):(k=k>>>8^r[(k^(224|O>>12&15))&255],k=k>>>8^r[(k^(128|O>>6&63))&255],k=k>>>8^r[(k^(128|O&63))&255]);return~k}t.table=r,t.bstr=z,t.buf=_,t.str=g})}(No)),No}var To,ua;function Fl(){if(ua)return To;ua=1;var e={overflow:{},get:function(i){var o=this.overflow[i];if(o)return o;if(typeof sessionStorage>"u")return null;var s=sessionStorage.getItem(i);if(s)try{return JSON.parse(s)}catch{return s}return null},set:function(i,o){try{sessionStorage.setItem(i,JSON.stringify(o))}catch{this.overflow[i]=o}},remove:function(i){var o;(o=this.overflow)!==null&&o!==void 0&&o[i]&&delete this.overflow[i],typeof sessionStorage<"u"&&sessionStorage.removeItem(i)},key:function(i){var o,s;if(typeof sessionStorage>"u"){var l;return(l=Object.keys(this.overflow))===null||l===void 0?void 0:l[i]}var u=(o=sessionStorage)===null||o===void 0?void 0:o.key(i),d=((s=sessionStorage)===null||s===void 0?void 0:s.length)||0;if(i>=d){var m,w=i-d;return(m=Object.keys(this.overflow))===null||m===void 0?void 0:m[w]}return u},length:function(){var i=Object.keys(this.overflow).length;return typeof sessionStorage>"u"?i:sessionStorage.length+i},clear:function(){this.overflow={},typeof sessionStorage<"u"&&sessionStorage.clear()}},t={overflow:{},get:function(i){var o=this.overflow[i];if(o)return o;if(typeof localStorage>"u")return null;var s=localStorage.getItem(i);if(s)try{return JSON.parse(s)}catch{return s}return null},set:function(i,o){try{localStorage.setItem(i,JSON.stringify(o))}catch{this.overflow[i]=o}},remove:function(i){var o;(o=this.overflow)!==null&&o!==void 0&&o[i]&&delete this.overflow[i],typeof localStorage<"u"&&localStorage.removeItem(i)},key:function(i){var o,s;if(typeof localStorage>"u"){var l;return(l=Object.keys(this.overflow))===null||l===void 0?void 0:l[i]}var u=(o=localStorage)===null||o===void 0?void 0:o.key(i),d=((s=localStorage)===null||s===void 0?void 0:s.length)||0;if(i>=d){var m,w=i-d;return(m=Object.keys(this.overflow))===null||m===void 0?void 0:m[w]}return u},length:function(){var i=Object.keys(this.overflow).length;return typeof localStorage>"u"?i:localStorage.length+i},clear:function(){this.overflow={},typeof localStorage<"u"&&localStorage.clear()}},n={local:t,session:e};return To=n,To}var qo,aa;function ot(){if(aa)return qo;aa=1;var e=Ye,t=e(Un()),n=$h(),r=Fl(),i="_constructorio_purchase_order_ids",o=[{pattern:/[\w\-+\\.]+@([\w-]+\.)+[\w-]{2,4}/,replaceBy:"<email_omitted>"},{pattern:/^(?:\+\d{11,12}|\+\d{1,3}\s\d{3}\s\d{3}\s\d{3,4}|\(\d{3}\)\d{7}|\(\d{3}\)\s\d{3}\s\d{4}|\(\d{3}\)\d{3}-\d{4}|\(\d{3}\)\s\d{3}-\d{4})$/,replaceBy:"<phone_omitted>"},{pattern:/^(?:4[0-9]{15}|(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})$/,replaceBy:"<credit_omitted>"}],s={trimNonBreakingSpaces:function(u){return u.replace(/\s/g," ").trim()},encodeURIComponentRFC3986:function(u){return encodeURIComponent(u).replace(/[!'()*]/g,function(d){return"%".concat(d.charCodeAt(0).toString(16).toUpperCase())})},cleanParams:function(u){var d={};return Object.keys(u).forEach(function(m){var w=u[m];typeof w=="string"?d[m]=s.trimNonBreakingSpaces(w):d[m]=w}),d},throwHttpErrorFromResponse:function(u,d){return d.json().then(function(m){throw u.message=m.message,u.status=d.status,u.statusText=d.statusText,u.url=d.url,u.headers=d.headers,u})},canUseDOM:function(){return!!(typeof window<"u"&&window.document&&window.document.createElement)},addEventListener:function(u,d,m){s.canUseDOM()&&window.addEventListener(u,d,m)},removeEventListener:function(u,d,m){s.canUseDOM()&&window.removeEventListener(u,d,m)},getNavigator:function(){return s.canUseDOM()?window.navigator:{userAgent:"",webdriver:!1}},isNil:function(u){return u==null},getWindowLocation:function(){return s.canUseDOM()?window.location:{}},dispatchEvent:function(u){s.canUseDOM()&&window.dispatchEvent(u)},createCustomEvent:function(u,d){if(s.canUseDOM())try{return new window.CustomEvent(u,{detail:d})}catch{var m=document.createEvent("CustomEvent");return m.initCustomEvent(u,!1,!1,d),m}return null},hasOrderIdRecord:function(u){var d=n.str(u.toString()),m=r.local.get(i);return typeof m=="string"&&(m=JSON.parse(m)),m&&m.includes(d)?!0:null},addOrderIdRecord:function(u){var d=n.str(u.toString()),m=r.local.get(i);if(typeof m=="string"&&(m=JSON.parse(m)),m){if(m.includes(d))return;m.length>=10&&(m=m.slice(-9)),m.push(d)}else m=[d];r.local.set(i,m)},applyNetworkTimeout:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,w=u&&u.networkParameters&&u.networkParameters.timeout,S=d&&d.timeout,E=S||w;typeof E=="number"&&m&&setTimeout(function(){return m.abort()},E)},stringify:function(u,d,m){if(!u)return"";var w=[];return Object.keys(u).forEach(function(S){var E=u[S],y=s.encodeURIComponentRFC3986(S),a;if(E!=null){var h=d?"".concat(d,"%5B").concat(y,"%5D"):y;Array.isArray(E)?a=s.stringify(E,h,"array"):(0,t.default)(E)==="object"?a=s.stringify(E,h,"object"):m==="object"?a="".concat(h,"=").concat(s.encodeURIComponentRFC3986(E)):a="".concat(d||y,"=").concat(s.encodeURIComponentRFC3986(E)),w.push(a)}}),w.join("&")},toSnakeCase:function(u){return u.replace(/[A-Z]/g,function(d){return"_".concat(d.toLowerCase())})},toSnakeCaseKeys:function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,m={};return Object.keys(u).forEach(function(w){var S=s.toSnakeCase(w);m[S]=d&&(0,t.default)(u[w])==="object"&&!Array.isArray(u[w])?s.toSnakeCaseKeys(u[w],d):u[w]}),m},containsPii:function(u,d){var m=u.toLowerCase();return d.test(m)},obfuscatePiiRequest:function(u){var d=u;try{var m,w,S=new URL(u),E=(m=decodeURI(S==null?void 0:S.pathname))===null||m===void 0?void 0:m.split("/"),y=(w=decodeURIComponent(S==null?void 0:S.search))===null||w===void 0?void 0:w.split("&").map(function(a){var h;return a==null||(h=a.split("="))===null||h===void 0?void 0:h[1]});o.forEach(function(a){E.forEach(function(h){s.containsPii(h,a.pattern)&&(d=d.replaceAll(h,a.replaceBy))}),y.forEach(function(h){s.containsPii(h,a.pattern)&&(d=d.replaceAll(h,a.replaceBy))})})}catch{}return d}};return qo=s,qo}var Po,ca;function Fn(){if(ca)return Po;ca=1;var e=Ye,t=e(ft()),n=e(dt()),r=ot(),i=function(){function o(s){var l=this;(0,t.default)(this,o),this.events=[],this.enabled=!(s&&s.enabled===!1),this.waitForBeacon=!(s&&s.waitForBeacon===!1),this.active=this.enabled,this.waitForBeacon&&(this.active=!1,r.canUseDOM()&&(window.ConstructorioAutocomplete||window.ConstructorioBeacon||window.ConstructorioTracker)&&this.enabled&&(this.active=!0,this.dispatchEvents()),r.addEventListener("cio.beacon.loaded",function(){l.enabled&&(l.active=!0,l.dispatchEvents())}))}return(0,n.default)(o,[{key:"queue",value:function(l,u){this.events.push({name:l,data:u}),this.active&&this.dispatchEvents()}},{key:"dispatchEvents",value:function(){for(;this.events.length;){var l=this.events.shift(),u=l.name,d=l.data,m="cio.client.".concat(u);r.dispatchEvent(r.createCustomEvent(m,d))}}}]),o}();return Po=i,Po}var Io,fa;function ev(){if(fa)return Io;fa=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fn(),i=ot();function o(l,u,d){var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,w=d.apiKey,S=d.version,E=d.serviceUrl,y=d.sessionId,a=d.clientId,h=d.userId,f=d.segments,c=d.testCells,p={c:S};if(p.key=w,p.i=a,p.s=y,!l||typeof l!="string")throw new Error("query is a required parameter of type string");if(c&&Object.keys(c).forEach(function(I){p["ef-".concat(I)]=c[I]}),f&&f.length&&(p.us=f),h&&(p.ui=String(h)),u){var C=u.offset,z=u.page,_=u.resultsPerPage,g=u.filters,v=u.sortBy,N=u.sortOrder,k=u.section,P=u.fmtOptions,q=u.hiddenFields,O=u.hiddenFacets,M=u.variationsMap,H=u.qsParam,A=u.preFilterExpression;i.isNil(C)||(p.offset=C),i.isNil(z)||(p.page=z),i.isNil(_)||(p.num_results_per_page=_),g&&(p.filters=g),v&&(p.sort_by=v),N&&(p.sort_order=N),k&&(p.section=k),P&&(p.fmt_options=P),q&&(p.fmt_options?p.fmt_options.hidden_fields=q:p.fmt_options={hidden_fields:q}),O&&(p.fmt_options?p.fmt_options.hidden_facets=O:p.fmt_options={hidden_facets:O}),M&&(p.variations_map=JSON.stringify(M)),A&&(p.pre_filter_expression=JSON.stringify(A)),H&&(p.qs=JSON.stringify(H))}p._dt=Date.now(),p=i.cleanParams(p);var x=i.stringify(p),R=m?"search/natural_language":"search";return"".concat(E,"/").concat(R,"/").concat(i.encodeURIComponentRFC3986(i.trimNonBreakingSpaces(l)),"?").concat(x)}var s=function(){function l(u){(0,t.default)(this,l),this.options=u||{},this.eventDispatcher=new r(u.eventDispatcher)}return(0,n.default)(l,[{key:"getSearchResults",value:function(d,m){var w=this,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E,y=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,S,h)}try{E=o(d,m,this.options)}catch(f){return Promise.reject(f)}return y(E,{signal:a}).then(function(f){return f.ok?f.json():i.throwHttpErrorFromResponse(new Error,f)}).then(function(f){if(f.response&&f.response.results)return f.result_id&&f.response.results.forEach(function(c){c.result_id=f.result_id}),w.eventDispatcher.queue("search.getSearchResults.completed",f),f;if(f.response&&f.response.redirect)return w.eventDispatcher.queue("search.getSearchResults.completed",f),f;throw new Error("getSearchResults response data is malformed")})}},{key:"getVoiceSearchResults",value:function(d,m){var w=this,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E,y=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,S,h)}try{var f=!0;E=o(d,m,this.options,f)}catch(c){return Promise.reject(c)}return y(E,{signal:a}).then(function(c){return c.ok?c.json():i.throwHttpErrorFromResponse(new Error,c)}).then(function(c){if(c.response&&c.response.results)return c.result_id&&c.response.results.forEach(function(p){p.result_id=c.result_id}),w.eventDispatcher.queue("search.getVoiceSearchResults.completed",c),c;if(c.response&&c.response.redirect)return w.eventDispatcher.queue("search.getVoiceSearchResults.completed",c),c;throw new Error("getVoiceSearchResults response data is malformed")})}}]),l}();return Io=s,Io}var Oo={exports:{}},da;function Qf(){return da||(da=1,function(e){var t=Vf();function n(r,i,o){return i=t(i),i in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Oo)),Oo.exports}var Lo,pa;function tv(){if(pa)return Lo;pa=1;var e=Ye,t=e(ft()),n=e(dt()),r=e(Qf());function i(y,a){var h=Object.keys(y);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(y);a&&(f=f.filter(function(c){return Object.getOwnPropertyDescriptor(y,c).enumerable})),h.push.apply(h,f)}return h}function o(y){for(var a=1;a<arguments.length;a++){var h=arguments[a]!=null?arguments[a]:{};a%2?i(Object(h),!0).forEach(function(f){(0,r.default)(y,f,h[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(h)):i(Object(h)).forEach(function(f){Object.defineProperty(y,f,Object.getOwnPropertyDescriptor(h,f))})}return y}var s=Fn(),l=ot();function u(y,a){var h=a.apiKey,f=a.version,c=a.sessionId,p=a.clientId,C=a.userId,z=a.segments,_=a.testCells,g={c:f};if(g.key=h,g.i=p,g.s=c,_&&Object.keys(_).forEach(function(F){g["ef-".concat(F)]=_[F]}),z&&z.length&&(g.us=z),C&&(g.ui=String(C)),y){var v=y.page,N=y.offset,k=y.resultsPerPage,P=y.filters,q=y.sortBy,O=y.sortOrder,M=y.section,H=y.fmtOptions,A=y.hiddenFields,x=y.hiddenFacets,R=y.variationsMap,I=y.qsParam,L=y.preFilterExpression;l.isNil(v)||(g.page=v),l.isNil(N)||(g.offset=N),l.isNil(k)||(g.num_results_per_page=k),P&&(g.filters=P),q&&(g.sort_by=q),O&&(g.sort_order=O),M&&(g.section=M),H&&(g.fmt_options=H),A&&(g.fmt_options?g.fmt_options.hidden_fields=A:g.fmt_options={hidden_fields:A}),x&&(g.fmt_options?g.fmt_options.hidden_facets=x:g.fmt_options={hidden_facets:x}),R&&(g.variations_map=JSON.stringify(R)),L&&(g.pre_filter_expression=JSON.stringify(L)),I&&(g.qs=JSON.stringify(I))}return g._dt=Date.now(),g=l.cleanParams(g),g}function d(y,a,h,f){var c=f.serviceUrl;if(!y||typeof y!="string")throw new Error("filterName is a required parameter of type string");if(!a||typeof a!="string")throw new Error("filterValue is a required parameter of type string");var p=u(h,f),C=l.stringify(p);return"".concat(c,"/browse/").concat(l.encodeURIComponentRFC3986(l.trimNonBreakingSpaces(y)),"/").concat(l.encodeURIComponentRFC3986(l.trimNonBreakingSpaces(a)),"?").concat(C)}function m(y,a,h){var f=h.serviceUrl;if(!y||!Array.isArray(y)||!y.length)throw new Error("ids is a required parameter of type array");var c=o(o({},u(a,h)),{},{ids:y}),p=l.stringify(c);return"".concat(f,"/browse/items?").concat(p)}function w(y,a){var h=a.serviceUrl,f=o({},u(y,a));delete f._dt;var c=l.stringify(f);return"".concat(h,"/browse/facets?").concat(c)}function S(y,a,h){var f=h.serviceUrl;if(!y||typeof y!="string")throw new Error("facetName is a required parameter of type string");var c=o({},u(a,h));c.facet_name=y,delete c._dt;var p=l.stringify(c);return"".concat(f,"/browse/facet_options?").concat(p)}var E=function(){function y(a){(0,t.default)(this,y),this.options=a||{},this.eventDispatcher=new s(a.eventDispatcher)}return(0,n.default)(y,[{key:"getBrowseResults",value:function(h,f,c){var p=this,C=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},z,_=this.options.fetch,g;if(typeof AbortController=="function"){var v=new AbortController;g=v&&v.signal,l.applyNetworkTimeout(this.options,C,v)}try{z=d(h,f,c,this.options)}catch(N){return Promise.reject(N)}return _(z,{signal:g}).then(function(N){return N.ok?N.json():l.throwHttpErrorFromResponse(new Error,N)}).then(function(N){if(N.response&&N.response.results)return N.result_id&&N.response.results.forEach(function(k){k.result_id=N.result_id}),p.eventDispatcher.queue("browse.getBrowseResults.completed",N),N;throw new Error("getBrowseResults response data is malformed")})}},{key:"getBrowseResultsForItemIds",value:function(h,f){var c=this,p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C,z=this.options.fetch,_;if(typeof AbortController=="function"){var g=new AbortController;_=g&&g.signal,l.applyNetworkTimeout(this.options,p,g)}try{C=m(h,f,this.options)}catch(v){return Promise.reject(v)}return z(C,{signal:_}).then(function(v){return v.ok?v.json():l.throwHttpErrorFromResponse(new Error,v)}).then(function(v){if(v.response&&v.response.results)return v.result_id&&v.response.results.forEach(function(N){N.result_id=v.result_id}),c.eventDispatcher.queue("browse.getBrowseResultsForItemIds.completed",v),v;throw new Error("getBrowseResultsForItemIds response data is malformed")})}},{key:"getBrowseGroups",value:function(h){var f=this,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=this.options.fetch,C=this.options.serviceUrl,z=u(h,this.options),_;if(typeof AbortController=="function"){var g=new AbortController;_=g&&g.signal,l.applyNetworkTimeout(this.options,c,g)}delete z._dt;var v=l.stringify(z),N="".concat(C,"/browse/groups?").concat(v);return p(N,{signal:_}).then(function(k){return k.ok?k.json():l.throwHttpErrorFromResponse(new Error,k)}).then(function(k){if(k.response&&k.response.groups)return f.eventDispatcher.queue("browse.getBrowseGroups.completed",k),k;throw new Error("getBrowseGroups response data is malformed")})}},{key:"getBrowseFacets",value:function(h,f){var c=this,p,C=this.options.fetch,z;if(typeof AbortController=="function"){var _=new AbortController;z=_&&_.signal,l.applyNetworkTimeout(this.options,f,_)}try{p=w(h,this.options)}catch(g){return Promise.reject(g)}return C(p,{signal:z}).then(function(g){return g.ok?g.json():l.throwHttpErrorFromResponse(new Error,g)}).then(function(g){if(g.response&&g.response.facets)return c.eventDispatcher.queue("browse.getBrowseFacets.completed",g),g;throw new Error("getBrowseFacets response data is malformed")})}},{key:"getBrowseFacetOptions",value:function(h){var f=this,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C,z=this.options.fetch,_;if(typeof AbortController=="function"){var g=new AbortController;_=g&&g.signal,l.applyNetworkTimeout(this.options,p,g)}try{C=S(h,c,this.options)}catch(v){return Promise.reject(v)}return z(C,{signal:_}).then(function(v){return v.ok?v.json():l.throwHttpErrorFromResponse(new Error,v)}).then(function(v){if(v.response&&v.response.facets)return f.eventDispatcher.queue("browse.getBrowseFacetOptions.completed",v),v;throw new Error("getBrowseFacetOptions response data is malformed")})}}]),y}();return Lo=E,Lo}var Ao,ha;function nv(){if(ha)return Ao;ha=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fn(),i=ot(),o=i.throwHttpErrorFromResponse,s=i.cleanParams,l=i.applyNetworkTimeout,u=i.trimNonBreakingSpaces,d=i.encodeURIComponentRFC3986,m=i.stringify;function w(E,y,a){var h=a.apiKey,f=a.version,c=a.serviceUrl,p=a.sessionId,C=a.clientId,z=a.userId,_=a.segments,g=a.testCells,v={c:f};if(v.key=h,v.i=C,v.s=p,!E||typeof E!="string")throw new Error("query is a required parameter of type string");if(g&&Object.keys(g).forEach(function(x){v["ef-".concat(x)]=g[x]}),_&&_.length&&(v.us=_),z&&(v.ui=String(z)),y){var N=y.numResults,k=y.resultsPerSection,P=y.filters,q=y.filtersPerSection,O=y.hiddenFields,M=y.variationsMap;N&&(v.num_results=N),k&&Object.keys(k).forEach(function(x){v["num_results_".concat(x)]=k[x]}),P&&(v.filters=P),q&&Object.keys(q).forEach(function(x){v["filters[".concat(x,"]")]=q[x]}),O&&(v.fmt_options?v.fmt_options.hidden_fields=O:v.fmt_options={hidden_fields:O}),M&&(v.variations_map=JSON.stringify(M))}v._dt=Date.now(),v=s(v);var H=m(v),A=E.replace(/^\//,"|");return"".concat(c,"/autocomplete/").concat(d(u(A)),"?").concat(H)}var S=function(){function E(y){(0,t.default)(this,E),this.options=y||{},this.eventDispatcher=new r(y.eventDispatcher)}return(0,n.default)(E,[{key:"getAutocompleteResults",value:function(a,h){var f=this,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},p,C=this.options.fetch,z;if(typeof AbortController=="function"){var _=new AbortController;z=_&&_.signal,l(this.options,c,_)}try{p=w(a,h,this.options)}catch(g){return Promise.reject(g)}return C(p,{signal:z}).then(function(g){return g.ok?g.json():o(new Error,g)}).then(function(g){if(g.sections){if(g.result_id){var v=Object.keys(g.sections);v.forEach(function(N){var k=g.sections[N];k.length&&k.forEach(function(P){P.result_id=g.result_id})})}return f.eventDispatcher.queue("autocomplete.getAutocompleteResults.completed",g),g}throw new Error("getAutocompleteResults response data is malformed")})}}]),E}();return Ao=S,Ao}var Bo,va;function rv(){if(va)return Bo;va=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fn(),i=ot();function o(l,u,d){var m=d.apiKey,w=d.version,S=d.serviceUrl,E=d.sessionId,y=d.userId,a=d.clientId,h=d.segments,f={c:w};if(f.key=m,f.i=a,f.s=E,!l||typeof l!="string")throw new Error("podId is a required parameter of type string");if(h&&h.length&&(f.us=h),y&&(f.ui=String(y)),u){var c=u.numResults,p=u.itemIds,C=u.section,z=u.term,_=u.filters,g=u.variationsMap,v=u.hiddenFields;i.isNil(c)||(f.num_results=c),p&&(f.item_id=p),C&&(f.section=C),z&&(f.term=z),_&&(f.filters=_),v&&(f.fmt_options?f.fmt_options.hidden_fields=v:f.fmt_options={hidden_fields:v}),g&&(f.variations_map=JSON.stringify(g))}f=i.cleanParams(f);var N=i.stringify(f);return"".concat(S,"/recommendations/v1/pods/").concat(i.encodeURIComponentRFC3986(i.trimNonBreakingSpaces(l)),"?").concat(N)}var s=function(){function l(u){(0,t.default)(this,l),this.options=u||{},this.eventDispatcher=new r(u.eventDispatcher)}return(0,n.default)(l,[{key:"getRecommendations",value:function(d,m){var w=this,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E,y=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,S,h)}try{E=o(d,m,this.options)}catch(f){return Promise.reject(f)}return y(E,{signal:a}).then(function(f){return f.ok?f.json():i.throwHttpErrorFromResponse(new Error,f)}).then(function(f){if(f.response&&f.response.results)return f.result_id&&f.response.results.forEach(function(c){c.result_id=f.result_id}),w.eventDispatcher.queue("recommendations.getRecommendations.completed",f),f;throw new Error("getRecommendations response data is malformed")})}}]),l}();return Bo=s,Bo}var Kr={exports:{}},ga;function iv(){if(ga)return Kr.exports;ga=1;var e=Ye,t=e(Un()),n=(typeof Reflect>"u"?"undefined":(0,t.default)(Reflect))==="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(g,v,N){return Function.prototype.apply.call(g,v,N)},i;n&&typeof n.ownKeys=="function"?i=n.ownKeys:Object.getOwnPropertySymbols?i=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:i=function(g){return Object.getOwnPropertyNames(g)};function o(_){console&&console.warn&&console.warn(_)}var s=Number.isNaN||function(g){return g!==g};function l(){l.init.call(this)}Kr.exports=l,Kr.exports.once=p,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var u=10;function d(_){if(typeof _!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+(0,t.default)(_))}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(g){if(typeof g!="number"||g<0||s(g))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+g+".");u=g}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||s(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function m(_){return _._maxListeners===void 0?l.defaultMaxListeners:_._maxListeners}l.prototype.getMaxListeners=function(){return m(this)},l.prototype.emit=function(g){for(var v=[],N=1;N<arguments.length;N++)v.push(arguments[N]);var k=g==="error",P=this._events;if(P!==void 0)k=k&&P.error===void 0;else if(!k)return!1;if(k){var q;if(v.length>0&&(q=v[0]),q instanceof Error)throw q;var O=new Error("Unhandled error."+(q?" ("+q.message+")":""));throw O.context=q,O}var M=P[g];if(M===void 0)return!1;if(typeof M=="function")r(M,this,v);else for(var H=M.length,A=h(M,H),N=0;N<H;++N)r(A[N],this,v);return!0};function w(_,g,v,N){var k,P,q;if(d(v),P=_._events,P===void 0?(P=_._events=Object.create(null),_._eventsCount=0):(P.newListener!==void 0&&(_.emit("newListener",g,v.listener?v.listener:v),P=_._events),q=P[g]),q===void 0)q=P[g]=v,++_._eventsCount;else if(typeof q=="function"?q=P[g]=N?[v,q]:[q,v]:N?q.unshift(v):q.push(v),k=m(_),k>0&&q.length>k&&!q.warned){q.warned=!0;var O=new Error("Possible EventEmitter memory leak detected. "+q.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");O.name="MaxListenersExceededWarning",O.emitter=_,O.type=g,O.count=q.length,o(O)}return _}l.prototype.addListener=function(g,v){return w(this,g,v,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(g,v){return w(this,g,v,!0)};function S(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E(_,g,v){var N={fired:!1,wrapFn:void 0,target:_,type:g,listener:v},k=S.bind(N);return k.listener=v,N.wrapFn=k,k}l.prototype.once=function(g,v){return d(v),this.on(g,E(this,g,v)),this},l.prototype.prependOnceListener=function(g,v){return d(v),this.prependListener(g,E(this,g,v)),this},l.prototype.removeListener=function(g,v){var N,k,P,q,O;if(d(v),k=this._events,k===void 0)return this;if(N=k[g],N===void 0)return this;if(N===v||N.listener===v)--this._eventsCount===0?this._events=Object.create(null):(delete k[g],k.removeListener&&this.emit("removeListener",g,N.listener||v));else if(typeof N!="function"){for(P=-1,q=N.length-1;q>=0;q--)if(N[q]===v||N[q].listener===v){O=N[q].listener,P=q;break}if(P<0)return this;P===0?N.shift():f(N,P),N.length===1&&(k[g]=N[0]),k.removeListener!==void 0&&this.emit("removeListener",g,O||v)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(g){var v,N,k;if(N=this._events,N===void 0)return this;if(N.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):N[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete N[g]),this;if(arguments.length===0){var P=Object.keys(N),q;for(k=0;k<P.length;++k)q=P[k],q!=="removeListener"&&this.removeAllListeners(q);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(v=N[g],typeof v=="function")this.removeListener(g,v);else if(v!==void 0)for(k=v.length-1;k>=0;k--)this.removeListener(g,v[k]);return this};function y(_,g,v){var N=_._events;if(N===void 0)return[];var k=N[g];return k===void 0?[]:typeof k=="function"?v?[k.listener||k]:[k]:v?c(k):h(k,k.length)}l.prototype.listeners=function(g){return y(this,g,!0)},l.prototype.rawListeners=function(g){return y(this,g,!1)},l.listenerCount=function(_,g){return typeof _.listenerCount=="function"?_.listenerCount(g):a.call(_,g)},l.prototype.listenerCount=a;function a(_){var g=this._events;if(g!==void 0){var v=g[_];if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}l.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function h(_,g){for(var v=new Array(g),N=0;N<g;++N)v[N]=_[N];return v}function f(_,g){for(;g+1<_.length;g++)_[g]=_[g+1];_.pop()}function c(_){for(var g=new Array(_.length),v=0;v<g.length;++v)g[v]=_[v].listener||_[v];return g}function p(_,g){return new Promise(function(v,N){function k(q){_.removeListener(g,P),N(q)}function P(){typeof _.removeListener=="function"&&_.removeListener("error",k),v([].slice.call(arguments))}z(_,g,P,{once:!0}),g!=="error"&&C(_,k,{once:!0})})}function C(_,g,v){typeof _.on=="function"&&z(_,"error",g,v)}function z(_,g,v,N){if(typeof _.on=="function")N.once?_.once(g,v):_.on(g,v);else if(typeof _.addEventListener=="function")_.addEventListener(g,function k(P){N.once&&_.removeEventListener(g,k),v(P)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+(0,t.default)(_))}return Kr.exports}var Uo,ma;function ov(){return ma||(ma=1,Uo=["Googlebot/","Googlebot-Mobile","Googlebot-Image","Googlebot-News","Googlebot-Video","AdsBot-Google([^-]|$)","AdsBot-Google-Mobile","Feedfetcher-Google","Mediapartners-Google","Mediapartners \\(Googlebot\\)","APIs-Google","bingbot","Slurp","[wW]get","curl","LinkedInBot","Python-urllib","python-requests","libwww","httpunit","nutch","Go-http-client","phpcrawl","msnbot","jyxobot","FAST-WebCrawler","FAST Enterprise Crawler","BIGLOTRON","Teoma","convera","seekbot","Gigabot","Gigablast","exabot","ia_archiver","GingerCrawler","webmon ","HTTrack","grub\\.org","UsineNouvelleCrawler","antibot","netresearchserver","speedy","fluffy","bibnum\\.bnf","findlink","msrbot","panscient","yacybot","AISearchBot","ips-agent","tagoobot","MJ12bot","woriobot","yanga","buzzbot","mlbot","YandexBot","yandex\\.com/bots","purebot","Linguee Bot","CyberPatrol","voilabot","Baiduspider","citeseerxbot","spbot","twengabot","postrank","turnitinbot","scribdbot","page2rss","sitebot","linkdex","Adidxbot","blekkobot","ezooms","dotbot","Mail\\.RU_Bot","discobot","heritrix","findthatfile","europarchive\\.org","NerdByNature\\.Bot","sistrix crawler","Ahrefs(Bot|SiteAudit)","fuelbot","CrunchBot","centurybot9","IndeedBot","mappydata","woobot","ZoominfoBot","PrivacyAwareBot","Multiviewbot","SWIMGBot","Grobbot","eright","Apercite","semanticbot","Aboundex","domaincrawler","wbsearchbot","summify","CCBot","edisterbot","seznambot","ec2linkfinder","gslfbot","aiHitBot","intelium_bot","facebookexternalhit","Yeti","RetrevoPageAnalyzer","lb-spider","Sogou","lssbot","careerbot","wotbox","wocbot","ichiro","DuckDuckBot","lssrocketcrawler","drupact","webcompanycrawler","acoonbot","openindexspider","gnam gnam spider","web-archive-net\\.com\\.bot","backlinkcrawler","coccoc","integromedb","content crawler spider","toplistbot","it2media-domain-crawler","ip-web-crawler\\.com","siteexplorer\\.info","elisabot","proximic","changedetection","arabot","WeSEE:Search","niki-bot","CrystalSemanticsBot","rogerbot","360Spider","psbot","InterfaxScanBot","CC Metadata Scaper","g00g1e\\.net","GrapeshotCrawler","urlappendbot","brainobot","fr-crawler","binlar","SimpleCrawler","Twitterbot","cXensebot","smtbot","bnf\\.fr_bot","A6-Indexer","ADmantX","Facebot","OrangeBot/","memorybot","AdvBot","MegaIndex","SemanticScholarBot","ltx71","nerdybot","xovibot","BUbiNG","Qwantify","archive\\.org_bot","Applebot","TweetmemeBot","crawler4j","findxbot","S[eE][mM]rushBot","yoozBot","lipperhey","Y!J","Domain Re-Animator Bot","AddThis","Screaming Frog SEO Spider","MetaURI","Scrapy","Livelap[bB]ot","OpenHoseBot","CapsuleChecker","collection@infegy\\.com","IstellaBot","DeuSu/","betaBot","Cliqzbot/","MojeekBot/","netEstate NE Crawler","SafeSearch microdata crawler","Gluten Free Crawler/","Sonic","Sysomos","Trove","deadlinkchecker","Slack-ImgProxy","Embedly","RankActiveLinkBot","iskanie","SafeDNSBot","SkypeUriPreview","Veoozbot","Slackbot","redditbot","datagnionbot","Google-Adwords-Instant","adbeat_bot","WhatsApp","contxbot","pinterest","electricmonk","GarlikCrawler","BingPreview/","vebidoobot","FemtosearchBot","Yahoo Link Preview","MetaJobBot","DomainStatsBot","mindUpBot","Daum/","Jugendschutzprogramm-Crawler","Xenu Link Sleuth","Pcore-HTTP","moatbot","KosmioBot","pingdom","PhantomJS","Gowikibot","PiplBot","Discordbot","TelegramBot","Jetslide","newsharecounts","James BOT","Barkrowler","TinEye","SocialRankIOBot","trendictionbot","Ocarinabot","epicbot","Primalbot","DuckDuckGo-Favicons-Bot","GnowitNewsbot","Leikibot","LinkArchiver","YaK/","PaperLiBot","Digg Deeper","dcrawl","Snacktory","AndersPinkBot","Fyrebot","EveryoneSocialBot","Mediatoolkitbot","Luminator-robots","ExtLinksBot","SurveyBot","NING/","okhttp","Nuzzel","omgili","PocketParser","YisouSpider","um-LN","ToutiaoSpider","MuckRack","Jamie's Spider","AHC/","NetcraftSurveyAgent","Laserlikebot","Apache-HttpClient","AppEngine-Google","Jetty","Upflow","Thinklab","Traackr\\.com","Twurly","Mastodon","http_get","DnyzBot","botify","007ac9 Crawler","BehloolBot","BrandVerity","check_http","BDCbot","ZumBot","EZID","ICC-Crawler","ArchiveBot","^LCC ","filterdb\\.iss\\.net/crawler","BLP_bbot","BomboraBot","Buck/","Companybook-Crawler","Genieo","magpie-crawler","MeltwaterNews","Moreover","newspaper/","ScoutJet","(^| )sentry/","StorygizeBot","UptimeRobot","OutclicksBot","seoscanners","Hatena","Google Web Preview","MauiBot","AlphaBot","SBL-BOT","IAS crawler","adscanner","Netvibes","acapbot","Baidu-YunGuanCe","bitlybot","blogmuraBot","Bot\\.AraTurka\\.com","bot-pge\\.chlooe\\.com","BoxcarBot","BTWebClient","ContextAd Bot","Digincore bot","Disqus","Feedly","Fetch/","Fever","Flamingo_SearchEngine","FlipboardProxy","g2reader-bot","imrbot","K7MLWCBot","Kemvibot","Landau-Media-Spider","linkapediabot","vkShare","Siteimprove\\.com","BLEXBot/","DareBoost","ZuperlistBot/","Miniflux/","Feedspotbot/","Diffbot/","SEOkicks","tracemyfile","Nimbostratus-Bot","Bytespider"]),Uo}var Fo,ya;function sv(){if(ya)return Fo;ya=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fl(),i=ov(),o=ot(),s="_constructorio_is_human",l=["scroll","resize","touchmove","mouseover","mousemove","keydown","keypress","keyup","focus"],u=function(){function d(){var m=this;(0,t.default)(this,d),this.isHumanBoolean=this.getIsHumanFromSessionStorage();var w=function S(){m.isHumanBoolean=!0,r.session.set(s,!0),l.forEach(function(E){o.removeEventListener(E,S,!0)})};this.isHumanBoolean||l.forEach(function(S){o.addEventListener(S,w,!0)})}return(0,n.default)(d,[{key:"getIsHumanFromSessionStorage",value:function(){return!!r.session.get(s)||!1}},{key:"isHuman",value:function(){return this.isHumanBoolean||!!r.session.get(s)}},{key:"isBot",value:function(){if(this.getIsHumanFromSessionStorage())return!1;var w=o.getNavigator(),S=w.userAgent,E=w.webdriver,y=new RegExp("(".concat(i.join("|"),")"));return!!S.match(y)||!!E}}]),d}();return Fo=u,Fo}var Mo,wa;function lv(){if(wa)return Mo;wa=1;var e=Ye,t=e(ft()),n=e(dt()),r=Fl(),i=sv(),o=ot(),s=ot(),l=s.obfuscatePiiRequest,u="_constructorio_requests",d=18e4,m=function(){function w(S,E){var y=this;(0,t.default)(this,w),this.options=S,this.eventemitter=E,this.humanity=new i,this.requestPending=!1,this.pageUnloading=!1,this.sendTrackingEvents=!!(S&&S.sendTrackingEvents===!0),o.addEventListener("beforeunload",function(){y.pageUnloading=!0}),this.sendTrackingEvents&&this.send()}return(0,n.default)(w,[{key:"queue",value:function(E){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GET",a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};if(this.sendTrackingEvents&&!this.humanity.isBot()){var f=w.get(),c=l(E);f.push({url:c,method:y,body:a,networkParameters:h}),w.set(f)}}},{key:"sendEvents",value:function(){var E=this,y=this.options.fetch,a=w.get();if((!o.canUseDOM()||this.humanity.isHuman())&&!this.requestPending&&!this.pageUnloading&&a.length){var h,f=a.shift(),c=f,p=c.networkParameters,C,z=this;if(w.set(a),p&&typeof AbortController=="function"){var _=new AbortController;C=_.signal,o.applyNetworkTimeout(this.options,p,_)}if(typeof f=="string"&&(f={url:f,method:"GET"}),f.url){var g=f.url.match(/\?.*_dt=([^&]+)/),v=parseInt(g&&g[1],10),N=+new Date;if(v&&Number.isInteger(v)&&N-v>d){this.sendTrackingEvents=!1,w.remove();return}}f.method==="GET"&&(h=y(f.url,{signal:C})),f.method==="POST"&&(h=y(f.url,{method:f.method,body:JSON.stringify(f.body),mode:"cors",headers:{"Content-Type":"text/plain"},signal:C})),h&&(this.requestPending=!0,h.then(function(k){k.ok?(z.eventemitter&&z.eventemitter.emit("success",{url:f.url,method:f.method,message:"ok"}),E.requestPending=!1,E.send()):k.json().then(function(P){z.eventemitter&&z.eventemitter.emit("error",{url:f.url,method:f.method,message:P&&P.message}),E.requestPending=!1,E.send()}).catch(function(P){z.eventemitter&&z.eventemitter.emit("error",{url:f.url,method:f.method,message:P.type}),E.requestPending=!1,E.send()})}).catch(function(k){z.eventemitter&&z.eventemitter.emit("error",{url:f.url,method:f.method,message:k&&k.toString&&k.toString()}),E.requestPending=!1,E.send()}))}}},{key:"send",value:function(){this.sendTrackingEvents&&(this.options&&this.options.trackingSendDelay===0?this.sendEvents():setTimeout(this.sendEvents.bind(this),this.options&&this.options.trackingSendDelay||250))}}],[{key:"get",value:function(){return r.local.get(u)||[]}},{key:"set",value:function(E){!E||Array.isArray(E)&&E.length===0?w.remove():r.local.set(u,E);var y=w.get();Array.isArray(y)&&y.length!==E.length&&(this.sendTrackingEvents=!1,w.remove())}},{key:"remove",value:function(){r.local.remove(u)}}]),w}();return Mo=m,Mo}var jo,_a;function uv(){if(_a)return jo;_a=1;var e=Ye,t=e(Qf()),n=e(Un()),r=e(ft()),i=e(dt());function o(E,y){var a=Object.keys(E);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(E);y&&(h=h.filter(function(f){return Object.getOwnPropertyDescriptor(E,f).enumerable})),a.push.apply(a,h)}return a}function s(E){for(var y=1;y<arguments.length;y++){var a=arguments[y]!=null?arguments[y]:{};y%2?o(Object(a),!0).forEach(function(h){(0,t.default)(E,h,a[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach(function(h){Object.defineProperty(E,h,Object.getOwnPropertyDescriptor(a,h))})}return E}var l=iv(),u=ot(),d=lv();function m(E,y){var a=y.apiKey,h=y.version,f=y.sessionId,c=y.clientId,p=y.userId,C=y.segments,z=y.testCells,_=y.requestMethod,g=y.beaconMode,v=u.getWindowLocation(),N=v.host,k=v.pathname,P=y.sendReferrerWithTrackingEvents!==!1,q=Object.assign(E);return h&&(q.c=h),c&&(q.i=c),f&&(q.s=f),p&&(q.ui=String(p)),C&&C.length&&(q.us=C),a&&(q.key=a),z&&Object.keys(z).forEach(function(O){q["ef-".concat(O)]=z[O]}),g&&_&&_.match(/POST/i)&&(q.beacon=!0),P&&N&&(q.origin_referrer=N,k&&(q.origin_referrer+=k)),q._dt=Date.now(),q=u.cleanParams(q),q}function w(E,y){return u.stringify(m(E,y))}var S=function(){function E(y){(0,r.default)(this,E),this.options=y||{},this.eventemitter=new l,this.requests=new d(y,this.eventemitter),this.behavioralV2Url="https://ac.cnstrc.com/v2/behavioral_action/"}return(0,i.default)(E,[{key:"trackSessionStartV2",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h="".concat(this.behavioralV2Url,"session_start?");return this.requests.queue("".concat(h).concat(w({},this.options)),"POST",void 0,a),this.requests.send(),!0}},{key:"trackSessionStart",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h="".concat(this.options.serviceUrl,"/behavior?"),f={action:"session_start"};return this.requests.queue("".concat(h).concat(w(f,this.options)),void 0,void 0,a),this.requests.send(),!0}},{key:"trackInputFocusV2",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f="".concat(this.behavioralV2Url,"focus?"),c={},p=h,C=a;(0,n.default)(a)==="object"&&(p=a,C=""),c.user_input=C;var z="POST",_=m(c,s(s({},this.options),{},{requestMethod:z}));return this.requests.queue("".concat(f).concat(w({},this.options)),z,_,p),this.requests.send(),!0}},{key:"trackInputFocus",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h="".concat(this.options.serviceUrl,"/behavior?"),f={action:"focus"};return this.requests.queue("".concat(h).concat(w(f,this.options)),void 0,void 0,a),this.requests.send(),!0}},{key:"trackItemDetailLoad",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/item_detail_load?"),c={},p={},C=a.item_name,z=a.name,_=a.item_id,g=a.customer_id,v=a.customerId,N=v===void 0?g:v,k=a.variation_id,P=a.itemName,q=P===void 0?C||z:P,O=a.itemId,M=O===void 0?_||N:O,H=a.variationId,A=H===void 0?k:H,x=a.url;q&&(p.item_name=q),M&&(p.item_id=M),A&&(p.variation_id=A),x&&(p.url=x);var R="".concat(f).concat(w(c,this.options)),I="POST",L=m(p,s(s({},this.options),{},{requestMethod:I}));return this.requests.queue(R,I,L,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackAutocompleteSelectV2",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.behavioralV2Url,"autocomplete_select?"),p=h.original_query,C=h.originalQuery,z=C===void 0?p:C,_=h.user_input,g=h.userInput,v=g===void 0?z||_:g,N=h.original_section,k=h.section,P=k===void 0?N:k,q=h.tr,O=h.group_id,M=h.groupId,H=M===void 0?O:M,A=h.item_id,x=h.itemId,R=x===void 0?A:x,I=h.variation_id,L=h.variationId,F=L===void 0?I:L,U={},V={user_input:v,tr:q,group_id:H,item_id:R,variation_id:F,item_name:a,section:P};P&&(U.section=P);var W="".concat(c).concat(w(U,this.options)),b="POST",K=m(V,s(s({},this.options),{},{requestMethod:b}));return this.requests.queue(W,b,K,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackAutocompleteSelect",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.options.serviceUrl,"/autocomplete/").concat(u.encodeURIComponentRFC3986(u.trimNonBreakingSpaces(a)),"/select?"),p={},C=h.original_query,z=h.originalQuery,_=z===void 0?C:z,g=h.section,v=h.original_section,N=h.originalSection,k=N===void 0?v:N,P=h.tr,q=h.group_id,O=h.groupId,M=O===void 0?q:O,H=h.display_name,A=h.displayName,x=A===void 0?H:A;return _&&(p.original_query=_),P&&(p.tr=P),(k||g)&&(p.section=k||g),M&&(p.group={group_id:M,display_name:x}),this.requests.queue("".concat(c).concat(w(p,this.options)),void 0,void 0,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchSubmitV2",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.behavioralV2Url,"search_submit?"),p=h.original_query,C=h.originalQuery,z=C===void 0?p:C,_=h.user_input,g=h.userInput,v=g===void 0?z||_:g,N=h.group_id,k=h.groupId,P=k===void 0?N:k,q=h.section,O={},M={user_input:v,search_term:a,section:q};P&&(M.filters={group_id:P}),q&&(O.section=q);var H="".concat(c).concat(w(O,this.options)),A="POST",x=m(M,s(s({},this.options),{},{requestMethod:A}));return this.requests.queue(H,A,x,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchSubmit",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.options.serviceUrl,"/autocomplete/").concat(u.encodeURIComponentRFC3986(u.trimNonBreakingSpaces(a)),"/search?"),p={},C=h.original_query,z=h.originalQuery,_=z===void 0?C:z,g=h.group_id,v=h.groupId,N=v===void 0?g:v,k=h.display_name,P=h.displayName,q=P===void 0?k:P;return _&&(p.original_query=_),N&&(p.group={group_id:N,display_name:q}),this.requests.queue("".concat(c).concat(w(p,this.options)),void 0,void 0,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultsLoadedV2",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.behavioralV2Url,"search_result_load?"),p=h.num_results,C=h.numResults,z=C===void 0?p:C,_=h.result_count,g=h.resultCount,v=g===void 0?z||_:g,N=h.customer_ids,k=h.item_ids,P=h.items,q=P===void 0?N||k:P,O=h.result_page,M=h.resultPage,H=M===void 0?O:M,A=h.result_id,x=h.resultId,R=x===void 0?A:x,I=h.sort_order,L=h.sortOrder,F=L===void 0?I:L,U=h.sort_by,V=h.sortBy,W=V===void 0?U:V,b=h.selected_filters,K=h.selectedFilters,X=K===void 0?b:K,ee=h.url,ue=h.section,ae={},Z;q&&Array.isArray(q)&&q.length!==0&&(Z=q,typeof q[0]=="string"||typeof q[0]=="number"?Z=q.map(function(re){return{item_id:String(re)}}):Z=q.map(function(re){return u.toSnakeCaseKeys(re,!1)})),ue&&(ae.section=ue);var Ne={search_term:a,result_count:v,items:Z,result_page:H,result_id:R,sort_order:F,sort_by:W,selected_filters:X,url:ee,section:ue},de="".concat(c).concat(w(ae,this.options)),we="POST",Je=m(Ne,s(s({},this.options),{},{requestMethod:we}));return this.requests.queue(de,we,Je,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultsLoaded",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.options.serviceUrl,"/behavior?"),p={action:"search-results",term:a},C=h.num_results,z=h.numResults,_=z===void 0?C:z,g=h.customer_ids,v=h.customerIds,N=v===void 0?g:v,k=h.item_ids,P=h.itemIds,q=P===void 0?k:P,O;return u.isNil(_)||(p.num_results=_),q&&Array.isArray(q)?O=q:N&&Array.isArray(N)&&(O=N),O&&Array.isArray(O)&&O.length&&(p.customer_ids=O.slice(0,100).join(",")),this.requests.queue("".concat(c).concat(w(p,this.options)),void 0,void 0,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultClickV2",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.behavioralV2Url,"search_result_click?"),p=h.num_results,C=h.customer_id,z=h.item_id,_=h.itemId,g=_===void 0?C||z:_,v=h.name,N=h.item_name,k=h.itemName,P=k===void 0?v||N:k,q=h.variation_id,O=h.variationId,M=O===void 0?q:O,H=h.result_id,A=h.resultId,x=A===void 0?H:A,R=h.result_count,I=h.resultCount,L=I===void 0?p||R:I,F=h.result_page,U=h.resultPage,V=U===void 0?F:U,W=h.result_position_on_page,b=h.resultPositionOnPage,K=b===void 0?W:b,X=h.num_results_per_page,ee=h.numResultsPerPage,ue=ee===void 0?X:ee,ae=h.selected_filters,Z=h.selectedFilters,Ne=Z===void 0?ae:Z,de=h.section,we={item_name:P,item_id:g,variation_id:M,result_id:x,result_count:L,result_page:V,result_position_on_page:K,num_results_per_page:ue,selected_filters:Ne,section:de,search_term:a},Je={};de&&(Je.section=de);var re="".concat(c).concat(w(Je,this.options)),pt="POST",sn=m(we,s(s({},this.options),{},{requestMethod:pt}));return this.requests.queue(re,pt,sn,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultClick",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c="".concat(this.options.serviceUrl,"/autocomplete/").concat(u.encodeURIComponentRFC3986(u.trimNonBreakingSpaces(a)),"/click_through?"),p={},C=h.item_name,z=h.name,_=h.itemName,g=_===void 0?C||z:_,v=h.item_id,N=h.itemId,k=N===void 0?v:N,P=h.customer_id,q=h.customerId,O=q===void 0?P||k:q,M=h.variation_id,H=h.variationId,A=H===void 0?M:H,x=h.result_id,R=h.resultId,I=R===void 0?x:R,L=h.item_is_convertible,F=h.itemIsConvertible,U=F===void 0?L:F,V=h.section;return g&&(p.name=g),O&&(p.customer_id=O),A&&(p.variation_id=A),I&&(p.result_id=I),typeof U=="boolean"&&(p.item_is_convertible=U),V&&(p.section=V),this.requests.queue("".concat(c).concat(w(p,this.options)),void 0,void 0,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackConversion",value:function(a,h){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var c=a||"TERM_UNKNOWN",p="".concat(this.options.serviceUrl,"/v2/behavioral_action/conversion?"),C={},z={},_=h.name,g=h.item_name,v=h.itemName,N=v===void 0?g||_:v,k=h.customer_id,P=h.customerId,q=P===void 0?k:P,O=h.item_id,M=h.itemId,H=M===void 0?O||q:M,A=h.variation_id,x=h.variationId,R=x===void 0?A:x,I=h.revenue,L=h.section,F=L===void 0?"Products":L,U=h.display_name,V=h.displayName,W=V===void 0?U:V,b=h.type,K=h.is_custom_type,X=h.isCustomType,ee=X===void 0?K:X;H&&(z.item_id=H),N&&(z.item_name=N),R&&(z.variation_id=R),(I||I===0)&&(z.revenue=I.toString()),F&&(C.section=F,z.section=F),c&&(z.search_term=c),b&&(z.type=b),ee&&(z.is_custom_type=ee),W&&(z.display_name=W);var ue="".concat(p).concat(w(C,this.options)),ae="POST",Z=m(z,s(s({},this.options),{},{requestMethod:ae}));return this.requests.queue(ue,ae,Z,f),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackPurchase",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/purchase?"),c={},p={},C=a.items,z=a.revenue,_=a.order_id,g=a.orderId,v=g===void 0?_:g,N=a.section;if(v){if(u.hasOrderIdRecord(v))return!1;u.addOrderIdRecord(v),p.order_id=v}C&&Array.isArray(C)&&(p.items=C.slice(0,100).map(function(O){return u.toSnakeCaseKeys(O,!1)})),(z||z===0)&&(p.revenue=z),N?c.section=N:c.section="Products";var k="".concat(f).concat(w(c,this.options)),P="POST",q=m(p,s(s({},this.options),{},{requestMethod:P}));return this.requests.queue(k,P,q,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackRecommendationView",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/recommendation_result_view?"),c={},p=a.result_count,C=a.resultCount,z=C===void 0?p:C,_=a.result_page,g=a.resultPage,v=g===void 0?_:g,N=a.result_id,k=a.resultId,P=k===void 0?N:k,q=a.section,O=a.url,M=a.pod_id,H=a.podId,A=H===void 0?M:H,x=a.num_results_viewed,R=a.numResultsViewed,I=R===void 0?x:R,L=a.items;u.isNil(z)||(c.result_count=z),u.isNil(v)||(c.result_page=v),P&&(c.result_id=P),q?c.section=q:c.section="Products",O&&(c.url=O),A&&(c.pod_id=A),u.isNil(I)||(c.num_results_viewed=I),L&&Array.isArray(L)&&(c.items=L.slice(0,100).map(function(W){return u.toSnakeCaseKeys(W,!1)}));var F="".concat(f).concat(w({},this.options)),U="POST",V=m(c,s(s({},this.options),{},{requestMethod:U}));return this.requests.queue(F,U,V,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackRecommendationClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/recommendation_result_click?"),c={},p=a.variation_id,C=a.variationId,z=C===void 0?p:C,_=a.section,g=_===void 0?"Products":_,v=a.result_id,N=a.resultId,k=N===void 0?v:N,P=a.result_count,q=a.resultCount,O=q===void 0?P:q,M=a.result_page,H=a.resultPage,A=H===void 0?M:H,x=a.result_position_on_page,R=a.resultPositionOnPage,I=R===void 0?x:R,L=a.num_results_per_page,F=a.numResultsPerPage,U=F===void 0?L:F,V=a.pod_id,W=a.podId,b=W===void 0?V:W,K=a.strategy_id,X=a.strategyId,ee=X===void 0?K:X,ue=a.item_id,ae=a.itemId,Z=ae===void 0?ue:ae,Ne=a.item_name,de=a.itemName,we=de===void 0?Ne:de;z&&(c.variation_id=z),g&&(c.section=g),k&&(c.result_id=k),u.isNil(O)||(c.result_count=O),u.isNil(A)||(c.result_page=A),u.isNil(I)||(c.result_position_on_page=I),u.isNil(U)||(c.num_results_per_page=U),b&&(c.pod_id=b),ee&&(c.strategy_id=ee),Z&&(c.item_id=Z),we&&(c.item_name=we);var Je="".concat(f).concat(w({},this.options)),re="POST",pt=m(c,s(s({},this.options),{},{requestMethod:re}));return this.requests.queue(Je,re,pt,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackBrowseResultsLoaded",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/browse_result_load?"),c={},p=a.section,C=p===void 0?"Products":p,z=a.result_count,_=a.resultCount,g=_===void 0?z:_,v=a.result_page,N=a.resultPage,k=N===void 0?v:N,P=a.result_id,q=a.resultId,O=q===void 0?P:q,M=a.selected_filters,H=a.selectedFilters,A=H===void 0?M:H,x=a.url,R=a.sort_order,I=a.sortOrder,L=I===void 0?R:I,F=a.sort_by,U=a.sortBy,V=U===void 0?F:U,W=a.filter_name,b=a.filterName,K=b===void 0?W:b,X=a.filter_value,ee=a.filterValue,ue=ee===void 0?X:ee,ae=a.items;C&&(c.section=C),u.isNil(g)||(c.result_count=g),u.isNil(k)||(c.result_page=k),O&&(c.result_id=O),A&&(c.selected_filters=A),x&&(c.url=x),L&&(c.sort_order=L),V&&(c.sort_by=V),K&&(c.filter_name=K),ue&&(c.filter_value=ue),ae&&Array.isArray(ae)&&(c.items=ae.slice(0,100).map(function(we){return u.toSnakeCaseKeys(we,!1)}));var Z="".concat(f).concat(w({},this.options)),Ne="POST",de=m(c,s(s({},this.options),{},{requestMethod:Ne}));return this.requests.queue(Z,Ne,de,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackBrowseResultClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/browse_result_click?"),c={},p=a.section,C=p===void 0?"Products":p,z=a.variation_id,_=a.variationId,g=_===void 0?z:_,v=a.result_id,N=a.resultId,k=N===void 0?v:N,P=a.result_count,q=a.resultCount,O=q===void 0?P:q,M=a.result_page,H=a.resultPage,A=H===void 0?M:H,x=a.result_position_on_page,R=a.resultPositionOnPage,I=R===void 0?x:R,L=a.num_results_per_page,F=a.numResultsPerPage,U=F===void 0?L:F,V=a.selected_filters,W=a.selectedFilters,b=W===void 0?V:W,K=a.filter_name,X=a.filterName,ee=X===void 0?K:X,ue=a.filter_value,ae=a.filterValue,Z=ae===void 0?ue:ae,Ne=a.customer_id,de=a.customerId,we=de===void 0?Ne:de,Je=a.item_id,re=a.itemId,pt=re===void 0?we||Je:re,sn=a.item_name,Gi=a.name,Dl=a.itemName,Hl=Dl===void 0?sn||Gi:Dl;C&&(c.section=C),g&&(c.variation_id=g),k&&(c.result_id=k),u.isNil(O)||(c.result_count=O),u.isNil(A)||(c.result_page=A),u.isNil(I)||(c.result_position_on_page=I),u.isNil(U)||(c.num_results_per_page=U),b&&(c.selected_filters=b),ee&&(c.filter_name=ee),Z&&(c.filter_value=Z),pt&&(c.item_id=pt),Hl&&(c.item_name=Hl);var td="".concat(f).concat(w({},this.options)),bl="POST",nd=m(c,s(s({},this.options),{},{requestMethod:bl}));return this.requests.queue(td,bl,nd,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackGenericResultClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if((0,n.default)(a)==="object"){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/result_click?"),c={},p=a.item_id,C=a.itemId,z=C===void 0?p:C,_=a.item_name,g=a.itemName,v=g===void 0?_:g,N=a.variation_id,k=a.variationId,P=k===void 0?N:k,q=a.section,O=q===void 0?"Products":q;if(z){c.section=O,c.item_id=z,v&&(c.item_name=v),P&&(c.variation_id=P);var M="".concat(f).concat(w({},this.options)),H="POST",A=m(c,s(s({},this.options),{},{requestMethod:H}));return this.requests.queue(M,H,A,h),this.requests.send(),!0}}return this.requests.send(),new Error('A parameters object with an "itemId" property is required.')}},{key:"trackQuizResultsLoaded",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/quiz_result_load?"),c=a.quiz_id,p=a.quizId,C=p===void 0?c:p,z=a.quiz_version_id,_=a.quizVersionId,g=_===void 0?z:_,v=a.quiz_session_id,N=a.quizSessionId,k=N===void 0?v:N,P=a.url,q=a.section,O=q===void 0?"Products":q,M=a.result_count,H=a.resultCount,A=H===void 0?M:H,x=a.result_id,R=a.resultId,I=R===void 0?x:R,L=a.result_page,F=a.resultPage,U=F===void 0?L:F,V=a.items,W={},b={};if(V&&Array.isArray(V)&&(b.items=V.slice(0,100).map(function(ue){return u.toSnakeCaseKeys(ue,!1)})),typeof C!="string")return new Error('"quizId" is a required parameter of type string');if(typeof g!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof k!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof P!="string")return new Error('"url" is a required parameter of type string');if(b.quiz_id=C,b.quiz_version_id=g,b.quiz_session_id=k,b.url=P,!u.isNil(O)){if(typeof O!="string")return new Error('"section" must be a string');W.section=O,b.section=O}if(!u.isNil(A)){if(typeof A!="number")return new Error('"resultCount" must be a number');b.result_count=A}if(!u.isNil(I)){if(typeof I!="string")return new Error('"resultId" must be a string');b.result_id=I}if(!u.isNil(U)){if(typeof U!="number")return new Error('"resultPage" must be a number');b.result_page=U}var K="".concat(f).concat(w(W,this.options)),X="POST",ee=m(b,s(s({},this.options),{},{requestMethod:X}));return this.requests.queue(K,X,ee,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackQuizResultClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/quiz_result_click?"),c=a.quiz_id,p=a.quizId,C=p===void 0?c:p,z=a.quiz_version_id,_=a.quizVersionId,g=_===void 0?z:_,v=a.quiz_session_id,N=a.quizSessionId,k=N===void 0?v:N,P=a.item_id,q=a.itemId,O=q===void 0?P:q,M=a.item_name,H=a.itemName,A=H===void 0?M:H,x=a.result_count,R=a.resultCount,I=R===void 0?x:R,L=a.result_id,F=a.resultId,U=F===void 0?L:F,V=a.result_page,W=a.resultPage,b=W===void 0?V:W,K=a.num_results_per_page,X=a.numResultsPerPage,ee=X===void 0?K:X,ue=a.result_position_on_page,ae=a.resultPositionOnPage,Z=ae===void 0?ue:ae,Ne=a.section,de=Ne===void 0?"Products":Ne,we=a.variationId,Je={},re={};if(typeof C!="string")return new Error('"quizId" is a required parameter of type string');if(typeof g!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof k!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof O!="string"&&typeof A!="string")return new Error('"itemId" or "itemName" is a required parameter of type string');if(re.quiz_id=C,re.quiz_version_id=g,re.quiz_session_id=k,!u.isNil(O)){if(typeof O!="string")return new Error('"itemId" must be a string');re.item_id=O}if(!u.isNil(A)){if(typeof A!="string")return new Error('"itemName" must be a string');re.item_name=A}if(!u.isNil(we)){if(typeof we!="string")return new Error('"variationId" must be a string');re.variation_id=we}if(!u.isNil(de)){if(typeof de!="string")return new Error('"section" must be a string');Je.section=de}if(!u.isNil(I)){if(typeof I!="number")return new Error('"resultCount" must be a number');re.result_count=I}if(!u.isNil(U)){if(typeof U!="string")return new Error('"resultId" must be a string');re.result_id=U}if(!u.isNil(b)){if(typeof b!="number")return new Error('"resultPage" must be a number');re.result_page=b}if(!u.isNil(ee)){if(typeof ee!="number")return new Error('"numResultsPerPage" must be a number');re.num_results_per_page=ee}if(!u.isNil(Z)){if(typeof Z!="number")return new Error('"resultPositionOnPage" must be a number');re.result_position_on_page=Z}var pt="".concat(f).concat(w(Je,this.options)),sn="POST",Gi=m(re,s(s({},this.options),{},{requestMethod:sn}));return this.requests.queue(pt,sn,Gi,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackQuizConversion",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var f="".concat(this.options.serviceUrl,"/v2/behavioral_action/quiz_conversion?"),c=a.quiz_id,p=a.quizId,C=p===void 0?c:p,z=a.quiz_version_id,_=a.quizVersionId,g=_===void 0?z:_,v=a.quiz_session_id,N=a.quizSessionId,k=N===void 0?v:N,P=a.item_id,q=a.itemId,O=q===void 0?P:q,M=a.item_name,H=a.itemName,A=H===void 0?M:H,x=a.variation_id,R=a.variationId,I=R===void 0?x:R,L=a.revenue,F=a.section,U=F===void 0?"Products":F,V=a.type,W=a.is_custom_type,b=a.isCustomType,K=b===void 0?W:b,X=a.display_name,ee=a.displayName,ue=ee===void 0?X:ee,ae={},Z={};if(typeof C!="string")return new Error('"quizId" is a required parameter of type string');if(typeof g!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof k!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof O!="string"&&typeof A!="string")return new Error('"itemId" or "itemName" is a required parameter of type string');if(Z.quiz_id=C,Z.quiz_version_id=g,Z.quiz_session_id=k,!u.isNil(O)){if(typeof O!="string")return new Error('"itemId" must be a string');Z.item_id=O}if(!u.isNil(A)){if(typeof A!="string")return new Error('"itemName" must be a string');Z.item_name=A}if(!u.isNil(I)){if(typeof I!="string")return new Error('"variationId" must be a string');Z.variation_id=I}if(!u.isNil(L)){if(typeof L!="string")return new Error('"revenue" must be a string');Z.revenue=L}if(!u.isNil(U)){if(typeof U!="string")return new Error('"section" must be a string');Z.section=U}if(!u.isNil(V)){if(typeof V!="string")return new Error('"type" must be a string');Z.type=V}if(!u.isNil(K)){if(typeof K!="boolean")return new Error('"isCustomType" must be a boolean');Z.is_custom_type=K}if(!u.isNil(ue)){if(typeof ue!="string")return new Error('"displayName" must be a string');Z.display_name=ue}var Ne="".concat(f).concat(w(ae,this.options)),de="POST",we=m(Z,s(s({},this.options),{},{requestMethod:de}));return this.requests.queue(Ne,de,we,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"on",value:function(a,h){return a!=="success"&&a!=="error"?new Error('messageType must be a string of value "success" or "error"'):!h||typeof h!="function"?new Error("callback is required and must be a function"):(this.eventemitter.on(a,h),!0)}}]),E}();return S.RequestQueue=d,jo=S,jo}const av="@constructor-io/constructorio-client-javascript",cv="2.42.2",fv="Constructor.io JavaScript client",dv="lib/constructorio.js",pv="lib/types/index.d.ts",hv={clean:"sudo rm -rf node_modules package-lock.json",version:"npm run verify-node-version && npm run docs && git add ./docs/* && npm run bundle && git add -A ./dist","check-license":"license-checker --production --onlyAllow 'Apache-2.0;BSD-3-Clause;MIT;0BSD;BSD-2-Clause'","verify-node-version":"chmod +x ./scripts/verify-node-version.sh && ./scripts/verify-node-version.sh",lint:"eslint 'src/**/*.js' 'spec/**/*.js' 'src/**/*.d.ts'",test:"npm run compile && mkdir -p test && cp -rf lib/* test && mocha --retries 3 ./spec/*","test:types":"tsd .","test:parallel":"npm run compile && mkdir -p test && cp -rf lib/* test && mocha --parallel --retries 3 ./spec/*","test:src":"mkdir -p test && cp -rf src/* test && mocha --retries 3 ./spec/*","test:src:parallel":"mkdir -p test && cp -rf src/* test && mocha --parallel --retries 3 ./spec/*","test:bundled":"npm run bundle && BUNDLED=true PACKAGE_VERSION=$(echo $npm_package_version) mocha --retries 3 ./spec/*","test:bundled:parallel":"npm run bundle && BUNDLED=true PACKAGE_VERSION=$(echo $npm_package_version) mocha --parallel --retries 3 ./spec/*","test:all":"npm run test && npm run test:bundled","test:all:parallel":"npm run test:parallel && npm run test:bundled:parallel",precoverage:"rm -rf ./coverage && rm -rf ./.nyc_output",coverage:"nyc --all --reporter=html npm run test:src",postcoverage:"open coverage/index.html && rm -rf test",docs:"jsdoc --configure ./.jsdoc.json ./README.md --recurse ./src --destination ./docs",compile:"rm -rf ./lib/* && babel src/ -d lib/ --copy-files && rm -rf ./lib/types/tests",prepublish:"npm run compile",bundle:"rm -rf ./dist/* && npm run compile && node bundle.js",prepare:"husky install"},vv={type:"git",url:"git+https://github.com/Constructor-io/constructorio-client-javascript.git"},gv="constructor.io",mv="MIT",yv={url:"https://github.com/Constructor-io/constructorio-client-javascript/issues"},wv="https://github.com/Constructor-io/constructorio-client-javascript#readme",_v=["lib/**/*"],kv={"@babel/cli":"^7.15.7","@babel/core":"^7.15.8","@babel/plugin-transform-runtime":"^7.16.4","@babel/preset-env":"^7.15.8","@babel/register":"^7.15.3","@cspell/eslint-plugin":"^6.8.2","@typescript-eslint/eslint-plugin":"^5.48.1","@typescript-eslint/parser":"^5.48.1",chai:"^4.2.0","chai-as-promised":"^7.1.1",docdash:"^2.0.1",dotenv:"^8.6.0",esbuild:"^0.12.28",eslint:"^8.17.0","eslint-config-airbnb-base":"^15.0.0","eslint-plugin-import":"^2.25.2",husky:"^7.0.4",jsdoc:"^4.0.2",jsdom:"^16.7.0","license-checker":"^25.0.1","lodash.clonedeep":"^4.5.0",mocha:"^9.1.3",nyc:"^15.1.0",qs:"^6.11.0",sinon:"^7.5.0","sinon-chai":"^3.7.0",tsd:"^0.24.1"},Sv={"@constructor-io/constructorio-id":"^2.4.17","crc-32":"^1.2.2","fetch-ponyfill":"^7.1.0"},Ev={"@babel/runtime":"^7.19.0"},Cv={directory:"src/types/tests"},xv={name:av,version:cv,description:fv,main:dv,types:pv,scripts:hv,repository:vv,author:gv,license:mv,bugs:yv,homepage:wv,files:_v,devDependencies:kv,dependencies:Sv,peerDependencies:Ev,tsd:Cv};var Do={exports:{}},Ho={exports:{}},bo={exports:{}},ka;function Wf(){return ka||(ka=1,function(e){function t(n,r){(r==null||r>n.length)&&(r=n.length);for(var i=0,o=new Array(r);i<r;i++)o[i]=n[i];return o}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(bo)),bo.exports}var Sa;function Rv(){return Sa||(Sa=1,function(e){var t=Wf();function n(r){if(Array.isArray(r))return t(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Ho)),Ho.exports}var Vo={exports:{}},Ea;function zv(){return Ea||(Ea=1,function(e){function t(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Vo)),Vo.exports}var Qo={exports:{}},Ca;function Nv(){return Ca||(Ca=1,function(e){var t=Wf();function n(r,i){if(r){if(typeof r=="string")return t(r,i);var o=Object.prototype.toString.call(r).slice(8,-1);if(o==="Object"&&r.constructor&&(o=r.constructor.name),o==="Map"||o==="Set")return Array.from(r);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return t(r,i)}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Qo)),Qo.exports}var Wo={exports:{}},xa;function Tv(){return xa||(xa=1,function(e){function t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
45
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Wo)),Wo.exports}var Ra;function qv(){return Ra||(Ra=1,function(e){var t=Rv(),n=zv(),r=Nv(),i=Tv();function o(s){return t(s)||n(s)||r(s)||i()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}(Do)),Do.exports}var Ko,za;function Pv(){if(za)return Ko;za=1;var e=Ye,t=e(ft()),n=e(dt()),r=e(qv()),i=e(Un()),o=Fn(),s=ot();function l(d,m,w,S){var E=w.apiKey,y=w.clientId,a=w.sessionId,h=w.segments,f=w.userId,c=w.version,p=w.quizzesServiceUrl,C={c},z="";if(C.key=E,C.i=y,C.s=a,h&&h.length&&(C.us=h),f&&(C.ui=String(f)),!d||typeof d!="string")throw new Error("quizId is a required parameter of type string");if(S==="results"&&((0,i.default)(m.answers)!=="object"||!Array.isArray(m.answers)||m.answers.length===0))throw new Error("answers is a required parameter of type array");if(m){var _=m.section,g=m.answers,v=m.quizSessionId,N=m.quizVersionId,k=m.page,P=m.resultsPerPage,q=m.filters;_&&(C.section=_),N&&(C.quiz_version_id=N),v&&(C.quiz_session_id=v),g&&g.length&&(z="&".concat(s.stringify({a:g.map(function(M){return(0,r.default)(M).join(",")})}))),s.isNil(k)||(C.page=k),s.isNil(P)||(C.num_results_per_page=P),q&&(C.filters=q)}C._dt=Date.now(),C=s.cleanParams(C);var O=s.stringify(C);return"".concat(p,"/v1/quizzes/").concat(encodeURIComponent(d),"/").concat(encodeURIComponent(S),"/?").concat(O).concat(z)}var u=function(){function d(m){(0,t.default)(this,d),this.options=m||{},this.eventDispatcher=new o(m.eventDispatcher)}return(0,n.default)(d,[{key:"getQuizNextQuestion",value:function(w,S){var E=this,y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,f=new AbortController,c=f.signal;try{a=l(w,S,this.options,"next")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,y,f),h(a,{signal:c}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return E.eventDispatcher.queue("quizzes.getQuizNextQuestion.completed",p),p;throw new Error("getQuizNextQuestion response data is malformed")})}},{key:"getQuizResults",value:function(w,S){var E=this,y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,f=new AbortController,c=f.signal;try{a=l(w,S,this.options,"results")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,y,f),h(a,{signal:c}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return E.eventDispatcher.queue("quizzes.getQuizResults.completed",p),p;throw new Error("getQuizResults response data is malformed")})}},{key:"getQuizResultsConfig",value:function(w,S){var E=this,y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,f=new AbortController,c=f.signal;try{a=l(w,S,this.options,"results_config")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,y,f),h(a,{signal:c}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return E.eventDispatcher.queue("quizzes.getQuizResultsConfig.completed",p),p;throw new Error("getQuizResultsConfig response data is malformed")})}}]),d}();return Ko=u,Ko}var Kf=Ye,Iv=Kf(ft()),Ov=Kf(dt()),Lv=Jh(),Av=Xh(),Bv=ev(),Uv=tv(),Fv=nv(),Mv=rv(),Gf=uv(),jv=Fn(),Ml=ot(),Dv=xv,Hv=Dv.version,bv=Pv(),Vv=function(){var t="ciojs-client-",n=[];return Ml.canUseDOM()||n.push("domless"),typeof process<"u"&&typeof process.env<"u"&&{}.BUNDLED&&n.push("bundled"),"".concat(t).concat(n.join("-")).concat(n.length?"-":"").concat(Hv)},jl=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,Iv.default)(this,e);var n=t.apiKey,r=t.version,i=t.serviceUrl,o=t.quizzesServiceUrl,s=t.segments,l=t.testCells,u=t.clientId,d=t.sessionId,m=t.userId,w=t.fetch,S=t.trackingSendDelay,E=t.sendReferrerWithTrackingEvents,y=t.sendTrackingEvents,a=t.eventDispatcher,h=t.idOptions,f=t.beaconMode,c=t.networkParameters;if(!n||typeof n!="string")throw new Error("API key is a required parameter of type string");var p,C,z=typeof Jn<"u"&&Jn.CLIENT_VERSION;if(Ml.canUseDOM()){var _=new Lv(h||{});p=_.session_id,C=_.client_id}else{if(!d||typeof d!="number")throw new Error("sessionId is a required user parameter of type number");if(!u||typeof u!="string")throw new Error("clientId is a required user parameter of type string")}this.options={apiKey:n,version:r||z||Vv(),serviceUrl:i&&i.replace(/\/$/,"")||"https://ac.cnstrc.com",quizzesServiceUrl:o&&o.replace(/\/$/,"")||"https://quizzes.cnstrc.com",sessionId:d||p,clientId:u||C,userId:m,segments:s,testCells:l,fetch:w||Av({Promise}).fetch,trackingSendDelay:S,sendTrackingEvents:y,sendReferrerWithTrackingEvents:E,eventDispatcher:a,beaconMode:f!==!1,networkParameters:c||{}},this.search=new Bv(this.options),this.browse=new Uv(this.options),this.autocomplete=new Fv(this.options),this.recommendations=new Mv(this.options),this.tracker=new Gf(this.options),this.quizzes=new bv(this.options),new jv(t.eventDispatcher).queue("instantiated",this.options)}return(0,Ov.default)(e,[{key:"setClientOptions",value:function(n){if(Object.keys(n).length){var r=n.apiKey,i=n.segments,o=n.testCells,s=n.userId;r&&(this.options.apiKey=r),i&&(this.options.segments=i),o&&(this.options.testCells=o),s&&(this.options.userId=s)}}}]),e}();jl.Tracker=Gf;Ml.canUseDOM()&&(window.ConstructorioClient=jl);var Qv=jl;const Wv=Na(Qv),Kv="1.13.0",Gv=e=>{if(e)return new Wv({apiKey:e,sendTrackingEvents:!0,version:`cio-ui-quizzes-${Kv}`})},Zv=(e,t,n)=>e==null?void 0:e.quizzes.getQuizNextQuestion(t,n),Yv=async(e,t,n)=>e==null?void 0:e.quizzes.getQuizResults(t,n),Jv=async(e,t,n)=>e==null?void 0:e.quizzes.getQuizResultsConfig(t,n),Xv=async(e,t)=>e==null?void 0:e.browse.getBrowseResultsForItemIds(t),$v=(e,t)=>{var d;const{quiz_id:n,quiz_session_id:r,quiz_version_id:i,result_id:o,request:s,response:l}=t,u=(d=l==null?void 0:l.results)==null?void 0:d.map(m=>{var w,S;return{itemId:(w=m==null?void 0:m.data)==null?void 0:w.id,variationId:(S=m==null?void 0:m.data)==null?void 0:S.variation_id,itemName:m==null?void 0:m.value}});e==null||e.tracker.trackQuizResultsLoaded({quizId:n,quizVersionId:i,quizSessionId:r,url:window.location.href,section:s==null?void 0:s.section,resultCount:l==null?void 0:l.total_num_results,resultPage:s==null?void 0:s.page,resultId:o,items:u})},eg=(e,t,n,r)=>{var i,o;if(t.request&&t.response){const{quiz_id:s,quiz_session_id:l,quiz_version_id:u,result_id:d,request:{section:m,page:w,num_results_per_page:S},response:{total_num_results:E}}=t;e==null||e.tracker.trackQuizResultClick({quizId:s,quizVersionId:u,quizSessionId:l,itemId:(i=n.data)==null?void 0:i.id,itemName:n==null?void 0:n.value,variationId:(o=n.data)==null?void 0:o.variation_id,section:m,resultCount:E,resultPage:w,resultId:d,resultPositionOnPage:r,numResultsPerPage:S})}},Zf=(e,t,n,r,i)=>{var o,s;if(t.request){const{quiz_id:l,quiz_session_id:u,quiz_version_id:d,request:{section:m}}=t;e==null||e.tracker.trackQuizConversion({quizId:l,quizVersionId:d,quizSessionId:u,itemId:(o=n.data)==null?void 0:o.id,itemName:n.value,section:m,variationId:(s=n.data)==null?void 0:s.variation_id,revenue:r&&String(r)||void 0,type:i})}},tg=({apiKey:e,cioJsClient:t})=>{if(!e&&!t)throw new Error("Either apiKey or cioJsClient is required");return j.useMemo(()=>t||Gv(e),[e,t])},ng=e=>{const{quizId:t,resultsPageOptions:n,callbacks:r}=e;j.useEffect(()=>{t||console.error("quizId is a required field of type string"),r!=null&&r.onAddToCartClick||console.error("callbacks.onAddToCartClick is a required field of type function")},[t,n,r==null?void 0:r.onAddToCartClick])};function rg(e,t,n,r){var S;const i=n==null?void 0:n.type,o=(S=n==null?void 0:n.options)==null?void 0:S.some(E=>E.images),[s,l]=j.useState({}),u=j.useRef({}),d=j.useCallback(E=>{if(i===Q.SingleSelect)u.current=!0,l({[E]:!0});else if(i===Q.MultipleSelect)if(s[E]){const y={...s};delete y[E],l(y)}else l({...s,[E]:!0})},[s,i]),m=(E,y)=>{((E==null?void 0:E.key)===" "||(E==null?void 0:E.key)==="Enter")&&d(y)};return j.useEffect(()=>{var E;if(n!=null&&n.type){const y=n.id,a=r==null?void 0:r[y],h={};Array.isArray(a==null?void 0:a.value)&&((E=a==null?void 0:a.value)==null||E.forEach(f=>{h[Number(f.id)]=!0,l(h)}))}return u.current=!1,function(){l({})}},[n==null?void 0:n.id]),j.useEffect(()=>{var E,y;if((n==null?void 0:n.type)==="multiple"||(n==null?void 0:n.type)==="single"){const a=(y=(E=n==null?void 0:n.options)==null?void 0:E.filter(h=>s[Number(h.id)]))==null?void 0:y.map(h=>({id:h.id,value:h.value}));e(a)}},[s,n==null?void 0:n.id,n==null?void 0:n.type,n==null?void 0:n.options,e]),j.useEffect(()=>{(n==null?void 0:n.type)==="single"&&u.current&&t()},[r]),j.useCallback(E=>({className:`${o?"cio-question-option-container":"cio-question-option-container-text-only"} ${s[E.id]?"selected":""}`,onClick:()=>{d(E.id)},onKeyDown:y=>{m(y,E.id)},role:"button",tabIndex:0,key:E.id}),[n==null?void 0:n.id,s])}function ig(e,t){return j.useEffect(()=>{(t==null?void 0:t.type)==="cover"&&e("")},[e,t]),j.useCallback(()=>({}),[])}function og(e,t,n,r){const[i,o]=j.useState(""),s=j.useCallback(d=>{o(d.target.value)},[]),l=j.useCallback(d=>{const{key:m}=d;m==="Enter"&&i&&(n==null?void 0:n.type)==="open"&&t()},[n==null?void 0:n.type,i,t]);return j.useEffect(()=>{(n==null?void 0:n.type)==="open"&&e(i)},[i,n==null?void 0:n.type,n==null?void 0:n.id,e]),j.useEffect(()=>{var d;if(r&&(n!=null&&n.id)){const m=(d=r[n.id])==null?void 0:d.value;o(m||"")}},[n==null?void 0:n.id]),j.useCallback(()=>({className:"cio-question-input-text",placeholder:(n==null?void 0:n.input_placeholder)||"Answer here...",value:i,onChange:s,onKeyDown:l}),[n==null?void 0:n.input_placeholder,n==null?void 0:n.id,i,l])}function sg(e,t,n){return j.useCallback(()=>{var s,l,u,d,m,w;const i=(l=(s=t.quizCurrentQuestion)==null?void 0:s.next_question)==null?void 0:l.id;let o;return i&&!((u=t.quizCurrentQuestion)!=null&&u.isCoverQuestion)&&(o=!((d=n.answerInputs[i])!=null&&d.value)||!((w=(m=n.answerInputs[i])==null?void 0:m.value)!=null&&w.length)),{className:o?"cio-question-cta-button disabled":"cio-question-cta-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,n.answerInputs,e])}function lg(e,t){return j.useCallback(()=>{var i;return{title:"Quiz Back Button",role:"button",className:`cio-question-back-button ${((i=e.quizCurrentQuestion)==null?void 0:i.isFirstQuestion)?"disabled":""}`,type:"button",onClick:()=>t()}},[e,t])}function ug(e,t){const n=i=>{var o,s;return((o=i==null?void 0:i.data)==null?void 0:o.id)&&(t==null?void 0:t.includes((s=i==null?void 0:i.data)==null?void 0:s.id))};return j.useCallback((i,o)=>({className:`cio-result-card-favorites-button ${n(i)?"favorited":""}`,onClick:s=>{e(s,i,o,!n(i))},type:"button"}),[e])}function ag(e,t){return j.useCallback(()=>{var o,s,l,u;return{className:((s=(o=t.quizCurrentQuestion)==null?void 0:o.next_question)==null?void 0:s.id)&&(((l=t.quizCurrentQuestion)==null?void 0:l.isCoverQuestion)||!((u=t.quizCurrentQuestion)!=null&&u.next_question.is_skippable))?"cio-question-skip-button hide":"cio-question-skip-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,e])}const cg=(e,t,n,r)=>{var O,M,H;const{quizAnswerChanged:i,nextQuestion:o,skipQuestion:s,previousQuestion:l,resetQuiz:u,hydrateQuiz:d,addToCart:m,addToFavorites:w,resultClick:S}=e,E=og(i,o,(O=t.quizCurrentQuestion)==null?void 0:O.next_question,n.answerInputs),y=ig(i,(M=t.quizCurrentQuestion)==null?void 0:M.next_question),a=rg(i,o,(H=t.quizCurrentQuestion)==null?void 0:H.next_question,n.answerInputs),h=sg(o,t,n),f=ag(s,t),c=lg(t,l),p=j.useCallback((A="primary")=>({className:A==="primary"?"cio-question-cta-button":"cio-question-redo-button",type:"button",onClick:()=>u()}),[u]),C=j.useCallback(()=>({className:"cio-question-share-results-button"}),[]),z=j.useCallback(()=>({className:"",type:"button",onClick:()=>d()}),[d]),_=j.useCallback((A,x)=>({className:"cio-result-card-cta-button",type:"button",onClick:R=>m(R,A,x)}),[m]),g=ug(w,r),v=j.useCallback((A,x,R)=>{((A==null?void 0:A.key)===" "||(A==null?void 0:A.key)==="Enter")&&S&&S(x,R)},[S]),N=j.useCallback(({result:A,position:x})=>({className:"cio-result-card-container",role:"button",tabIndex:0,onClick:()=>S(A,x),onKeyDown:R=>v(R,A,x)}),[v,S]),k=j.useCallback(({result:A,position:x})=>{var R;return{href:(R=A.data)==null?void 0:R.url,onClick:()=>S(A,x),onKeyDown:I=>v(I,A,x)}},[v,S]),P=j.useCallback(()=>{var A,x,R,I,L,F;return{src:((R=(x=(A=t.quizCurrentQuestion)==null?void 0:A.next_question)==null?void 0:x.images)==null?void 0:R.primary_url)||void 0,alt:((F=(L=(I=t.quizCurrentQuestion)==null?void 0:I.next_question)==null?void 0:L.images)==null?void 0:F.primary_alt)||void 0}},[t.quizCurrentQuestion]),q=j.useCallback(A=>{var x,R;return{className:"cio-question-option-image",src:((x=A==null?void 0:A.images)==null?void 0:x.primary_url)||void 0,alt:((R=A==null?void 0:A.images)==null?void 0:R.primary_alt)||void 0}},[]);return{getOpenTextInputProps:E,getNextQuestionButtonProps:h,getPreviousQuestionButtonProps:c,getQuizImageProps:P,getSelectQuestionImageProps:q,getSelectInputProps:a,getCoverQuestionProps:y,getResetQuizButtonProps:p,getShareResultsButtonProps:C,getHydrateQuizButtonProps:z,getAddToCartButtonProps:_,getAddToFavoritesButtonProps:g,getQuizResultButtonProps:N,getQuizResultLinkProps:k,getSkipQuestionButtonProps:f}},fg=e=>j.useMemo(()=>{var r;let n={"--primary-color-h":"227","--primary-color-s":"70%","--primary-color-l":"46%"};if(e){const i=/^\s*\(?(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)?/,o=(r=e.trim().match(i))==null?void 0:r.slice(1);if(o&&o.length===3){const[s,l,u]=o,[d,m,w]=Eh(Number(s),Number(l),Number(u));n={"--primary-color-h":`${d}`,"--primary-color-s":`${m}%`,"--primary-color-l":`${w}%`}}}return n},[e]),dg=(e,t,n)=>{j.useEffect(()=>{var r;t.quizResults&&($v(e,t.quizResults),n&&Bn(n)&&((r=t.quizResults.response)!=null&&r.results)&&n(t.quizResults.response.results))},[t,e,n])},pg=(e,t,n)=>j.useCallback((i,o)=>{t.quizResults&&(eg(e,t.quizResults,i,o),Bn(n)&&n(i,o))},[t,e,n]),hg=(e,t,n)=>j.useCallback((i,o,s)=>{i.preventDefault(),t.quizResults&&(Zf(e,t.quizResults,o,s),Bn(n)&&n(o))},[t,e,n]),vg=(e,t)=>j.useCallback(()=>{t&&t({type:Q.Back,payload:e.quizCurrentQuestion})},[t,e.quizCurrentQuestion]),gg=(e,t)=>j.useCallback(r=>{var s,l;const i=(l=(s=e.quizCurrentQuestion)==null?void 0:s.next_question)==null?void 0:l.type,o=e.quizCurrentQuestion;if(o!=null&&o.next_question)switch(i){case Q.Cover:t({type:Q.Cover,payload:{questionId:o.next_question.id,input:""}});break;case Q.OpenText:t({type:Q.OpenText,payload:{questionId:o.next_question.id,input:r}});break;case Q.SingleSelect:case Q.MultipleSelect:t({type:o.next_question.type,payload:{questionId:o.next_question.id,input:r}});break}},[e,t]),mg=(e,t,n,r)=>j.useCallback(()=>{var l,u;const o=(l=e.quizCurrentQuestion)==null?void 0:l.next_question,s=o==null?void 0:o.id;if(n&&s){const d=t.answerInputs[s];((u=d==null?void 0:d.value)!=null&&u.length||(o==null?void 0:o.type)==="cover")&&n({type:Q.Next,payload:e.quizCurrentQuestion}),o&&Bn(r)&&r({...o,answer:d})}},[n,e.quizCurrentQuestion,t.answerInputs,r]),Yf=()=>{const e=o=>{const l=new URLSearchParams(window.location.search).get(o);return l?l==null?void 0:l.split(","):[]},t=e("items"),n=e("attributes"),r=!!t.length&&!!n.length,i=j.useCallback(()=>{const o=new URL(window.location.href);o.searchParams.delete("items"),o.searchParams.delete("attributes"),o.searchParams.toString().length||(o.search=""),window.history.replaceState({},"",o.toString())},[]);return{queryItems:t,queryAttributes:n,isSharedResultsQuery:r,removeSharedResultsQueryParams:i}},yg=e=>{const{resetQuizSessionStorageState:t,dispatchLocalState:n,dispatchApiState:r,quizResults:i}=e,{removeSharedResultsQueryParams:o,isSharedResultsQuery:s}=Yf();return j.useCallback(()=>{i&&(n({type:Q.Reset}),r({type:he.RESET_QUIZ}),t(),s&&o())},[n,r,t,i,o,s])},wg=(e,t)=>{const n=Ds(e);return j.useCallback(()=>{n&&t({type:Q.Hydrate,payload:n})},[t,n])},_g=(e,t,n)=>j.useCallback((i,o,s,l=!0)=>{i.preventDefault(),t.quizResults&&(l&&Zf(e,t.quizResults,o,s,"add_to_wishlist"),Bn(n)&&n(o))},[t,e,n]),kg=(e,t,n,r)=>j.useCallback(()=>{var l;const o=(l=e.quizCurrentQuestion)==null?void 0:l.next_question,s=o==null?void 0:o.id;if(n&&s){(o==null?void 0:o.type)!=="cover"&&n({type:Q.Skip,payload:e.quizCurrentQuestion});const u={...t.answerInputs[s],value:(o==null?void 0:o.type)==="open"?"false":null};o&&Bn(r)&&r({...o,answer:u})}},[n,r,e.quizCurrentQuestion,t.answerInputs]),Sg=(e,t,n)=>{const{quizApiState:r,dispatchLocalState:i,dispatchApiState:o,quizLocalState:s,quizSessionStorageState:l}=n,{callbacks:u}=e,{onAddToCartClick:d,onAddToFavoritesClick:m,onQuizNextQuestion:w,onQuizResultClick:S,onQuizResultsLoaded:E,onQuizSkipQuestion:y}=u||{},a=gg(r,i),h=mg(r,s,i,w),f=kg(r,s,i,y),c=vg(r,i),p=hg(t,r,d),C=pg(t,r,S),z=_g(t,r,m);dg(t,r,E);const _=yg({resetQuizSessionStorageState:$u(l.key),dispatchLocalState:i,dispatchApiState:o,quizResults:r.quizResults}),g=wg(l.key,i);return{addToCart:p,addToFavorites:z,resultClick:C,quizAnswerChanged:a,previousQuestion:c,nextQuestion:h,skipQuestion:f,resetQuiz:_,hydrateQuiz:g,resetSessionStorageState:$u(l.key)}},Jf={quizRequestState:gt.Stale};function Eg(e,t){var n,r,i,o,s,l,u,d,m,w,S,E,y,a,h;switch(t.type){case he.SET_IS_LOADING:return{...e,quizRequestState:gt.Loading,quizCurrentQuestion:void 0,quizResults:void 0};case he.SET_IS_ERROR:return{...e,quizRequestState:gt.Error,quizCurrentQuestion:void 0,quizResults:void 0,selectedOptionsWithAttributes:void 0,matchedOptions:void 0};case he.SET_CURRENT_QUESTION:{const{isOpenQuestion:f,isCoverQuestion:c,isSingleQuestion:p,isMultipleQuestion:C,isSelectQuestion:z}=Df((i=(r=(n=t.payload)==null?void 0:n.quizCurrentQuestion)==null?void 0:r.next_question)==null?void 0:i.type),_=e.quizFirstQuestion||((o=t.payload)==null?void 0:o.quizCurrentQuestion);return{...e,quizRequestState:gt.Success,quizCurrentQuestion:{...(s=t.payload)==null?void 0:s.quizCurrentQuestion,isFirstQuestion:((l=_==null?void 0:_.next_question)==null?void 0:l.id)===((m=(d=(u=t.payload)==null?void 0:u.quizCurrentQuestion)==null?void 0:d.next_question)==null?void 0:m.id),isOpenQuestion:f,isCoverQuestion:c,isSingleQuestion:p,isMultipleQuestion:C,isSelectQuestion:z},quizFirstQuestion:_,quizResults:void 0,selectedOptionsWithAttributes:void 0,matchedOptions:void 0}}case he.SET_QUIZ_RESULTS:{const f=((w=t.payload)==null?void 0:w.quizResults.quiz_selected_options.filter(p=>p.has_attribute).map(p=>p.value))||[],c=((S=t.payload)==null?void 0:S.quizResults.quiz_selected_options.filter(p=>p.is_matched&&p.has_attribute).map(p=>p.value))||[];return{...e,quizRequestState:gt.Success,quizResults:(E=t.payload)==null?void 0:E.quizResults,quizCurrentQuestion:void 0,selectedOptionsWithAttributes:f,matchedOptions:c}}case he.SET_QUIZ_SHARED_RESULTS:return{...e,quizRequestState:gt.Success,quizResults:(y=t.payload)==null?void 0:y.quizResults,quizCurrentQuestion:void 0,selectedOptionsWithAttributes:(a=t.payload)==null?void 0:a.quizResults.attributes};case he.SET_QUIZ_RESULTS_CONFIG:return{...e,resultsConfig:(h=t.payload)==null?void 0:h.quizResultsConfig.results_config};case he.SET_QUIZ_RESULTS_CONFIG_ERROR:return{...e,resultsConfig:null};case he.RESET_QUIZ:return{...Jf};default:return e}}const Cg=(e,t,n,r,i)=>{const[o,s]=j.useReducer(Eg,Jf),{quizId:l,quizVersionId:u,resultsPageOptions:d}=e,{queryItems:m,queryAttributes:w,isSharedResultsQuery:S}=Yf(),E=async()=>{try{const h=await Yv(t,l,{answers:n.answers,resultsPerPage:d==null?void 0:d.numResultsToDisplay,quizVersionId:n.quizVersionId,quizSessionId:n.quizSessionId});s({type:he.SET_QUIZ_RESULTS,payload:{quizResults:h}}),n.isQuizCompleted||i({type:Q.Complete})}catch{s({type:he.SET_IS_ERROR})}},y=async()=>{try{const h=await Jv(t,l,{quizVersionId:n.quizVersionId});s({type:he.SET_QUIZ_RESULTS_CONFIG,payload:{quizResultsConfig:h}})}catch{s({type:he.SET_QUIZ_RESULTS_CONFIG_ERROR,payload:{quizResultsConfigError:null}})}},a=async()=>{try{const h=await Xv(t,m);s({type:he.SET_QUIZ_SHARED_RESULTS,payload:{quizResults:{...h,attributes:w}}})}catch{s({type:he.SET_IS_ERROR})}};return j.useEffect(()=>{typeof o.resultsConfig>"u"&&y()},[o.resultsConfig]),j.useEffect(()=>{(async()=>{if(s({type:he.SET_IS_LOADING}),S)await a();else if(r)await E();else try{const h=n.quizVersionId||u,{quizSessionId:f}=n,c=await Zv(t,l,{answers:n.answers,quizVersionId:h,quizSessionId:f});if(!c.next_question){await E();return}(!f&&(c!=null&&c.quiz_session_id)||!h&&c.quiz_version_id)&&i({type:Q.Hydrate,payload:{quizVersionId:c==null?void 0:c.quiz_version_id,quizSessionId:c==null?void 0:c.quiz_session_id}}),s({type:he.SET_CURRENT_QUESTION,payload:{quizCurrentQuestion:c}})}catch{s({type:he.SET_IS_ERROR})}})()},[t,l,n.answers,d==null?void 0:d.numResultsToDisplay,S]),{quizApiState:o,dispatchApiState:s}},Xf={answers:[],answerInputs:{},prevAnswerInputs:{},isQuizCompleted:!1};function Gr(e,t){return{...e,[String(t.payload.questionId)]:{type:t.type,value:t.payload.input}}}function xg(e,t){var n;switch(t.type){case Q.OpenText:return{...e,answerInputs:Gr(e.answerInputs,t),isQuizCompleted:!1};case Q.Cover:return{...e,answerInputs:Gr(e.answerInputs,t),isQuizCompleted:!1};case Q.SingleSelect:return{...e,answerInputs:Gr(e.answerInputs,t),isQuizCompleted:!1};case Q.MultipleSelect:return{...e,answerInputs:Gr(e.answerInputs,t),isQuizCompleted:!1};case Q.Next:{const{answers:r,answerInputs:i}=e,o=[...r],s=r.length,l=(n=Object.values(e.answerInputs))==null?void 0:n[s];switch(l.type){case Q.OpenText:o.push(["true"]);break;case Q.Cover:o.push(["seen"]);break;case Q.SingleSelect:case Q.MultipleSelect:o.push(l.value.map(u=>u.id));break;default:o.push([])}return{...e,prevAnswerInputs:i,answers:o,isQuizCompleted:!1}}case Q.Skip:{const{answers:r,answerInputs:i}=e,o=[...r],s=r.length;switch(Object.values(e.answerInputs)[s].type){case Q.OpenText:o.push(["false"]);break;case Q.Cover:o.push(["seen"]);break;case Q.SingleSelect:case Q.MultipleSelect:default:o.push([])}return{...e,prevAnswerInputs:i,answers:o,isQuizCompleted:!1}}case Q.Back:{const r={...e.prevAnswerInputs};return{...e,answerInputs:r,answers:[...e.answers.slice(0,-1)],isQuizCompleted:!1}}case Q.Reset:return{...Xf};case Q.Hydrate:return{...e,...t.payload};case Q.Complete:return{...e,isQuizCompleted:!0};default:return e}}const Rg=()=>{const[e,t]=j.useReducer(xg,Xf),n=j.useCallback(r=>{Sh(r),t(r)},[]);return{quizLocalState:e,dispatchLocalState:n}},zg=(e,t,n)=>{var o;const r=(t==null?void 0:t.sessionStateKey)||Ih;return j.useEffect(()=>{var s,l;n&&((s=e==null?void 0:e.answers)!=null&&s.length)&&((l=window==null?void 0:window.sessionStorage)==null||l.setItem(r,JSON.stringify(e)))},[e,r,n]),{skipToResults:!!n&&!!((o=Ds(r))!=null&&o.isQuizCompleted)&&!(t!=null&&t.showSessionModalOnResults),quizSessionStorageStateKey:r,hasSessionStorageState:()=>Ds(r)!==null}},Ng=(e,t)=>{const{sessionStateOptions:n,enableHydration:r}=e,{quizLocalState:i,dispatchLocalState:o}=Rg(),{skipToResults:s,quizSessionStorageStateKey:l,hasSessionStorageState:u}=zg(i,n,r===void 0?!0:r),{quizApiState:d,dispatchApiState:m}=Cg(e,t,i,s,o);return{quizApiState:d,quizLocalState:i,dispatchApiState:m,dispatchLocalState:o,quizSessionStorageState:{skipToResults:s,key:l,hasSessionStorageState:u}}},Tg=e=>{const{apiKey:t,cioJsClient:n,primaryColor:r,resultsPageOptions:i}=e;ng(e);const o=tg({apiKey:t,cioJsClient:n}),s=Ng(e,o),l=Sg(e,o,s),{quizApiState:u,quizLocalState:d,quizSessionStorageState:m}=s,{skipToResults:w}=m,S=cg(l,u,d,i==null?void 0:i.favoriteItems),E=fg(r);return j.useEffect(()=>{w&&l.hydrateQuiz()},[]),{cioClient:o,state:{answers:{inputs:d.answerInputs},quiz:{requestState:u.quizRequestState,versionId:d.quizVersionId,sessionId:d.quizSessionId,currentQuestion:u.quizCurrentQuestion,results:u.quizResults,selectedOptionsWithAttributes:u.selectedOptionsWithAttributes,matchedOptions:u.matchedOptions,resultsConfig:u.resultsConfig??null},quizSessionStorageState:m},events:{...l},...S,primaryColorStyles:E}};function qg({continueSession:e,resetStoredState:t,setShowSessionPrompt:n,showSessionPrompt:r}){const i=()=>{t(),n(!1)};if(r){const o=()=>({className:"cio-question-cta-button",onClick:()=>{e(),n(!1)}}),s=()=>({className:"cio-question-cta-button",onClick:()=>{t(),n(!1)}});return T.createElement("div",{className:"cio-session-prompt-modal",role:"presentation",onClick:i},T.createElement("div",{className:"cio-session-prompt-container"},T.createElement("div",{className:"cio-session-prompt-content",role:"presentation",onClick:l=>l.stopPropagation()},T.createElement("div",null,"Do you want to continue where you left off?"),T.createElement("div",{className:"cio-session-prompt-controls-container"},T.createElement(Pi,{ctaText:"No",type:"button",propsGetters:s}),T.createElement(Pi,{type:"button",ctaText:"Yes",propsGetters:o})))))}return null}function Pg(){return T.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M18.4748 4.11089C18.8653 3.72036 19.4985 3.72036 19.889 4.11089C20.2795 4.50141 20.2795 5.13458 19.889 5.5251L5.52503 19.8891C5.13451 20.2796 4.50134 20.2796 4.11082 19.8891C3.72029 19.4985 3.72029 18.8654 4.11082 18.4748L18.4748 4.11089Z",fill:"#505A75"}),T.createElement("path",{d:"M4.11076 5.5251C3.72024 5.13458 3.72024 4.50141 4.11076 4.11089C4.50129 3.72036 5.13445 3.72036 5.52498 4.11089L19.8889 18.4748C20.2795 18.8654 20.2795 19.4985 19.8889 19.8891C19.4984 20.2796 18.8652 20.2796 18.4747 19.8891L4.11076 5.5251Z",fill:"#505A75"}))}function $f(){return T.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M21.001 12.0001C21.001 7.03137 16.9697 3.00012 12.001 3.00012C7.03223 3.00012 3.00098 7.03137 3.00098 12.0001C3.00098 16.9689 7.03223 21.0001 12.001 21.0001C16.9697 21.0001 21.001 16.9689 21.001 12.0001Z",stroke:"#101010",strokeWidth:"1.33",strokeMiterlimit:"10"}),T.createElement("path",{d:"M16.5005 8.24963L10.2005 15.7496L7.50049 12.7496",stroke:"#101010",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"}))}function ed(){return T.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T.createElement("path",{d:"M21.0009 11.9995C21.0009 7.03076 16.9697 2.99951 12.0009 2.99951C7.03217 2.99951 3.00092 7.03076 3.00092 11.9995C3.00092 16.9683 7.03217 20.9995 12.0009 20.9995C16.9697 20.9995 21.0009 16.9683 21.0009 11.9995Z",stroke:"#101010",strokeWidth:"1.33",strokeMiterlimit:"10"}),T.createElement("path",{d:"M11.7311 7.78322L12.0002 13.4996L12.2688 7.78322C12.2705 7.74667 12.2646 7.71017 12.2517 7.67595C12.2388 7.64173 12.219 7.6105 12.1936 7.58418C12.1682 7.55785 12.1377 7.53699 12.104 7.52285C12.0702 7.50872 12.034 7.50161 11.9974 7.50197V7.50197C11.9612 7.50231 11.9255 7.50993 11.8924 7.52437C11.8593 7.53882 11.8294 7.55979 11.8045 7.58604C11.7797 7.61229 11.7604 7.64328 11.7478 7.67716C11.7352 7.71104 11.7295 7.74711 11.7311 7.78322V7.78322Z",stroke:"#101010",strokeWidth:"1.00189",strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M12.0028 17.2505C11.8168 17.2505 11.6351 17.1954 11.4805 17.0921C11.3259 16.9888 11.2054 16.8419 11.1342 16.6702C11.0631 16.4984 11.0444 16.3093 11.0807 16.127C11.117 15.9446 11.2065 15.7771 11.338 15.6456C11.4695 15.5141 11.637 15.4246 11.8194 15.3883C12.0017 15.352 12.1908 15.3706 12.3626 15.4418C12.5343 15.513 12.6812 15.6335 12.7845 15.7881C12.8878 15.9427 12.9429 16.1244 12.9429 16.3104C12.9429 16.5597 12.8439 16.7988 12.6676 16.9752C12.4913 17.1515 12.2521 17.2505 12.0028 17.2505Z",fill:"#101010"}))}function Ig({url:e}){const[t,n]=j.useState(!1),[r,i]=j.useState(!1);return T.createElement("div",{className:"cio-share-results-feature-group"},T.createElement("div",{className:"cio-share-results-description"},"Share by link"),T.createElement("div",{className:"cio-share-results-button-group"},T.createElement("input",{className:"cio-share-results-link-input",value:e,disabled:!0}),T.createElement("button",{className:"cio-share-results-share-button",type:"button",onClick:()=>{try{navigator.clipboard.writeText(e),n(!0)}catch{i(!0)}}},"Copy link")),t&&T.createElement("div",{className:"cio-share-results-notification"},T.createElement($f,null),T.createElement("div",null,"Link copied to clipboard")),r&&T.createElement("div",{className:"cio-share-results-notification"},T.createElement(ed,null),T.createElement("div",null,"Sorry, there was an error copying. Please try again.")))}function Og({onSubmit:e}){const[t,n]=j.useState(null),[r,i]=j.useState(!1),[o,s]=j.useState(""),l=()=>o.length>0&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)?(n(null),!0):(n({type:"validate",message:"Please enter a valid email address"}),!1),u=async d=>{if(d.preventDefault(),!!l())try{await e(o),i(!0)}catch{n({type:"callback",message:"Sorry, there was an error sending. Please try again."})}};return T.createElement("div",{className:"cio-share-results-feature-group"},T.createElement("form",{onSubmit:u},T.createElement("div",{className:"cio-share-results-description"},"Share by email"),T.createElement("div",{className:"cio-share-results-button-group"},T.createElement("div",{className:"cio-share-results-email-input-group"},T.createElement("input",{className:`cio-share-results-email-input ${t?"cio-share-results-email-input--error":""}`,onChange:d=>s(d.target.value)}),(t==null?void 0:t.type)==="validate"&&T.createElement("div",{className:"cio-share-results-email-input-error-message"},t.message)),T.createElement("button",{className:"cio-share-results-share-button",type:"submit"},"Send"))),r&&T.createElement("div",{className:"cio-share-results-notification"},T.createElement($f,null),T.createElement("div",null,"Email sent")),(t==null?void 0:t.type)==="callback"&&T.createElement("div",{className:"cio-share-results-notification"},T.createElement(ed,null),T.createElement("div",null,t.message)))}function Lg(e){var i,o,s;const t=new URL(window.location.href),n=t.searchParams;if(!((o=(i=e.results)==null?void 0:i.response)!=null&&o.results))throw new Error("Can't generate share link without results");return n.set("items",e.results.response.results.filter(l=>{var u;return(u=l.data)==null?void 0:u.id}).map(l=>l.data.id).join(",")||""),n.set("attributes",((s=e.selectedOptionsWithAttributes)==null?void 0:s.map(l=>l).join(","))||""),t.toString()}function Ag({onClose:e,quizState:t,onEmailResults:n}){const r=Lg(t);return T.createElement("div",{className:"cio-share-results-modal",role:"presentation",onClick:e},T.createElement("div",{className:"cio-share-results-container"},T.createElement("div",{className:"cio-share-results-content",onClick:i=>i.stopPropagation(),role:"presentation"},T.createElement("div",{className:"cio-share-results-header"},T.createElement("div",{className:"cio-share-results-title"},"Share results"),T.createElement("button",{onClick:e,type:"button",className:"cio-modal-close-button","aria-label":"Close button"},T.createElement(Pg,null))),T.createElement("div",null,n?"Share or save your quiz results through email or using the link below.":"Share or save your quiz results with this link."),n&&T.createElement(Og,{onSubmit:i=>n({email:i,url:r})}),T.createElement(Ig,{url:r}))))}function Bg(){const{state:e}=j.useContext(Ee),t=e==null?void 0:e.quiz.currentQuestion;return t!=null&&t.next_question?T.createElement("div",{className:"cio-question-progress-affixed-container"},T.createElement("div",{className:"cio-question-progress-progress-container"},T.createElement("div",{className:"cio-question-progress-progress-bar",style:{width:`${(t.next_question.id-1)/t.total_questions*100}%`}}))):null}function Ug(e){var L;const{cioClient:t,state:n,events:{hydrateQuiz:r,resetSessionStorageState:i},getAddToCartButtonProps:o,getAddToFavoritesButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:d,getSkipQuestionButtonProps:m,getOpenTextInputProps:w,getPreviousQuestionButtonProps:S,getQuizImageProps:E,getQuizResultButtonProps:y,getQuizResultLinkProps:a,getResetQuizButtonProps:h,getSelectInputProps:f,primaryColorStyles:c,getShareResultsButtonProps:p}=Tg(e),[C,z]=j.useState(!1),[_,g]=j.useState(!1),{callbacks:v,sessionStateOptions:N,questionsPageOptions:k,resultCardOptions:P,resultsPageOptions:q}=e,{quizSessionStorageState:{hasSessionStorageState:O,skipToResults:M}}=n;j.useEffect(()=>{(N==null?void 0:N.showSessionModal)!==void 0?z((N==null?void 0:N.showSessionModal)&&O()&&!M):z(O()&&!M)},[]);const H={cioClient:t,state:n,getAddToCartButtonProps:o,getAddToFavoritesButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:d,getSkipQuestionButtonProps:m,getOpenTextInputProps:w,getPreviousQuestionButtonProps:S,getQuizImageProps:E,getQuizResultButtonProps:y,getQuizResultLinkProps:a,getResetQuizButtonProps:h,getShareResultsButtonProps:p,getSelectInputProps:f,customClickItemCallback:!!(v!=null&&v.onQuizResultClick),customAddToFavoritesCallback:!!(v!=null&&v.onAddToFavoritesClick),primaryColorStyles:c};if(n.quiz.requestState===gt.Loading)return T.createElement("div",{className:"cio-quiz cio-quiz-loading"},T.createElement(Hf,null));const A=(L=n.quiz.currentQuestion)==null?void 0:L.next_question,x=A==null?void 0:A.type,R=A==null?void 0:A.images,I=(x==="single"||x==="multiple")&&R;return n.quiz.requestState===gt.Success?T.createElement("div",{className:"cio-quiz",style:{overflow:_||C?"hidden":void 0}},I&&Ki(R,"cio-question-background-image"),T.createElement("style",null,".cio-quiz ",Ch(c)),T.createElement(qg,{resetStoredState:i,continueSession:r,showSessionPrompt:C,setShowSessionPrompt:z}),n.quiz&&_&&T.createElement(Ag,{onClose:()=>g(!1),quizState:n.quiz,onEmailResults:v==null?void 0:v.onEmailResults}),T.createElement(Ee.Provider,{value:H},n.quiz.results||M?T.createElement(Qh,{resultCardOptions:P,onShare:()=>g(!0),resultsPageOptions:q}):n.quiz.currentQuestion&&T.createElement(T.Fragment,null,T.createElement(Bg,null),T.createElement(Th,null),T.createElement(Gh,{skipQuestionButtonText:k==null?void 0:k.skipQuestionButtonText,ctaButtonText:(A==null?void 0:A.cta_text)||void 0})))):null}const Fg=({selector:e,includeCSS:t=!0,...n})=>{if(document){const r=document.getElementById("cio-quizzes-styles"),i=document.querySelector(e);if(!i){console.error("CioQuiz: There were no elements found for the provided selector");return}r&&(t?r.disabled=!1:r.disabled=!0),Go.createRoot(i).render(T.createElement(T.StrictMode,null,T.createElement(Ug,{...n})))}};window&&(window.CioQuiz=Fg);export{Fg as default};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importDefault(require("react"));
5
+ const constants_1 = require("../../constants");
6
+ const utils_1 = require("../../utils");
7
+ const getSummaryVariables = ({ summary, matchedOptions = [] }) => {
8
+ if (summary === null) {
9
+ return {
10
+ summaryFirstPart: 'Based on your answers ',
11
+ summaryLastPart: ' we recommend these matches.',
12
+ itemsSeparator: ', ',
13
+ lastSeparator: ' and ',
14
+ isActiveSummary: true,
15
+ };
16
+ }
17
+ const { text = '', is_active: isActive, items_separator: itemsSeparator, last_separator: lastSeparator, } = summary;
18
+ const isActiveSummary = !!isActive && !!matchedOptions.length && !!(text === null || text === void 0 ? void 0 : text.length);
19
+ const [summaryFirstPart, summaryLastPart] = (text === null || text === void 0 ? void 0 : text.split(constants_1.MATCHED_OPTIONS_PLACEHOLDER)) || [];
20
+ return {
21
+ summaryFirstPart,
22
+ summaryLastPart,
23
+ itemsSeparator,
24
+ lastSeparator,
25
+ isActiveSummary,
26
+ };
27
+ };
28
+ function QuizResultsSummary({ summary, matchedOptions = [], }) {
29
+ const { summaryFirstPart, summaryLastPart, itemsSeparator, lastSeparator, isActiveSummary } = getSummaryVariables({ summary, matchedOptions });
30
+ const matchedOptionsTemplate = (0, utils_1.formatMatchedOptions)(matchedOptions, itemsSeparator, lastSeparator);
31
+ if (!isActiveSummary)
32
+ return null;
33
+ return (react_1.default.createElement("p", { className: 'cio-results-explanation' },
34
+ !!(summaryFirstPart === null || summaryFirstPart === void 0 ? void 0 : summaryFirstPart.length) && summaryFirstPart,
35
+ !!matchedOptionsTemplate.length && react_1.default.createElement("span", null, matchedOptionsTemplate),
36
+ !!(summaryLastPart === null || summaryLastPart === void 0 ? void 0 : summaryLastPart.length) && summaryLastPart));
37
+ }
38
+ exports.default = QuizResultsSummary;
@@ -4,15 +4,15 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const context_1 = tslib_1.__importDefault(require("../CioQuiz/context"));
6
6
  const ShareButton_1 = tslib_1.__importDefault(require("../ShareButton/ShareButton"));
7
+ const QuizResultsSummary_1 = tslib_1.__importDefault(require("../QuizResultsSummary/QuizResultsSummary"));
7
8
  function ResultFiltersAndShare({ onShare, numberOfResults, showShareButton, }) {
8
- var _a;
9
+ var _a, _b, _c, _d, _e;
9
10
  const { state } = (0, react_1.useContext)(context_1.default);
10
- const matchedOptions = ((_a = state === null || state === void 0 ? void 0 : state.quiz) === null || _a === void 0 ? void 0 : _a.matchedOptions) || [];
11
+ const matchedOptions = (_a = state === null || state === void 0 ? void 0 : state.quiz) === null || _a === void 0 ? void 0 : _a.matchedOptions;
12
+ const summary = (_e = (_d = (_c = (_b = state === null || state === void 0 ? void 0 : state.quiz) === null || _b === void 0 ? void 0 : _b.resultsConfig) === null || _c === void 0 ? void 0 : _c.desktop) === null || _d === void 0 ? void 0 : _d.response_summary) !== null && _e !== void 0 ? _e : null;
11
13
  return (react_1.default.createElement("div", { className: 'cio-results-filter-and-redo-container cio-results-button-group' },
12
- react_1.default.createElement("div", { className: 'cio-results-filter-container' }, !!matchedOptions.length && (react_1.default.createElement("p", { className: 'cio-results-explanation' },
13
- "Based on your answers ",
14
- react_1.default.createElement("span", null, matchedOptions.join(', ')),
15
- " we recommend these matches."))),
14
+ react_1.default.createElement("div", { className: 'cio-results-filter-container' },
15
+ react_1.default.createElement(QuizResultsSummary_1.default, { summary: summary, matchedOptions: matchedOptions })),
16
16
  react_1.default.createElement("div", { className: 'cio-results-number-and-share-button-group' },
17
17
  numberOfResults,
18
18
  " ",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RequestStates = exports.quizSessionStateKey = exports.quizId = exports.apiKey = void 0;
3
+ exports.MATCHED_OPTIONS_PLACEHOLDER = exports.RequestStates = exports.quizSessionStateKey = exports.quizId = exports.apiKey = void 0;
4
4
  // Autocomplete key index
5
5
  exports.apiKey = 'key_n4SkMH5PFWLdStQZ';
6
6
  exports.quizId = 'coffee-quiz';
@@ -13,3 +13,4 @@ var RequestStates;
13
13
  RequestStates["Success"] = "SUCCESS";
14
14
  RequestStates["Error"] = "ERROR";
15
15
  })(RequestStates = exports.RequestStates || (exports.RequestStates = {}));
16
+ exports.MATCHED_OPTIONS_PLACEHOLDER = '@matched_options';
package/lib/cjs/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertPrimaryColorsToString = exports.rgbToHsl = exports.sleep = exports.logger = exports.resetQuizSessionStorageState = exports.getStateFromSessionStorage = exports.isFunction = exports.getPreferredColorScheme = exports.getQuestionTypes = exports.stringify = exports.stringifyWithDefaults = exports.functionStrings = exports.renderImages = void 0;
3
+ exports.formatMatchedOptions = exports.convertPrimaryColorsToString = exports.rgbToHsl = exports.sleep = exports.logger = exports.resetQuizSessionStorageState = exports.getStateFromSessionStorage = exports.isFunction = exports.getPreferredColorScheme = exports.getQuestionTypes = exports.stringify = exports.stringifyWithDefaults = exports.functionStrings = exports.renderImages = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  /* eslint-disable no-console */
6
6
  const react_1 = tslib_1.__importDefault(require("react"));
@@ -165,3 +165,11 @@ function convertPrimaryColorsToString(primaryColorStyles) {
165
165
  }`;
166
166
  }
167
167
  exports.convertPrimaryColorsToString = convertPrimaryColorsToString;
168
+ function formatMatchedOptions(options, separator, lastSeparator) {
169
+ if (!options.length || !separator || !lastSeparator) {
170
+ return '';
171
+ }
172
+ const firstPart = options.slice(0, -1).join(separator);
173
+ return [firstPart, lastSeparator, options.at(-1)].join('');
174
+ }
175
+ exports.formatMatchedOptions = formatMatchedOptions;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.12.6';
3
+ exports.default = '1.13.0';
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { MATCHED_OPTIONS_PLACEHOLDER } from '../../constants';
3
+ import { formatMatchedOptions } from '../../utils';
4
+ const getSummaryVariables = ({ summary, matchedOptions = [] }) => {
5
+ if (summary === null) {
6
+ return {
7
+ summaryFirstPart: 'Based on your answers ',
8
+ summaryLastPart: ' we recommend these matches.',
9
+ itemsSeparator: ', ',
10
+ lastSeparator: ' and ',
11
+ isActiveSummary: true,
12
+ };
13
+ }
14
+ const { text = '', is_active: isActive, items_separator: itemsSeparator, last_separator: lastSeparator, } = summary;
15
+ const isActiveSummary = !!isActive && !!matchedOptions.length && !!text?.length;
16
+ const [summaryFirstPart, summaryLastPart] = text?.split(MATCHED_OPTIONS_PLACEHOLDER) || [];
17
+ return {
18
+ summaryFirstPart,
19
+ summaryLastPart,
20
+ itemsSeparator,
21
+ lastSeparator,
22
+ isActiveSummary,
23
+ };
24
+ };
25
+ export default function QuizResultsSummary({ summary, matchedOptions = [], }) {
26
+ const { summaryFirstPart, summaryLastPart, itemsSeparator, lastSeparator, isActiveSummary } = getSummaryVariables({ summary, matchedOptions });
27
+ const matchedOptionsTemplate = formatMatchedOptions(matchedOptions, itemsSeparator, lastSeparator);
28
+ if (!isActiveSummary)
29
+ return null;
30
+ return (React.createElement("p", { className: 'cio-results-explanation' },
31
+ !!summaryFirstPart?.length && summaryFirstPart,
32
+ !!matchedOptionsTemplate.length && React.createElement("span", null, matchedOptionsTemplate),
33
+ !!summaryLastPart?.length && summaryLastPart));
34
+ }
@@ -1,14 +1,14 @@
1
1
  import React, { useContext } from 'react';
2
2
  import QuizContext from '../CioQuiz/context';
3
3
  import ShareButton from '../ShareButton/ShareButton';
4
+ import QuizResultsSummary from '../QuizResultsSummary/QuizResultsSummary';
4
5
  function ResultFiltersAndShare({ onShare, numberOfResults, showShareButton, }) {
5
6
  const { state } = useContext(QuizContext);
6
- const matchedOptions = state?.quiz?.matchedOptions || [];
7
+ const matchedOptions = state?.quiz?.matchedOptions;
8
+ const summary = state?.quiz?.resultsConfig?.desktop?.response_summary ?? null;
7
9
  return (React.createElement("div", { className: 'cio-results-filter-and-redo-container cio-results-button-group' },
8
- React.createElement("div", { className: 'cio-results-filter-container' }, !!matchedOptions.length && (React.createElement("p", { className: 'cio-results-explanation' },
9
- "Based on your answers ",
10
- React.createElement("span", null, matchedOptions.join(', ')),
11
- " we recommend these matches."))),
10
+ React.createElement("div", { className: 'cio-results-filter-container' },
11
+ React.createElement(QuizResultsSummary, { summary: summary, matchedOptions: matchedOptions })),
12
12
  React.createElement("div", { className: 'cio-results-number-and-share-button-group' },
13
13
  numberOfResults,
14
14
  " ",
@@ -10,3 +10,4 @@ export var RequestStates;
10
10
  RequestStates["Success"] = "SUCCESS";
11
11
  RequestStates["Error"] = "ERROR";
12
12
  })(RequestStates || (RequestStates = {}));
13
+ export const MATCHED_OPTIONS_PLACEHOLDER = '@matched_options';
package/lib/mjs/utils.js CHANGED
@@ -145,3 +145,10 @@ export function convertPrimaryColorsToString(primaryColorStyles) {
145
145
  --primary-color-l: ${primaryColorStyles['--primary-color-l']};
146
146
  }`;
147
147
  }
148
+ export function formatMatchedOptions(options, separator, lastSeparator) {
149
+ if (!options.length || !separator || !lastSeparator) {
150
+ return '';
151
+ }
152
+ const firstPart = options.slice(0, -1).join(separator);
153
+ return [firstPart, lastSeparator, options.at(-1)].join('');
154
+ }
@@ -1 +1 @@
1
- export default '1.12.6';
1
+ export default '1.13.0';
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { QuizResultsConfig } from '../../types';
3
+ interface QuizResultsSummaryProps {
4
+ summary: QuizResultsConfig['desktop']['response_summary'];
5
+ matchedOptions?: string[];
6
+ }
7
+ export default function QuizResultsSummary({ summary, matchedOptions, }: QuizResultsSummaryProps): JSX.Element | null;
8
+ export {};
@@ -7,3 +7,4 @@ export declare enum RequestStates {
7
7
  Success = "SUCCESS",
8
8
  Error = "ERROR"
9
9
  }
10
+ export declare const MATCHED_OPTIONS_PLACEHOLDER = "@matched_options";
@@ -36,3 +36,4 @@ export declare const logger: (action: any) => void;
36
36
  export declare function sleep(ms: any): Promise<unknown>;
37
37
  export declare function rgbToHsl(r: number, g: number, b: number): number[];
38
38
  export declare function convertPrimaryColorsToString(primaryColorStyles: PrimaryColorStyles): string;
39
+ export declare function formatMatchedOptions(options: string[], separator?: string | null, lastSeparator?: string | null): string;
@@ -1,2 +1,2 @@
1
- declare const _default: "1.12.6";
1
+ declare const _default: "1.13.0";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-ui-quizzes",
3
- "version": "1.12.6",
3
+ "version": "1.13.0",
4
4
  "description": "Constructor.io Quizzes UI library for web applications",
5
5
  "author": "constructor.io",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "check-license": "license-checker --production --onlyAllow 'Apache-2.0;BSD-3-Clause;MIT;0BSD;BSD-2-Clause' --excludePackages 'picocolors@1.0.0'"
62
62
  },
63
63
  "peerDependencies": {
64
- "@constructor-io/constructorio-client-javascript": "^2.42.0",
64
+ "@constructor-io/constructorio-client-javascript": "^2.42.1",
65
65
  "react": ">=16.12.0",
66
66
  "react-dom": ">=16.12.0",
67
67
  "tslib": "^2.4.0"