UNPKG

@heymantle/polaris

Version:

Mantle's frontend component library

27 lines (24 loc) 55.9 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("@shopify/polaris");var Xe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qe(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var et={exports:{}};(function(r,a){(function(g,f){r.exports=f()})(Xe,function(){var g=1e3,f=6e4,p=36e5,b="millisecond",o="second",M="minute",v="hour",k="day",C="week",$="month",Y="quarter",R="year",L="date",h="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(i){var u=["th","st","nd","rd"],c=i%100;return"["+i+(u[(c-20)%10]||u[c]||u[0])+"]"}},j=function(i,u,c){var E=String(i);return!E||E.length>=u?i:""+Array(u+1-E.length).join(c)+i},W={s:j,z:function(i){var u=-i.utcOffset(),c=Math.abs(u),E=Math.floor(c/60),m=c%60;return(u<=0?"+":"-")+j(E,2,"0")+":"+j(m,2,"0")},m:function i(u,c){if(u.date()<c.date())return-i(c,u);var E=12*(c.year()-u.year())+(c.month()-u.month()),m=u.clone().add(E,$),x=c-m<0,B=u.clone().add(E+(x?-1:1),$);return+(-(E+(c-m)/(x?m-B:B-m))||0)},a:function(i){return i<0?Math.ceil(i)||0:Math.floor(i)},p:function(i){return{M:$,y:R,w:C,d:k,D:L,h:v,m:M,s:o,ms:b,Q:Y}[i]||String(i||"").toLowerCase().replace(/s$/,"")},u:function(i){return i===void 0}},w="en",_={};_[w]=y;var T="$isDayjsObject",P=function(i){return i instanceof ee||!(!i||!i[T])},V=function i(u,c,E){var m;if(!u)return w;if(typeof u=="string"){var x=u.toLowerCase();_[x]&&(m=x),c&&(_[x]=c,m=x);var B=u.split("-");if(!m&&B.length>1)return i(B[0])}else{var U=u.name;_[U]=u,m=U}return!E&&m&&(w=m),m||!E&&w},s=function(i,u){if(P(i))return i.clone();var c=typeof u=="object"?u:{};return c.date=i,c.args=arguments,new ee(c)},A=W;A.l=V,A.i=P,A.w=function(i,u){return s(i,{locale:u.$L,utc:u.$u,x:u.$x,$offset:u.$offset})};var ee=function(){function i(c){this.$L=V(c.locale,null,!0),this.parse(c),this.$x=this.$x||c.x||{},this[T]=!0}var u=i.prototype;return u.parse=function(c){this.$d=function(E){var m=E.date,x=E.utc;if(m===null)return new Date(NaN);if(A.u(m))return new Date;if(m instanceof Date)return new Date(m);if(typeof m=="string"&&!/Z$/i.test(m)){var B=m.match(S);if(B){var U=B[2]-1||0,Z=(B[7]||"0").substring(0,3);return x?new Date(Date.UTC(B[1],U,B[3]||1,B[4]||0,B[5]||0,B[6]||0,Z)):new Date(B[1],U,B[3]||1,B[4]||0,B[5]||0,B[6]||0,Z)}}return new Date(m)}(c),this.init()},u.init=function(){var c=this.$d;this.$y=c.getFullYear(),this.$M=c.getMonth(),this.$D=c.getDate(),this.$W=c.getDay(),this.$H=c.getHours(),this.$m=c.getMinutes(),this.$s=c.getSeconds(),this.$ms=c.getMilliseconds()},u.$utils=function(){return A},u.isValid=function(){return this.$d.toString()!==h},u.isSame=function(c,E){var m=s(c);return this.startOf(E)<=m&&m<=this.endOf(E)},u.isAfter=function(c,E){return s(c)<this.startOf(E)},u.isBefore=function(c,E){return this.endOf(E)<s(c)},u.$g=function(c,E,m){return A.u(c)?this[E]:this.set(m,c)},u.unix=function(){return Math.floor(this.valueOf()/1e3)},u.valueOf=function(){return this.$d.getTime()},u.startOf=function(c,E){var m=this,x=!!A.u(E)||E,B=A.p(c),U=function(oe,X){var se=A.w(m.$u?Date.UTC(m.$y,X,oe):new Date(m.$y,X,oe),m);return x?se:se.endOf(k)},Z=function(oe,X){return A.w(m.toDate()[oe].apply(m.toDate("s"),(x?[0,0,0,0]:[23,59,59,999]).slice(X)),m)},q=this.$W,Q=this.$M,re=this.$D,ce="set"+(this.$u?"UTC":"");switch(B){case R:return x?U(1,0):U(31,11);case $:return x?U(1,Q):U(0,Q+1);case C:var le=this.$locale().weekStart||0,ie=(q<le?q+7:q)-le;return U(x?re-ie:re+(6-ie),Q);case k:case L:return Z(ce+"Hours",0);case v:return Z(ce+"Minutes",1);case M:return Z(ce+"Seconds",2);case o:return Z(ce+"Milliseconds",3);default:return this.clone()}},u.endOf=function(c){return this.startOf(c,!1)},u.$set=function(c,E){var m,x=A.p(c),B="set"+(this.$u?"UTC":""),U=(m={},m[k]=B+"Date",m[L]=B+"Date",m[$]=B+"Month",m[R]=B+"FullYear",m[v]=B+"Hours",m[M]=B+"Minutes",m[o]=B+"Seconds",m[b]=B+"Milliseconds",m)[x],Z=x===k?this.$D+(E-this.$W):E;if(x===$||x===R){var q=this.clone().set(L,1);q.$d[U](Z),q.init(),this.$d=q.set(L,Math.min(this.$D,q.daysInMonth())).$d}else U&&this.$d[U](Z);return this.init(),this},u.set=function(c,E){return this.clone().$set(c,E)},u.get=function(c){return this[A.p(c)]()},u.add=function(c,E){var m,x=this;c=Number(c);var B=A.p(E),U=function(Q){var re=s(x);return A.w(re.date(re.date()+Math.round(Q*c)),x)};if(B===$)return this.set($,this.$M+c);if(B===R)return this.set(R,this.$y+c);if(B===k)return U(1);if(B===C)return U(7);var Z=(m={},m[M]=f,m[v]=p,m[o]=g,m)[B]||1,q=this.$d.getTime()+c*Z;return A.w(q,this)},u.subtract=function(c,E){return this.add(-1*c,E)},u.format=function(c){var E=this,m=this.$locale();if(!this.isValid())return m.invalidDate||h;var x=c||"YYYY-MM-DDTHH:mm:ssZ",B=A.z(this),U=this.$H,Z=this.$m,q=this.$M,Q=m.weekdays,re=m.months,ce=m.meridiem,le=function(X,se,fe,ve){return X&&(X[se]||X(E,x))||fe[se].slice(0,ve)},ie=function(X){return A.s(U%12||12,X,"0")},oe=ce||function(X,se,fe){var ve=X<12?"AM":"PM";return fe?ve.toLowerCase():ve};return x.replace(O,function(X,se){return se||function(fe){switch(fe){case"YY":return String(E.$y).slice(-2);case"YYYY":return A.s(E.$y,4,"0");case"M":return q+1;case"MM":return A.s(q+1,2,"0");case"MMM":return le(m.monthsShort,q,re,3);case"MMMM":return le(re,q);case"D":return E.$D;case"DD":return A.s(E.$D,2,"0");case"d":return String(E.$W);case"dd":return le(m.weekdaysMin,E.$W,Q,2);case"ddd":return le(m.weekdaysShort,E.$W,Q,3);case"dddd":return Q[E.$W];case"H":return String(U);case"HH":return A.s(U,2,"0");case"h":return ie(1);case"hh":return ie(2);case"a":return oe(U,Z,!0);case"A":return oe(U,Z,!1);case"m":return String(Z);case"mm":return A.s(Z,2,"0");case"s":return String(E.$s);case"ss":return A.s(E.$s,2,"0");case"SSS":return A.s(E.$ms,3,"0");case"Z":return B}return null}(X)||B.replace(":","")})},u.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},u.diff=function(c,E,m){var x,B=this,U=A.p(E),Z=s(c),q=(Z.utcOffset()-this.utcOffset())*f,Q=this-Z,re=function(){return A.m(B,Z)};switch(U){case R:x=re()/12;break;case $:x=re();break;case Y:x=re()/3;break;case C:x=(Q-q)/6048e5;break;case k:x=(Q-q)/864e5;break;case v:x=Q/p;break;case M:x=Q/f;break;case o:x=Q/g;break;default:x=Q}return m?x:A.a(x)},u.daysInMonth=function(){return this.endOf($).$D},u.$locale=function(){return _[this.$L]},u.locale=function(c,E){if(!c)return this.$L;var m=this.clone(),x=V(c,E,!0);return x&&(m.$L=x),m},u.clone=function(){return A.w(this.$d,this)},u.toDate=function(){return new Date(this.valueOf())},u.toJSON=function(){return this.isValid()?this.toISOString():null},u.toISOString=function(){return this.$d.toISOString()},u.toString=function(){return this.$d.toUTCString()},i}(),te=ee.prototype;return s.prototype=te,[["$ms",b],["$s",o],["$m",M],["$H",v],["$W",k],["$M",$],["$y",R],["$D",L]].forEach(function(i){te[i[1]]=function(u){return this.$g(u,i[0],i[1])}}),s.extend=function(i,u){return i.$i||(i(u,ee,s),i.$i=!0),s},s.locale=V,s.isDayjs=P,s.unix=function(i){return s(1e3*i)},s.en=_[w],s.Ls=_,s.p={},s})})(et);var Bt=et.exports;const Te=Qe(Bt);var be={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ke;function $t(){if(Ke)return be;Ke=1;var r=e,a=Symbol.for("react.element"),g=Symbol.for("react.fragment"),f=Object.prototype.hasOwnProperty,p=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,b={key:!0,ref:!0,__self:!0,__source:!0};function o(M,v,k){var C,$={},Y=null,R=null;k!==void 0&&(Y=""+k),v.key!==void 0&&(Y=""+v.key),v.ref!==void 0&&(R=v.ref);for(C in v)f.call(v,C)&&!b.hasOwnProperty(C)&&($[C]=v[C]);if(M&&M.defaultProps)for(C in v=M.defaultProps,v)$[C]===void 0&&($[C]=v[C]);return{$$typeof:a,type:M,key:Y,ref:R,props:$,_owner:p.current}}return be.Fragment=g,be.jsx=o,be.jsxs=o,be}var Se={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Je;function At(){return Je||(Je=1,process.env.NODE_ENV!=="production"&&function(){var r=e,a=Symbol.for("react.element"),g=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),M=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),L=Symbol.iterator,h="@@iterator";function S(n){if(n===null||typeof n!="object")return null;var l=L&&n[L]||n[h];return typeof l=="function"?l:null}var O=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(n){{for(var l=arguments.length,d=new Array(l>1?l-1:0),D=1;D<l;D++)d[D-1]=arguments[D];j("error",n,d)}}function j(n,l,d){{var D=O.ReactDebugCurrentFrame,H=D.getStackAddendum();H!==""&&(l+="%s",d=d.concat([H]));var z=d.map(function(N){return String(N)});z.unshift("Warning: "+l),Function.prototype.apply.call(console[n],console,z)}}var W=!1,w=!1,_=!1,T=!1,P=!1,V;V=Symbol.for("react.module.reference");function s(n){return!!(typeof n=="string"||typeof n=="function"||n===f||n===b||P||n===p||n===k||n===C||T||n===R||W||w||_||typeof n=="object"&&n!==null&&(n.$$typeof===Y||n.$$typeof===$||n.$$typeof===o||n.$$typeof===M||n.$$typeof===v||n.$$typeof===V||n.getModuleId!==void 0))}function A(n,l,d){var D=n.displayName;if(D)return D;var H=l.displayName||l.name||"";return H!==""?d+"("+H+")":d}function ee(n){return n.displayName||"Context"}function te(n){if(n==null)return null;if(typeof n.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case f:return"Fragment";case g:return"Portal";case b:return"Profiler";case p:return"StrictMode";case k:return"Suspense";case C:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case M:var l=n;return ee(l)+".Consumer";case o:var d=n;return ee(d._context)+".Provider";case v:return A(n,n.render,"ForwardRef");case $:var D=n.displayName||null;return D!==null?D:te(n.type)||"Memo";case Y:{var H=n,z=H._payload,N=H._init;try{return te(N(z))}catch{return null}}}return null}var i=Object.assign,u=0,c,E,m,x,B,U,Z;function q(){}q.__reactDisabledLog=!0;function Q(){{if(u===0){c=console.log,E=console.info,m=console.warn,x=console.error,B=console.group,U=console.groupCollapsed,Z=console.groupEnd;var n={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:n,log:n,warn:n,error:n,group:n,groupCollapsed:n,groupEnd:n})}u++}}function re(){{if(u--,u===0){var n={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:i({},n,{value:c}),info:i({},n,{value:E}),warn:i({},n,{value:m}),error:i({},n,{value:x}),group:i({},n,{value:B}),groupCollapsed:i({},n,{value:U}),groupEnd:i({},n,{value:Z})})}u<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ce=O.ReactCurrentDispatcher,le;function ie(n,l,d){{if(le===void 0)try{throw Error()}catch(H){var D=H.stack.trim().match(/\n( *(at )?)/);le=D&&D[1]||""}return` `+le+n}}var oe=!1,X;{var se=typeof WeakMap=="function"?WeakMap:Map;X=new se}function fe(n,l){if(!n||oe)return"";{var d=X.get(n);if(d!==void 0)return d}var D;oe=!0;var H=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var z;z=ce.current,ce.current=null,Q();try{if(l){var N=function(){throw Error()};if(Object.defineProperty(N.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(N,[])}catch(ue){D=ue}Reflect.construct(n,[],N)}else{try{N.call()}catch(ue){D=ue}n.call(N.prototype)}}else{try{throw Error()}catch(ue){D=ue}n()}}catch(ue){if(ue&&D&&typeof ue.stack=="string"){for(var F=ue.stack.split(` `),ne=D.stack.split(` `),K=F.length-1,J=ne.length-1;K>=1&&J>=0&&F[K]!==ne[J];)J--;for(;K>=1&&J>=0;K--,J--)if(F[K]!==ne[J]){if(K!==1||J!==1)do if(K--,J--,J<0||F[K]!==ne[J]){var ae=` `+F[K].replace(" at new "," at ");return n.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",n.displayName)),typeof n=="function"&&X.set(n,ae),ae}while(K>=1&&J>=0);break}}}finally{oe=!1,ce.current=z,re(),Error.prepareStackTrace=H}var Ee=n?n.displayName||n.name:"",qe=Ee?ie(Ee):"";return typeof n=="function"&&X.set(n,qe),qe}function ve(n,l,d){return fe(n,!1)}function st(n){var l=n.prototype;return!!(l&&l.isReactComponent)}function Ce(n,l,d){if(n==null)return"";if(typeof n=="function")return fe(n,st(n));if(typeof n=="string")return ie(n);switch(n){case k:return ie("Suspense");case C:return ie("SuspenseList")}if(typeof n=="object")switch(n.$$typeof){case v:return ve(n.render);case $:return Ce(n.type,l,d);case Y:{var D=n,H=D._payload,z=D._init;try{return Ce(z(H),l,d)}catch{}}}return""}var xe=Object.prototype.hasOwnProperty,Le={},Ye=O.ReactDebugCurrentFrame;function we(n){if(n){var l=n._owner,d=Ce(n.type,n._source,l?l.type:null);Ye.setExtraStackFrame(d)}else Ye.setExtraStackFrame(null)}function ut(n,l,d,D,H){{var z=Function.call.bind(xe);for(var N in n)if(z(n,N)){var F=void 0;try{if(typeof n[N]!="function"){var ne=Error((D||"React class")+": "+d+" type `"+N+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof n[N]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ne.name="Invariant Violation",ne}F=n[N](l,N,D,d,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(K){F=K}F&&!(F instanceof Error)&&(we(H),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",D||"React class",d,N,typeof F),we(null)),F instanceof Error&&!(F.message in Le)&&(Le[F.message]=!0,we(H),y("Failed %s type: %s",d,F.message),we(null))}}}var dt=Array.isArray;function _e(n){return dt(n)}function mt(n){{var l=typeof Symbol=="function"&&Symbol.toStringTag,d=l&&n[Symbol.toStringTag]||n.constructor.name||"Object";return d}}function ft(n){try{return Fe(n),!1}catch{return!0}}function Fe(n){return""+n}function je(n){if(ft(n))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",mt(n)),Fe(n)}var ye=O.ReactCurrentOwner,gt={key:!0,ref:!0,__self:!0,__source:!0},Ne,We,Be;Be={};function vt(n){if(xe.call(n,"ref")){var l=Object.getOwnPropertyDescriptor(n,"ref").get;if(l&&l.isReactWarning)return!1}return n.ref!==void 0}function ht(n){if(xe.call(n,"key")){var l=Object.getOwnPropertyDescriptor(n,"key").get;if(l&&l.isReactWarning)return!1}return n.key!==void 0}function Et(n,l){if(typeof n.ref=="string"&&ye.current&&l&&ye.current.stateNode!==l){var d=te(ye.current.type);Be[d]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',te(ye.current.type),n.ref),Be[d]=!0)}}function pt(n,l){{var d=function(){Ne||(Ne=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};d.isReactWarning=!0,Object.defineProperty(n,"key",{get:d,configurable:!0})}}function yt(n,l){{var d=function(){We||(We=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};d.isReactWarning=!0,Object.defineProperty(n,"ref",{get:d,configurable:!0})}}var bt=function(n,l,d,D,H,z,N){var F={$$typeof:a,type:n,key:l,ref:d,props:N,_owner:z};return F._store={},Object.defineProperty(F._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(F,"_self",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.defineProperty(F,"_source",{configurable:!1,enumerable:!1,writable:!1,value:H}),Object.freeze&&(Object.freeze(F.props),Object.freeze(F)),F};function St(n,l,d,D,H){{var z,N={},F=null,ne=null;d!==void 0&&(je(d),F=""+d),ht(l)&&(je(l.key),F=""+l.key),vt(l)&&(ne=l.ref,Et(l,H));for(z in l)xe.call(l,z)&&!gt.hasOwnProperty(z)&&(N[z]=l[z]);if(n&&n.defaultProps){var K=n.defaultProps;for(z in K)N[z]===void 0&&(N[z]=K[z])}if(F||ne){var J=typeof n=="function"?n.displayName||n.name||"Unknown":n;F&&pt(N,J),ne&&yt(N,J)}return bt(n,F,ne,H,D,ye.current,N)}}var $e=O.ReactCurrentOwner,He=O.ReactDebugCurrentFrame;function he(n){if(n){var l=n._owner,d=Ce(n.type,n._source,l?l.type:null);He.setExtraStackFrame(d)}else He.setExtraStackFrame(null)}var Ae;Ae=!1;function Re(n){return typeof n=="object"&&n!==null&&n.$$typeof===a}function Ue(){{if($e.current){var n=te($e.current.type);if(n)return` Check the render method of \``+n+"`."}return""}}function kt(n){{if(n!==void 0){var l=n.fileName.replace(/^.*[\\\/]/,""),d=n.lineNumber;return` Check your code at `+l+":"+d+"."}return""}}var ze={};function Ct(n){{var l=Ue();if(!l){var d=typeof n=="string"?n:n.displayName||n.name;d&&(l=` Check the top-level render call using <`+d+">.")}return l}}function Ve(n,l){{if(!n._store||n._store.validated||n.key!=null)return;n._store.validated=!0;var d=Ct(l);if(ze[d])return;ze[d]=!0;var D="";n&&n._owner&&n._owner!==$e.current&&(D=" It was passed a child from "+te(n._owner.type)+"."),he(n),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',d,D),he(null)}}function Ge(n,l){{if(typeof n!="object")return;if(_e(n))for(var d=0;d<n.length;d++){var D=n[d];Re(D)&&Ve(D,l)}else if(Re(n))n._store&&(n._store.validated=!0);else if(n){var H=S(n);if(typeof H=="function"&&H!==n.entries)for(var z=H.call(n),N;!(N=z.next()).done;)Re(N.value)&&Ve(N.value,l)}}}function xt(n){{var l=n.type;if(l==null||typeof l=="string")return;var d;if(typeof l=="function")d=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===v||l.$$typeof===$))d=l.propTypes;else return;if(d){var D=te(l);ut(d,n.props,"prop",D,n)}else if(l.PropTypes!==void 0&&!Ae){Ae=!0;var H=te(l);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",H||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function wt(n){{for(var l=Object.keys(n.props),d=0;d<l.length;d++){var D=l[d];if(D!=="children"&&D!=="key"){he(n),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",D),he(null);break}}n.ref!==null&&(he(n),y("Invalid attribute `ref` supplied to `React.Fragment`."),he(null))}}function Ze(n,l,d,D,H,z){{var N=s(n);if(!N){var F="";(n===void 0||typeof n=="object"&&n!==null&&Object.keys(n).length===0)&&(F+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ne=kt(H);ne?F+=ne:F+=Ue();var K;n===null?K="null":_e(n)?K="array":n!==void 0&&n.$$typeof===a?(K="<"+(te(n.type)||"Unknown")+" />",F=" Did you accidentally export a JSX literal instead of a component?"):K=typeof n,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",K,F)}var J=St(n,l,d,H,z);if(J==null)return J;if(N){var ae=l.children;if(ae!==void 0)if(D)if(_e(ae)){for(var Ee=0;Ee<ae.length;Ee++)Ge(ae[Ee],n);Object.freeze&&Object.freeze(ae)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ge(ae,n)}return n===f?wt(J):xt(J),J}}function Tt(n,l,d){return Ze(n,l,d,!0)}function Pt(n,l,d){return Ze(n,l,d,!1)}var Dt=Pt,Mt=Tt;Se.Fragment=f,Se.jsx=Dt,Se.jsxs=Mt}()),Se}process.env.NODE_ENV==="production"?$t():At();const I={AmountPerInterval:"{{ amount }} per {{ interval }}",Back:"Back",Cancel:"Cancel",CancelConfirmation:"Are you sure you want to cancel your subscription?",CancelPlan:"Cancel plan",ChangePlan:"Change plan",CurrentPlan:"Current plan",CustomPlans:"Custom plans",CustomPlansDescription:"Plans tailored to your specific needs",DiscountAmount:"{{ amount }} discount",DiscountAmountExpired:"{{ amount }} discount expired",FreeTrialLength:"{{ trialDays }}-day free trial",Features:"Features",Month:"month",MonthShort:"mo",Monthly:"Monthly",NextBillingDate:"Next billing date",NotSubscribed:"You're not subscribed to a plan yet.",Year:"year",YearShort:"yr",Yearly:"Yearly",MostPopular:"Most popular",Per:"/",Plans:"Plans",Price:"Price",SelectPlan:"Select plan",SubscribeSuccessTitle:"Subscription successful",SubscribeSuccessBody:"Thanks for subscribing to our app!",Subscription:"Subscription",SubscriptionCancelled:"Subscription cancelled",UsageCharges:"Usage charges",loading:"Loading...",error:"An error occurred",retry:"Retry",cancel:"Cancel",continue:"Continue",subscribe:"Subscribe",subscribeNow:"Subscribe Now",upgradeNow:"Upgrade Now",manageSubscription:"Manage Subscription",cancelSubscription:"Cancel Subscription",addPaymentMethod:"Add Payment Method",updatePaymentMethod:"Update Payment Method",featureNotAvailable:"This feature is not available on your current plan",upgradeRequired:"Upgrade Required",limitReached:"Limit Reached"},Rt=e.createContext(void 0),It=()=>{const r=e.useContext(Rt);if(r===void 0)throw new Error("useMantle must be used within a MantleProvider");return r},Ot=(r="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:r,notation:"standard"}),me=(r,a="USD",g=!0)=>{let f=Ot(a).format(r);return g&&(f=f.replace(/\.00$/,"")),f};var G=(r=>(r.Annual="ANNUAL",r.Every30Days="EVERY_30_DAYS",r))(G||{});const Lt=(r="EVERY_30_DAYS")=>{switch(r){case"ANNUAL":return"year";case"EVERY_30_DAYS":default:return"month"}},Yt=(r="EVERY_30_DAYS")=>{switch(r){case"ANNUAL":return"yr";case"EVERY_30_DAYS":default:return"mo"}},pe=({interval:r="EVERY_30_DAYS",useShortFormPlanIntervals:a=!0})=>a?Yt(r):Lt(r),Ie=({plan:r,customFieldKey:a="recommended"})=>{var g;return!!((g=r.customFields)!=null&&g[a])},Oe=({plan:r,customFieldKey:a="buttonLabel",defaultLabel:g=I.subscribe})=>{var f;return((f=r.customFields)==null?void 0:f[a])||g},tt=({plan:r})=>r.discounts&&r.discounts.length>0?r.discounts.reduce((a,g)=>a.discountedAmount<g.discountedAmount?a:g):void 0,Ft=(r=4)=>r%4===0?{xs:6,sm:6,md:2,lg:3,xl:3}:r%3===0?{xs:6,sm:6,md:2,lg:4,xl:4}:r%2===0?{xs:6,sm:6,md:3,lg:6,xl:6}:r===1?{xs:6,sm:6,md:6,lg:12,xl:12}:{xs:6,sm:6,md:2,lg:4,xl:4},jt=(r=4)=>r%4===0?4:r%3===0?3:r%2===0?2:r===1?1:4,Nt=({orientation:r="horizontal",onShowPlans:a,onCancelPlan:g,onPlanCancelled:f=()=>{},cancelSubscription:p=async()=>{},i18n:b,subscription:o,refetch:M=async()=>{},apps:v=[]})=>e.createElement(t.Banner,{title:"Bundle and save!",tone:"success"},e.createElement(t.BlockStack,{gap:"400"},e.createElement(t.Text,null,"Save money on your subscription when you install these great apps."),e.createElement(t.BlockStack,{gap:"300"},v.map((k,C)=>e.createElement(t.BlockStack,{gap:"300"},e.createElement(t.InlineStack,{gap:"200",align:"space-between",blockAlign:"center"},e.createElement(t.InlineStack,{gap:"300"},e.createElement(t.Thumbnail,{source:k.iconUrl,alt:k.name,size:"small"}),e.createElement(t.BlockStack,null,e.createElement(t.Text,{variant:"headingSm"},k.name),e.createElement(t.Text,null,k.description))),e.createElement(t.InlineStack,{gap:"400"},e.createElement(t.Text,{tone:"subdued"},"20% off"),e.createElement(t.BlockStack,null,e.createElement(t.Button,null,b.Install)))),C<v.length-1&&e.createElement(t.Divider,null))))));var nt=function(a){return e.createElement("svg",Object.assign({viewBox:"0 0 20 20"},a),e.createElement("path",{d:"M13.28 9.03a.75.75 0 0 0-1.06-1.06l-2.97 2.97-1.22-1.22a.75.75 0 0 0-1.06 1.06l1.75 1.75a.75.75 0 0 0 1.06 0l3.5-3.5Z"}),e.createElement("path",{fillRule:"evenodd",d:"M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0Zm-1.5 0a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Z"}))};nt.displayName="CheckCircleIcon";var ge=function(a){return e.createElement("svg",Object.assign({viewBox:"0 0 20 20"},a),e.createElement("path",{fillRule:"evenodd",d:"M15.78 5.97a.75.75 0 0 1 0 1.06l-6.5 6.5a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 1 1 1.06-1.06l2.72 2.72 5.97-5.97a.75.75 0 0 1 1.06 0Z"}))};ge.displayName="CheckIcon";var rt=function(a){return e.createElement("svg",Object.assign({viewBox:"0 0 20 20"},a),e.createElement("path",{fillRule:"evenodd",d:"M5.72 8.47a.75.75 0 0 1 1.06 0l3.47 3.47 3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06Z"}))};rt.displayName="ChevronDownIcon";var at=function(a){return e.createElement("svg",Object.assign({viewBox:"0 0 20 20"},a),e.createElement("path",{fillRule:"evenodd",d:"M14.53 12.28a.75.75 0 0 1-1.06 0l-3.47-3.47-3.47 3.47a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06Z"}))};at.displayName="ChevronUpIcon";var De=function(a){return e.createElement("svg",Object.assign({viewBox:"0 0 20 20"},a),e.createElement("path",{d:"M10 14a.75.75 0 0 1-.75-.75v-3.5a.75.75 0 0 1 1.5 0v3.5a.75.75 0 0 1-.75.75Z"}),e.createElement("path",{d:"M9 7a1 1 0 1 1 2 0 1 1 0 0 1-2 0Z"}),e.createElement("path",{fillRule:"evenodd",d:"M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0Zm-1.5 0a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Z"}))};De.displayName="InfoIcon";var Me=function(a){return e.createElement("svg",Object.assign({viewBox:"0 0 20 20"},a),e.createElement("path",{d:"M10.75 6.75a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5Z"}))};Me.displayName="PlusIcon";const Wt=({title:r="Checklist",steps:a=[],showProgress:g=!0,showProgressText:f=!0,hideCompleted:p=!1,allowExpandCompleted:b=!0,showDescription:o=!0,enableDescriptionModal:M=!1,completionMessage:v="All items completed! Great job!",noItemsMessage:k="No items in this checklist yet."})=>{const[C,$]=e.useState(!1),[Y,R]=e.useState(null),L=a.filter(s=>s.completed).length,h=a.length,S=h>0?Math.round(L/h*100):0,O=L===h&&h>0,y=a.filter(s=>!s.completed),j=a.filter(s=>s.completed),W=p?y:a,w=()=>{$(!C)},_=s=>{if(M){const A=a.find(ee=>ee.id===s);A&&A.description&&R(s)}},T=()=>{R(null)},P=Y?a.find(s=>s.id===Y):null,V=s=>{const A=e.createElement(t.Text,{variant:"bodyMd",tone:s.completed?"subdued":"base",textDecorationLine:s.completed?"line-through":"none"},s.name);return M&&s.description?e.createElement("span",{style:{cursor:"pointer",textDecoration:"underline",textDecorationColor:"transparent",transition:"text-decoration-color 0.2s ease"},onMouseEnter:ee=>{ee.target.style.textDecorationColor="currentColor"},onMouseLeave:ee=>{ee.target.style.textDecorationColor="transparent"},onClick:()=>_(s.id)},A):A};return e.createElement(t.Card,null,e.createElement(t.BlockStack,{gap:"400"},e.createElement(t.BlockStack,{gap:"200"},e.createElement(t.InlineStack,{align:"space-between",blockAlign:"center"},e.createElement(t.Text,{variant:"headingMd"},r),O&&e.createElement(t.InlineStack,{gap:"100",blockAlign:"center"},e.createElement(t.Icon,{source:nt,tone:"success"}),e.createElement(t.Text,{tone:"success"},"Complete!"))),g&&h>0&&e.createElement(t.BlockStack,{gap:"100"},f&&e.createElement(t.InlineStack,{align:"space-between"},e.createElement(t.Text,{variant:"bodyMd",tone:"subdued"},"Progress: ",L," of ",h," completed"),e.createElement(t.Text,{variant:"bodyMd",tone:"subdued"},S,"%")),e.createElement("div",{style:{width:"100%",height:"8px",backgroundColor:"#f0f0f0",borderRadius:"4px",overflow:"hidden"}},e.createElement("div",{style:{width:`${S}%`,height:"100%",backgroundColor:O?"#00a047":"#006fbb",transition:"width 0.3s ease"}})))),e.createElement(t.BlockStack,{gap:"300"},W.map(s=>e.createElement(t.InlineStack,{key:s.id,align:"space-between",blockAlign:"start"},e.createElement(t.InlineStack,{gap:"300",blockAlign:"start"},e.createElement(t.Checkbox,{id:`checklist-step-${s.id}`,checked:s.completed,onChange:()=>handleToggle(s.id)}),e.createElement(t.BlockStack,{gap:"100"},V(s),s.description&&o&&e.createElement(t.Text,{variant:"bodySm",tone:"subdued"},s.description)))))),p&&b&&j.length>0&&e.createElement(t.BlockStack,{gap:"200"},e.createElement(t.Button,{variant:"plain",onClick:w,icon:C?at:rt,disclosure:C?"up":"down"},C?"Hide":"Show"," ",L," completed ",L===1?"item":"items"),e.createElement(t.Collapsible,{open:C,id:"completed-steps",transition:{duration:"200ms",timingFunction:"ease-in-out"}},e.createElement(t.BlockStack,{gap:"300"},j.map(s=>e.createElement(t.InlineStack,{key:s.id,align:"space-between",blockAlign:"start"},e.createElement(t.InlineStack,{gap:"300",blockAlign:"start"},e.createElement(t.Checkbox,{id:`checklist-step-${s.id}`,checked:s.completed,onChange:()=>handleToggle(s.id)}),e.createElement(t.BlockStack,{gap:"100"},V(s),s.description&&o&&e.createElement(t.Text,{variant:"bodySm",tone:"subdued"},s.description)))))))),W.length===0&&p&&h>0&&!b&&(typeof v=="string"?e.createElement(t.Text,{tone:"subdued",alignment:"center"},v):v),h===0&&(typeof k=="string"?e.createElement(t.Text,{tone:"subdued",alignment:"center"},k):k)),P&&e.createElement(t.Modal,{open:!!Y,onClose:T,title:P.name,primaryAction:{content:"Close",onAction:T}},e.createElement(t.Modal.Section,null,e.createElement(t.Text,{variant:"bodyMd"},P.description))))},Ht=({plan:r,t:a,translatePlanName:g,planNameTextVariant:f,planDescriptionTextVariant:p})=>e.createElement(t.BlockStack,{gap:"100"},e.createElement(t.Text,{variant:f,alignment:"center"},g?a(r.name):r.name),r.description&&e.createElement(t.Text,{variant:p,tone:"subdued",alignment:"center"},a(r.description))),Ut=({plan:r,discount:a,t:g,priceTextVariant:f,useShortFormPlanIntervals:p=!0,toggleYearlySubtitle:b=!1})=>e.createElement(t.BlockStack,{gap:"100"},!!a&&e.createElement(t.InlineStack,{align:"center",blockAlign:"center",gap:"200"},e.createElement(t.Text,{variant:f},me(a.presentmentDiscountedAmount,r.presentmentCurrencyCode,!0)),e.createElement(t.Text,{variant:f,tone:"subdued",fontWeight:"medium",textDecorationLine:"line-through"},me(r.presentmentAmount,r.presentmentCurrencyCode,!0)),e.createElement(t.Text,{variant:"bodyLg",tone:"subdued"},g(I.Per)," ",g(pe({interval:r.interval,useShortFormPlanIntervals:p})))),!a&&e.createElement(t.InlineStack,{align:"center",blockAlign:"center",gap:"200"},e.createElement(t.Text,{alignment:"center",variant:f},me(r.presentmentAmount,r.presentmentCurrencyCode,!0)),e.createElement(t.Text,{alignment:"center",variant:"bodyLg",tone:"subdued"},g(I.Per)," ",g(pe({interval:r.interval,useShortFormPlanIntervals:p})))),r.usageCharges.length>0&&e.createElement(t.BlockStack,null,r.usageCharges.filter(o=>o.terms&&o.terms.length>0).map((o,M)=>e.createElement(t.InlineStack,{key:`plan-usageCharge-${M}`,align:"center",gap:"100"},e.createElement(t.Box,null,e.createElement(t.Icon,{source:Me,tone:"subdued"})),e.createElement(t.Text,{variant:"bodyLg"},g(o.terms))))),b&&e.createElement(t.Text,{variant:"bodyMd",tone:"subdued",alignment:"center"},"Billed yearly")),zt=({plan:r,t:a,trialDaysAsFeature:g=!1,showFeatureDescriptionAsTooltip:f=!0})=>e.createElement(t.BlockStack,{gap:"300"},g&&r.trialDays&&r.trialDays>0?e.createElement(t.InlineStack,{align:"center",blockAlign:"center",gap:"100"},e.createElement(t.Box,null,e.createElement(t.Icon,{source:ge,tone:"subdued"})),e.createElement(t.Text,null,a(I.FreeTrialLength).replace("{{ trialDays }}",r.trialDays))):null,r.featuresOrder.map((p,b)=>{const o=r.features[p];if((o.type!=="boolean"||o.value===!0)&&o.visible)return e.createElement(t.InlineStack,{key:`plan-feature-${b}`,align:"center",gap:"100",wrap:!1},e.createElement(t.Box,null,e.createElement(t.Icon,{source:ge,tone:"subdued"})),o.type==="boolean"?e.createElement(t.Text,null,a(o.name)):e.createElement(t.Text,null,o.value," ",a(o.name)),o.description&&f&&e.createElement(t.Tooltip,{content:a(o.description)},e.createElement(t.Icon,{source:De,tone:"subdued"})))})),lt=({plan:r,discount:a,buttonLabel:g,onSelectPlan:f,useShortFormPlanIntervals:p=!0,trialDaysAsFeature:b=!1,expanded:o=!1,isActivePlan:M=!1,isRecommendedPlan:v=!1,isCustomPlan:k=!1,showRecommendedPlanBadge:C=!0,t:$,translatePlanName:Y=!0,planNameTextVariant:R="headingMd",planDescriptionTextVariant:L="bodyLg",priceTextVariant:h="heading3xl",toggleYearlySubtitle:S=!1,showFeatureDescriptionAsTooltip:O=!0})=>{const[y,j]=e.useState(!1),W=$||(_=>_),w=async({plan:_,discount:T})=>{f?(j(!0),await f({plan:_,discount:T})!==!0&&j(!1)):console.log("No onSelectPlan callback provided")};return e.createElement(t.Box,{position:"relative",minHeight:"100%"},e.createElement(t.Box,{paddingBlock:o||v?void 0:"800",minHeight:"100%"},e.createElement(t.Box,{background:v||k?"bg-surface":"bg-surface-secondary",borderStyle:"solid",borderColor:"border",borderWidth:"025",paddingBlock:o||v?"1600":"800",paddingInline:"400",borderRadius:"200",minHeight:"calc(100% - calc(var(--p-space-800) * 2))"},e.createElement(t.BlockStack,{gap:"800"},e.createElement(t.BlockStack,{gap:"400"},e.createElement(Ht,{plan:r,t:W,translatePlanName:Y,planNameTextVariant:R,planDescriptionTextVariant:L}),e.createElement(Ut,{plan:r,discount:a,useShortFormPlanIntervals:p,t:W,priceTextVariant:h,toggleYearlySubtitle:S})),e.createElement(t.Button,{size:"large",variant:v?"primary":"secondary",onClick:async()=>{await w({plan:r,discount:a})},disabled:M,loading:y},W(g||I.SelectPlan)),e.createElement(zt,{plan:r,t:W,trialDaysAsFeature:b,showFeatureDescriptionAsTooltip:O}),v&&C&&e.createElement(t.InlineStack,{align:"center",gap:"100"},e.createElement(t.Badge,{tone:"success"},W(I.MostPopular)))))))},de={Highlighted:"highlighted",Horizontal:"horizontal",Vertical:"vertical"},ke=({plans:r,customer:a,onSelectPlan:g,planInterval:f,cardType:p=de.Horizontal,trialDaysAsFeature:b=!0,useShortFormPlanIntervals:o=!0,keyForRecommended:M="recommended",keyForCustomButtonLabel:v="buttonLabel",showRecommendedPlanBadge:k=!0,applyDiscount:C=!0,t:$,translatePlanName:Y=!0,toggleYearlySubtitle:R=!1,showFeatureDescriptionAsTooltip:L=!0})=>{var w;const h=(w=a==null?void 0:a.subscription)!=null&&w.active?a.subscription:void 0,S=h==null?void 0:h.plan,O=f?r.filter(_=>_.interval===f):r,y=p===de.Vertical?1:jt(O.length),j=Ft(y),W=$||(_=>_);return e.createElement(t.Grid,{columns:y},O.map(_=>{const T=C?tt({plan:_}):void 0,P=(S==null?void 0:S.id)===_.id&&!(h!=null&&h.cancelOn);return e.createElement(t.Grid.Cell,{columnSpan:j,key:_.id},p===de.Highlighted&&e.createElement(lt,{key:`HighlightedPlanCard-${_.id}`,plan:_,discount:T,onSelectPlan:g,isActivePlan:P,trialDaysAsFeature:b,useShortFormPlanIntervals:o,isCustomPlan:_.availability!=="public",isRecommendedPlan:Ie({plan:_,customFieldKey:M}),buttonLabel:Oe({plan:_,customFieldKey:v}),showRecommendedPlanBadge:k,showFeatureDescriptionAsTooltip:L,toggleYearlySubtitle:R,t:W,translatePlanName:Y}),p===de.Horizontal&&e.createElement(ot,{key:`HorizontalPlanCard-${_.id}`,plan:_,discount:T,onSelectPlan:g,isActivePlan:P,trialDaysAsFeature:b,useShortFormPlanIntervals:o,isRecommendedPlan:Ie({plan:_,customFieldKey:M}),buttonLabel:Oe({plan:_,customFieldKey:v}),showRecommendedPlanBadge:k,showFeatureDescriptionAsTooltip:L,toggleYearlySubtitle:R,t:W,translatePlanName:Y}))}))},Vt=({customer:r,plans:a,onSubscribe:g,backUrl:f="",showRecommendedBadge:p=!0,customFieldCta:b,customFieldPlanRecommended:o="Recommended",showPlanIntervalToggle:M=!0,showTrialDaysAsFeature:v=!0,useShortFormPlanIntervals:k,pageWidth:C="default",showCustomPlans:$=!0,toggleYearlySubtitle:Y=!1,showFeatureDescriptionAsTooltip:R=!0})=>{const L=r==null?void 0:r.subscription,h=new URLSearchParams(window.location.search),S=a.some(P=>P.interval===G.Annual)&&a.some(P=>P.interval===G.Every30Days),O=a.find(P=>P.id===(L==null?void 0:L.plan.id)),[y,j]=e.useState(O?O.interval:S?G.Annual:G.Every30Days),W=a.filter(P=>P.availability==="public"),w=$?a.filter(P=>P.availability!=="public"):[],[_,T]=e.useState(h.get("subscribed")==="true");return e.createElement(t.Page,{title:I.Plans,backAction:f?{content:I.Back,url:f}:void 0,secondaryActions:M&&S?e.createElement(t.ButtonGroup,{variant:"segmented"},e.createElement(t.Button,{pressed:y===G.Every30Days,onClick:()=>j(G.Every30Days)},I.Monthly),e.createElement(t.Button,{pressed:y===G.Annual,onClick:()=>j(G.Annual)},I.Yearly)):void 0,fullWidth:C==="full",narrowWidth:C==="narrow"},e.createElement(t.Layout,null,e.createElement(t.Layout.Section,null,e.createElement(t.BlockStack,{gap:"1000"},_&&e.createElement(t.Banner,{tone:"success",title:I.SubscribeSuccessTitle,onDismiss:()=>{T(!1),window.history.replaceState({},document.title,window.location.pathname)}},I.SubscribeSuccessBody),e.createElement(ke,{plans:W,onSelectPlan:g,planInterval:y,cardType:de.Horizontal,keyForRecommended:o,keyForCustomButtonLabel:b,trialDaysAsFeature:v,useShortFormPlanIntervals:k,showRecommendedPlanBadge:p,toggleYearlySubtitle:Y,showFeatureDescriptionAsTooltip:R}),(w==null?void 0:w.length)>0&&e.createElement(t.Divider,{borderColor:"border"}),(w==null?void 0:w.length)>0&&e.createElement(t.BlockStack,{gap:"300"},e.createElement(t.Box,{paddingInline:{xs:400,sm:0}},e.createElement(t.Text,{variant:"headingMd"},I.CustomPlans)),e.createElement(ke,{plans:w,onSelectPlan:g,planInterval:y,cardType:de.Horizontal,keyForRecommended:o,keyForCustomButtonLabel:b,trialDaysAsFeature:v,useShortFormPlanIntervals:k,showRecommendedPlanBadge:p,showFeatureDescriptionAsTooltip:R}))))))},Gt=({plan:r,t:a,translatePlanName:g,isRecommendedPlan:f=!1,planNameTextVariant:p,planDescriptionTextVariant:b,showRecommendedPlanBadge:o})=>e.createElement(t.BlockStack,{gap:"100"},e.createElement(t.InlineStack,{align:"space-between",gap:"100"},e.createElement(t.Text,{variant:p},g?a(r.name):r.name),f&&o&&e.createElement(t.Badge,{tone:"success"},a(I.MostPopular))),r.description&&e.createElement(t.Text,{variant:b,tone:"subdued"},a(r.description))),Zt=({plan:r,discount:a,t:g,useShortFormPlanIntervals:f=!0,priceTextVariant:p,toggleYearlySubtitle:b=!1})=>e.createElement(t.BlockStack,null,a?e.createElement(t.InlineStack,{blockAlign:"center",gap:"200"},e.createElement(t.Text,{variant:p},me(a.presentmentDiscountedAmount,r.presentmentCurrencyCode)),e.createElement(t.Text,{variant:p,tone:"subdued",fontWeight:"medium",textDecorationLine:"line-through"},r.presentmentAmount),e.createElement(t.Text,{variant:"bodyLg",tone:"subdued"},I.Per," ",pe({interval:r.interval,useShortFormPlanIntervals:f}))):e.createElement(t.InlineStack,{blockAlign:"center",gap:"200"},e.createElement(t.Text,{alignment:"center",variant:p},me(r.presentmentAmount,r.presentmentCurrencyCode)),e.createElement(t.Text,{alignment:"center",variant:"bodyLg",tone:"subdued"},I.Per," ",pe({interval:r.interval,useShortFormPlanIntervals:f}))),r.usageCharges&&r.usageCharges.length>0&&e.createElement(t.BlockStack,null,r.usageCharges.filter(o=>o.terms&&o.terms.length>0).map((o,M)=>e.createElement(t.InlineStack,{key:`plan-usageCharge-${M}`,align:"start",gap:"100"},e.createElement(t.Box,null,e.createElement(t.Icon,{source:Me,tone:"subdued"})),e.createElement(t.Text,{variant:"bodyLg"},g(o.terms))))),b&&e.createElement(t.Text,{variant:"bodyMd",tone:"subdued",alignment:"left"},"Billed yearly")),qt=({plan:r,t:a,trialDaysAsFeature:g=!1,showFeatureDescriptionAsTooltip:f=!0})=>e.createElement(t.BlockStack,{gap:"100"},g&&r.trialDays&&r.trialDays>0?e.createElement(t.InlineStack,{align:"start",gap:"100"},e.createElement(t.Box,null,e.createElement(t.Icon,{source:ge,tone:"subdued"})),e.createElement(t.Text,null,a(I.FreeTrialLength).replace("{{ trialDays }}",r.trialDays))):null,r.featuresOrder.map((p,b)=>{const o=r.features[p];if((o.type!=="boolean"||o.value===!0)&&o.visible)return e.createElement(t.InlineStack,{key:`plan-feature-${b}`,align:"start",gap:"100",wrap:!1},e.createElement(t.Box,null,e.createElement(t.Icon,{source:ge,tone:"subdued"})),o.type==="boolean"?e.createElement(t.Text,null,a(o.name)):e.createElement(t.Text,null,o.value," ",a(o.name)),o.description&&f&&e.createElement(t.Tooltip,{content:a(o.description)},e.createElement(t.Icon,{source:De,tone:"subdued"})))})),ot=({plan:r,discount:a,buttonLabel:g,onSelectPlan:f,useShortFormPlanIntervals:p=!0,trialDaysAsFeature:b=!1,isRecommendedPlan:o=!1,isActivePlan:M=!1,t:v,translatePlanName:k=!0,showRecommendedPlanBadge:C=!0,planNameTextVariant:$="bodyLg",planDescriptionTextVariant:Y="bodyMd",priceTextVariant:R="headingXl",toggleYearlySubtitle:L=!1,showFeatureDescriptionAsTooltip:h=!0})=>{const[S,O]=e.useState(!1),y=v||(W=>W),j=async({plan:W,discount:w})=>{f?(O(!0),await f({plan:W,discount:w})!==!0&&O(!1)):console.log("No onSelectPlan callback provided")};return e.createElement(t.Card,null,e.createElement(t.BlockStack,{gap:"400"},e.createElement(Gt,{plan:r,isRecommendedPlan:o,showRecommendedPlanBadge:C,t:y,translatePlanName:k,planNameTextVariant:$,planDescriptionTextVariant:Y}),e.createElement(Zt,{plan:r,discount:a,useShortFormPlanIntervals:p,t:y,priceTextVariant:R,toggleYearlySubtitle:L}),e.createElement(t.Button,{size:"large",variant:o?"primary":"secondary",onClick:async()=>{await j({plan:r,discount:a})},disabled:M,loading:S},y(M?I.CurrentPlan:g||I.SelectPlan)),e.createElement(qt,{plan:r,trialDaysAsFeature:b,showFeatureDescriptionAsTooltip:h,t:y})))},Kt=({customer:r,plans:a,onSubscribe:g,backUrl:f="",showRecommendedBadge:p=!0,customFieldCta:b=null,customFieldPlanRecommended:o="Recommended",showPlanIntervalToggle:M=!0,showTrialDaysAsFeature:v=!0,useShortFormPlanIntervals:k=!0,pageWidth:C="default",showCustomPlans:$=!0,toggleYearlySubtitle:Y=!1,showFeatureDescriptionAsTooltip:R=!0})=>{const L=r==null?void 0:r.subscription,h=new URLSearchParams(window.location.search),S=a.some(P=>P.interval===G.Annual)&&a.some(P=>P.interval===G.Every30Days),O=a.find(P=>P.id===(L==null?void 0:L.plan.id)),[y,j]=e.useState(O?O.interval:S?G.Annual:G.Every30Days),W=a.filter(P=>P.availability==="public"),w=$?a.filter(P=>P.availability!=="public"):[],[_,T]=e.useState(h.get("subscribed")==="true");return e.createElement(t.Page,{title:I.Plans,backAction:f&&f!==""?{content:I.Back,url:f}:void 0,secondaryActions:M&&S?e.createElement(t.ButtonGroup,{variant:"segmented"},e.createElement(t.Button,{pressed:y===G.Every30Days,onClick:()=>j(G.Every30Days)},I.Monthly),e.createElement(t.Button,{pressed:y===G.Annual,onClick:()=>j(G.Annual)},I.Yearly)):void 0,fullWidth:C==="full",narrowWidth:C==="narrow"},e.createElement(t.Box,{paddingBlockEnd:"800"},e.createElement(t.Layout,null,e.createElement(t.Layout.Section,null,e.createElement(t.BlockStack,{gap:"1000"},_&&e.createElement(t.Banner,{tone:"success",title:I.SubscribeSuccessTitle,onDismiss:()=>{T(!1),window.history.replaceState({},document.title,window.location.pathname)}},I.SubscribeSuccessBody),e.createElement(ke,{plans:W,onSelectPlan:g,planInterval:y,cardType:de.Highlighted,keyForRecommended:o,keyForCustomButtonLabel:b,trialDaysAsFeature:v,useShortFormPlanIntervals:k,showRecommendedPlanBadge:p,toggleYearlySubtitle:Y,showFeatureDescriptionAsTooltip:R}),(w==null?void 0:w.length)>0&&e.createElement(t.Divider,{borderColor:"border"}),(w==null?void 0:w.length)>0&&e.createElement(t.BlockStack,{gap:"300"},e.createElement(t.Box,{paddingInline:{xs:400,sm:0}},e.createElement(t.Text,{variant:"headingMd"},I.CustomPlans)),e.createElement(ke,{plans:w,onSelectPlan:g,planInterval:y,cardType:de.Highlighted,keyForRecommended:o,keyForCustomButtonLabel:b,trialDaysAsFeature:v,useShortFormPlanIntervals:k,showRecommendedPlanBadge:p,showFeatureDescriptionAsTooltip:R})))))))},ct=({plan:r,discount:a,buttonLabel:g,onSelectPlan:f,useShortFormPlanIntervals:p=!0,trialDaysAsFeature:b=!1,isRecommendedPlan:o=!1,isActivePlan:M=!1,t:v=_t,translatePlanName:k=!0,showRecommendedPlanBadge:C=!0,planNameTextVariant:$="bodyLg",planDescriptionTextVariant:Y="bodyMd",priceTextVariant:R="headingXl",toggleYearlySubtitle:L=!1,showFeatureDescriptionAsTooltip:h=!0})=>{const[S,O]=e.useState(!1),y=async({plan:T,discount:P})=>{f?(O(!0),await f({plan:T,discount:P})!==!0&&O(!1)):console.log("No onSelectPlan callback provided")},j=({plan:T})=>e.createElement(t.BlockStack,null,e.createElement(t.Text,{variant:$},k?v(T.name):T.name),T.description&&e.createElement(t.Text,{variant:Y,tone:"subdued"},v(T.description))),W=({plan:T})=>e.createElement(t.BlockStack,{gap:"200"},e.createElement(t.Text,{fontWeight:"medium"},v(I.Features)),e.createElement(t.BlockStack,{gap:"100"},b&&T.trialDays&&T.trialDays>0?e.createElement(t.InlineStack,{align:"start",gap:"100"},e.createElement(t.Box,null,e.createElement(t.Icon,{source:ge,tone:"positive"})),e.createElement(t.Text,{tone:"subdued"},v(I.FreeTrialLength.replace("{{ trialDays }}",T.trialDays)))):null,T.featuresOrder.map((P,V)=>{const s=T.features[P];if((s.type!=="boolean"||s.value===!0)&&s.visible)return e.createElement(t.InlineStack,{key:`plan-feature-${V}`,align:"start",gap:"100",wrap:!1},e.createElement(t.Box,null,e.createElement(t.Icon,{source:ge,tone:"positive"})),s.type==="boolean"?e.createElement(t.Text,{tone:"subdued"},s.name):e.createElement(t.Text,{tone:"subdued"},s.value," ",s.name),s.description&&h&&e.createElement(t.Tooltip,{content:v(s.description)},e.createElement(t.Icon,{source:De,tone:"subdued"})))}))),w=({plan:T,discount:P,toggleYearlySubtitle:V})=>e.createElement(t.BlockStack,{gap:"100"},P?e.createElement(t.InlineStack,{blockAlign:"center",gap:"200"},e.createElement(t.Text,{variant:R},me(P.presentmentDiscountedAmount,T.presentmentCurrencyCode)),e.createElement(t.Text,{variant:R,tone:"subdued",fontWeight:"medium",textDecorationLine:"line-through"},T.presentmentAmount),e.createElement(t.Text,{variant:"bodyLg",tone:"subdued"},I.Per," ",pe({interval:T.interval,useShortFormPlanIntervals:p}))):e.createElement(t.InlineStack,{blockAlign:"center",gap:"200"},e.createElement(t.Text,{alignment:"center",variant:R},me(T.presentmentAmount,T.presentmentCurrencyCode)),e.createElement(t.Text,{alignment:"center",variant:"bodyLg",tone:"subdued"},I.Per," ",pe({interval:T.interval,useShortFormPlanIntervals:p}))),T.usageCharges.length>0&&e.createElement(t.BlockStack,null,T.usageCharges.filter(s=>s.terms&&s.terms.length>0).map((s,A)=>e.createElement(t.InlineStack,{key:`plan-usageCharge-${A}`,align:"start",gap:"100"},e.createElement(t.Box,null,e.createElement(t.Icon,{source:Me,tone:"positive"})),e.createElement(t.Text,{variant:"bodyLg"},s.terms)))),V&&e.createElement(t.Text,{variant:"bodyMd",tone:"subdued",alignment:"left"},"Billed yearly")),_=({plan:T,discount:P})=>e.createElement(t.InlineStack,{blockAlign:"center",gap:"400"},e.createElement(t.Button,{size:"large",variant:o?"primary":"secondary",onClick:async()=>{await y({plan:T,discount:P})},disabled:M,loading:S},v(M?I.CurrentPlan:g||I.SelectPlan)),o&&C&&e.createElement(t.Badge,{tone:"success"},v(I.MostPopular)));return e.createElement(t.Card,null,e.createElement(t.Grid,null,e.createElement(t.Grid.Cell,{columnSpan:{xs:6,sm:6,md:3,lg:6,xl:6}},e.createElement(t.BlockStack,{gap:"300"},j({plan:r}),w({plan:r,discount:a,toggleYearlySubtitle:L}),e.createElement(t.Box,null,_({plan:r,discount:a})))),e.createElement(t.Grid.Cell,{columnSpan:{xs:6,sm:6,md:3,lg:6,xl:6}},W({plan:r}))))},Jt=({plans:r,customer:a,onSubscribe:g,backUrl:f="",keyForRecommended:p="recommended",keyForCustomButtonLabel:b="buttonLabel",showPlanIntervalToggle:o=!1,trialDaysAsFeature:M=!0,useShortFormPlanIntervals:v=!0,pageWidth:k="default",showCustomPlans:C=!0,showRecommendedPlanBadge:$=!0,applyDiscount:Y=!0,t:R,translatePlanName:L=!0,toggleYearlySubtitle:h=!1,showFeatureDescriptionAsTooltip:S=!0})=>{var te;const O=new URLSearchParams(window.location.search),y=r.some(i=>i.interval===G.Annual)&&r.some(i=>i.interval===G.Every30Days),j=(te=a==null?void 0:a.subscription)!=null&&te.active?a.subscription:void 0,W=j==null?void 0:j.plan,[w,_]=e.useState(W?W.interval:y?G.Annual:G.Every30Days),T=r.filter(i=>i.availability!=="customerTag"&&i.availability!=="customer"),P=o&&y?T.filter(i=>i.interval===w):T,V=C?r.filter(i=>i.availability==="customerTag"||i.availability==="customer"):[],[s,A]=e.useState(O.get("subscribed")==="true"),ee=R||(i=>i);return e.createElement(t.Page,{title:I.Plans,backAction:f!==""?{content:I.Back,url:f}:void 0,secondaryActions:o&&y?e.createElement(t.ButtonGroup,{variant:"segmented"},e.createElement(t.Button,{pressed:w===G.Every30Days,onClick:()=>_(G.Every30Days)},I.Monthly),e.createElement(t.Button,{pressed:w===G.Annual,onClick:()=>_(G.Annual)},I.Year)):void 0,fullWidth:k==="full",narrowWidth:k==="narrow"},e.createElement(t.Layout,null,e.createElement(t.Layout.Section,null,e.createElement(t.BlockStack,{gap:"400"},s&&e.createElement(t.Banner,{tone:"success",title:I.SubscribeSuccessTitle,onDismiss:()=>{A(!1),window.history.replaceState({},document.title,window.location.pathname)}},I.SubscribeSuccessBody),P.map((i,u)=>{const c=Y?tt({plan:i}):void 0,E=(W==null?void 0:W.id)===i.id&&!(j!=null&&j.cancelOn);return e.createElement(ct,{key:`plan-${u}`,plan:i,discount:c,onSelectPlan:g,isActivePlan:E,trialDaysAsFeature:M,useShortFormPlanIntervals:v,isCustomPlan:i.ava