PageSourceSearch

https://telepathicinstruments.com/cdn/shop/t/11/assets/timesact.js?v=163295939614899592881779242964

js telepathicinstruments.com collected 2026-09-25 23:49:14 UTC 99,352 bytes, 502 lines download raw bytes

1(function(){const loadScript=function(url,callback){const script=document.createElement("script");script.type="text/javascript",script.readyState?script.onreadystatechange=function(){(script.readyState==="loaded"||script.readyState==="complete")&&(script.onreadystatechange=null,callback())}:script.onload=function(){callback()},script.src=url,document.getElementsByTagName("head")[0].appendChild(script)};timesactScriptNew=async function($){const style=document.createElement("style");style.id="TimesactCSS",style.innerHTML=`.timesact-badge-ribbon span::before {
2                            content: "";
3                            position: absolute; left: 0px; top: 100%;
4                            z-index: -1;
5                            border-left: 3px solid #888888;
6                            border-right: 3px solid transparent;
7                            border-bottom: 3px solid transparent;
8                            border-top: 3px solid #888888;
9                        }
10                        .timesact-badge-ribbon span::after {
11                            content: "";
12                            position: absolute; right: 0px; top: 100%;
13                            z-index: -1;
14                            border-left: 3px solid transparent;
15                            border-right: 3px solid #888888;
16                            border-bottom: 3px solid transparent;
17                            border-top: 3px solid #888888;
18                        }
19                        .md-modal {
20                            position: fixed;
21                            top: 50%;
22                            left: 50%;
23                            width: 40%;
24                            height: auto;
25                            z-index: 999999999999;
26                            visibility: hidden;
27                            transform: translateX(-50%) translateY(-50%);
28                        }
29                        .md-content {
30                            background: #fff;
31                            position: relative;
32                            border-radius: 10px;
33                            margin: 0 auto;
34                        }
35                        .md-show {
36                            visibility: visible;
37                        }
38                        .md-show ~ .md-overlay {
39                            opacity: 1;
40                            visibility: visible;
41                            display: block;
42                        }
43                        .popup-container {
44                            min-height: 100%;
45                            display: none;
46                        }
47                        .md-overlay {
48                            position: fixed;
49                            width: 100%;
50                            height: 100%;
51                            visibility: hidden;
52                            top: 0;
53                            left: 0;
54                            z-index: 1000;
55                            opacity: 0;
56                            background: #c9c9c9c2;
57                            -webkit-transition: all 0.3s;
58                            -moz-transition: all 0.3s;
59                            transition: all 0.3s;
60                        }
61                        .md-body {
62                            text-align: center;
63                            padding-top: 10%;
64                            padding-bottom: 10%;
65                            font-family: "Roboto";
66                        }
67                        p.message {
68                              padding: 20px;
69                        }
70                        .md-close {
71                            background: #f70427;
72                            border: none;
73                            color: white;
74                            padding: 10px;
75                            border-radius: 4px;
76                            cursor: pointer;
77                        }
78                        @media screen and (max-width: 32em) {
79                            .md-modal { width: 80%; }
80                        }
81                        .timesact_bis_popup_overlay {
82                            position: fixed;
83                            top: 0;
84                            left: 0;
85                            z-index: 1040;
86                            visibility: hidden;
87                            width: 100vw;
88                            height: 100vh;
89                            background-color: #000;
90                            opacity: .5;
91                            display: block !important;
92                        }
93
94                        .timesact_bis_dialog {
95                            display: inline-table;
96                            position: fixed;
97                            top: 0;
98                            left: 0;
99                            z-index: 1050;
100                            visibility: hidden;
101                            width: 100%;
102                            height: 100%;
103                            overflow-x: hidden;
104                            overflow-y: auto;
105                            outline: 0;
106                        }
107                        
108                        .timesact_bis_popup_overlay_show,
109                        .timesact_bis_dialog_show {
110                            visibility: visible;
111                        }
112                        
113                        .timesact_bis_popup {
114                            z-index: 1000000;
115                            background: #fff;
116                            color: #000;
117                            margin: auto;
118                            pointer-events: none;
119                            max-width: 460px;
120                            width: 96%;
121                            top: 50%;
122                            left: 50%;
123                            transform: translate(-50%, -50%);
124                            position: fixed;
125                            border-radius: 10px;
126                            font-size: 14px;
127                            /*add dynamic value*/
128                        }
129
130                        .timesact_bis_popup_content {
131                            pointer-events: auto;
132                            position: relative
133                        }
134
135                        .timesact_bis_popup_body {
136                            padding: 20px;
137                            position: relative;
138                            display: flex;
139                            flex-direction: column;
140                            width: 100%;
141                            border-radius: .3rem
142                        }
143
144                        .timesact_bis_close_button {
145                            padding: 5px;
146                            background: 0 0;
147                            font-size: 1.4rem;
148                            font-weight: 700;
149                            line-height: 1;
150                            opacity: 1;
151                            cursor: pointer;
152                            outline: 0;
153                            border-radius: 0;
154                            position: absolute;
155                            top: 0;
156                            right: 0;
157                            border: 0
158                        }
159
160                        .timesact_bis_close_span {
161                            display: inline-block;
162                            height: 20px;
163                            width: 20px;
164                            color: #000;
165                            margin-top: 0;
166                        }
167
168                        .timesact_bis_heading {
169                            margin-bottom: 0;
170                            color: #000;
171                            /*dynamic value*/
172                            margin-top: 0;
173                            font-size: calc(2 * 1em);
174                            /*dynamic value*/
175                            font-weight: 700
176                        }
177
178                        .timesact_bis_desc {
179                            margin-bottom: 0;
180                            color: #000;
181                            /*dynamic value*/
182                            font-size: 14px;
183                            /*dynamic value*/
184                        }
185
186                        .timesact_bis_line {
187                            margin: 10px 0
188                        }
189
190                        .timesact_bis_form_field {
191                            margin-top: 10px
192                        }
193
194                        .timesact_bis_input {
195                            padding: 8px 15px;
196                            border: 1px solid #949494;
197                            background-color: #fff;
198                            color: #000;
199                            max-width: 100%;
200                            line-height: 1.2;
201                            width: 100%;
202                            outline: 0;
203                            border-radius: 10px;
204                            /*dynamic value*/
205                        }
206
207                        .timesact_bis_submit_button {
208                            width: 100%;
209                            outline: 0;
210                            border: 0;
211                            padding: 10px;
212                            display: flex;
213                            align-items: center;
214                            justify-content: center;
215                            background: #000;
216                            /*dynamic value*/
217                            color: #fff;
218                            /*dynamic value*/
219                            border-radius: 10px;
220                            /*dynamic value*/
221                            font-size: 14px;
222                            cursor: pointer;
223                        }
224
225                        .timesact_bis_submit_button--disabled {
226                            background: #ddd
227                        }
228
229                        .timesact_bis_loading_icon {
230                            width: 15px !important;
231                            height: 15px !important;
232                            margin-right: 5px !important;
233                        }
234
235                        .timesact_bis_loading_icon:after {
236                            content: " ";
237                            display: block;
238                            width: 15px !important;
239                            height: 15px !important;
240                            border-radius: 50%;
241                            border: 2px solid #fff;
242                            border-color: #fff transparent #fff transparent;
243                            animation: timesact-bis-loading 1.2s linear infinite
244                        }
245
246                        @keyframes timesact-bis-loading {
247                            0% {
248                                transform: rotate(0)
249                            }
250
251                            100% {
252                                transform: rotate(360deg)
253                            }
254                        }
255
256                        .timesact_bis_note {
257                            color: black;
258                            font-size: 80%;
259                            margin-bottom: 0
260                        }
261                        
262                        .timesact_bis_response {
263                            margin-bottom: 0;
264                        }
265
266                        .timesact_bis_message_success {
267                            width: 100%;
268							text-align: center;
269							font-weight: 600;
270                            display: none;
271                            color: #28a745;
272                        }
273
274                        .timesact_bis_message_error {
275                            width: 100%;
276							text-align: center;
277							font-weight: 600;
278                            display: none;
279                            color: red;
280                        }
281
282                        .timesact_powered_by {
283                            margin-top: 15px;
284                            left: 0;
285                            right: 0;
286                            text-align: center;
287                        }
288
289                        .timesact_powered_by a {
290                          text-decoration: none;
291                          color: #000 !important;
292                          font-weight: 700;
293                        }
294                        
295                        .timesact_bis_field_empty {
296                          border: 1px solid red;
297                        }
298                        
299                        .timesact_bis_message_show {
300                            display: block !important;
301                        }
302                        
303                        .timesact-button:after {
304                            content: none
305                        }
306
307                        .timesact-button:before {
308                            content: none
309                        }
310                        .timesact_bis_subscribe {
311                          font-size: 80%;
312                        }
313
314                        .timesact_sub #newsletter {
315                            height: 14px !important;
316                            width: 14px !important;
317                        }
318                        .timesact_sub {
319                            display: none;
320                        }
321
322                        #timesact_widget{
323                            width: 100%;
324                            text-align: left;
325                            margin-top: 17px;
326                            clear: both;
327                            max-width: 400px;
328                            
329                        }
330                        #timesact_widget .timesact_widget_wrapper {
331                            border: 1.5px solid #cccccc;
332                            // box-shadow: 0 0 0 1px #c4cdd5;
333                            border-radius: 5px;
334                            margin-bottom: 5px;
335                            margin-top: 10px;
336                        }
337                        
338                        #timesact_widget .timesact_option {
339                            display: flex;
340                            position: relative;
341                            padding: 16px 16px;
342                            flex-direction: column;
343                        }
344                        
345                        #timesact_widget .timesact_option:first-child {
346                            border-bottom: inherit;
347                        }
348                        #timesact_widget .timesact_option:first-child:last-child {
349                            border-bottom: none;
350                        }
351
352                        #timesact_widget .timesact_radio_label {
353                            display: flex !important;
354                            align-items: center;
355                            margin: 0;
356                            padding: 0;
357                            background: none;
358                        }
359                        
360                        .timesact_circle {
361                            position: relative;
362                        }
363                        
364                        .timesact_option input[type=radio]:focus + label .timesact_circle:before {
365                            height: 24px;
366                            width: 24px;
367                            border: 2px solid #3a3a3a;
368                            border-radius: 50%;
369                            flex-shrink: 0;
370                            content: '';
371                            position: absolute;
372                            left: 50%;
373                            top: 50%;
374                            transform: translate(-50%, -50%);
375                        }
376                        
377                        [name="selling_plan"] {
378                          position: absolute;
379                          opacity: 0;
380                        }
381
382                        #timesact_widget .timesact_circle {
383                            display: flex;
384                            height: 18px;
385                            width: 18px;
386                            border: 2px solid #3a3a3a;
387                            border-radius: 50%;
388                            margin-right: 10px;
389                            justify-content: center;
390                            align-items: center;
391                            flex-shrink: 0;
392                            
393                          }
394                      
395                        #timesact_widget .timesact_option input[type=radio]:checked + label .t
395imesact_circle .timesact_dot {
396                            height: 10px;
397                            width: 10px;
398                            background-color: #3a3a3a;
399                            border-radius: 50%;
400                            flex-shrink: 0;
401                            
402                          }
403                          `,document.getElementsByTagName("head")[0].appendChild(style),document.getElementsByTagName("body")[0].insertAdjacentHTML("afterbegin",'<div class="md-modal" id="mixed-modal"><div class="md-content"><div class="md-body"></div></div></div><div class="popup-container"><div class="column"><button class="md-trigger md-setperspective" data-modal="mixed-modal"></button></div></div><div class="md-overlay"></div>');const timesactBIS=`<div class="timesact_bis_popup_overlay"></div>
404        <div aria-modal="true" aria-hidden="true" tabindex="-1" role="dialog" class="timesact_bis_dialog">
405            <div class="timesact_bis_popup">
406                <div class="timesact_bis_popup_content">
407                    <div class="timesact_bis_popup_body">
408                        <button type="button" data-dismiss="modal" aria-label="Close"
409                            class="timesact_bis_close_button">
410                            <span aria-hidden="true" class="timesact_bis_close_span">x</span>
411                        </button>
412                        <h3 class="timesact_bis_heading"></h3>
413                        <p class="timesact_bis_desc"></p>
414                        <p class="timesact_bis_response">
415                            <span class="timesact_bis_message_success"></span>
416                            <span class="timesact_bis_message_error"></span>
417                             
418                        </p>
419                        <hr class="timesact_bis_line">
420                        <div id="subscriptionForm">
421                            <div class="timesact_bis_form_field">
422                                <input id="timesact_bis_email" class="timesact_bis_input " type="email"
423                                placeholder="eg. [email protected]" name="email" value="">
424                            </div>
425                            <div class="timesact_bis_form_field">
426                                <button type="button" class="timesact_bis_submit_button ">
427                                    <span class="timesact_bis_loading_icon"></span>
428                                </button>
429                            </div>
430                            <div class="timesact_bis_form_field">
431                                <p class="timesact_bis_note"></p>
432                            </div>
433                            <div class="timesact_bis_form_field timesact_sub">
434                                <input type="checkbox" id="newsletter" name="newsletter" checked />
435                                <label class="timesact_bis_subscribe" for="newsletter"></label>
436                            </div>
437                        </div>
438                        <div class="timesact_powered_by">
439                            <a href="https://timesact.com" target="_blank" rel="noreferrer">
440                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M8 24l2.674-9h-9.674l16-15-2.674 9h8.674l-15 15zm-1.586-11h6.912l-1.326 4 5.739-6h-6.065l1.304-4-6.564 6z"></path></svg>
441                                <span>by Timesact</span>
442                            </a>
443                        </div>
444                    </div>
445                </div>
446            </div>
447        </div>`,timesactPartialPayment=`<div class="timesact_widget" id="timesact_widget">
448            <div class="timesact_widget_wrapper">
449                <div class="timesact_option">
450                    <div class="timesact_radio_wrapper">
451                        <input checked type="radio" id="timesact_selling_plan_label" name="selling_plan" value="" tabindex="2">
452                        <label for="timesact_selling_plan_label" class="timesact_radio_label">
453                            <span class="timesact_circle"><span class="timesact_dot"></span></span>
454                            <span class="timesact_text"></span>
455                        </label>
456                    </div>
457                </div>
458            </div>
459        </div>
460        `;document.getElementsByTagName("body")[0].insertAdjacentHTML("afterbegin",timesactBIS);const emailInputFieldSelector=document.querySelector("#timesact_bis_email"),newsletterCheckboxFieldSelector=document.querySelector("#newsletter"),cartModal={isOpen:!1,queue:JSON.parse(window.sessionStorage.getItem("modal-queue")||null)||[]};class Badge{add(selector,badgeType,value,settingType){if(badgeType==="RIBBON"){$(selector).remove(`.timesact-badge-common-${settingType}`),$(selector).remove(`.timesact-badge-ribbon-${settingType}`),$(selector).append(`<div class='timesact-badge-ribbon timesact-badge-ribbon-${settingType}'><span class='timesact-badge-ribbon-span-${settingType}'><p>`+value+"</p></span></div>");return}badgeType==="ROUNDED"&&($(selector).remove(`.timesact-badge-common-${settingType}`),$(selector).remove(`.timesact-badge-ribbon-${settingType}`),$(selector).append(`<div class='timesact-badge-common-${settingType}'><span class='timesact-badge-rounded-span-${settingType}'>`+value+"</span></div>")),badgeType==="RECTANGLE"&&($(selector).remove(`.timesact-badge-common-${settingType}`),$(selector).remove(`.timesact-badge-ribbon-${settingType}`),$(selector).append(`<div class='timesact-badge-common-${settingType}'><span class='timesact-badge-rectangle-span-${settingType}'>`+value+"</span></div>")),badgeType==="SQUARE"&&($(selector).remove(`.timesact-badge-common-${settingType}`),$(selector).remove(`.timesact-badge-ribbon-${settingType}`),$(selector).append(`<div class='timesact-badge-common-${settingType}'><span class='timesact-badge-square-span-${settingType}'>`+value+"</span></div>")),badgeType==="CIRCLE"&&($(selector).remove(`.timesact-badge-common-${settingType}`),$(selector).remove(`.timesact-badge-ribbon-${settingType}`),$(selector).append(`<div class='timesact-badge-common-${settingType}'><span class='timesact-badge-circle-span-${settingType}'>`+value+"</span></div>"))}getPositions(isTop,isRight,x,y){return{top:isTop&&y,bottom:!isTop&&y,left:!isRight&&x,right:isRight&&x}}getPositionsRibbon(isTop,isRight){return{top:isTop?"19px":"35px",right:isRight?"-20px":"-5px"}}getTransformRibbon(isTop,isRight){let degree=45;return isTop&&!isRight?degree-=90:!isTop&&!isRight?degree-=180:!isTop&&isRight&&(degree-=270),{transform:`rotate(${degree}deg)`,"-webkit-transform":`rotate(${degree}deg)`}}getTransformRibbonText(isTop){return isTop?{}:{transform:"rotate(180deg)","-webkit-transform":"rotate(180deg)"}}applyStyles(style2,settingType){const isTop=style2.top||style2.top===void 0,isRight=style2.right||style2.right===void 0;$(".timesact-badge").css({position:"relative"}),$(`.timesact-badge-ribbon-${settingType}`).css({position:"absolute",...this.getPositions(isTop,isRight,"-5px","-5px"),width:"75px",height:"75px","text-align":"right","z-index":"1",overflow:"hidden"}),$(`.timesact-badge-ribbon-${settingType} span`).css({position:"absolute",...this.getPositionsRibbon(isTop,isRight),display:"block",width:"100px","font-size":`${style2.fontSize}px`,"font-weight":"bold",color:style2.fontColor,"text-transform":"uppercase","text-align":"center","line-height":"20px","white-space":"nowrap",...this.getTransformRibbon(isTop,isRight)}),$(`.timesact-badge-ribbon-${settingType} span p`).css({margin:0,...this.getTransformRibbonText(isTop),"font-size":`${style2.fontSize}px`,color:style2.fontColor}),$(`.timesact-badge-ribbon-span-${settingType}`).css({"background-color":style2.backgroundColor,"box-shadow":"0 3px 10px -5px rgba(0, 0, 0, 1)"}),$(`.timesact-badge-rounded-span-${settingType}`).css({border:"1px solid transparent","border-radius":"4rem",display:"inline-block","letter-spacing":".1rem","line-height":"1",padding:"0.6rem 1.3rem","text-align":"center","background-color":style2.backgroundColor,"border-color":style2.backgroundColor,"font-size":`${style2.fontSize}px`,color:style2.fontColor,"font-weight":"bold","word-break":"break-word"}),$(`.timesact-badge-rectangle-span-${settingType}`).css({display:"inline-block","min-width":"60px",padding:"0.6rem 1.3rem","letter-spacing":".1rem","line-height":"1","text-align":"center","font-size":`${style2.fontSize}px`,color:style2.fontColor,"font-weight":"bold","word-break":"break-word","background-color":style2.backgroundColor,"border-color":style2.backgroundColor,border:"1px solid transparent"}),$(`.timesact-badge-square-span-${settingType}`).css({display:"flex","align-items":"center","justify-content":"center","min-height":"60px","min-width":"60px",width:`${style2.width}px`,height:`${style2.width}px`,"letter-spacing":".1rem","line-height":"1","text-align":"center","font-size":`${style2.fontSize}px`,color:style2.fontColor,"font-weight":"bold","word-break":"break-word","background-color":style2.backgroundColor,"border-color":style2.backgroundColor,border:"1px solid transparent",overflow:"hidden"}),$(`.timesact-badge-circle-span-${settingType}`).css({display:"flex","align-items":"center","justify-content":"center","min-height":"60px","min-width":"60px",width:`${style2.width+28}px`,height:`${style2.width+28}px`,padding:"14px","letter-spacing":".1rem","line-height":"1","text-align":"center","font-size":`${style2.fontSize}px`,color:style2.fontColor,"font-weight":"bold","word-break":"break-word","background-color":style2.backgroundColor,"border-color":style2.backgroundColor,border:"1px solid transparent","border-radius":"50%",overflow:"hidden"}),$(`.timesact-badge-common-${settingType}`).css({position:"absolute",...this.getPositions(isTop,isRight,"10px","10px"),display:"flex","flex-wrap":"wrap","z-index":"1"}),$("gp-product-images-v2").length>0&&$(`.timesact-badge-ribbon-${settingType}`).css({width:"100%"})}}class Modal{static updateStorage(){window.sessionStorage.setItem("modal-queue",JSON.stringify(cartModal.queue))}
460static pushQueue(settings,closeCb){cartModal.queue.find(it=>it.settings.id===settings.id)||(cartModal.queue.push({settings,closeCb}),this.updateStorage())}static popQueue(){if(cartModal.queue.length<=0)return;const item=cartModal.queue.pop();return this.updateStorage(),item}static clearQueue(){cartModal.queue=[],this.updateStorage()}static showFirst(){if(cartModal.isOpen)return;const item=this.popQueue();item&&new Modal().display(item.settings,item.closeCb)}display(settings,closeCb){if(cartModal.isOpen)return Modal.pushQueue(settings,closeCb);cartModal.isOpen=!0,$(".md-body").append("<h3>"+settings.header+'</h3><p class="message">'+settings.body+'</p><button class="md-close">'+settings.button+'</button><p><input type="checkbox" id="md-stop" name="md-stop"><label for="md-stop">'+settings.stop+"</label></p>"),$("#mixed-modal").addClass("md-show"),$(".md-close, .md-overlay").click(function(event){event.stopPropagation(),closeCb instanceof Function&&closeCb(),cartModal.isOpen=!1,$("#mixed-modal").removeClass("md-show"),$(".md-body").empty(),Modal.showFirst()}),$(".md-close").attr("style",`
461				background: ${settings.buttonBackgroundColor}!important;
462				color: ${settings.buttonFontColor}!important;`)}}class Product{constructor(id,variants,title,sellingPlanGroups){this.id=id,this.variants=variants,this.title=title,this.sellingPlans=sellingPlanGroups?sellingPlanGroups.filter(sellingPlanGroup=>sellingPlanGroup.app_id=="timesact").reduce((accumulator,sellingPlanGroup)=>accumulator.concat(sellingPlanGroup.selling_plans),[]):[]}setActiveVariant(variantId){this.variantId=variantId}setTimesactVariants(productConfig){if(!productConfig||!productConfig.variants){console.log("[ERROR 2002]: Product config is undefined.");return}this.timesactVariants=productConfig.variants}isPOEnabledForVariant(){return!this.timesactVariants[this.variantId]||!this.timesactVariants[this.variantId].config?!1:"isPOEnabled"in this.timesactVariants[this.variantId]?this.timesactVariants[this.variantId].isPOEnabled:this.timesactVariants[this.variantId].config.status==="ACTIVE"||this.timesactVariants[this.variantId].config.status==="NO_STOCK"}isISEnabledForVariant(){return this.timesactVariants[this.variantId]&&"isISEnabled"in this.timesactVariants[this.variantId]?this.timesactVariants[this.variantId].isISEnabled:!1}isBISEnabledForVariant(){return this.timesactVariants[this.variantId]?(window.ta.currentTimesactProductData.variantId=this.variantId,window.ta.currentTimesactProductData.productName=this.timesactVariants[this.variantId].displayName,this.timesactVariants[this.variantId].isBISEnabled):!1}isCSEnabledForVariant(){return this.timesactVariants[this.variantId]?this.timesactVariants[this.variantId].isCSEnabled:!1}getVariantSettings(settings,defaultSettingId,type){if(!this.timesactVariants[this.variantId].config.settingsTemplate){const defaultSettings=settings[defaultSettingId];if(!this.hasCustomSettings())return defaultSettings;const customSettings=this.timesactVariants[this.variantId].settings;return{button:{...defaultSettings.button,name:customSettings.buttonName||defaultSettings.button.name},message:{...defaultSettings.message,type:customSettings.messageType||defaultSettings.message.type,value:customSettings.messageValue||defaultSettings.message.value},cart:{...defaultSettings.cart,labelText:{key:customSettings.cartLabelTextKey||defaultSettings.cart.labelText.key,value:customSettings.cartLabelTextValue||defaultSettings.cart.labelText.value}},badge:defaultSettings.badge}}return type==="PO"?this.timesactVariants[this.variantId].config.settingsTemplate in settings?settings[this.timesactVariants[this.variantId].config.settingsTemplate]:settings[defaultSettingId]:type==="BIS"?this.timesactVariants[this.variantId].configBIS.settingsTemplate in settings?settings[this.timesactVariants[this.variantId].configBIS.settingsTemplate]:settings[defaultSettingId]:type==="CS"?this.timesactVariants[this.variantId].configCS.settingsTemplate in settings?settings[this.timesactVariants[this.variantId].configCS.settingsTemplate]:settings[defaultSettingId]:type==="IS"&&this.timesactVariants[this.variantId].configIS.settingsTemplate in settings?settings[this.timesactVariants[this.variantId].configIS.settingsTemplate]:settings[defaultSettingId]}hasCustomSettings(){return this.timesactVariants[this.variantId].settings?this.timesactVariants[this.variantId].settings.type==="CUSTOM":!1}isVariantOutOfStock(){if(!this.timesactVariants[this.variantId])return!1;const variant=this.timesactVariants[this.variantId];return variant.quantity>0?!1:variant.inventoryPolicy==="DENY"}}class ShopUtil{constructor(){}initTimesact(){if(typeof window.ta<"u")return;const products=localStorage.getItem("products")?JSON.parse(localStorage.getItem("products")):{},settings=localStorage.getItem("settings")?JSON.parse(localStorage.getItem("settings")):void 0,lastProductUpdate=this.computeLastProductUpdate(products),lastSettingsUpdate=localStorage.getItem("lastSettingsUpdate")?JSON.parse(localStorage.getItem("lastSettingsUpdate")):0;window.ta={products,settings,lastProductUpdate,lastSettingsUpdate,cart:{showMixedCartAlert:sessionStorage.getItem("showCartMixedAlert")?JSON.parse(sessionStorage.getItem("showCartMixedAlert")):!0},quickView:{selectors:{button:".quick-add__submit, .productitem--action-qs, .boost-pfs-quickview-btn, .cc-quick-buy-btn, .button--quick-shop, .sca-qv-button, .quick-view-btn, .bc-quickview-btn-wrapper, .sca-qv-cartbtn, .js-quick-shop-link, .searchit-quick-view-button, .quick-view, .js-quickbuy-button, .quick-product__btn, .product-card-interaction-quickshop, .product-modal, .productitem--action button, a.quickview, .overlay, a.quickview, .has-quick-view .btn .v-b, .shop-now-button, .quick-buy, .quick_shop, a[data-action='show-product'], .trigger-quick-view, .quickview-button, .quick_view, .qview-button, button.btn-addToCart:last, .quick-shop, .fancybox.ajax, .quick-add-button-variants, .product-thumbnail__quickshop-button, .js-quickView-button",form:`.product__form:visible,
463							#sca-qv-add-item-form:visible,
464							.shopify-product-form:visible,
465							.bc-modal-wrapper:visible
466							#bc-quickview-cart-form:visible,
467							.product_form:visible,
468							.searchit-quick-view-form-wrapper
469							form:visible, .product-form:visible,
470							.quick-buy__product-form:visible,
471							.product-single__form:visible,
472							form[action='/cart/add']:visible,
473							#AddToCartForm:visible,
474							form.module:visible,
475							#add-to-cart-quickview-form:visible`,addToCartButton:"[type=submit]:visible:first span, .sca-qv-cartbtn:visible, #addToCart:visible, #bc-quickview-cart-btn:visible, .add_to_cart:visible, #searchit-quick-view-add-to-cart:visible, .product-form__cart-submit:visible, .quickbuy__submit:visible, .add-to-cart:visible, .product-submit:visible, .add:visible, .product-form--atc-button:visible, input.action-button.submit:visible, .addto.cart.sliding-cart:visible, #AddToCart:visible, .product-add:visible, .add-to-cart:visible, .product__submit__add:visible, .product-add-to-cart:visible, #add-to-cart:visible, .product-submit.action-button.product-submit, .product-form__add-button:visible, .add-to-cart-btn:visible, .qview-btn-addtocart:visible, button.btn-addToCart:last, .button--add-to-cart:visible",variant:"#sca-qv-variant-options select.single-option-selector, .bc-quickview-single-option-selector, .searchit-option-selector-wrapper select, .qview-variants select, select:visible, .radio-wrapper fieldset, input[type='radio']",quantity:"[name='quantity']",quickviewModalContainer:".quick-add-modal, .theme-modal--quickbuy, .quickview-product .product-quickview:visible, .sca-fancybox-wrap:visible, .mfp-container:visible, .bc-modal-wrapper:visible, .quick-shop:visible, .searchit-modal:visible, #colorbox:visible, .modal--quick-shop:visible, .quickshop:visible, .fancybox-wrap:visible, .fancybox-container:visible, .modal-content:visible, .product-quick-view, section.quick-view, #ShopNowContainer, #ProductScreens, .product.preview, .modal__inner__wrapper:visible, .halo-modal-content:visible, #quickView:visible, .quickshop-content:visible, .modal__inner:visible, .quick-view .content:visible, .qview-product:visible"}}}}computeLastProductUpdate(products){let timestamp=parseInt(new Date().getTime()/1e3);
475for(let product of Object.values(products)){if(product.lastUpdate&&product.lastUpdate<timestamp){timestamp=product.lastUpdate;continue}product.lastUpdate||(timestamp=1)}return timestamp}isProductPage(){return-1<window.location.href.indexOf("/products/")||-1<window.location.href.indexOf("/products_preview?")}isCollectionPage(){return-1<window.location.href.indexOf("/collections/")}isSearchPage(){return-1<window.location.href.indexOf("/search?")}isPagesPage(){return-1<window.location.href.indexOf("/pages/")}isHomePage(){return document.location.pathname==="/"}isCartPage(){return-1<window.location.pathname.indexOf("/cart")}initQuickView(shop){this.shopData=shop,this.createQuickViewButtonListener()}createQuickViewButtonListener(){var thisShop=this;$(window.ta.quickView.selectors.button).click(function(target){const handle=thisShop.getProductHandle(target.currentTarget);if(!handle)return;const url=thisShop.getProductPageJsURL(handle);var product;$.getJSON(url.concat(".js"),function(data){console.log(data),product=new Product(data.id,data.variants,data.title,data.selling_plan_groups)}).done(function(){new ScriptRunner(thisShop.shopData,product).run(!0)}).fail(function(){console.log("[Error 1001]: Product could not be fetched.")})})}getProductHandle(target){return $(target).data("product-url").split("/").pop()}getProductPageJsURL(handle){return"https://"+window.location.hostname+"/products/"+handle}sleep(e){return new Promise(function(t){setTimeout(t,e)})}cleanupModal(){$(window.ta.quickView.selectors.quickviewModalContainer).find("#preorder-label").remove(),$(window.ta.quickView.selectors.quickviewModalContainer).find(".timesact-preorder-description").remove()}}class ProductUtil{extractVariantId(variants,formSelector){var productParams=window.location.search.match(/variant=([0-9]+)/);if(productParams!=null)return productParams[1];const variantIdFromForm=$(formSelector).find("select[name='id'], input[name='id'], select[name='id[]'], input[name='id[]']").attr("type")==="radio"?$(formSelector).find("input[name='id']:checked, input[name='id[]']:checked").val():$(formSelector).find("select[name='id'], input[name='id'], select[name='id[]'], input[name='id[]']").val();return variants.some(variant=>variant.id.toString()===variantIdFromForm)?variantIdFromForm:variants[0].id}}class TimesactBisModal{static createListeners(){$(".timesact_bis_input").focusout(function(){const timesactBisInput=$(".timesact_bis_input");timesactBisInput.val()&&timesactBisInput.hasClass("timesact_bis_field_empty")&&(timesactBisInput.removeClass("timesact_bis_field_empty"),$(".timesact_bis_message_success").removeClass("timesact_bis_message_show"),$(".timesact_bis_message_error").removeClass("timesact_bis_message_show"))}),$(".timesact_bis_close_button").click(TimesactBisModal.hidenBisModal),$(".timesact_bis_submit_button").click(TimesactBisModal.createSubscription)}static displayBisModal(){const{defaultSettings,productId,productVariants,variantId}=window.ta.currentTimesactProductData,product=new Product(productId,productVariants);product.setActiveVariant(variantId),product.setTimesactVariants({variants:productVariants});const{form}=product.getVariantSettings(window.ta.settings,defaultSettings.templates.BIS,"BIS");$("h3.timesact_bis_heading").attr("style",`color: ${form.headingFontColor} !important;`),$("#subscriptionForm .timesact_bis_submit_button").attr("style",`
476				background: ${form.buttonBackgroundColor} !important;
477				color: ${form.buttonFontColor} !important;
478				border-radius: ${form.fieldsBorderRadius}px !important;
479				font-size: ${form.fontSize}px !important;`),$("#subscriptionForm .timesact_bis_input").attr("style",`
480				border-radius: ${form.fieldsBorderRadius}px !important;
481				font-size: ${form.fontSize}px !important;`),$(".timesact_bis_popup").attr("style",`border-radius: ${form.popupBorderRadius}px !important;`),$(".timesact_bis_desc, .timesact_bis_note, .timesact_bis_subscribe").attr("style",`color: ${form.textFontColor} !important;`),$(".timesact_bis_email").attr("style",`border-radius: ${form.fieldsBorderRadius}px !important;`),$(".timesact_bis_heading").text(form.heading),$(".timesact_bis_desc").text(form.description),$(".timesact_bis_submit_button").text(form.buttonName),$(".timesact_bis_form_field .timesact_bis_note").text(form.note),$(".timesact_bis_form_field .timesact_bis_subscribe").text(form.messageNewsletter),$(".timesact_bis_message_success").text(form.messageSuccess),$(".timesact_bis_message_error").text(form.messageError),form.isNewsletterEnabled&&$(".timesact_sub").attr("style","display: inline-flex !important;"),$(".timesact_bis_popup_overlay").addClass("timesact_bis_popup_overlay_show"),$(".timesact_bis_dialog").addClass("timesact_bis_dialog_show"),form.isBrandEnabled||$(".timesact_powered_by").hide()}static hidenBisModal(){$(".timesact_bis_popup_overlay").removeClass("timesact_bis_popup_overlay_show"),$(".timesact_bis_dialog").removeClass("timesact_bis_dialog_show"),$(".timesact_bis_message_success").removeClass("timesact_bis_message_show").html(""),$(".timesact_bis_message_error").removeClass("timesact_bis_message_show").html(""),emailInputFieldSelector.value=""}static async createSubscription(){const timesactBisMessageSuccess=$(".timesact_bis_message_success"),timesactBisMessageError=$(".timesact_bis_message_error"),timesactBisInput=$(".timesact_bis_input");if(!emailInputFieldSelector.value){timesactBisInput.addClass("timesact_bis_field_empty");return}const data={type:"EMAIL",status:"PENDING",value:emailInputFieldSelector.value,productId:window.ta.currentTimesactProductData.productId,variantId:window.ta.currentTimesactProductData.variantId,productName:window.ta.currentTimesactProductData.productName,isSubNewsletter:$("#newsletter").is(":checked")},created=await Api.createSubscription(data);created&&timesactBisMessageError.removeClass("timesact_bis_message_show")&&timesactBisMessageSuccess.addClass("timesact_bis_message_show")&&$("#timesact_bis_email").val(""),!created&&timesactBisMessageSuccess.removeClass("timesact_bis_message_show")&&timesactBisMessageError.addClass("timesact_bis_message_show")}}class TimesactButton{constructor(buttonSelector,className){this.addToCartButtonSelector=buttonSelector,this.hasInsideSpan=$(this.addToCartButtonSelector).first().prop("tagName")?.toLowerCase()==="span",className==="timesact-button-po"||className==="timesact-button-is"?this.button=buttonSelector:(this.button=$(`<button type="button" class="${className}" />`).attr("style","display: none !important;"),this.hasInsideSpan?$(this.addToCartButtonSelector).first().parent().after(this.button):$(this.addToCartButtonSelector).first().after(this.button))}showPO(settings){this.hasInsideSpan?$(this.button).parent().show():$(this.button).show(),$(this.button).val(settings.button.name),$(this.button).text(sett
481ings.button.name),$(this.button).prop("disabled",!1),settings.button.type!=="DEFAULT"&&(this.hasInsideSpan?$(this.button).first().parent().addClass("timesact-button"):$(this.button).first().addClass("timesact-button"),this.applyStyles(settings.button.style,"timesact-button"))}showBIS(settings){$(this.button).text(settings.button.name),this.applyStyles(settings.button.style,"timesact-button-bis"),$(this.button).click(TimesactBisModal.displayBisModal),$(this.button).show(),this.hasInsideSpan?$(this.addToCartButtonSelector).first().parent().attr("style","display: none !important;"):$(this.addToCartButtonSelector).first().attr("style","display: none !important;")}showCS(settings){$(this.button).text(settings.button.name),this.button.prop("disabled",!0),this.applyStyles(settings.button.style,"timesact-button-cs"),$(this.button).show(),this.hasInsideSpan?$(this.addToCartButtonSelector).first().parent().attr("style","display: none !important;"):$(this.addToCartButtonSelector).first().attr("style","display: none !important;")}showAddToCart(){this.hasInsideSpan?($(this.addToCartButtonSelector).first().parent().show(),$(this.addToCartButtonSelector).first().parent().removeClass("timesact-button"),$(this.addToCartButtonSelector).first().parent().removeAttr("style")):($(this.addToCartButtonSelector).first().show(),$(this.addToCartButtonSelector).first().removeClass("timesact-button"),$(this.addToCartButtonSelector).first().removeAttr("style")),$(this.addToCartButtonSelector).val(this.addToCartText),$(this.addToCartButtonSelector).text(this.addToCartText),$(this.addToCartButtonSelector).prop("disabled",!1)}showOutOfStock(){this.hasInsideSpan?($(this.addToCartButtonSelector).first().parent().show(),$(this.addToCartButtonSelector).first().parent().removeClass("timesact-button"),$(this.addToCartButtonSelector).first().parent().removeAttr("style")):($(this.addToCartButtonSelector).first().show(),$(this.addToCartButtonSelector).first().removeClass("timesact-button"),$(this.addToCartButtonSelector).first().removeAttr("style")),$(this.addToCartButtonSelector).val(this.soldOutText),$(this.addToCartButtonSelector).text(this.soldOutText),$(this.addToCartButtonSelector).prop("disabled",!0)}setAddToCartText(text){this.addToCartText=text||$(this.addToCartButtonSelector).text()}setSoldOutText(text){this.soldOutText=text}hide(){$(this.button).hide()}disable(){this.hasInsideSpan?$(this.button).parent().prop("disabled",!0):$(this.button).prop("disabled",!0),$(this.addToCartButtonSelector).prop("disabled",!0)}confirmButtonExists(){return $(this.button).closest("body").length>0}identifyButton(selectors){this.button=selectors.formSelector.find(selectors.ids.addToCartButton)}applyStyles(style2,className){if($(`.${className}`).attr("style",`
482                width: ${style2.width}${style2.widthType==="PERCENT"?"%":"px"} !important;
483                height: ${style2.height}${style2.heightType==="PERCENT"?"%":"px"} !important;
484                background-color: ${style2.backgroundColor} !important;
485                border: ${style2.borderWidth}px solid ${style2.borderColor} !important;
486                border-color: ${style2.borderColor} !important;
487                border-radius: ${style2.borderRadius}px !important;
488                border-width: ${style2.borderWidth}px !important;
489                color: ${style2.fontColor} !important;
490                font-size: ${style2.fontSize}px !important;
491                font-style: ${style2.fontStyle} !important;
492                font-weight: ${style2.fontWeight} !important;
493                margin-bottom: 10px !important;
494                margin-top: 10px !important;
495                cursor: pointer;`),style2.heightType==="PERCENT"){const parentHeight=$(`.${className}`).parent().height();$(`.${className}`).height(`${parentHeight*style2.height/100}px`)}}removeCartAlertListener(){$(this.button).parent().off("click",this.cartAlertModalClickHandler)}closeCartAlertModal(settings,tmps={}){window.sessionStorage.setItem("showCartAlert",JSON.stringify({...tmps,[settings.id]:{dismiss:$("#md-stop").is(":checked")}})),$("#md-stop").is(":checked")&&this.removeCartAlertListener()}addCartAlertListener(settings,product){const tmps=JSON.parse(window.sessionStorage.getItem("showCartAlert")||null)||{},closedTmpsIds=JSON.parse(window.sessionStorage.getItem("closedModals")||null)||[],tmpId=`${settings.type}-${product.id}-${product.variantId}`;settings.cart.alert&&(!settings.cart.alert.isEnabled||settings.cart.alert.onButtonClick!==!0||tmps[tmpId]?.dismiss||closedTmpsIds.includes(tmpId
495)||(this.cartAlertModalClickHandler=()=>{const s={...settings.cart.alert,id:tmpId};return new Modal().display(s,()=>this.closeCartAlertModal(s,tmps))},$(this.button).parent().on("click",this.cartAlertModalClickHandler)))}}class TimesactCountdownTimer{constructor(timerSelector,className){this.timerSelector=timerSelector,this.utils={delims:[60,60,24,365]},this.components={timer:null,timerElements:[null,null,null,null]},this.componentsClasses={timer:`timer-container-${className}`,title:"timer-title",subheading:"timer-subheading",timerValueContainer:"timer-value-container",timerLabels:"timer-value-labels",timerValues:"timer-values"}}setTimerInfo({content,isEnabled,placement,style:style2,productConfig}){this.title=content.title,this.subheading=content.subheading,this.labels=content.labels,this.dates=content?.dates,this.placement=placement,this.isEnabled=isEnabled||!1,this.style=style2||null,this.onceItEnds=content.onceItEnds,this.productConfig=productConfig}show(){if(!this.isEnable())return!1;this.createTimer(),this.placement==="BELOW"?$(this.timerSelector).after(this.components.timer):$(this.timerSelector).before(this.components.timer),this.applyStyles(),this.countdown()}hide(){this.stop(),$(`.${this.componentsClasses.timer}`).remove()}createTitle(){return $(`<h2 class="${this.componentsClasses.title}">${this.title}</h2>`)}createSubheading(){return $(`<p class="${this.componentsClasses.subheading}">${this.subheading}</p>`)}createTimerLabels(){const els=[],labelOrder=["days","hours","mins","secs"];for(const propName of labelOrder)els.push($(`<div class="${this.componentsClasses.timerLabels}">${this.labels[propName]}</div>`));return els}createTimerValues(){const els=[];return["00",":","00",":","00",":","00"].forEach(v=>els.push($(`<div translate="no" class="${this.componentsClasses.timerValues}">${v}</div>`))),this.components.timerElements=els.filter((_,i)=>i%2===0),els}createTimerValueContainer(){const el=$(`<div class="${this.componentsClasses.timerValueContainer}"></div>`);return el.append(...this.createTimerValues(),...this.createTimerLabels()),el}createTimer(){const el=$(`<div class="${this.componentsClasses.timer}"></div>`);return el.append(this.createTitle(),this.createSubheading(),this.createTimerValueContainer()),this.components.timer=el,el}getEndDateFromPeriod(type,value){const now=parseInt(Date.now()/1e3),dayInSeconds=parseInt(value)*60*60*24;switch(type){case"MONTH":return now+dayInSeconds*30;case"WEEK":return now+dayInSeconds*7;default:return now+dayInSeconds}}getActualEndDate(){switch(this.dates.endAt){case"END_DATE":return this.productConfig.hasEndDate&&this.productConfig.endDate||parseInt(Date.now()/1e3);case"SHIPPING_DATE":switch(this.productConfig.shippingDate.type){case"PERIOD":return this.getEndDateFromPeriod(this.productConfig.shippingDate.periodType,this.productConfig.shippingDate.periodValue);case"INTERVAL":return this.getEndDateFromPeriod(this.productConfig.shippingDate.periodEnd.type,this.productConfig.shippingDate.periodEnd.value);default:return this.productConfig.shippingDate.date||parseInt(Date.now()/1e3)}default:return this.dates.type==="FIXED"?parseInt(Date.now()/1e3)+parseInt(this.dates.minutes)*60:this.dates.endDate._seconds}}isEnable(){return this.getActualEndDate()<Date.now()/1e3?!1:this.dates?.startDate?this.isEnabled&&this.dates.startDate._seconds<Date.now()/1e3:this.isEnabled}make2Digit(number){return`${number<10?"0":""}${number}`}handleOnEnd(){const{value,customTitle}=this.onceItEnds;switch(value){case"unpublish-timer":return this.hide();case"repeat-the-countdown":return this.dates.type!=="FIXED"||this.dates.endAt&&this.dates.endAt!=="DATE"?void 0:(this.dates.endDate._seconds=this.getActualEndDate(),setTimeout(()=>this.countdown(),500));case"show-custom-title":return this.components.timer.html(customTitle);default:break}}calculateRelativeDatetime(fromSeconds,toSeconds){if(typeof fromSeconds!="number"||typeof toSeconds!="number")return["00","00","00","00"];if(fromSeconds-toSeconds<=0)return["00","00","00","00"];const remains=[0,0,0,0];let diff=Math.abs(fromSeconds-toSeconds);for(let i=0;i<this.utils.delims.length;i++){const delimeter=this.utils.delims[i];if(remains[i]=Math.floor(diff%delimeter),diff>=delimeter){diff/=delimeter;continue}break}return remains.map(v=>this.make2Digit(v)).reverse()}countdown(){let prevVals=[],timerDateSeconds=parseInt(Date.now()/1e3);const endDateSeconds=this.getActualEndDate(),timerInterval=1e3;this.timerId=setInterval(()=>{if(endDateSeconds<timerDateSeconds)return this.handleOnEnd(),this.stop();const timerVals=this.calculateRelativeDatetime(endDateSeconds,timerDateSeconds);
495this.components.timerElements.forEach((el,i)=>{prevVals[i]!==timerVals[i]&&el.text(timerVals[i])}),prevVals=timerVals,timerDateSeconds+=timerInterval/1e3},timerInterval)}stop(){clearInterval(this.timerId)}applyStyles(){$(`.${this.componentsClasses.timer} *`).css({margin:0,padding:0,"box-sizing":"border-box"}),$(`.${this.componentsClasses.timer}`).css({"max-width":"420px","min-width":"260px",display:"flex","flex-flow":"column","text-align":"center","-webkit-box-align":"center","align-items":"center",overflow:"hidden","margin-bottom":`${this.style.container?.marginBottom}px`,"margin-top":`${this.style.container?.marginTop}px`,"padding-bottom":`${this.style.container?.paddingBottom}px`,"padding-top":`${this.style.container?.paddingTop}px`,"background-color":this.style.container?.background,"border-color":this.style.container?.borderColor,"border-radius":`${this.style.container?.borderRadius}px`,"border-width":`${this.style.container?.borderSize}px`,"border-style":"solid"}),$(`.${this.componentsClasses.title}`).css({"font-weight":"bold",color:this.style.title?.color,"font-size":`${this.style.title?.fontSize}px`}),$(`.${this.componentsClasses.subheading}`).css({"padding-top":"2px","line-height":"1.5",color:this.style.subheading?.color,"font-size":`${this.style.subheading?.fontSize}px`}),$(`.${this.componentsClasses.timerValueContainer}`).css({display:"grid","grid-template-columns":"1fr 10px 1fr 10px 1fr 10px 1fr",gap:"6px 2px","place-items":"center","align-items":"flex-start"}),$(`.${this.componentsClasses.timerValues}`).css({"font-weight":"bold","font-feature-settings":"tnum","font-variant-numeric":"tabular-nums","letter-spacing":"-2px","line-height":"1",color:this.style.timer?.color,"font-size":`${this.style.timer?.fontSize}px`}),$(`.${this.componentsClasses.timerLabels}`).css({"max-width":"100px","white-space":"pre-line","grid-column":"span 2 / auto","text-align":"center","padding-right":"10px","line-height":"1",color:this.style.labels?.color,"font-size":`${this.style.labels?.fontSize}px`}),$(`.${this.componentsClasses.timerLabels}:last-of-type`).css({"grid-column":"span 1 / auto","padding-right":0})}}class Message{constructor(locale){this.locale=locale}addStylePreorderMessage(style2,type){$(`.timesact-${type}-description`).css({"font-size":`${style2.fontSize}px`,color:style2.fontColor,"text-align":style2.textAlign,"font-weight":style2.fontWeight,"font-style":style2.fontStyle,"margin-bottom":"10px","margin-top":"10px"})}populateDynamicValues(variant,value,isCartLabel,configType){return value=value.replace("{{preorderQuantity}}",this.getQuantity(variant,isCartLabel,configType)),value=value.replace("{{shippingDate}}",this.getShippingDate(variant[configType].shippingDate,isCartLabel)),value=value.replace("{{daysLeftUntilShippingDate}}",this.getDaysLeftUntilShippingDate(variant[configType].shippingDate,isCartLabel)),value=value.replace("{{daysLeftUntilPreorderEndDate}}",this.getDaysLeftUntilEndDate(variant[configType],isCartLabel)),value}getQuantity(variant,isCartLabel,configType){return variant[configType].stock.option=="STOCK3"?variant.quantity:variant[configType].stock.hasUnlimitedQuantity?isCartLabel?"VARIABLE_NOT_SET":'<span style="color:red;">VARIABLE_NOT_SET</span>':variant[configType].stock.quantity}getShippingDate(shippingDate,isCartLabel){if(!shippingDate||shippingDate.type==="NO_SET")return isCartLabel?"VARIABLE_NOT_SET":'<span style="color:red;">VARIABLE_NOT_SET</span>';if(shippingDate.type==="DATE")return new Date(shippingDate.date*1e3).toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"});if(shippingDate.type==="PERIOD"){var days=1;switch(shippingDate.periodType){case"DAY":days=shippingDate.periodValue;break;case"WEEK":days=shippingDate.periodValue*7;break;case"MONTH":days=shippingDate.periodValue*30;break}var date=new Date;return date.setDate(date.getDate()+days),date.toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"})}if(shippingDate.type==="INTERVAL"){var periodStartDays=1,periodEndDays=1;switch(shippingDate.periodStart.type){case"DAY":periodStartDays=shippingDate.periodStart.value;break;case"WEEK":periodStartDays=shippingDate.periodStart.value*7;break;case"MONTH":periodStartDays=shippingDate.periodStart.value*30;break}switch(shippingDate.periodEnd.type){case"DAY":periodEndDays=shippingDate.periodEnd.value;break;case"WEEK":periodEndDays=shippingDate.periodEnd.value*7;break;case"MONTH":periodEndDays=shippingDate.periodEnd.value*30;break}var dateStart=new Date;dateStart.setDate(dateStart.getDate()+periodStartDays);var dateEnd=new Date;return dateEnd.setDate(dateEnd.getDate()+periodEndDays),dateStart.toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"})+" - "+dateEnd.toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"})}}getDaysLeftUntilShippingDate(shippingDate,isCartLabel){if(!shippingDate||shippingDate.type==="NO_SET")return isCartLabel?"VARIABLE_NOT_SET"
495:'<span style="color:red;">VARIABLE_NOT_SET</span>';const today=new Date;if(shippingDate.type==="DATE"){const date=new Date(shippingDate.date*1e3);return Math.ceil((date.getTime()-today.getTime())/(1e3*3600*24))}if(shippingDate.type==="PERIOD")switch(shippingDate.periodType){case"DAY":return shippingDate.periodValue;case"WEEK":return shippingDate.periodValue*7;case"MONTH":return shippingDate.periodValue*30;default:return 1}if(shippingDate.type==="INTERVAL"){var periodStartDays=1,periodEndDays=1;switch(shippingDate.periodStart.type){case"DAY":periodStartDays=shippingDate.periodStart.value;break;case"WEEK":periodStartDays=shippingDate.periodStart.value*7;break;case"MONTH":periodStartDays=shippingDate.periodStart.value*30;break}switch(shippingDate.periodEnd.type){case"DAY":periodEndDays=shippingDate.periodEnd.value;break;case"WEEK":periodEndDays=shippingDate.periodEnd.value*7;break;case"MONTH":periodEndDays=shippingDate.periodEnd.value*30;break}return periodStartDays+" - "+periodEndDays}}getDaysLeftUntilEndDate(config,isCartLabel){if(!config.hasEndDate)return isCartLabel?"VARIABLE_NOT_SET":'<span style="color:red;">VARIABLE_NOT_SET</span>';const today=new Date,date=new Date(config.endDate*1e3);return Math.ceil((date.getTime()-today.getTime())/(1e3*3600*24))}}class Timesact{constructor(selectors,product,defaultSettingIds,shop){this.selectors=selectors,this.product=product,this.settings=window.ta.settings,this.defaultSettingIds=defaultSettingIds,this.buttonPO=new TimesactButton(this.selectors.buttonSelector,"timesact-button-po"),this.buttonIS=new TimesactButton(this.selectors.buttonSelector,"timesact-button-is"),this.buttonBIS=new TimesactButton(this.selectors.buttonSelector,"timesact-button-bis"),this.buttonCS=new TimesactButton(this.selectors.buttonSelector,"timesact-button-cs"),this.timerPO=new TimesactCountdownTimer(this.selectors.timerSelector,"timesact-timer-po"),this.timerIS=new TimesactCountdownTimer(this.selectors.timerSelector,"timesact-timer-is"),this.timerBIS=new TimesactCountdownTimer(this.selectors.timerSelector,"timesact-timer-bis"),this.timerCS=new TimesactCountdownTimer(this.selectors.timerSelector,"timesact-timer-cs"),this.uuid=Math.floor(1e8+Math.random()*9e8),$(this.selectors.variantSelector).addClass("timesact-variant-picker-"+this.uuid),this.shop=shop}init(){this.createWidget(),new TimesactEventListener().initVariantEventListener(this)}createWidget(){const variant=this.product.timesactVariants[this.product.variantId];if(this.product.isBISEnabledForVariant()){const settings=this.product.getVariantSettings(this.settings,this.defaultSettingIds.BIS,"BIS");this.buttonBIS.setAddToCartText(settings.button.addToCartText),this.buttonBIS.setSoldOutText(settings.button.soldOutText),variant.configBIS.status==="ACTIVE"&&(this.buttonBIS.showBIS(settings),this.addCommonElements(settings,variant))}if(this.product.isISEnabledForVariant()){const settings=this.product.getVariantSettings(this.settings,this.defaultSettingIds.IS,"IS");if(this.buttonIS.setAddToCartText(settings.button.addToCartText),this.buttonIS.setSoldOutText(settings.button.soldOutText),variant.configIS.status==="NO_STOCK"&&(this.buttonIS.showOutOfStock(),$(this.selectors.formSelector).find(".shopify-payment-button").hide()),variant.configIS.status==="ACTIVE"){this.buttonIS.confirmButtonExists()||(this.buttonIS.identifyButton(this.selectors),this.selectors.buttonSelector=$(this.selectors.formSelector).find(this.selectors.ids.addToCartButton)),this.buttonIS.showPO(settings),this.buttonIS.addCartAlertListener(settings,this.product),this.shop.isDisabledIS&&this.buttonIS.disable(),this.addCommonElements(settings,variant);const message=new Message(settings.message.locale||"en-US"),cartLabelTextKey=message.populateDynamicValues(variant,settings.cart.labelText.key,!0,"configIS"),cartLabelTextValue=message.populateDynamicValues(variant,settings.cart.labelText.value,!0,"configIS");(typeof settings.cart.labelText.isEnabled>"u"||settings.cart.labelText.isEnabled)&&this.showPreorderLineItemProperty(cartLabelTextKey,cartLabelTextValue)}}if(this.product.isPOEnabledForVariant()){const settings=this.product.getVariantSettings(this.settings,this.defaultSettingIds.PO,"PO");
495if(this.buttonPO.setAddToCartText(settings.button.addToCartText),this.buttonPO.setSoldOutText(settings.button.soldOutText),variant.config.status==="NO_STOCK"&&(this.buttonPO.showOutOfStock(),$(this.selectors.formSelector).find(".shopify-payment-button").hide()),variant.config.status==="ACTIVE"){this.buttonPO.confirmButtonExists()||(this.buttonPO.identifyButton(this.selectors),this.selectors.buttonSelector=$(this.selectors.formSelector).find(this.selectors.ids.addToCartButton)),this.shop.hasSellingPlanEnabled&&this.product.sellingPlans.length>0&&!this.shop.isSellingPlanUIDisabled&&this.addSellingPlan(this.product.sellingPlans,settings,variant),this.buttonPO.showPO(settings),this.buttonPO.addCartAlertListener(settings,this.product),this.shop.isDisabled&&this.buttonPO.disable(),this.addCommonElements(settings,variant);const message=new Message(settings.message.locale||"en-US"),cartLabelTextKey=message.populateDynamicValues(variant,settings.cart.labelText.key,!0,"config"),cartLabelTextValue=message.populateDynamicValues(variant,settings.cart.labelText.value,!0,"config");(typeof settings.cart.labelText.isEnabled>"u"||settings.cart.labelText.isEnabled)&&this.showPreorderLineItemProperty(cartLabelTextKey,cartLabelTextValue),variant.config.stock.hasUnlimitedQuantity||this.addQuantityListener(variant.config.stock.quantity)}}if(this.product.isCSEnabledForVariant()){const settings=this.product.getVariantSettings(this.settings,this.defaultSettingIds.CS,"CS");this.buttonCS.setAddToCartText(settings.button.addToCartText),this.buttonCS.setSoldOutText(settings.button.soldOutText),variant.configCS.status==="ACTIVE"&&(this.buttonCS.showCS(settings),this.addCommonElements(settings,variant))}$(".atc-button-hide").removeClass("atc-button-hide")}resetDefault(){this.buttonBIS.hide(),this.buttonCS.hide(),this.timerPO.hide(),this.timerIS.hide(),this.timerBIS.hide(),this.timerCS.hide(),this.buttonPO.removeCartAlertListener(),this.buttonIS.removeCartAlertListener(),(!this.buttonPO.confirmButtonExists()||!this.buttonIS.confirmButtonExists())&&(this.buttonPO.identifyButton(this.selectors),this.buttonIS.identifyButton(this.selectors),this.selectors.buttonSelector=$(this.selectors.formSelector).find(this.selectors.ids.addToCartButton)),this.product.isVariantOutOfStock()?(this.buttonPO.showOutOfStock(),$(this.selectors.formSelector).find(".shopify-payment-button").hide()):(this.buttonPO.showAddToCart(),$(this.selectors.formSelector).find(".shopify-payment-button").show()),this.removePreorderLineItemProperty(),this.removePreorderMessage(),this.removePreorderBadge(),this.removePreorderQuantity(),this.removeSellingPlanWidget(),this.selectors.hideProductElements&&this.addHiddenElements()}addSellingPlan(sellingPlans,settings,variant){if(!variant.config.sellingPlan){console.log("Variant has no SellingPlan set.");return}const sellingPlan=sellingPlans.find(sellingPlan2=>String(sellingPlan2.id)===variant.config.sellingPlan);if(!sellingPlan){console.log("SellingPlan was not found.");return}sellingPlan.options[0].name==="FULL_PAYMENT"?this.addHiddenSellingPlan(sellingPlan.id):($(this.selectors.sellingPlanSelector).before(timesactPartialPayment),$("#timesact_widget .timesact_text").text(sellingPlan.options[0].value),$("#timesact_widget #timesact_selling_plan_label").val(sellingPlan.id));const message=new Message(settings.locale||"en-US");this.showPreorderMessage(settings.message.type,sellingPlan.description,"selling-plan"),message.addStylePreorderMessage(settings.message,"selling-plan")}static displayBisModal(){const{defaultSettings,productId,productVariants,variantId}=window.ta.currentTimesactProductData,product=new Product(productId,productVariants);product.setActiveVariant(variantId),product.setTimesactVariants({variants:productVariants});const{form}=product.getVariantSettings(window.ta.settings,defaultSettings.templates.BIS,"BIS");$("h3.timesact_bis_heading").attr("style",`color: ${form.headingFontColor} !important;`),$("#subscriptionForm .timesact_bis_submit_button").attr("style",`
496				background: ${form.buttonBackgroundColor} !important;
497				color: ${form.buttonFontColor} !important;
498				border-radius: ${form.fieldsBorderRadius}px !important;
499				font-size: ${form.fontSize}px !important;`),$("#subscriptionForm .timesact_bis_input").attr("style",`
500				border-radius: ${form.fieldsBorderRadius}px !important;
501				font-size: ${form.fontSize}px !important;`),$(".timesact_bis_popup").attr("style",`border-radius: ${form.popupBorderRadius}px !important;`),$(".timesact_bis_desc, .timesact_bis_note, .timesact_bis_subscribe").attr("style",`color: ${form.textFontColor} !important;`),$(".timesact_bis_email").attr("style",`border-radius: ${form.fieldsBorderRadius}px !important;`),$(".timesact_bis_heading").text(form.heading),$(".timesact_bis_desc").text(form.description),$(".timesact_bis_submit_button").text(form.buttonName),$(".timesact_bis_form_field .timesact_bis_note").text(form.note),$(".timesact_bis_form_field .timesact_bis_subscribe").text(form.messageNewsletter),$(".timesact_bis_message_success").text(form.messageSuccess),$(".timesact_bis_message_error").text(form.messageError),!form.isNewsletterEnabled&&$(".timesact_sub").attr("style","display: none;"),$(".timesact_bis_popup_overlay").addClass("timesact_bis_popup_overlay_show"),$(".timesact_bis_dialog").addClass("timesact_bis_dialog_show"),form.isBrandEnabled||$(".timesact_powered_by").hide()}addHiddenSellingPlan(sellingPlanId){$(this.selectors.formSelector).append(`<input type="hidden" checked="checked" data-timesact-selling-plan name="selling_plan" value="${sellingPlanId}" id="selling_plan_${sellingPlanId}">`)}
501addCommonElements(settings,variant){const type=settings.type==="BIS"?"bis":settings.type==="CS"?"cs":settings.type==="IS"?"is":"preorder";type!=="is"&&$(this.selectors.formSelector).find(".shopify-payment-button").hide(),this.addPreorderMessage(settings.message,variant,type),settings.badge.product&&this.addBadge(this.selectors.badgeSelector,settings.badge,type),this.selectors.hideProductElements&&$(this.selectors.hideProductElements).hide();const timer=settings.message.timer;if(timer){const configType=settings.type!=="PO"?settings.type:"";this[`timer${settings.type}`].setTimerInfo({...timer,productConfig:variant[`config${configType}`]}),this[`timer${settings.type}`].show()}}showPreorderLineItemProperty(key,value){$(this.selectors.formSelector).find("#preorder-label").length===0?$(this.selectors.formSelector).append('<input type="hidden" id="preorder-label" name="properties['+key+']" value="'+value+'" />'):$(this.selectors.formSelector).find("#preorder-label").val(value)}removePreorderLineItemProperty(){$(this.selectors.formSelector).find("#preorder-label").remove()}removePreorderBadge(){$(this.selectors.badgeSelector).find(".timesact-badge-ribbon-preorder, .timesact-badge-ribbon-bis, .timesact-badge-ribbon-cs, .timesact-badge-ribbon-is").remove(),$(this.selectors.badgeSelector).find(".timesact-badge-common-preorder, .timesact-badge-common-bis, .timesact-badge-common-cs, .timesact-badge-common-is").remove()}removeSellingPlanWidget(){$("#timesact_widget").remove(),$(".timesact-selling-plan-description").remove(),$("[data-timesact-selling-plan]").remove()}addBadge(selector,settings,settingType){const badge=new Badge;badge.add(selector,settings.type,settings.value,settingType),badge.applyStyles(settings,settingType)}addPreorderMessage(settings,variant,type){const message=new Message(settings.locale||"en-US");if(settings.value!=""){const configType=type==="bis"?"configBIS":type==="cs"?"configCS":type==="is"?"configIS":"config",messageValue=message.populateDynamicValues(variant,settings.value,!1,configType);this.showPreorderMessage(settings.type,messageValue,type),message.addStylePreorderMessage(settings,type)}}showPreorderMessage(placementType,value,type){if(this.selectors.messageSelector){$(this.selectors.formSelector).find(`.timesact-${type}-description`).length===0?placementType==="BELOW"?$(this.selectors.messageSelector).after(`<div class='timesact-${type}-description'>`+value+"</div>"):$(this.selectors.messageSelector).before(`<div class='timesact-${type}-description'>`+value+"</div>"):$(this.selectors.formSelector).find(`.timesact-${type}-description`).val(value);return}$(this.selectors.formSelector).find(`.timesact-${type}-description`).length===0?placementType==="BELOW"?$(this.selectors.buttonSelector).after(`<div class='timesact-${type}-description'>`+value+"</div>"):$(this.selectors.buttonSelector).before(`<div class='timesact-${type}-description'>`+value+"</div>"):$(this.selectors.formSelector).find(`.timesact-${type}-description`).val(value)}removePreorderMessage(){$(this.selectors.formSelector).find(".timesact-preorder-description, .timesact-bis-description, .timesact-cs-description, .timesact-is-description").remove()}removePreorderQuantity(){$(".timesact-quantity-message").remove(),$(this.selectors.quantitySelector).off("change.quantityChange"),$(this.selectors.buttonSelector).off("click.quantityButtonClick")}addHiddenElements(){$(this.selectors.hideProductElements).show()}addQuantityListener(preorderQty){const selectors=this.selectors;$(this.selectors.quantitySelector).on("change.quantityChange",function(){preorderQty<parseInt($(this).val())?($(".timesact-quantity-message").length||(selectors.messageSelector?$(selectors.messageSelector).before(`<div class='timesact-quantity-message' style='color:red'>You can only pre-order ${preorderQty} items!</div>`):$(selectors.buttonSelector).before(`<div class='timesact-quantity-message' style='color:red'>You can only pre-order ${preorderQty} items!</div>`)),$(selectors.buttonSelector).prop("disabled",!0)):($(".timesact-quantity-message").remove(),$(selectors.buttonSelector).prop("disabled",!1))}),$(this.selectors.buttonSelector).on("click.quantityButtonClick",function(event){const qt
501y=$(selectors.quantitySelector).val();preorderQty<parseInt(qty)?(event.preventDefault(),$(".timesact-quantity-message").length||(selectors.messageSelector?$(selectors.messageSelector).before(`<div class='timesact-quantity-message' style='color:red'>You can only pre-order ${preorderQty} items!</div>`):$(selectors.buttonSelector).before(`<div class='timesact-quantity-message' style='color:red'>You can only pre-order ${preorderQty} items!</div>`))):$(".timesact-quantity-message").remove()})}}class TimesactEventListener{initVariantEventListener(preorder){var event=this;$(document).on("change",".timesact-variant-picker-"+preorder.uuid,function(e){event.variantChangeHandler(preorder)}),event.setup(function(){event.variantChangeHandler(preorder)})}sleep(e){return new Promise(function(t){setTimeout(t,e)})}variantChangeHandler(preorder){const preorderEntry=preorder;this.sleep(preorder.selectors.variantChangingTime).then(function(){var selectedVariantId=window.location.search.replace(/.*variant=(\d+).*/,"$1");selectedVariantId||(selectedVariantId=$(preorderEntry.selectors.formSelector).find("select[name='id'], input[name='id'], select[name='id[]'], input[name='id[]']").attr("type")==="radio"?$(preorderEntry.selectors.formSelector).find("input[name='id']:checked, input[name='id[]']:checked").val():$(preorderEntry.selectors.formSelector).find("select[name='id'], input[name='id'], select[name='id[]'], input[name='id[]']").val()),preorderEntry.product.setActiveVariant(selectedVariantId),preorderEntry.resetDefault(),preorderEntry.createWidget()})}track(fn,handler,before){return function(){if(before)return handler.apply(this,arguments),fn.apply(this,arguments);var result=fn.apply(this,arguments);return handler.apply(this,arguments),result}}setup(handler){history.pushState=this.track(history.pushState,handler),history.replaceState=this.track(history.replaceState,handler),window.addEventListener("popstate",handler)}}class Api{static async createSubscription(data){try{return await $.ajax({url:"/apps/timesact/notifications/bis",type:"POST",contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(data)}),!0}catch(err){return console.log("Subscription no create",err),!1}}static async getProductPreOrderConfig(productId){try{return await $.ajax({url:`/apps/timesact/config?productId=${productId}`,type:"GET",contentType:"application/json; charset=utf-8",dataType:"json"})}catch{return console.log("Product is not active on pre-order."),null}}async getProducts(productIds=[]){try{return await $.ajax({url:`/apps/timesact/products?productIds=${productIds}`,type:"GET",contentType:"application/json; charset=utf-8",dataType:"json"})}catch{return console.log("Products config couldn't be fetched."),null}}async getShop(){try{return await $.ajax({url:"/apps/timesact/shop",type:"GET",contentType:"application/json; charset=utf-8",dataType:"json"})}catch{return console.log("Shop data couldn't be fetched."),null}}async getSettings(){try{return await $.ajax({url:"/apps/timesact/shop/settings",type:"GET",contentType:"application/json; charset=utf-8",dataType:"json"})}catch{return console.log("Settings data couldn't be fetched."),null}}}class Selectors{constructor(selectors){this.ids=selectors}setNormalSelectors(){this.formSelector=$(this.ids.form),this.buttonSelector=this.formSelector.find(this.ids.addToCartButton),this.buttonSelector.length===0&&(this.buttonSelector=this.formSelector.find('[type="submit"]:visible:first, [name="add"], .product-submit, .addtocart-button-active, .product-form--add-to-cart, .button--addToCart, .product-form__submit, .add-to-cart, .btn-addtocart, .single_add_to_cart_button, .product-form__cart-submit, .product-form--atc-button, .ProductForm__AddToCart, [type="button"]:visible:first').first()),this.variantSelector=this.formSelector.find(this.ids.variant),this.ids.quantity?this.quantitySelector=this.formSelector.find(this.ids.quantity):(this.quantitySelector=this.formSelector.find('[name="quantity"]'),this.quantitySelector.length===0&&(this.quantitySelector=$('[name="quantity"]'))),this.ids.badge?this.badgeSelector=$(this.ids.badge):this.badgeSelector=$(".timesact-badge"),this.ids.message&&(this.messageSelector=this.formSelector.find(this.ids.message)),this.sellingPlanSelector=this.formSelector.find('[type="submit"]:visible:first'),this.ids.sellingPlan&&(this.sellingPlanSelector=this.formSelector.find(this.ids.sellingPlan)),this.timerSelector=this.formSelector.find('[type="submit"]:visible:first'),this.ids.timer&&(this.timerSelector=this.formSelector.find(this.ids.timer)),this.ids.hide&&this.ids.hide.product&&(this.hideProductElements=this.ids.hide.product),this.variantChangingTime=this.ids.variantChangingTime||250,this.formSelector.find('[data-pf-type="ProductATC"], [data-pf-type="ProductATC2"]').length>0&&(this.buttonSelector=this.formSelector.find('[data-pf-type="ProductATC"] span:first, [data-pf-type="ProductATC2"] span:first'),this.messageSelector=this.formSelector.find(this.ids.message||'[data-
501pf-type="ProductATC"]'),this.badgeSelector=$('[data-pf-type="MainMedia"]')),this.formSelector.find("gp-product-images-v2").length>0&&(this.badgeSelector=this.formSelector.find("gp-product-images-v2"))}setQuickViewSelectors(){this.formSelector=$(window.ta.quickView.selectors.quickviewModalContainer).find(window.ta.quickView.selectors.form),this.buttonSelector=$(window.ta.quickView.selectors.quickviewModalContainer).find(window.ta.quickView.selectors.addToCartButton),this.variantSelector=$(window.ta.quickView.selectors.quickviewModalContainer).find(window.ta.quickView.selectors.variant),this.quantitySelector=$(window.ta.quickView.selectors.quickviewModalContainer).find(window.ta.quickView.selectors.quantity),this.ids.message&&(this.messageSelector=this.formSelector.find(this.ids.message)),this.variantChangingTime=this.ids.variantChangingTime||250,this.ids.badge?this.badgeSelector=$(this.ids.badge):this.badgeSelector=$(".timesact-badge"),this.sellingPlanSelector=this.formSelector.find('[type="submit"]:visible:first'),this.ids.sellingPlan&&(this.sellingPlanSelector=$(this.ids.sellingPlan))}}class ScriptRunner{constructor(shop,product){this.shop=shop,this.product=product}async run(isQuickView){const timesactProduct=await Api.getProductPreOrderConfig(this.product.id);if(!timesactProduct){window.ta.products[this.product.id]={isPreorder:!1,isBIS:!1,isCS:!1,isIS:!1,lastUpdate:parseInt(new Date().getTime()/1e3)},localStorage.setItem("products",JSON.stringify(window.ta.products)),$(".atc-button-hide").removeClass("atc-button-hide");return}window.ta.currentTimesactProductData={defaultSettings:this.shop.settings,productId:this.product.id,productName:this.product.title,productVariants:timesactProduct.product.variants,variantId:null},this.selectors=new Selectors(this.shop.selectors),isQuickView?this.selectors.setQuickViewSelectors():this.selectors.setNormalSelectors(),this.product.setActiveVariant(new ProductUtil().extractVariantId(this.product.variants,this.selectors.formSelector)),this.product.setTimesactVariants(timesactProduct.product),new Timesact(this.selectors,this.product,this.shop.settings.templates,this.shop).init(),window.ta.products[this.product.id]={isPreorder:this.isActiveOnPreorder(timesactProduct.product.variants),isBIS:this.isActiveOnBIS(timesactProduct.product.variants),isCS:this.isActiveOnCS(timesactProduct.product.variants),isIS:this.isActiveOnIS(timesactProduct.product.variants),variants:timesactProduct.product.variants,lastUpdate:parseInt(new Date().getTime()/1e3)},localStorage.setItem("products",JSON.stringify(window.ta.products))}hasCustomSettings(product,variantId){return product.variants[variantId].settings?product.variants[variantId].settings.type==="CUSTOM":!1}async getVariantSettings(settings,defaultSettings,product,variantId,type){if(!product.variants[variantId].config.settingsTemplate){if(!this.hasCustomSettings(product,variantId))return defaultSettings;const customSettings=product.variants[variantId].settings;return{button:{...defaultSettings.button,name:customSettings.buttonName||defaultSettings.button.name},message:{...defaultSettings.message,type:customSettings.messageType||defaultSettings.message.type,value:customSettings.messageValue||defaultSettings.message.value},cart:{...defaultSettings.cart,labelText:{key:customSettings.cartLabelTextKey||defaultSettings.cart.labelText.key,value:customSettings.cartLabelTextValue||defaultSettings.cart.labelText.value}},badge:defaultSettings.badge}}return type==="PO"?product.variants[variantId].config.settingsTemplate in settings?settings[product.variants[variantId].config.settingsTemplate]:defaultSettings:type==="BIS"?product.variants[variantId].configBIS.settingsTemplate in settings?settings[product.variants[variantId].configBIS.settingsTemplate]:defaultSettings:type==="CS"&&product.variants[variantId].configCS.settingsTemplate in settings?settings[product.variants[variantId].configCS.settingsTemplate]:defaultSettings}addSellingPlan(sellingPlans,settings,variant,productForm){if(!variant.config.sellingPlan){console.log("Variant has no SellingPlan set.");return}const sellingPlan=sellingPlans.find(sellingPlan2=>String(sellingPlan2.id)===variant.config.sellingPlan);if(!sellingPlan){console.log("SellingPlan was not found.");return}sellingPlan.options[0].name==="FULL_PAYMENT"?$(productForm).append(`<input type="hidden" checked="checked" data-timesact-selling-plan name="selling_plan" value="${sellingPlan.id}" id="selling_plan_${sellingPlan.id}">`):($(productForm).find(this.selectors.sellingPlanSelector).before(timesactPartialPayment),$("#timesact_widget .timesact_text").text(sellingPlan.options[0].value),$("#timesact_widget #timesact_selling_plan_label").val(sellingPlan.id));const message=new Message(settings.locale||"en-US");$(productForm).find(".timesact-selling-plan-description").length===0?$(productForm).find(this.selectors.messageSelector).after("<div class='timesact-selling-plan-description'>"+sellingPlan.description+"</div>"):$(productForm).find(".timesact-selling-plan-description").val(sellingPlan.description),message.addStylePreorderMessage(settings.message,"selling-plan")}async runHomepage(){const thisEvent=this;this.selectors=new Selectors(this.shop.selectors),this.selectors.setNormalSelectors();var productIds=new Set;const productForms=$(this.selectors.formSelector);for(var form=0;form<productForms.length;form++){const productId=$(productForms[form]).data("productid");productId&&productIds.add(productId)}const timesact=await new Api().getProducts(Array.from(productIds));if(!timesact){console.log("[Error] Timesact API getProducts.");return}const defaultSetting=window.ta.settings[this.shop.settings.templates.PO];for(var form=0;form<productForms.length;form++){const productId=$(productForms[form]).data("productid");if(!(productId in timesact.products))continue;const product=timesact.products[productId];if(this.shop.hasSellingPlanEnabled){var shopifyProduct;await $.getJSON(window.Shopify.routes.root+`products/${product.handle}
501.js`,function(data){shopifyProduct=new Product(data.id,data.variants,data.title,data.selling_plan_groups)})}const variantId=$(productForms[form]).find("[name='id']").val(),variantSetting=await this.getVariantSettings(window.ta.settings,defaultSetting,product,variantId,"PO"),buttonSelector=$(productForms[form]).find(this.selectors.buttonSelector);if(!variantId||product.variants[variantId].config.status==="NO_STOCK"){$(buttonSelector).val(variantSetting.button.soldOutText),$(buttonSelector).text(variantSetting.button.soldOutText),$(buttonSelector).prop("disabled",!0),$(productForms[form]).find(".timesact-preorder-description").remove(),$(productForms[form]).find("#preorder-label").remove(),$(productForms[form]).parent().parent().parent().parent().parent().find(".timesact-badge-common").remove();continue}if(product.variants[variantId].config.status==="ACTIVE"){$(buttonSelector).val(variantSetting.button.name),$(buttonSelector).text(variantSetting.button.name),$(buttonSelector).prop("disabled",!1),$(productForms[form]).find(".shopify-payment-button").hide();const message=new Message(defaultSetting.message.locale||"en-US");if(typeof variantSetting.cart.labelText.isEnabled>"u"||variantSetting.cart.labelText.isEnabled){const key=message.populateDynamicValues(product.variants[variantId],variantSetting.cart.labelText.key,!1,"config"),value=message.populateDynamicValues(product.variants[variantId],variantSetting.cart.labelText.value,!1,"config");$(productForms[form]).find("#preorder-label").length===0?$(productForms[form]).append('<input type="hidden" id="preorder-label" name="properties['+key+']" value="'+value+'" />'):$(productForms[form]).find("#preorder-label").val(value)}this.shop.hasSellingPlanEnabled&&this.addSellingPlan(shopifyProduct.sellingPlans,variantSetting,product.variants[variantId],productForms[form]);const messageValue=message.populateDynamicValues(product.variants[variantId],variantSetting.message.value,!1,"config");$(productForms[form]).find(".timesact-preorder-description").length===0?$(productForms[form]).find(this.selectors.messageSelector).after("<div class='timesact-preorder-description'>"+messageValue+"</div>"):$(productForms[form]).find(".timesact-preorder-description").val(messageValue),message.addStylePreorderMessage(variantSetting.message,"preorder");const badge=new Badge;badge.add($(productForms[form]).parent().parent().parent().parent().parent().find(".image--container:first"),variantSetting.badge.type,variantSetting.badge.value),badge.applyStyles(variantSetting.badge)}(product.variants[variantId].config.status==="NO_SET"||product.variants[variantId].config.status==="PENDING")&&($(buttonSelector).val(variantSetting.button.addToCartText),$(buttonSelector).text(variantSetting.button.addToCartText),$(productForms[form]).find(".timesact-preorder-description").remove(),$(productForms[form]).find("#preorder-label").remove(),$(productForms[form]).parent().parent().parent().parent().parent().find(".timesact-badge-common").remove()),$(productForms[form]).parent().parent().parent().find("[type='radio']").on("click.variant",function(){thisEvent.runHomepage()})}}async runCollection(){if(window.ta.settings[this.shop.settings.templates.PO].badge.collection||window.ta.settings[this.shop.settings.templates.BIS].badge.collection||window.ta.settings[this.shop.settings.templates.CS].badge.collection||window.ta.settings[this.shop.settings.templates.IS].badge.collection){this.shop.lastProductUpdate&&window.ta.lastProductUpdate<this.shop.lastProductUpdate&&(window.ta.products={});let possibleClasses=[".timesact-badge",".product-item",".card--standard",".card--card",".ProductItem",'[data-pf-type="ProductBox"], gp-product'];this.shop.selectors.collection&&this.shop.selectors.collection.badge&&(possibleClasses=[this.shop.selectors.collection.badge]);let items=[];for(let i=0;i<possibleClasses.length;i++)if($(possibleClasses[i]).length>0){items=$(possibleClasses[i]);break}this.enableBadgeOnCollection(items)}}async runMixedCartAlert(data){if(!window.ta.cart.showMixedCartAlert||!data.items.length)return;const isCartPage=window.location.pathname.includes("cart"),defaultSettingsPO=window.ta.settings[this.shop.settings.templates.PO];if(!defaultSettingsPO.cart.mixed.isEnabled||isCartPage&&defaultSettingsPO.cart.mixed.onCartPage===!1||!isCartPage&&defaultSettingsPO.cart.mixed.onButtonClick!==!0)return;let hasPreorderProduct=!1,hasNormalProduct=!1,products={};for(const item of data.items){if(window.ta.products[item.product_id]){if(window.ta.products[item.product_id].variants&&window.ta.products[item.product_id].variants[item.variant_id]&&window.ta.products[item.product_id].variants[item.variant_id].config.status==="ACTIVE"){hasPreorderProduct=!0;continue}hasNormalProduct=!0;continue}products[item.product_id]=products[item.product_id]||[],products[item.product_id].push(item.variant_id)}const modal=new Modal,modalSettings={...defaultSettingsPO.cart.mixed,id:defaultSettingsPO.id||defaultSettingsPO.name},closeModal=()=>{window.sessionStorage.setItem("showCartMixedAlert",!$("#md-stop").is(":checked")),window.ta.cart.showMixedCartAlert=!$("#md-stop").is(":checked")};
501if(hasPreorderProduct&&hasNormalProduct)return modal.display(modalSettings,closeModal);if(!Object.keys(products).length)return;const timesact=await new Api().getProducts(Object.keys(products));if(!timesact){console.log("[Error] Timesact API getProducts.");return}for(const productId of Object.keys(products)){if(!(productId in timesact.products)){hasNormalProduct=!0,window.ta.products[productId]={isPreorder:!1,isBIS:!1,isCS:!1,lastUpdate:parseInt(new Date().getTime()/1e3)};continue}for(const variantId of products[productId]){if(timesact.products[productId].variants[variantId]&&timesact.products[productId].variants[variantId].config.status==="ACTIVE"){hasPreorderProduct=!0;continue}hasNormalProduct=!0}if(window.ta.products[productId]={isPreorder:this.isActiveOnPreorder(timesact.products[productId].variants),isBIS:this.isActiveOnBIS(timesact.products[productId].variants),isCS:this.isActiveOnCS(timesact.products[productId].variants),isIS:this.isActiveOnIS(timesact.products[productId].variants),variants:timesact.products[productId].variants,lastUpdate:parseInt(new Date().getTime()/1e3)},hasNormalProduct&&hasPreorderProduct){modal.display(modalSettings,closeModal);break}}localStorage.setItem("products",JSON.stringify(window.ta.products))}async runCartAlert(data){if(!data.items.length)return;const products={};for(var item of data.items){const product=window.ta.products[item.product_id];if(!product)continue;const variant=product?.variants?.[item.variant_id],configName=product.isIS?"configIS":"config";variant?.[configName]?.status==="ACTIVE"&&(products[item.product_id]={...products[item.product_id]||{},[item.variant_id]:variant})}if(!Object.keys(products).length)return;const storageTmps=JSON.parse(window.sessionStorage.getItem("showCartAlert")||null)||{},tmps={};for(const[productId,product]of Object.entries(products))for(const[variantId,variant]of Object.entries(product)){const configName=variant.isISEnabled?"configIS":"config",tmpSettings=window.ta.settings[variant[configName]?.settingsTemplate],id=`${tmpSettings.type}-${productId}-${variantId}`;tmps[id]={dismiss:!!storageTmps[id]?.dismiss,settings:{id,...tmpSettings.cart?.alert}}}const closeModal=settings=>()=>{const actualStorageTmps=JSON.parse(window.sessionStorage.getItem("showCartAlert")||null)||{};return new TimesactButton("","").closeCartAlertModal(settings,actualStorageTmps)};for(const tmp of Object.values(tmps))!tmp.settings.isEnabled||tmp.settings.onCartPage===!1||tmp.dismiss||Modal.pushQueue(tmp.settings,closeModal(tmp.settings));Modal.showFirst()}isActiveOnPreorder(variants){return Object.values(variants).every(variant=>variant.config.status==="ACTIVE")}isActiveOnBIS(variants){return Object.values(variants).every(variant=>variant.configBIS&&variant.configBIS.status==="ACTIVE")}isActiveOnCS(variants){return Object.values(variants).every(variant=>variant.configCS&&variant.configCS.status==="ACTIVE")}isActiveOnIS(variants){return Object.values(variants).some(variant=>variant.configIS&&variant.configIS.status==="ACTIVE")}async enableBadgeOnCollection(items){if(items.length===0){console.log("No items detected.");return}const products={},defaultSettingsPO=window.ta.settings[this.shop.settings.templates.PO],defaultSettingsBIS=window.ta.settings[this.shop.settings.templates.BIS],defaultSettingsCS=window.ta.settings[this.shop.settings.templates.CS],defaultSettingsIS=window.ta.settings[this.shop.settings.templates.IS];await Promise.all(Array.from(items).map(async item=>{var productId;if($(item).attr("gp-context")){var gpContextObject=JSON.parse($(item).attr("gp-context"));if(gpContextObject.productId)productId=gpContextObject.productId;else{var gpContextImage=JSON.parse($(item).find("gp-product-images-v2").attr("gp-data"));productId=gpContextImage.product.id}}else if($(item).data("product-id"))productId=$(item).data("product-id");else{let href=$(item).find("a").attr("href");if(!href)return;let handle=href.split("/").pop().split("?")[0];if(!handle)return;console.log("Product handle: ",handle);const data=await $.getJSON(window.location.origin+href);if(!data||!data.product||!data.product.id)return;productId=String(data.product.id)}if(window.ta.products[productId]){let shouldHide=!1;window.ta.products[productId].isPreorder&&defaultSettingsPO.badge.collection&&(this.addBadge(item,defaultSettingsPO.badge,"preorder"),shouldHide=!0,defaultSettingsPO.button.collection&&defaultSettingsPO.button.collection.isEnabled&&this.enableButtonOnCollection(item,this.shop,window.ta.products[productId],defaultSettingsPO,productId)),window.ta.products[productId].isBIS&&defaultSettingsBIS.badge.collection&&(this.addBadge(item,defaultSettingsBIS.badge,"bis"),shouldHide=!0,this.enableButtonOnCollection(item,this.shop,window.ta.products[productId],defaultSettingsBIS,productId)),window.ta.products[productId].isCS&&defaultSettingsCS.badge.collection&&(this.addBadge(item,defaultSettingsCS.badge,"cs"),shouldHide=!0,this.enableButtonOnCollection(item,this.shop,window.ta.products[productId],defaultSettingsCS,productId)),window.ta.products[productId].isIS&&defaultSettingsIS.badge.collection&&(this.addBadge(item,defaultSettingsIS.badge,"is"),shouldHide=!0),shouldHide&&this.shop.selectors.hide&&this.shop.selectors.hide.collection&&$(item).find(this.shop.selectors.hide.collection).hide();return}products[productId]=item}));const timesact=await new Api().getProducts(Object.keys(products));if(!timesact){console.log("[Error] Timesact API getProducts.");return}for(const[productId,item]of Object.entries(products)){if(!(productId in timesact.products)){window.ta.products[productId]={isPreorder:!1,isBIS:!1,isCS:!1,isIS:!1,lastUpdate:parseInt(new Date().getTime()/1e3)};continue}const isPreorder=this.isActiveOnPreorder(timesact.products[productId].variants),isBIS=this.isActiveOnBIS(timesact.products[productId].variants),isCS=this.isActiveOnCS(timesact.products[productId].variants),isIS=this.isActiveOnIS(timesact.products[productId].variants);let shouldHide=!1;isPreorder&&defaultSettingsPO.badge.collection&&(this.addBadge(item,defaultSettingsPO.badge,"preorder"),shouldHide=!0,defaultSettingsPO.button.collection&&defaultSettingsPO.button.collection.isEnabled&&this.enableButtonOnCollection(item,this.shop,timesact.products[productId],defaultSettingsPO,productId)),isBIS&&defaultSettingsBIS.badge.collection&&(this.addBadge(item,defaultSettingsBIS.badge,"bis"),shouldHide=!0,this.enableButtonOnCollection(item,this.shop,timesact.products[productId],defaultSettingsBIS,productId)),isCS&&defaultSettingsCS.badge.collection&&(this.addBadge(item,defaultSettingsCS.badge,"cs"),shouldHide=!0,this.enableButtonOnCollection(item,this.shop,timesact.products[productId],defaultSettingsCS,productId)),isIS&&defaultSettingsIS.badge.collection&&(this.addBadge(item,defaultSettingsIS.badge,"is"),shouldHide=!0),shouldHide&&this.shop.selectors.hide&&this.shop.selectors.hide.collection&&$(item).find(this.shop.selectors.hide.collection).hide(),window.ta.products[productId]={isPreorder,isBIS,isCS,isIS,variants:timesact.products[productId].variants,lastUpdate:parseInt(new Date().getTime()/1e3)}}localStorage.setItem("products",JSON.stringify(window.ta.products))}getActiveConfigType(product){return product.isBISEnabled?"configBIS":product.isCSEnabled?"configCS":product.isISEnabled?"configIS":"config"}enableButtonOnCollection(item,shop,product,defaultSettings,productId){let formCollectionSelector='form[action="/cart/add"]';shop.selectors.collection&&shop.selectors.collection.form&&(formCollectionSelector=shop.selectors.collection.form);let addToCartButtonCollectionSelector='[type=submit]:visible:first, [data-pf-type="ProductATC"] span:first, [data-pf-type="ProductATC2"] span:first, .gp-button-atc';shop.selectors.collection&&shop.selectors.collection.addToCartButton&&(addToCartButtonCollectionSelector=shop.selectors.collection.addToCartButton);const productForm=$(item).find(formCollectionSelector);for(let variantId in product.variants){const variant=product.variants[variantId],configType=this.getActiveConfigType(variant),config=variant[configType];
501if(!config||config?.status!=="ACTIVE")continue;let buttonSelector=$(item).find(addToCartButtonCollectionSelector);const buttonName=window.ta.settings[config.settingsTemplate]?.button.name||defaultSettings.button.name;$(buttonSelector).length===0&&(buttonSelector=$(item).find('[type="submit"]')),$(buttonSelector).val(buttonName),$(buttonSelector).text(buttonName),$(buttonSelector).prop("disabled",!1),$(item).find(".shopify-payment-button").hide(),configType==="configBIS"&&($(buttonSelector).click(function(event){window.ta.currentTimesactProductData={defaultSettings:shop.settings,productId,productName:product.variants[variantId].displayName,productVariants:product.variants,variantId},event.preventDefault(),TimesactBisModal.displayBisModal()}),$(buttonSelector).prop("disabled",!1)),configType==="configCS"&&(window.ta.currentTimesactProductData={defaultSettings:shop.settings,productId:product?.id,productName:product?.title,productVariants:product.variants,variantId});const message=new Message(defaultSettings.message.locale||"en-US");let cartValue=window.ta.settings[product.variants[variantId].config.settingsTemplate]?window.ta.settings[product.variants[variantId].config.settingsTemplate].cart.labelText.value:defaultSettings.cart.labelText.value,cartKey=window.ta.settings[product.variants[variantId].config.settingsTemplate]?window.ta.settings[product.variants[variantId].config.settingsTemplate].cart.labelText.key:defaultSettings.cart.labelText.key,isCartEnabled=window.ta.settings[product.variants[variantId].config.settingsTemplate]?window.ta.settings[product.variants[variantId].config.settingsTemplate].cart.labelText.isEnabled:defaultSettings.cart.labelText.isEnabled;shop.hasSellingPlanEnabled&&product.variants[variantId].config.sellingPlan&&$(productForm).append(`<input type="hidden" checked="checked" data-timesact-selling-plan name="selling_plan" value="${product.variants[variantId].config.sellingPlan}" id="selling_plan_${product.variants[variantId].config.sellingPlan}">`),(typeof isCartEnabled>"u"||isCartEnabled)&&(cartKey=message.populateDynamicValues(product.variants[variantId],cartKey,!0,"config"),cartValue=message.populateDynamicValues(product.variants[variantId],cartValue,!0,"config"),$(productForm).find("#preorder-label").length===0?$(productForm).append('<input type="hidden" id="preorder-label" name="properties['+cartKey+']" value="'+cartValue+'" />'):$(productForm).find("#preorder-label").val(cartValue))}}addBadge(selector,settings,settingType){$(selector).find('[data-pf-type="ProductMedia"], [data-pf-type="ProductMedia2"]').length>0&&(selector=$(selector).find('[data-pf-type="ProductMedia"], [data-pf-type="ProductMedia2"]')),$(selector).attr("gp-context")&&(selector=$(selector).find("gp-product-images-v2")),$(selector).css("position")!=="absolute"&&$(selector).css({position:"relative"});const badge=new Badge;badge.add(selector,settings.type,settings.value,settingType),badge.applyStyles(settings,settingType)}}$(document).ready(async function(){const api=new Api,utils=new ShopUtil;if(TimesactBisModal.createListeners(),utils.initTimesact(),!utils.isProductPage()&&!utils.isCollectionPage()&&!utils.isSearchPage()&&!utils.isPagesPage()&&!utils.isHomePage()&&!utils.isCartPage())return;const shop=await api.getShop();if(!window.ta.settings||shop.lastSettingsUpdate&&window.ta.lastSettingsUpdate<shop.lastSettingsUpdate){const{settings}=await api.getSettings();window.ta.settings=settings,window.ta.lastSettingsUpdate=shop.lastSettingsUpdate||parseInt(new Date().getTime()/1e3),localStorage.setItem("settings",JSON.stringify(window.ta.settings)),localStorage.setItem("lastSettingsUpdate",JSON.stringify(window.ta.lastSettingsUpdate))}if(utils.isProductPage()){let product={};$.getJSON(window.location.href.split("?")[0].concat(".js"),function(data){product=new Product(data.id,data.variants,data.title,data.selling_plan_groups)}).done(function(){new ScriptRunner(shop,product).run(!1)}).fail(function(){console.log("[Error 1001]: Product could not be fetched.")})}(utils.isCollectionPage()||utils.isHomePage()||utils.isSearchPage()||utils.isPagesPage())&&(utils.initQuickView(shop),new ScriptRunner(shop).runCollection());function callRunningMixedCartAlert(timeout=0,isNeedCartAlert=!1){const closedTmpsIds=JSON.parse(window.sessionStorage.getItem("closedModals")||null)||[],t=shop.settings.templates.PO;closedTmpsIds.includes(t)||setTimeout(()=>{$.getJSON(window.location.origin+"/cart",function(data){isNeedCartAlert&&new ScriptRunner(shop).runCartAlert(data),new ScriptRunner(shop).runMixedCartAlert(data)}).fail(function(){console.log("[Error 1001]: Product could not be fetched.")})},timeout)}let submitBtn=$(shop.selectors.form).find(shop.selectors.addToCartButton);submitBtn.prop("tagName")!=="button"&&(submitBtn=submitBtn.parent()),submitBtn.click(()=>callRunningMixedCartAlert(2e3)),$('a[href="/cart"]').click(()=>callRunningMixedCartAlert(500)),utils.isCartPage()&&callRunningMixedCartAlert(0,!0)})},typeof jQuery>"u"||parseFloat(jQuery.fn.jquery)<100?loadScript("https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js",function(){jQuery191=jQuery.noConflict(!0),timesactScriptNew(jQuery191)}):timesactScriptNew(jQuery)})();
502//# sourceMappingURL=/cdn/shop/t/11/assets/timesact.js.map?v=163295939614899592881779242964

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