index of
/
home
/
thefkyzp
/
hulmvisaadvisor.com
/
wp-content
/
plugins
/
surecart
/
dist
/
File: /home/thefkyzp/hulmvisaadvisor.com/wp-content/plugins/surecart/dist/9892.js
"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[9892],{448:function(n,e,t){t.d(e,{a:function(){return l},b:function(){return s},g:function(){return d}});var r=t(4942),i=t(885);function o(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.push.apply(t,r)}return t}function c(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?o(Object(t),!0).forEach((function(e){(0,r.Z)(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}function a(n,e){var t="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=function(n,e){if(n){if("string"==typeof n)return u(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(n,e):void 0}}(n))||e&&n&&"number"==typeof n.length){t&&(n=t);var r=0,i=function(){};return{s:i,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(n){throw n},f:i}}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,c=!0,a=!1;return{s:function(){t=t.call(n)},n:function(){var n=t.next();return c=n.done,n},e:function(n){a=!0,o=n},f:function(){try{c||null==t.return||t.return()}finally{if(a)throw o}}}}function u(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function s(n){for(var e,t="",r=Object.entries(n);e=r.shift();){var o=e,c=(0,i.Z)(o,2),u=c[0],s=c[1];if(Array.isArray(s)||s&&s.constructor===Object){var d,l=a(Object.entries(s).reverse());try{for(l.s();!(d=l.n()).done;){var p=(0,i.Z)(d.value,2),f=p[0],h=p[1];r.unshift(["".concat(u,"[").concat(f,"]"),h])}}catch(n){l.e(n)}finally{l.f()}}else void 0!==s&&(null===s&&(s=""),t+="&"+[u,s].map(encodeURIComponent).join("="))}return t.substr(1)}function d(n){return(function(n){var e;try{e=new URL(n,"http://example.com").search.substring(1)}catch(n){}if(e)return e}(n)||"").replace(/\+/g,"%20").split("&").reduce((function(n,e){var t=e.split("=").filter(Boolean).map(decodeURIComponent),r=(0,i.Z)(t,2),o=r[0],a=r[1],u=void 0===a?"":a;return o&&function(n,e,t){for(var r=e.length,i=r-1,o=0;o<r;o++){var a=e[o];!a&&Array.isArray(n)&&(a=n.length.toString());var u=!isNaN(Number(e[o+1]));n[a]=o===i?t:n[a]||(u?[]:{}),Array.isArray(n[a])&&!u&&(n[a]=c({},n[a])),n=n[a]}}(n,o.replace(/\]/g,"").split("["),u),n}),{})}function l(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;if(!e||!Object.keys(e).length)return n;var t=n,r=n.indexOf("?");return-1!==r&&(e=Object.assign(d(n),e),t=t.substr(0,r)),t+"?"+s(e)}},2846:function(n,e,t){t.d(e,{i:function(){return o},m:function(){return i},z:function(){return r}});var r=["bif","byr","clp","djf","gnf","isk","jpy","kmf","krw","pyg","rwf","ugx","vnd","vuv","xaf","xag","xau","xba","xbb","xbc","xbd","xdr","xof","xpd","xpf","xpt","xts"],i=function(n,e){return o(e)?n:n/100},o=function(n){var e;return r.includes(null===(e=null==n?void 0:n.toLowerCase)||void 0===e?void 0:e.call(n))}},930:function(n,e,t){t.d(e,{a:function(){return J},h:function(){return G}});var r=t(5861),i=t(5987),o=t(885),c=t(4942),a=t(1284),u=t.n(a),s=t(448),d=["rest_route"],l=["path","url"],p=["url","path","data","parse"];function f(n,e){var t="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=function(n,e){if(n){if("string"==typeof n)return h(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h(n,e):void 0}}(n))||e&&n&&"number"==typeof n.length){t&&(n=t);var r=0,i=function(){};return{s:i,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(n){throw n},f:i}}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,c=!0,a=!1;return{s:function(){t=t.call(n)},n:function(){var n=t.next();return c=n.done,n},e:function(n){a=!0,o=n},f:function(){try{c||null==t.return||t.return()}finally{if(a)throw o}}}}function h(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function v(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.push.apply(t,r)}return t}function w(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?v(Object(t),!0).forEach((function(e){(0,c.Z)(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}var b=function(n,e){var t,r,i=n.path;return"string"==typeof n.namespace&&"string"==typeof n.endpoint&&(t=n.namespace.replace(/^\/|\/$/g,""),i=(r=n.endpoint.replace(/^\//,""))?t+"/"+r:t),delete n.namespace,delete n.endpoint,e(w(w({},n),{},{path:i}))};function y(n){for(var e,t="",r=Object.entries(n);e=r.shift();){var i=e,c=(0,o.Z)(i,2),a=c[0],u=c[1];if(Array.isArray(u)||u&&u.constructor===Object){var s,d=f(Object.entries(u).reverse());try{for(d.s();!(s=d.n()).done;){var l=(0,o.Z)(s.value,2),p=l[0],h=l[1];r.unshift(["".concat(a,"[").concat(p,"]"),h])}}catch(n){d.e(n)}finally{d.f()}}else void 0!==u&&(null===u&&(u=""),t+="&"+[a,u].map(encodeURIComponent).join("="))}return t.substr(1)}function m(n){return(function(n){var e;try{e=new URL(n,"http://example.com").search.substring(1)}catch(n){}if(e)return e}(n)||"").replace(/\+/g,"%20").split("&").reduce((function(n,e){var t=e.split("=").filter(Boolean).map(decodeURIComponent),r=(0,o.Z)(t,2),i=r[0],c=r[1],a=void 0===c?"":c;return i&&function(n,e,t){for(var r=e.length,i=r-1,o=0;o<r;o++){var c=e[o];!c&&Array.isArray(n)&&(c=n.length.toString()),c=["__proto__","constructor","prototype"].includes(c)?c.toUpperCase():c;var a=!isNaN(Number(e[o+1]));n[c]=o===i?t:n[c]||(a?[]:{}),Array.isArray(n[c])&&!a&&(n[c]=w({},n[c])),n=n[c]}}(n,i.replace(/\]/g,"").split("["),a),n}),Object.create(null))}function _(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;if(!e||!Object.keys(e).length)return n;var t=n,r=n.indexOf("?");return-1!==r&&(e=Object.assign(m(n),e),t=t.substr(0,r)),t+"?"+y(e)}function g(n,e){return void 0!==function(n,e){return m(n)[e]}(n,e)}function O(n){var e=n.split("?"),t=e[1],r=e[0];return t?r+"?"+t.split("&").map((function(n){return n.split("=")})).map((function(n){return n.map(decodeURIComponent)})).sort((function(n,e){return n[0].localeCompare(e[0])})).map((function(n){return n.map(encodeURIComponent)})).map((function(n){return n.join("=")})).join("&"):r}function x(n,e){return Promise.resolve(e?n.body:new window.Response(JSON.stringify(n.body),{status:200,statusText:"OK",headers:n.headers}))}var j=function(n){return n.json?n.json():Promise.reject(n)},k=function(n){return function(n){if(!n)return{};var e=n.match(/<([^>]+)>; rel="next"/);return e?{next:e[1]}:{}}(n.headers.get("link")).next},P=function(n){var e=!!n.path&&-1!==n.path.indexOf("per_page=-1"),t=!!n.url&&-1!==n.url.indexOf("per_page=-1");return e||t},S=function(){var n=(0,r.Z)(u().mark((function n(e,t){var r,o,c,a,s,d;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!1!==e.parse){n.next=2;break}return n.abrupt("return",t(e));case 2:if(P(e)){n.next=4;break}return n.abrupt("return",t(e));case 4:return n.next=6,J(w(w({},(p={per_page:100},void 0,void 0,f=(u=e).path,h=u.url,w(w({},(0,i.Z)(u,l)),{},{url:h&&_(h,p),path:f&&_(f,p)}))),{},{parse:!1}));case 6:return r=n.sent,n.next=9,j(r);case 9:if(o=n.sent,Array.isArray(o)){n.next=12;break}return n.abrupt("return",o);case 12:if(c=k(r)){n.next=15;break}return n.abrupt("return",o);case 15:a=[].concat(o);case 16:if(!c){n.next=27;break}return n.next=19,J(w(w({},e),{},{path:void 0,url:c,parse:!1}));case 19:return s=n.sent,n.next=22,j(s);case 22:d=n.sent,a=a.concat(d),c=k(s),n.next=16;break;case 27:return n.abrupt("return",a);case 28:case"end":return n.stop()}var u,p,f,h}),n)})));return function(_x,e){return n.apply(this,arguments)}}(),A=new Set(["PATCH","PUT","DELETE"]),C=function(n){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e?204===n.status?null:n.json?n.json():Promise.reject(n):n},M=function(n){var e={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.")};if(!n||!n.json)throw e;return n.json().catch((function(){throw e}))},E=function(n){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Promise.resolve(C(n,e)).catch((function(n){return U(n,e)}))};function U(n){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)throw n;return M(n).then((function(n){var e={code:"unknown_error",message:wp.i18n.__("An unknown error occurred.")};throw n||e}))}var T,Z,R,D,N,I,L,F={Accept:"application/json, */*;q=0.1"},q={credentials:"include"},H=[function(n,e){return"string"!=typeof n.url||g(n.url,"_locale")||(n.url=_(n.url,{_locale:"user"})),"string"!=typeof n.path||g(n.path,"_locale")||(n.path=_(n.path,{_locale:"user"})),e(n)},b,function(n,e){var t=n.method,r=void 0===t?"GET":t;return A.has(r.toUpperCase())&&(n=w(w({},n),{},{headers:w(w({},n.headers),{},{"X-HTTP-Method-Override":r,"Content-Type":"application/json"}),method:"POST"})),e(n)},S],z=function(n){if(n.status>=200&&n.status<300)return n;throw n},B=function(n){var e=n.url,t=n.path,r=n.data,o=n.parse,c=void 0===o||o,a=(0,i.Z)(n,p),u=n.body,s=n.headers;return s=w(w({},F),s),r&&(u=JSON.stringify(r),s["Content-Type"]="application/json"),window.fetch(e||t||window.location.href,w(w(w({},q),a),{},{body:u,headers:s})).then((function(n){return Promise.resolve(n).then(z).catch((function(n){return U(n,c)})).then((function(n){return E(n,c)}))}),(function(n){if(n&&"AbortError"===n.name)throw n;throw{code:"fetch_error",message:wp.i18n.__("You are probably offline.")}}))};function J(n){return H.reduceRight((function(n,e){return function(t){return e(t,n)}}),B)(n).catch((function(e){return"rest_cookie_invalid_nonce"!==e.code?Promise.reject(e):window.fetch(J.nonceEndpoint).then(z).then((function(n){return n.text()})).then((function(e){return J.nonceMiddleware.nonce=e,J(n)}))}))}J.use=function(n){H.unshift(n)},J.setFetchHandler=function(n){B=n},J.createNonceMiddleware=function(n){var e=function n(e,t){var r=e.headers,i=void 0===r?{}:r;for(var o in i)if("x-wp-nonce"===o.toLowerCase()&&i[o]===n.nonce)return t(e);return t(w(w({},e),{},{headers:w(w({},i),{},{"X-WP-Nonce":n.nonce})}))};return e.nonce=n,e},J.createPreloadingMiddleware=function(n){var e=Object.fromEntries(Object.entries(n).map((function(n){var e=(0,o.Z)(n,2),t=e[0],r=e[1];return[O(t),r]})));return function(n,t){var r=n.parse,o=void 0===r||r,c=n.path;if(!c&&n.url){var a=m(n.url),u=a.rest_route,s=(0,i.Z)(a,d);"string"==typeof u&&(c=_(u,s))}if("string"!=typeof c)return t(n);var l=n.method||"GET",p=O(c);if("GET"===l&&e[p]){var f=e[p];return delete e[p],x(f,!!o)}if("OPTIONS"===l&&e[l]&&e[l][p]){var h=e[l][p];return delete e[l][p],x(h,!!o)}return t(n)}},J.createRootURLMiddleware=function(n){return function(e,t){return b(e,(function(e){var r,i=e.url,o=e.path;return"string"==typeof o&&(r=n,-1!==n.indexOf("?")&&(o=o.replace("?","&")),o=o.replace(/^\//,""),"string"==typeof r&&-1!==r.indexOf("?")&&(o=o.replace("?","&")),i=r+o),t(w(w({},e),{},{url:i}))}))}},J.fetchAllMiddleware=S,J.mediaUploadMiddleware=function(n,e){if(!function(n){var e=!!n.method&&"POST"===n.method;return(!!n.path&&-1!==n.path.indexOf("/wp/v2/media")||!!n.url&&-1!==n.url.indexOf("/wp/v2/media"))&&e}(n))return e(n);var t=0,r=function n(r){return t++,e({path:"/wp/v2/media/".concat(r,"/post-process"),method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((function(){return t<5?n(r):(e({path:"/wp/v2/media/".concat(r,"?force=true"),method:"DELETE"}),Promise.reject())}))};return e(w(w({},n),{},{parse:!1})).catch((function(e){var t=e.headers.get("x-wp-upload-attachment-id");return e.status>=500&&e.status<600&&t?r(t).catch((function(){return!1!==n.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(e)})):U(e,n.parse)})).then((function(e){return E(e,n.parse)}))},J.fetchAllMiddleware=null,J.use(J.createRootURLMiddleware((null===(Z=null===(T=null===window||void 0===window?void 0:window.parent)||void 0===T?void 0:T.scData)||void 0===Z?void 0:Z.root_url)||(null===(R=null===window||void 0===window?void 0:window.scData)||void 0===R?void 0:R.root_url))),(null===(D=null===window||void 0===window?void 0:window.scData)||void 0===D?void 0:D.nonce)&&(J.nonceMiddleware=J.createNonceMiddleware(null===(N=null===window||void 0===window?void 0:window.scData)||void 0===N?void 0:N.nonce),J.use(J.nonceMiddleware)),(null===(I=null===window||void 0===window?void 0:window.scData)||void 0===I?void 0:I.nonce_endpoint)&&(J.nonceEndpoint=null===(L=null===window||void 0===window?void 0:window.scData)||void 0===L?void 0:L.nonce_endpoint),J.use((function(n,e){return n.path=(0,s.a)(n.path,{t:Date.now()}),e(n)}));var Y=function(n){var e={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.","surecart")};if((null==n?void 0:n.code)&&(null==n?void 0:n.message))throw n;if(!n||!n.json)throw e;return n.json().catch((function(){throw e}))},G=function(){var n=(0,r.Z)(u().mark((function n(e){var t;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Y(e);case 2:if("rest_cookie_invalid_nonce"===(t=n.sent).code){n.next=5;break}throw t;case 5:return n.abrupt("return",window.fetch(J.nonceEndpoint).then((function(n){if(n.status>=200&&n.status<300)return n;throw n})).then((function(n){return n.text()})).then((function(n){J.nonceMiddleware.nonce=n})));case 6:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()},6455:function(n,e,t){t.d(e,{o:function(){return r}});var r=function(n,e){new window.IntersectionObserver((function(n,t){n[0].intersectionRatio>0&&(e(),t.unobserve(n[0].target))})).observe(n)}},2400:function(n,e,t){t.d(e,{a:function(){return i},b:function(){return p},c:function(){return h},d:function(){return c},g:function(){return o},i:function(){return s},p:function(){return f},t:function(){return a}});var r=t(2846),i=function(n){return(null==n?void 0:n.amount_off)&&(null==n?void 0:n.currency)?o({amount:n.amount_off,currency:n.currency}):(null==n?void 0:n.percent_off)?wp.i18n.sprintf(wp.i18n.__("%1d%% off","surecart"),0|n.percent_off):""},o=function(n){var e=n.amount,t=n.currency,i=function(n,e){return r.z.includes(e)?n:n/100}(e,t);return"".concat(new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(parseFloat(i.toFixed(2))))},c=function(){var n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"usd",t=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).formatToParts();return null===(n=t.find((function(n){return"currency"===n.type})))||void 0===n?void 0:n.value},a=function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wp.i18n.__("every","surecart"),r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:wp.i18n.__("once","surecart"),i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];switch(e){case"day":return"".concat(t," ").concat(wp.i18n.sprintf(i?wp.i18n._n("%d day","%d days",n,"surecart"):wp.i18n._n("day","%d days",n,"surecart"),n));case"week":return"".concat(t," ").concat(wp.i18n.sprintf(i?wp.i18n._n("%d week","%d weeks",n,"surecart"):wp.i18n._n("week","%d weeks",n,"surecart"),n));case"month":return"".concat(t," ").concat(wp.i18n.sprintf(i?wp.i18n._n("%d month","%d months",n,"surecart"):wp.i18n._n("month","%d months",n,"surecart"),n));case"year":return"".concat(t," ").concat(wp.i18n.sprintf(i?wp.i18n._n("%d year","%d years",n,"surecart"):wp.i18n._n("year","%d years",n,"surecart"),n));default:return r}},u=function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wp.i18n.__("once","surecart"),r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];switch(e){case"day":return" / ".concat(wp.i18n.sprintf(r?wp.i18n._n("%d day","%d days",n,"surecart"):wp.i18n._n("day","%d days",n,"surecart"),n));case"week":return" / ".concat(wp.i18n.sprintf(r?wp.i18n._n("%d wk","%d wks",n,"surecart"):wp.i18n._n("wk","%d wks",n,"surecart"),n));case"month":return" / ".concat(wp.i18n.sprintf(r?wp.i18n._n("%d mo","%d months",n,"surecart"):wp.i18n._n("mo","%d mos",n,"surecart"),n));case"year":return" / ".concat(wp.i18n.sprintf(r?wp.i18n._n("%d yr","%d yrs",n,"surecart"):wp.i18n._n("yr","%d yrs",n,"surecart"),n));default:return t}},s=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!n)return"";var t=e.showOnce,r=e.labels,i=e.abbreviate,o=r||{},c=o.interval,a=void 0===c?wp.i18n.__("every","surecart"):c;return"".concat(d(n,a,t?wp.i18n.__("once","surecart"):"",i)," ").concat(l(n,i))},d=function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wp.i18n.__("once","surecart"),r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return n.recurring_interval_count&&n.recurring_interval&&1!==(null==n?void 0:n.recurring_period_count)?r?u(n.recurring_interval_count,n.recurring_interval,t):a(n.recurring_interval_count,n.recurring_interval," ".concat(e),t):""},l=function(n){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(null==n?void 0:n.recurring_period_count)&&1!==(null==n?void 0:n.recurring_period_count)?e?"x ".concat(n.recurring_period_count):" (".concat(wp.i18n.sprintf(wp.i18n._n("%d payment","%d payments",n.recurring_period_count,"surecart"),n.recurring_period_count),")"):""},p=function(n){return wp.i18n.sprintf(wp.i18n._n("%d payment remaining","%d payments remaining",n,"surecart"),n)},f=function(n){var e;return n?"".concat(null===(e=null==n?void 0:n.product)||void 0===e?void 0:e.name," ").concat((null==n?void 0:n.name)?"— ".concat(n.name):""):""},h=function(n){switch(n){case"invalid":return wp.i18n.__("Not valid","surecart");case"expired":return wp.i18n.__("Expired","surecart");case"gone":return wp.i18n.__("Not available","surecart");case"less_than_min_subtotal_amount":return wp.i18n.__("Minimum not met","surecart");case"greater_than_max_subtotal_amount":return wp.i18n.__("Order too large","surecart");case"not_applicable":return wp.i18n.__("Product(s) not eligible","surecart");case"not_applicable_to_customer":return wp.i18n.__("Not eligible","surecart");case"":return"";default:return wp.i18n.__("Not redeemable","surecart")}}},9892:function(n,e,t){t.r(e),t.d(e,{sc_subscription:function(){return w}});var r=t(4942),i=t(5861),o=t(5671),c=t(3144),a=t(1284),u=t.n(a),s=t(8860),d=t(930),l=t(6455),p=t(2400),f=t(448);function h(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.push.apply(t,r)}return t}function v(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?h(Object(t),!0).forEach((function(e){(0,r.Z)(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):h(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}var w=function(){function n(e){(0,o.Z)(this,n),(0,s.r)(this,e),this.subscriptionId=void 0,this.showCancel=void 0,this.heading=void 0,this.query=void 0,this.protocol=void 0,this.subscription=void 0,this.updatePaymentMethodUrl=void 0,this.loading=void 0,this.cancelModal=void 0,this.resubscribeModal=void 0,this.busy=void 0,this.error=void 0}var e,t,r;return(0,c.Z)(n,[{key:"componentWillLoad",value:function(){var n=this;(0,l.o)(this.el,(function(){n.subscription||n.getSubscription()}))}},{key:"cancelPendingUpdate",value:(r=(0,i.Z)(u().mark((function n(){var e;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(confirm(wp.i18n.__("Are you sure you want to cancel the pending update to your plan?","surecart"))){n.next=3;break}return n.abrupt("return");case 3:return n.prev=3,this.busy=!0,n.next=7,(0,d.a)({path:(0,f.a)("surecart/v1/subscriptions/".concat(null===(e=this.subscription)||void 0===e?void 0:e.id,"/"),{expand:["price","price.product","current_period","period.checkout","purchase","purchase.license","license.activations","discount","discount.coupon"]}),method:"PATCH",data:{purge_pending_update:!0}});case 7:this.subscription=n.sent,n.next=14;break;case 10:n.prev=10,n.t0=n.catch(3),(null===n.t0||void 0===n.t0?void 0:n.t0.message)?this.error=n.t0.message:this.error=wp.i18n.__("Something went wrong","surecart"),console.error(this.error);case 14:return n.prev=14,this.busy=!1,n.finish(14);case 17:case"end":return n.stop()}}),n,this,[[3,10,14,17]])}))),function(){return r.apply(this,arguments)})},{key:"renewSubscription",value:(t=(0,i.Z)(u().mark((function n(){var e;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,this.error="",this.busy=!0,n.next=5,(0,d.a)({path:(0,f.a)("surecart/v1/subscriptions/".concat(null===(e=this.subscription)||void 0===e?void 0:e.id,"/renew"),{expand:["price","price.product","current_period","period.checkout","purchase","purchase.license","license.activations","discount","discount.coupon"]}),method:"PATCH"});case 5:this.subscription=n.sent,n.next=11;break;case 8:n.prev=8,n.t0=n.catch(0),this.error=(null===n.t0||void 0===n.t0?void 0:n.t0.message)||wp.i18n.__("Something went wrong","surecart");case 11:return n.prev=11,this.busy=!1,n.finish(11);case 14:case"end":return n.stop()}}),n,this,[[0,8,11,14]])}))),function(){return t.apply(this,arguments)})},{key:"getSubscription",value:(e=(0,i.Z)(u().mark((function n(){var e;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,this.loading=!0,n.next=4,(0,d.a)({path:(0,f.a)("surecart/v1/subscriptions/".concat(this.subscriptionId||(null===(e=this.subscription)||void 0===e?void 0:e.id)),v({expand:["price","price.product","current_period"]},this.query||{}))});case 4:return n.next=6,n.sent;case 6:this.subscription=n.sent,n.next=13;break;case 9:n.prev=9,n.t0=n.catch(0),(null===n.t0||void 0===n.t0?void 0:n.t0.message)?this.error=n.t0.message:this.error=wp.i18n.__("Something went wrong","surecart"),console.error(this.error);case 13:return n.prev=13,this.loading=!1,n.finish(13);case 16:case"end":return n.stop()}}),n,this,[[0,9,13,16]])}))),function(){return e.apply(this,arguments)})},{key:"renderName",value:function(n){var e;return"string"!=typeof(null===(e=null==n?void 0:n.price)||void 0===e?void 0:e.product)?(0,p.p)(null==n?void 0:n.price):wp.i18n.__("Subscription","surecart")}},{key:"renderRenewalText",value:function(n){var e=(0,s.h)("sc-subscription-status-badge",{subscription:n});return(null==n?void 0:n.cancel_at_period_end)&&n.current_period_end_at?(0,s.h)("span",null,e," ",wp.i18n.sprintf(wp.i18n.__("Your plan will be canceled on","surecart"))," ",(0,s.h)("sc-format-date",{date:1e3*n.current_period_end_at,month:"long",day:"numeric",year:"numeric"})):"trialing"===n.status&&n.trial_end_at?(0,s.h)("span",null,e," ",wp.i18n.sprintf(wp.i18n.__("Your plan begins on","surecart"))," ",(0,s.h)("sc-format-date",{date:1e3*n.trial_end_at,month:"long",day:"numeric",year:"numeric"})):"active"===n.status&&n.current_period_end_at?(0,s.h)("span",null,e," ",wp.i18n.sprintf(wp.i18n.__("Your plan renews on","surecart"))," ",(0,s.h)("sc-format-date",{date:1e3*n.current_period_end_at,month:"long",day:"numeric",year:"numeric"})):e}},{key:"renderEmpty",value:function(){return(0,s.h)("slot",{name:"empty"},wp.i18n.__("This subscription does not exist.","surecart"))}},{key:"renderLoading",value:function(){return(0,s.h)("sc-stacked-list-row",{style:{"--columns":"2"},"mobile-size":0},(0,s.h)("div",{style:{padding:"0.5em"}},(0,s.h)("sc-skeleton",{style:{width:"30%",marginBottom:"0.75em"}}),(0,s.h)("sc-skeleton",{style:{width:"20%",marginBottom:"0.75em"}}),(0,s.h)("sc-skeleton",{style:{width:"40%"}})))}},{key:"renderContent",value:function(){return this.loading?this.renderLoading():this.subscription?(0,s.h)(s.F,null,(0,s.h)("sc-subscription-next-payment",{subscription:this.subscription,updatePaymentMethodUrl:this.updatePaymentMethodUrl},(0,s.h)("sc-subscription-details",{subscription:this.subscription}))):this.renderEmpty()}},{key:"render",value:function(){var n,e,t,r,i,o,c,a=this,u=(null==this?void 0:this.subscription.payment_method)||(null==this?void 0:this.subscription.manual_payment);return(0,s.h)("sc-dashboard-module",{heading:this.heading||wp.i18n.__("Current Plan","surecart"),class:"subscription",error:this.error},!!this.subscription&&(0,s.h)("sc-flex",{slot:"end",class:"subscription__action-buttons"},this.updatePaymentMethodUrl&&u&&(0,s.h)("sc-button",{type:"link",href:this.updatePaymentMethodUrl},(0,s.h)("sc-icon",{name:"credit-card",slot:"prefix"}),wp.i18n.__("Update Payment Method","surecart")),!u&&(0,s.h)("sc-button",{type:"link",href:(0,f.a)(window.location.href,v({action:"create",model:"payment_method",id:null==this?void 0:this.subscription.id},!1===(null===(n=null==this?void 0:this.subscription)||void 0===n?void 0:n.live_mode)?{live_mode:!1}:{}))},(0,s.h)("sc-icon",{name:"credit-card",slot:"prefix"}),wp.i18n.__("Add Payment Method","surecart")),!!Object.keys(null===(e=this.subscription)||void 0===e?void 0:e.pending_update).length&&(0,s.h)("sc-button",{type:"link",onClick:function(){return a.cancelPendingUpdate()}},(0,s.h)("sc-icon",{name:"x-octagon",slot:"prefix"}),wp.i18n.__("Cancel Scheduled Update","surecart")),(null===(t=null==this?void 0:this.subscription)||void 0===t?void 0:t.cancel_at_period_end)?(0,s.h)("sc-button",{type:"link",onClick:function(){return a.renewSubscription()}},(0,s.h)("sc-icon",{name:"repeat",slot:"prefix"}),wp.i18n.__("Restore Plan","surecart")):"canceled"!==(null===(r=this.subscription)||void 0===r?void 0:r.status)&&(null===(i=this.subscription)||void 0===i?void 0:i.current_period_end_at)&&this.showCancel&&(0,s.h)("sc-button",{type:"link",onClick:function(){return a.cancelModal=!0}},(0,s.h)("sc-icon",{name:"x",slot:"prefix"}),wp.i18n.__("Cancel Plan","surecart")),"canceled"===(null===(o=this.subscription)||void 0===o?void 0:o.status)&&(0,s.h)("sc-button",v({type:"link"},(null===(c=this.subscription)||void 0===c?void 0:c.payment_method)?{onClick:function(){return a.resubscribeModal=!0}}:{href:null==this?void 0:this.updatePaymentMethodUrl}),(0,s.h)("sc-icon",{name:"repeat",slot:"prefix"}),wp.i18n.__("Resubscribe","surecart"))),(0,s.h)("sc-card",{style:{"--overflow":"hidden"},noPadding:!0},this.renderContent()),this.busy&&(0,s.h)("sc-block-ui",{spinner:!0}),(0,s.h)("sc-cancel-dialog",{subscription:this.subscription,protocol:this.protocol,open:this.cancelModal,onScRequestClose:function(){return a.cancelModal=!1},onScRefresh:function(){return a.getSubscription()}}),(0,s.h)("sc-subscription-reactivate",{subscription:this.subscription,open:this.resubscribeModal,onScRequestClose:function(){return a.resubscribeModal=!1},onScRefresh:function(){return a.getSubscription()}}))}},{key:"el",get:function(){return(0,s.a)(this)}}]),n}();w.style=":host{display:block}.subscription{display:grid;gap:0.5em}.subscription a{text-decoration:none;font-weight:var(--sc-font-weight-semibold);display:inline-flex;align-items:center;gap:0.25em;color:var(--sc-color-primary-500)}.subscription a.cancel{color:var(--sc-color-danger-500)}@media screen and (max-width: 720px){.subscription__action-buttons{--sc-flex-column-gap:var(--sc-spacing-xxx-small)}.subscription__action-buttons::part(base){flex-direction:column}.subscription__action-buttons sc-button::part(base){width:auto;height:2em}}"},4942:function(n,e,t){function r(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}t.d(e,{Z:function(){return r}})},5987:function(n,e,t){t.d(e,{Z:function(){return i}});var r=t(3366);function i(n,e){if(null==n)return{};var t,i,o=(0,r.Z)(n,e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(n);for(i=0;i<c.length;i++)t=c[i],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(n,t)&&(o[t]=n[t])}return o}},3366:function(n,e,t){function r(n,e){if(null==n)return{};var t,r,i={},o=Object.keys(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)>=0||(i[t]=n[t]);return i}t.d(e,{Z:function(){return r}})}}]);