var R;const T=((R=window.orderData)==null?void 0:R.products)||[];var E;const L=((E=window.orderData)==null?void 0:E.tlds)||[];var O;(O=window.orderData)!=null&&O.currencies;var F;const b=((F=window.translations)==null?void 0:F.orders)||{};let m=null,S="₺";function B(t){const r=window.orderData.currencies.find(d=>d.id==t);return r&&(r.prefix||r.suffix||r.code)||"₺"}function G(t){return S+parseFloat(t||0).toLocaleString("tr-TR",{minimumFractionDigits:2})}function k(t){if(!m){t.find(".domain-price-input").val("");return}const r=t.find(".domain-input").val(),d=t.find(".registration-type-select").val(),u=t.find(".period-select").val();if(!r||!d||!u){t.find(".domain-price-input").val("");return}const n=r.split(".").pop(),e=L.find(i=>i.tld==="."+n);if(!e){t.find(".domain-price-input").val("TLD not found");return}let o=0;d==="register"?o=e.register_price||0:d==="transfer"?o=e.transfer_price||0:d==="renew"&&(o=e.renew_price||0),o*=parseInt(u),t.find('input[name*="[dns_management]"]').is(":checked")&&(o+=e.dns_price||0),t.find('input[name*="[email_forwarding]"]').is(":checked")&&(o+=e.email_price||0),t.find('input[name*="[id_protection]"]').is(":checked")&&(o+=e.whois_price||0),t.find(".domain-price-input").val(G(o)),C()}function C(t){var d,u,n,e;let r="";!t||!t.items||t.items.length===0?r=`<p class="text-muted">${(d=window.ordertranslations.messages)==null?void 0:d.no_items}</p>`:(t.items.forEach(function(o){let i=o.label;o.domain&&(i+=` <br>(${o.domain})`),r+=`<div class="d-flex justify-content-between mb-2">
                <span>${i}</span>
                <span>${o.price.toLocaleString("tr-TR",{minimumFractionDigits:2})}${o.currency_symbol}</span>
            </div>`}),r+=`<hr>
            <div class="d-flex justify-content-between">
                <span>${(u=window.ordertranslations.calculations)==null?void 0:u.subtotal}</span>
                <span>${t.subtotal.toLocaleString("tr-TR",{minimumFractionDigits:2})}${t.currency_symbol}</span>
            </div>
            <div class="d-flex justify-content-between">
                <span>${(n=window.ordertranslations.calculations)==null?void 0:n.tax}</span>
                <span>${t.tax_total.toLocaleString("tr-TR",{minimumFractionDigits:2})}${t.currency_symbol}</span>
            </div>
            <div class="d-flex justify-content-between fw-bold fs-5 mt-2">
                <span>${(e=window.ordertranslations.calculations)==null?void 0:e.total}</span>
                <span>${t.grand_total.toLocaleString("tr-TR",{minimumFractionDigits:2})}${t.currency_symbol}</span>
            </div>`),$("#order-summary").html(r)}function q(t,r=!1){r||t.find(".domain-input").val(""),t.find(".registration-type-select").val("").prop("disabled",!0),t.find(".period-select").val("").prop("disabled",!0),t.find('input[name*="[dns_management]"]').prop("checked",!1).prop("disabled",!0),t.find('input[name*="[email_forwarding]"]').prop("checked",!1).prop("disabled",!0),t.find('input[name*="[id_protection]"]').prop("checked",!1).prop("disabled",!0),t.find(".domain-price-input").val("")}function U(t){const r=t.find(".domain-input").val(),d=t.find(".registration-type-select").val(),u=t.find(".period-select").val();return!!(r&&d&&u)}function z(){const t=[];return $(".product-row").each(function(){const r=$(this),d=r.find(".product-select").val(),u=r.find(".cycle-select").val(),n=r.find(".domain-for-product").val();if(d&&u&&m){const e={product_id:d,cycle:u,currency_id:m};n&&n.trim()&&(e.domain=n.trim()),t.push(e)}}),$(".domain-row").each(function(){const r=$(this);U(r)&&t.push({domain:r.find(".domain-input").val(),type:r.find(".registration-type-select").val(),year:r.find(".period-select").val(),dns:r.find('input[name*="[dns_management]"]').is(":checked")?1:0,email:r.find('input[name*="[email_forwarding]"]').is(":checked")?1:0,id:r.find('input[name*="[id_protection]"]').is(":checked")?1:0,currency_id:m})}),t}function p(){const t=z();if(t.length===0){C({items:[],grand_total:0,currency_symbol:S});return}$.ajax({url:window.orderData.routes.orderCalculate,method:"POST",headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content"),Accept:"application/json"},data:{items:t},success:function(r){C(r)},error:function(){C({items:[],grand_total:0,currency_symbol:S})}})}$(document).on("input",".domain-input",function(){const t=$(this).closest(".domain-row");q(t,!0);const r=$(this).val();!r||!m||$.ajax({url:window.orderData.routes.tldLookup+"?domain="+encodeURIComponent(r)+"&currency_id="+m,method:"GET",headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content"),Accept:"application/json"},success:function(d){if(d.success){const u=t.find(".registration-type-select");u.find("option").each(function(){const n=$(this).val();n&&$(this).prop("disabled",!d[n+"_active"])}),d.default_type?u.val(d.default_type).trigger("change"):u.val(""),u.prop("disabled",!1),t.find(".period-select").val("").prop("disabled",!0),t.find('input[name*="[dns_management]"]').prop("checked",!1).prop("disabled",!0),t.find('input[name*="[email_forwarding]"]').prop("checked",!1).prop("disabled",!0),t.find('input[name*="[id_protection]"]').prop("checked",!1).prop("disabled",!0)}else q(t,!0);p()},error:function(){q(t,!0),p()}})});$(document).on("change",".registration-type-select",function(){const t=$(this).closest(".domain-row");t.find(".period-select").empty(),t.find('input[name*="[dns_management]"]').prop("checked",!1).prop("disabled",!0),t.find('input[name*="[email_forwarding]"]').prop("checked",!1).prop("disabled",!0),t.find('input[name*="[id_protection]"]').prop("checked",!1).prop("disabled",!0);const r=$(this).val(),d=t.find(".domain-input").val();if(!d||!r||!m){p();return}$.ajax({url:window.orderData.routes.tldLookup+"?domain="+encodeURIComponent(d)+"&currency_id="+m,method:"GET",headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content"),Accept:"application/json"},success:function(u){if(u.success){const n=Object.keys(u.prices[r]||{}).map(Number).sort((o,i)=>o-i),e=t.find(".period-select");e.empty(),n.forEach(function(o){e.append(`<option value="${o}">${o} Year(s)</option>`)}),n.length?(e.val(n[0]).trigger("change"),e.prop("disabled",!1)):e.val("").prop("disabled",!0),t.find('input[name*="[dns_management]"]').prop("checked",!1).prop("disabled",!u.dns_management),t.find('input[name*="[email_forwarding]"]').prop("checked",!1).prop("disabled",!u.email_forwarding),t.find('input[name*="[id_protection]"]').prop("checked",!1).prop("disabled",!u.id_protection)}p()},error:function(){p()}})});$(document).on("change",".period-select",function(){p()});$(document).on("change",'input[name*="[dns_management]"], input[name*="[email_forwarding]"], input[name*="[id_protection]"]',function(){p()});$(document).on("DOMNodeInserted",".domain-row",function(t){q($(t.target),!0)});$(document).ready(function(){t();function t(){var n;$("#client_id").select2({placeholder:(n=b.placeholders)==null?void 0:n.select_client,allowClear:!0,ajax:{url:window.orderData.routes.clientSearch,dataType:"json",delay:250,headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content"),Accept:"application/json"},data:function(e){return{q:e.term}},processResults:function(e){return{results:e.results}},cache:!0},minimumInputLength:2})}$("#client_id").on("select2:select",function(n){const e=n.params.data,o=e.id;if(console.log("Client selected - All data:",e),console.log("Currency ID:",e.currency_id),console.log("Currency Symbol:",e.currency_symbol),o){m=e.currency_id,S=e.currency_symbol||B(m);const i=e.currency_name&&e.currency_symbol?`${e.currency_name} (${e.currency_symbol})`:e.currency_name||S;console.log("Processed currency info:",{currencyId:m,currencySymbol:S,currencyDisplay:i,originalCurrencyId:e.currency_id,originalCurrencySymbol:e.currency_symbol,originalCurrencyName:e.currency_name}),$("#currency_id").val(i),$("#currency_id_hidden").val(m),$("#order-blocks").removeClass("d-none"),C(),console.log("Currency info:",{currencyId:m,currencySymbol:S,currencyDisplay:i})}}),$("#client_id").on("select2:clear",function(){m=null,$("#currency_id").val(""),$("#currency_id_hidden").val(""),$("#order-blocks").addClass("d-none"),C()}),$("#addProduct").on("click",function(){var f,s,a,h,v;const n=$(".product-row").length,e=`
            <div class="product-row row mb-3" data-index="${n}">
                <div class="col-md-4">
                    <label class="form-label">${(f=window.ordertranslations.fields)==null?void 0:f.product}</label>
                    <select name="products[${n}][product_id]" class="form-select product-select" required>
                        <option value="">${(s=window.ordertranslations.placeholders)==null?void 0:s.select_product}</option>
                        ${T.map(_=>`<option value="${_.id}" data-require-domain="${_.require_domain?1:0}">${_.name}</option>`).join("")}
                    </select>
                </div>
                <div class="col-md-3">
                    <label class="form-label">${(a=window.ordertranslations.fields)==null?void 0:a.billing_cycle}</label>
                    <select name="products[${n}][billing_cycle]" class="form-select cycle-select" required disabled>
                        <option value="">${window.ordertranslations.placeholders.select_cycle}</option>
                    </select>
                </div>
                <div class="col-md-2 domain-input-col d-none">
                    <label class="form-label">${(h=window.ordertranslations.fields)==null?void 0:h.domain}</label>
                    <input type="text" name="products[${n}][domain]" class="form-control domain-for-product" placeholder="${(v=window.ordertranslations.placeholders)==null?void 0:v.example_domain}">
                </div>
                <div class="col-md-2">
                    <label class="form-label">&nbsp;</label>
                    <button type="button" class="btn btn-outline-danger btn-sm d-block remove-product">
                        <i class="fas fa-trash"></i>
                    </button>
                </div>
            </div>
        `;$("#products-container").append(e);const o=$("#products-container .product-row:last"),i=o.find(".product-select"),c=o.find(".domain-input-col"),l=o.find(".domain-for-product");i.on("change",function(){var A;const _=$(this).val(),w=o.find(".cycle-select");w.prop("disabled",!0).html('<option value="">${window.ordertranslations.placeholders?.loading}</option>');const y=T.find(g=>g.id==_);if(y&&y.require_domain?(c.removeClass("d-none"),l.prop("required",!0)):(c.addClass("d-none"),l.prop("required",!1).val("")),!_||!m){let g=(A=window.ordertranslations.placeholders)==null?void 0:A.select_cycle;w.html('<option value="">'+g+"</option>").prop("disabled",!0),p();return}const D=window.orderData.routes.productCycles.replace(":product",_)+`?currency_id=${m}`;$.ajax({url:D,method:"GET",headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content"),Accept:"application/json"},success:function(g){var x,j;if(g.cycles&&g.cycles.length){let I=(x=window.ordertranslations.placeholders)==null?void 0:x.select_cycle;w.html('<option value="">'+I+"</option>"+g.cycles.map(P=>`<option value="${P.value}">${P.label}</option>`).join("")),w.prop("disabled",!1)}else{let I=(j=window.ordertranslations.messages)==null?void 0:j.no_suitable_cycle;w.html('<option value="">'+I+"</option>").prop("disabled",!0)}p()},error:function(g){var j;let x=(j=window.ordertranslations.messages)==null?void 0:j.cycle_load_failed;w.html('<option value="">'+x+"</option>").prop("disabled",!0),p()}})}),o.find(".cycle-select").on("change",function(){p()}),o.find(".remove-product").on("click",function(){o.remove(),p()}),i.trigger("change")}),$(document).on("click",".remove-product",function(){$(this).closest(".product-row").remove(),p()}),$("#addDomain").on("click",function(){var i,c,l,f,s,a,h,v,_,w,y;const n=$(".domain-row").length,e=`
            <div class="domain-row row mb-3" data-index="${n}">
                <div class="col-md-3">
                    <label class="form-label">${(i=window.ordertranslations.fields)==null?void 0:i.domain_name}</label>
                    <input type="text" name="domains[${n}][domain]" class="form-control domain-input" placeholder="${(c=window.ordertranslations.placeholders)==null?void 0:c.example_domain}">
                </div>
                <div class="col-md-2">
                    <label class="form-label">${(l=window.ordertranslations.fields)==null?void 0:l.registration_type}</label>
                    <select name="domains[${n}][registration_type]" class="form-select registration-type-select" required>
                        <option value="register">${(f=window.ordertranslations.fields)==null?void 0:f.register}</option>
                        <option value="transfer">${(s=window.ordertranslations.fields)==null?void 0:s.transfer}</option>
                    </select>
                </div>
                <div class="col-md-2 transfer-code-col d-none">
                    <label class="form-label">${(a=window.ordertranslations.fields)==null?void 0:a.transfer_code}</label>
                    <input type="text" name="domains[${n}][transfer_code]" class="form-control transfer-code-input" placeholder="${(h=window.ordertranslations.placeholders)==null?void 0:h.transfer_code}">
                </div>
                <div class="col-md-2">
                    <label class="form-label">${(v=window.ordertranslations.fields)==null?void 0:v.period}</label>
                    <select name="domains[${n}][period]" class="form-select period-select" required>
                    </select>
                </div>
                <div class="col-md-2">
                    <label class="form-label">&nbsp;</label>
                    <button type="button" class="btn btn-outline-danger btn-sm d-block remove-domain">
                        <i class="fas fa-trash"></i>
                    </button>
                </div>
                <div class="col-12 mt-2">
                    <div class="form-check form-check-inline">
                        <input class="form-check-input" type="checkbox" name="domains[${n}][dns_management]" value="1">
                        <label class="form-check-label">${(_=window.ordertranslations.options)==null?void 0:_.dns_management}</label>
                    </div>
                    <div class="form-check form-check-inline">
                        <input class="form-check-input" type="checkbox" name="domains[${n}][email_forwarding]" value="1">
                        <label class="form-check-label">${(w=window.ordertranslations.options)==null?void 0:w.email_forwarding}</label>
                    </div>
                    <div class="form-check form-check-inline">
                        <input class="form-check-input" type="checkbox" name="domains[${n}][id_protection]" value="1">
                        <label class="form-check-label">${(y=window.ordertranslations.options)==null?void 0:y.id_protection}</label>
                    </div>
                </div>
            </div>
        `;$("#domains-container").append(e);const o=$("#domains-container .domain-row:last");o.find(".domain-input").on("input",function(){k(o)}),o.find(".registration-type-select").on("change",function(){const D=$(this).val(),A=o.find(".transfer-code-col"),g=o.find(".transfer-code-input");D==="transfer"?(A.removeClass("d-none"),g.prop("required",!0)):(A.addClass("d-none"),g.prop("required",!1).val("")),k(o)}),o.find(".period-select").on("change",function(){k(o)}),o.find('input[type="checkbox"]').on("change",function(){k(o)}),o.find(".domain-input").trigger("input")}),$(document).on("click",".remove-domain",function(){$(this).closest(".domain-row").remove(),C()}),$(".product-select").on("change",function(){var c;const n=$(this).closest(".product-row"),e=$(this).val(),o=n.find(".cycle-select");if(o.prop("disabled",!0).html('<option value="">${window.ordertranslations.placeholders?.loading}</option>'),!e||!m){o.html('<option value="">'+((c=window.ordertranslations.placeholders)==null?void 0:c.select_cycle)+"</option>").prop("disabled",!0),p();return}const i=window.orderData.routes.productCycles.replace(":product",e)+`?currency_id=${m}`;$.ajax({url:i,method:"GET",headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content"),Accept:"application/json"},success:function(l){var f,s;l.cycles&&l.cycles.length?(o.html('<option value="">'+((f=window.ordertranslations.placeholders)==null?void 0:f.select_cycle)+"</option>"+l.cycles.map(a=>`<option value="${a.value}">${a.label}</option>`).join("")),o.prop("disabled",!1)):o.html('<option value="">'+((s=window.ordertranslations.messages)==null?void 0:s.no_suitable_cycle)+"</option>").prop("disabled",!0),p()},error:function(){var l;o.html('<option value="">'+((l=window.ordertranslations.messages)==null?void 0:l.cycle_load_failed)+"</option>").prop("disabled",!0),p()}})}),$(".cycle-select").on("change",function(){p()}),$(".domain-input").on("input",function(){k($(this).closest(".domain-row"))}),$(".registration-type-select").on("change",function(){k($(this).closest(".domain-row"))}),$(".period-select").on("change",function(){k($(this).closest(".domain-row"))}),$('input[type="checkbox"]').on("change",function(){k($(this).closest(".domain-row"))}),$(".product-row").each(function(){var o;const n=$(this),e=n.find(".cycle-select");e.prop("disabled",!0).html('<option value="">'+((o=window.ordertranslations.placeholders)==null?void 0:o.select_cycle)+"</option>"),n.find(".product-select").on("change",function(){var l,f;const i=$(this).val();if(e.prop("disabled",!0).html('<option value="">'+((l=window.ordertranslations.placeholders)==null?void 0:l.loading)+"</option>"),!i||!m){e.html('<option value="">'+((f=window.ordertranslations.placeholders)==null?void 0:f.select_cycle)+"</option>").prop("disabled",!0),p();return}const c=window.orderData.routes.productCycles.replace(":product",i)+`?currency_id=${m}`;$.ajax({url:c,method:"GET",headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content"),Accept:"application/json"},success:function(s){var a,h;s.cycles&&s.cycles.length?(e.html('<option value="">'+((a=window.ordertranslations.placeholders)==null?void 0:a.select_cycle)+"</option>"+s.cycles.map(v=>`<option value="${v.value}">${v.label}</option>`).join("")),e.prop("disabled",!1)):e.html('<option value="">'+((h=window.ordertranslations.messages)==null?void 0:h.no_suitable_cycle)+"</option>").prop("disabled",!0),p()},error:function(){var s;e.html('<option value="">'+((s=window.ordertranslations.messages)==null?void 0:s.cycle_load_failed)+"</option>").prop("disabled",!0),p()}})}),n.find(".cycle-select").on("change",function(){p()}),n.find(".remove-product").on("click",function(){n.remove(),p()})}),$(".product-row").each(function(){const n=$(this),e=n.find(".product-select"),o=n.find(".domain-input-col"),i=n.find(".domain-for-product");e.on("change",function(){const c=$(this).val(),l=T.find(f=>f.id==c);l&&l.require_domain?(o.removeClass("d-none"),i.prop("required",!0)):(o.addClass("d-none"),i.prop("required",!1).val(""))}),e.trigger("change")}),$(".domain-row").each(function(){const n=$(this),e=n.find(".registration-type-select"),o=n.find(".transfer-code-col"),i=n.find(".transfer-code-input");e.on("change",function(){$(this).val()==="transfer"?(o.removeClass("d-none"),i.prop("required",!0)):(o.addClass("d-none"),i.prop("required",!1).val(""))}),e.trigger("change")});function r(n,e,o){$("<input>",{type:"hidden",name:e,value:o??"",class:"js-order-hidden"}).appendTo(n)}function d(){const n=($('#orderForm select[name="payment_method"]').val()||"").toString().toLowerCase();return n?n.indexOf("bank")!==-1||n.indexOf("transfer")!==-1||n.indexOf("havale")!==-1||n.indexOf("eft")!==-1?"bank_transfer":n.indexOf("paypal")!==-1?"paypal":/(card|kart|stripe|iyzi|payu|sipay|param|craftgate|mollie|braintree|adyen|paratika|garanti|posnet)/.test(n)?"credit_card":"manual":null}function u(n){const e=new FormData(n);$.ajax({url:$(n).attr("action"),method:"POST",data:e,processData:!1,contentType:!1,headers:{},success:function(o){var i,c,l,f,s,a;try{o.success?window.showAlert?showAlert("success",o.message||((i=b.messages)==null?void 0:i.success)||"Operation successful"):window.showSuccess(o.message||((c=b.messages)==null?void 0:c.success)||"Operation successful"):window.showAlert?showAlert("error",o.message||((l=b.messages)==null?void 0:l.error_occurred)||"An error occurred"):window.showError(o.message||((f=b.messages)==null?void 0:f.error_occurred)||"An error occurred")}catch(h){console.error("Error:",h),window.showAlert?showAlert("error",((s=b.messages)==null?void 0:s.error_occurred)+": "+xhr.responseText||"An error occurred"):window.showError(((a=b.messages)==null?void 0:a.error_occurred)+": "+xhr.responseText||"An error occurred")}},error:function(o){var i,c;window.showAlert?showAlert("error",((i=b.messages)==null?void 0:i.error_occurred)+": "+o.responseText||"An error occurred"):window.showError(((c=b.messages)==null?void 0:c.error_occurred)+": "+o.responseText||"An error occurred")}})}$("#orderForm").on("submit",function(n){var i,c,l,f;n.preventDefault();const e=this;if(m||(m=$("#currency_id_hidden").val()||null),!m)return window.showAlert?showAlert("warning",((i=b.messages)==null?void 0:i.select_client_first)||"Please select a client first."):window.showWarning((c=b.messages)==null?void 0:c.select_client_first),!1;const o=z();if(o.length===0)return window.showAlert?showAlert("warning",((l=window.ordertranslations.messages)==null?void 0:l.no_items)||"Please add at least one product or domain."):window.showWarning((f=window.ordertranslations.messages)==null?void 0:f.no_items),!1;$.ajax({url:window.orderData.routes.orderCalculate,method:"POST",headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content"),Accept:"application/json"},data:{items:o,client_id:$("#client_id").val()},success:function(s){var v,_;if(!s||!s.items||s.items.length===0){window.showAlert?showAlert("warning",((v=window.ordertranslations.messages)==null?void 0:v.no_items)||"Please add at least one product or domain."):window.showWarning((_=window.ordertranslations.messages)==null?void 0:_.no_items);return}const a=$(e);a.find(".js-order-hidden").remove(),s.items.forEach(function(w,y){const D=w.type==="product"?w.product_id||0:w.tld_id||0,A=parseInt(w.period,10)||1,g=w.period_type==="month"||w.period_type==="year"?w.period_type:"year",x=parseFloat(w.price)||0;r(a,`items[${y}][type]`,w.type),r(a,`items[${y}][relation_id]`,D),r(a,`items[${y}][description]`,w.label||w.type+" #"+D),r(a,`items[${y}][amount]`,x),r(a,`items[${y}][setup_amount]`,0),r(a,`items[${y}][quantity]`,1),r(a,`items[${y}][period]`,A),r(a,`items[${y}][period_type]`,g),r(a,`items[${y}][total_amount]`,x)}),r(a,"subtotal",parseFloat(s.subtotal)||0),r(a,"tax_amount",parseFloat(s.tax_total)||0),r(a,"discount_amount",0),r(a,"setup_amount",0),r(a,"total_amount",parseFloat(s.grand_total)||0);const h=d();a.find('select[name="payment_method"]').prop("disabled",!0),h&&r(a,"payment_method",h),u(e)},error:function(s){var a,h;window.showAlert?showAlert("error",(((a=b.messages)==null?void 0:a.error_occurred)||"An error occurred")+": "+(s.responseText||"")):window.showError((h=b.messages)==null?void 0:h.error_occurred)}})}),$("#client_id").val()&&$("#client_id").trigger("change"),$("#searchPromoCode").on("click",function(){var e,o;const n=$('input[name="promo_code"]').val();if(!n){window.showAlert?showAlert("warning",((e=window.ordertranslations.messages)==null?void 0:e.enter_promo_code)||"Please enter a promo code."):window.showWarning(((o=window.ordertranslations.messages)==null?void 0:o.enter_promo_code)||"Please enter a promo code.");return}$.ajax({url:"/api/admin/promo-codes/validate",method:"POST",headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content"),Accept:"application/json"},data:{promo_code:n},success:function(i){var c,l,f,s;i.valid?(window.showAlert?showAlert("success",((c=window.ordertranslations.messages)==null?void 0:c.promo_code_applied)||"Promo code applied."):window.showSuccess(((l=window.ordertranslations.messages)==null?void 0:l.promo_code_applied)||"Promo code applied."),p()):window.showAlert?showAlert("error",((f=window.ordertranslations.messages)==null?void 0:f.promo_code_invalid)||"Invalid promo code."):window.showError(((s=window.ordertranslations.messages)==null?void 0:s.promo_code_invalid)||"Invalid promo code.")},error:function(){var i,c;window.showAlert?showAlert("error",((i=window.ordertranslations.messages)==null?void 0:i.promo_code_not_found)||"Promo code not found."):window.showError(((c=window.ordertranslations.messages)==null?void 0:c.promo_code_not_found)||"Promo code not found.")}})}),$("#price_override").on("change",function(){$(this).is(":checked")?($(".product-row").each(function(){const e=$(this);e.find(".price-input").length||e.find(".col-md-2:last").before(`
                        <div class="col-md-2">
                            <label class="form-label">Price</label>
                            <input type="number" step="0.01" class="form-control price-input" placeholder="0.00">
                        </div>
                    `)}),$(".domain-row").each(function(){const e=$(this);e.find(".domain-price-input").length||e.find(".col-md-2:last").before(`
                        <div class="col-md-2">
                            <label class="form-label">Price</label>
                            <input type="number" step="0.01" class="form-control domain-price-input" placeholder="0.00">
                        </div>
                    `)})):$(".price-input, .domain-price-input").closest(".col-md-2").remove()})});$(document).on("input",".domain-for-product",function(){p()});
