File: /home/zeusxp5/tour.kamille.us/wp-content/plugins/surecart/dist/6453.js
"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[6453],{4805:function(e,n,t){t.d(n,{a:function(){return p},b:function(){return s},g:function(){return l}});var r=t(4467),o=t(3453);function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){(0,r.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function c(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return u(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(a)throw o}}}}function u(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function s(e){for(var n,t="",r=Object.entries(e);n=r.shift();){var i=n,a=(0,o.A)(i,2),u=a[0],s=a[1];if(Array.isArray(s)||s&&s.constructor===Object){var d,l=c(Object.entries(s).reverse());try{for(l.s();!(d=l.n()).done;){var p=(0,o.A)(d.value,2),f=p[0],h=p[1];r.unshift(["".concat(u,"[").concat(f,"]"),h])}}catch(e){l.e(e)}finally{l.f()}}else void 0!==s&&(null===s&&(s=""),t+="&"+[u,s].map(encodeURIComponent).join("="))}return t.substr(1)}function d(e){try{return decodeURIComponent(e)}catch(n){return e}}function l(e){return(function(e){var n;try{n=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(n)return n}(e)||"").replace(/\+/g,"%20").split("&").reduce((function(e,n){var t=n.split("=").filter(Boolean).map(d),r=(0,o.A)(t,2),i=r[0],c=r[1],u=void 0===c?"":c;return i&&function(e,n,t){for(var r=n.length,o=r-1,i=0;i<r;i++){var c=n[i];!c&&Array.isArray(e)&&(c=e.length.toString()),c=["__proto__","constructor","prototype"].includes(c)?c.toUpperCase():c;var u=!isNaN(Number(n[i+1]));e[c]=i===o?t:e[c]||(u?[]:{}),Array.isArray(e[c])&&!u&&(e[c]=a({},e[c])),e=e[c]}}(e,i.replace(/\]/g,"").split("["),u),e}),Object.create(null))}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;if(!n||!Object.keys(n).length)return e;var t=e,r=e.indexOf("?");return-1!==r&&(n=Object.assign(l(e),n),t=t.substr(0,r)),t+"?"+s(n)}},581:function(e,n,t){t.d(n,{o:function(){return o}});var r=t(1346),o=function(e,n,t){void 0===t&&(t=!0);var o="Function"===e.constructor.name?e.prototype:e,i=o.componentWillLoad;o.componentWillLoad=function(){var e,o=this,a=(0,r.a)(this),c={promise:new Promise((function(n){e=n})),resolve:e},u=new CustomEvent("openWormhole",{bubbles:!0,composed:!0,detail:{consumer:this,fields:n,updater:function(e,n){(e in a?a:o)[e]=n},onOpen:c}});a.dispatchEvent(u);var s=function(){if(i)return i.call(o)};return t?c.promise.then((function(){return s()})):s()}}},8803:function(e,n,t){t.d(n,{a:function(){return J},h:function(){return z}});var r=t(9394),o=t(467),i=t(45),a=t(3453),c=t(4467),u=t(9280),s=t.n(u),d=t(4805),l=t(3506),p=["rest_route"],f=["path","url"],h=["url","path","data","parse"];function v(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function w(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?v(Object(t),!0).forEach((function(n){(0,c.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function m(e,n){return void 0!==(0,l.g)(e,n)}function y(e){var n=e.split("?"),t=n[1],r=n[0];return t?r+"?"+t.split("&").map((function(e){return e.split("=")})).map((function(e){return e.map(decodeURIComponent)})).sort((function(e,n){return e[0].localeCompare(n[0])})).map((function(e){return e.map(encodeURIComponent)})).map((function(e){return e.join("=")})).join("&"):r}var g=function(e,n){var t,r,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(t=e.namespace.replace(/^\/|\/$/g,""),o=(r=e.endpoint.replace(/^\//,""))?t+"/"+r:t),delete e.namespace,delete e.endpoint,n(w(w({},e),{},{path:o}))};function b(e,n){return Promise.resolve(n?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var _=function(e){return e.json?e.json():Promise.reject(e)},O=function(e){return function(e){if(!e)return{};var n=e.match(/<([^>]+)>; rel="next"/);return n?{next:n[1]}:{}}(e.headers.get("link")).next},j=function(e){var n=!!e.path&&-1!==e.path.indexOf("per_page=-1"),t=!!e.url&&-1!==e.url.indexOf("per_page=-1");return n||t},P=function(){var e=(0,o.A)(s().mark((function e(n,t){var r,o,a,c,u,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==n.parse){e.next=2;break}return e.abrupt("return",t(n));case 2:if(j(n)){e.next=4;break}return e.abrupt("return",t(n));case 4:return e.next=6,J(w(w({},(p={per_page:100},void 0,void 0,h=(s=n).path,v=s.url,w(w({},(0,i.A)(s,f)),{},{url:v&&(0,d.a)(v,p),path:h&&(0,d.a)(h,p)}))),{},{parse:!1}));case 6:return r=e.sent,e.next=9,_(r);case 9:if(o=e.sent,Array.isArray(o)){e.next=12;break}return e.abrupt("return",o);case 12:if(a=O(r)){e.next=15;break}return e.abrupt("return",o);case 15:c=[].concat(o);case 16:if(!a){e.next=27;break}return e.next=19,J(w(w({},n),{},{path:void 0,url:a,parse:!1}));case 19:return u=e.sent,e.next=22,_(u);case 22:l=e.sent,c=c.concat(l),a=O(u),e.next=16;break;case 27:return e.abrupt("return",c);case 28:case"end":return e.stop()}var s,p,h,v}),e)})));return function(_x,n){return e.apply(this,arguments)}}(),x=new Set(["PATCH","PUT","DELETE"]),A=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Promise.resolve(function(e){return arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?e:204===e.status?null:e.json?e.json():Promise.reject(e)}(e,n)).catch((function(e){return k(e,n)}))};function k(e){if(arguments.length>1&&void 0!==arguments[1]&&!arguments[1])throw e;return function(e){var n={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.")};if(!e||!e.json)throw n;return e.json().catch((function(){throw n}))}(e).then((function(e){var n={code:"unknown_error",message:wp.i18n.__("An unknown error occurred.")};throw e||n}))}var I,E,S,T,C,D,M,U={Accept:"application/json, */*;q=0.1"},L={credentials:"include"},N=[function(e,n){return"string"!=typeof e.url||m(e.url,"_locale")||(e.url=(0,d.a)(e.url,{_locale:"user"})),"string"!=typeof e.path||m(e.path,"_locale")||(e.path=(0,d.a)(e.path,{_locale:"user"})),n(e)},g,function(e,n){var t=e.method,r=void 0===t?"GET":t;return x.has(r.toUpperCase())&&(e=w(w({},e),{},{headers:w(w({},e.headers),{},{"X-HTTP-Method-Override":r,"Content-Type":"application/json"}),method:"POST"})),n(e)},P],R=function(e){if(e.status>=200&&e.status<300)return e;throw e},q=function(e){var n=e.url,t=e.path,r=e.data,o=e.parse,a=void 0===o||o,c=(0,i.A)(e,h),u=e.body,s=e.headers;return s=w(w({},U),s),r&&(u=JSON.stringify(r),s["Content-Type"]="application/json"),window.fetch(n||t||window.location.href,w(w(w({},L),c),{},{body:u,headers:s})).then((function(e){return Promise.resolve(e).then(R).catch((function(e){return k(e,a)})).then((function(e){return A(e,a)}))}),(function(e){if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:wp.i18n.__("You are probably offline.")}}))};function J(e){return N.reduceRight((function(e,n){return function(t){return n(t,e)}}),q)(e).catch((function(n){return"rest_cookie_invalid_nonce"!==n.code?Promise.reject(n):window.fetch(J.nonceEndpoint).then(R).then((function(e){return e.text()})).then((function(n){return J.nonceMiddleware.nonce=n,J(e)}))}))}J.use=function(e){N.unshift(e)},J.setFetchHandler=function(e){q=e},J.createNonceMiddleware=function(e){var n=function e(n,t){var r=n.headers,o=void 0===r?{}:r;for(var i in o)if("x-wp-nonce"===i.toLowerCase()&&o[i]===e.nonce)return t(n);return t(w(w({},n),{},{headers:w(w({},o),{},{"X-WP-Nonce":e.nonce})}))};return n.nonce=e,n},J.createPreloadingMiddleware=function(e){var n=Object.fromEntries(Object.entries(e).map((function(e){var n=(0,a.A)(e,2),t=n[0],r=n[1];return[y(t),r]})));return function(e,t){var r=e.parse,o=void 0===r||r,a=e.path;if(!a&&e.url){var c=(0,d.g)(e.url),u=c.rest_route,s=(0,i.A)(c,p);"string"==typeof u&&(a=(0,d.a)(u,s))}if("string"!=typeof a)return t(e);var l=e.method||"GET",f=y(a);if("GET"===l&&n[f]){var h=n[f];return delete n[f],b(h,!!o)}if("OPTIONS"===l&&n[l]&&n[l][f]){var v=n[l][f];return delete n[l][f],b(v,!!o)}return t(e)}},J.createRootURLMiddleware=function(e){return function(n,t){return g(n,(function(n){var r,o=n.url,i=n.path;return"string"==typeof i&&(r=e,-1!==e.indexOf("?")&&(i=i.replace("?","&")),i=i.replace(/^\//,""),"string"==typeof r&&-1!==r.indexOf("?")&&(i=i.replace("?","&")),o=r+i),t(w(w({},n),{},{url:o}))}))}},J.fetchAllMiddleware=P,J.mediaUploadMiddleware=function(e,n){if(!function(e){var n=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&n}(e))return n(e);var t=0,r=function e(r){return t++,n({path:"/wp/v2/media/".concat(r,"/post-process"),method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((function(){return t<5?e(r):(n({path:"/wp/v2/media/".concat(r,"?force=true"),method:"DELETE"}),Promise.reject())}))};return n(w(w({},e),{},{parse:!1})).catch((function(n){var t=n.headers.get("x-wp-upload-attachment-id");return n.status>=500&&n.status<600&&t?r(t).catch((function(){return!1!==e.parse?Promise.reject({code:"post_process",message:wp.i18n.__("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(n)})):k(n,e.parse)})).then((function(n){return A(n,e.parse)}))},J.createThemePreviewMiddleware=function(e){return function(n,t){if("string"==typeof n.url){var r=(0,l.g)(n.url,"wp_theme_preview");void 0===r?n.url=(0,d.a)(n.url,{wp_theme_preview:e}):""===r&&(n.url=(0,l.r)(n.url,"wp_theme_preview"))}if("string"==typeof n.path){var o=(0,l.g)(n.path,"wp_theme_preview");void 0===o?n.path=(0,d.a)(n.path,{wp_theme_preview:e}):""===o&&(n.path=(0,l.r)(n.path,"wp_theme_preview"))}return t(n)}},J.fetchAllMiddleware=null,J.use(J.createRootURLMiddleware((null===(E=null===(I=null===window||void 0===window?void 0:window.parent)||void 0===I?void 0:I.scData)||void 0===E?void 0:E.root_url)||(null===(S=null===window||void 0===window?void 0:window.scData)||void 0===S?void 0:S.root_url))),(null===(T=null===window||void 0===window?void 0:window.scData)||void 0===T?void 0:T.nonce)&&(J.nonceMiddleware=J.createNonceMiddleware(null===(C=null===window||void 0===window?void 0:window.scData)||void 0===C?void 0:C.nonce),J.use(J.nonceMiddleware)),(null===(D=null===window||void 0===window?void 0:window.scData)||void 0===D?void 0:D.nonce_endpoint)&&(J.nonceEndpoint=null===(M=null===window||void 0===window?void 0:window.scData)||void 0===M?void 0:M.nonce_endpoint),J.use((function(e,n){return e.path=(0,d.a)(e.path,{t:Date.now()}),n(e)})),J.use((function(e,n){return e.path=(0,d.a)(e.path,w({},!!(0,l.g)(window.location.href,"currency")&&{currency:(0,l.g)(window.location.href,"currency")})),n(e)})),J.use((function(e,n){var t=n(e);return t.catch((function(e){var n;return"invalid_json"===e.code&&(e.message=wp.i18n.__("The response is not a valid JSON response.","surecart"),e.additional_errors=[{code:"invalid_json",message:wp.i18n.sprintf(/* translators: %s: URL to debug settings page */
wp.i18n.__("Please ensure that your site is not in debug mode as this may interfere with API responses. %s","surecart"),'<a href="'.concat("https://surecart.com/docs/is-not-a-valid-json-response/",'" target="_blank" rel="noopener noreferrer">').concat(wp.i18n.__("More Information","surecart"),"</a>"))}]),"checkout.finalize_error"===e.code&&(e.additional_errors=[].concat((0,r.A)((null===(n=null==e?void 0:e.additional_errors)||void 0===n?void 0:n.length)?[]:[{code:"checkout.finalize_error",message:e.message}]),(0,r.A)(e.additional_errors||[])),e.message=wp.i18n.__("We were not able to process this order","surecart")),Promise.reject(e)})),t}));var W=function(e){var n={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.","surecart")};if((null==e?void 0:e.code)&&(null==e?void 0:e.message))throw e;if(!e||!e.json)throw n;return e.json().catch((function(){throw n}))},z=function(){var e=(0,o.A)(s().mark((function e(n){var t;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,W(n);case 2:if("rest_cookie_invalid_nonce"===(t=e.sent).code){e.next=5;break}throw t;case 5:return e.abrupt("return",window.fetch(J.nonceEndpoint).then((function(e){if(e.status>=200&&e.status<300)return e;throw e})).then((function(e){return e.text()})).then((function(e){J.nonceMiddleware.nonce=e})));case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}()},3506:function(e,n,t){t.d(n,{g:function(){return o},r:function(){return i}});var r=t(4805);function o(e,n){return(0,r.g)(e)[n]}function i(e){var n=e.indexOf("?");if(-1===n)return e;for(var t=(0,r.g)(e),o=e.substr(0,n),i=arguments.length,a=new Array(i>1?i-1:0),c=1;c<i;c++)a[c-1]=arguments[c];a.forEach((function(e){return delete t[e]}));var u=(0,r.b)(t);return u?o+"?"+u:o}},6453:function(e,n,t){t.r(n),t.d(n,{sc_custom_order_price_input:function(){return l}});var r=t(467),o=t(3029),i=t(2901),a=t(9280),c=t.n(a),u=t(1346),s=t(8803),d=t(581),l=function(){return(0,i.A)((function e(n){(0,o.A)(this,e),(0,u.r)(this,n),this.scUpdateLineItem=(0,u.c)(this,"scUpdateLineItem",7),this.priceId=void 0,this.price=void 0,this.loading=!1,this.busy=!1,this.label=void 0,this.placeholder=void 0,this.required=void 0,this.help=void 0,this.showCode=void 0,this.lineItems=[],this.fetching=!1,this.lineItem=void 0}),[{key:"handleBlur",value:function(e){var n,t=parseInt(e.target.value);isNaN(t)||(null===(n=this.lineItem)||void 0===n?void 0:n.ad_hoc_amount)!==t&&this.scUpdateLineItem.emit({price_id:this.priceId,quantity:1,ad_hoc_amount:t})}},{key:"handleLineItemsChange",value:function(){var e,n=this;(null===(e=this.lineItems)||void 0===e?void 0:e.length)&&(this.lineItem=(this.lineItems||[]).find((function(e){return e.price.id===n.priceId})))}},{key:"componentDidLoad",value:function(){this.price||this.fetchPrice()}},{key:"fetchPrice",value:(e=(0,r.A)(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.priceId){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,this.fetching=!0,e.next=6,(0,s.a)({path:"surecart/v1/prices/".concat(this.priceId)});case 6:this.price=e.sent,e.next=11;break;case 9:e.prev=9,e.t0=e.catch(2);case 11:return e.prev=11,this.fetching=!1,e.finish(11);case 14:case"end":return e.stop()}}),e,this,[[2,9,11,14]])}))),function(){return e.apply(this,arguments)})},{key:"renderEmpty",value:function(){var e;return(null===(e=null===window||void 0===window?void 0:window.wp)||void 0===e?void 0:e.blocks)?(0,u.h)("sc-alert",{type:"danger",open:!0,style:{margin:"0px"}},wp.i18n.__("This price has been archived.","surecart")):(0,u.h)(u.H,{style:{display:"none"}})}},{key:"render",value:function(){var e,n,t,r,o,i;return this.loading||this.fetching?(0,u.h)("div",null,(0,u.h)("sc-skeleton",{style:{width:"20%",marginBottom:"0.75em"}}),(0,u.h)("sc-skeleton",{style:{width:"100%"}})):!(null===(e=null==this?void 0:this.price)||void 0===e?void 0:e.id)||(null===(n=this.price)||void 0===n?void 0:n.archived)?this.renderEmpty():(0,u.h)("div",{class:"sc-custom-order-price-input"},(0,u.h)("sc-price-input",{"currency-code":(null===(t=this.price)||void 0===t?void 0:t.currency)||"usd",label:this.label,min:null===(r=null==this?void 0:this.price)||void 0===r?void 0:r.ad_hoc_min_amount,max:null===(o=null==this?void 0:this.price)||void 0===o?void 0:o.ad_hoc_max_amount,placeholder:this.placeholder,required:this.required,value:null===(i=this.lineItem)||void 0===i?void 0:i.ad_hoc_amount.toString(),"show-code":this.showCode,help:this.help}),this.busy&&(0,u.h)("sc-block-ui",{style:{zIndex:"9"}}))}}],[{key:"watchers",get:function(){return{lineItems:["handleLineItemsChange"]}}}]);var e}();(0,d.o)(l,["busy","lineItems"],!1),l.style="sc-custom-order-price-input{display:block}"},45:function(e,n,t){t.d(n,{A:function(){return o}});var r=t(8587);function o(e,n){if(null==e)return{};var t,o,i=(0,r.A)(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)t=a[o],n.indexOf(t)>=0||{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}},8587:function(e,n,t){function r(e,n){if(null==e)return{};var t={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)>=0)continue;t[r]=e[r]}return t}t.d(n,{A:function(){return r}})}}]);