@sudobility/subscription-components 1.0.24 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(A,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react/jsx-runtime"),require("@sudobility/design"),require("@sudobility/components"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@sudobility/design","@sudobility/components","react"],u):(A=typeof globalThis<"u"?globalThis:A||self,u(A.SubscriptionComponents={},A.ReactJSXRuntime,A.SudobilityDesign,A.SudobilityComponents,A.React))})(this,(function(A,u,ue,ye,I){"use strict";function we(e){var o,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(o=0;o<s;o++)e[o]&&(r=we(e[o]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function qe(){for(var e,o,r=0,t="",s=arguments.length;r<s;r++)(e=arguments[r])&&(o=we(e))&&(t&&(t+=" "),t+=o);return t}const Ke=(e,o)=>{const r=new Array(e.length+o.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let t=0;t<o.length;t++)r[e.length+t]=o[t];return r},Ye=(e,o)=>({classGroupId:e,validator:o}),ve=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),se="-",ke=[],Xe="arbitrary..",Je=e=>{const o=He(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Re(i);const p=i.split(se),c=p[0]===""&&p.length>1?1:0;return Ce(p,c,o)},getConflictingClassGroupIds:(i,p)=>{if(p){const c=t[i],x=r[i];return c?x?Ke(x,c):c:x||ke}return r[i]||ke}}},Ce=(e,o,r)=>{if(e.length-o===0)return r.classGroupId;const s=e[o],n=r.nextPart.get(s);if(n){const x=Ce(e,o+1,n);if(x)return x}const i=r.validators;if(i===null)return;const p=o===0?e.join(se):e.slice(o).join(se),c=i.length;for(let x=0;x<c;x++){const y=i[x];if(y.validator(p))return y.classGroupId}},Re=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=e.slice(1,-1),r=o.indexOf(":"),t=o.slice(0,r);return t?Xe+t:void 0})(),He=e=>{const{theme:o,classGroups:r}=e;return Qe(r,o)},Qe=(e,o)=>{const r=ve();for(const t in e){const s=e[t];fe(s,r,t,o)}return r},fe=(e,o,r,t)=>{const s=e.length;for(let n=0;n<s;n++){const i=e[n];Ze(i,o,r,t)}},Ze=(e,o,r,t)=>{if(typeof e=="string"){et(e,o,r);return}if(typeof e=="function"){tt(e,o,r,t);return}rt(e,o,r,t)},et=(e,o,r)=>{const t=e===""?o:Pe(o,e);t.classGroupId=r},tt=(e,o,r,t)=>{if(ot(e)){fe(e(t),o,r,t);return}o.validators===null&&(o.validators=[]),o.validators.push(Ye(r,e))},rt=(e,o,r,t)=>{const s=Object.entries(e),n=s.length;for(let i=0;i<n;i++){const[p,c]=s[i];fe(c,Pe(o,p),r,t)}},Pe=(e,o)=>{let r=e;const t=o.split(se),s=t.length;for(let n=0;n<s;n++){const i=t[n];let p=r.nextPart.get(i);p||(p=ve(),r.nextPart.set(i,p)),r=p}return r},ot=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,st=e=>{if(e<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null);const s=(n,i)=>{r[n]=i,o++,o>e&&(o=0,t=r,r=Object.create(null))};return{get(n){let i=r[n];if(i!==void 0)return i;if((i=t[n])!==void 0)return s(n,i),i},set(n,i){n in r?r[n]=i:s(n,i)}}},me="!",Se=":",nt=[],ze=(e,o,r,t,s)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:s}),it=e=>{const{prefix:o,experimentalParseClassName:r}=e;let t=s=>{const n=[];let i=0,p=0,c=0,x;const y=s.length;for(let S=0;S<y;S++){const z=s[S];if(i===0&&p===0){if(z===Se){n.push(s.slice(c,S)),c=S+1;continue}if(z==="/"){x=S;continue}}z==="["?i++:z==="]"?i--:z==="("?p++:z===")"&&p--}const O=n.length===0?s:s.slice(c);let w=O,C=!1;O.endsWith(me)?(w=O.slice(0,-1),C=!0):O.startsWith(me)&&(w=O.slice(1),C=!0);const P=x&&x>c?x-c:void 0;return ze(n,C,w,P)};if(o){const s=o+Se,n=t;t=i=>i.startsWith(s)?n(i.slice(s.length)):ze(nt,!1,i,void 0,!0)}if(r){const s=t;t=n=>r({className:n,parseClassName:s})}return t},at=e=>{const o=new Map;return e.orderSensitiveModifiers.forEach((r,t)=>{o.set(r,1e6+t)}),r=>{const t=[];let s=[];for(let n=0;n<r.length;n++){const i=r[n],p=i[0]==="[",c=o.has(i);p||c?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(i)):s.push(i)}return s.length>0&&(s.sort(),t.push(...s)),t}},lt=e=>({cache:st(e.cacheSize),parseClassName:it(e),sortModifiers:at(e),...Je(e)}),ct=/\s+/,dt=(e,o)=>{const{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:s,sortModifiers:n}=o,i=[],p=e.trim().split(ct);let c="";for(let x=p.length-1;x>=0;x-=1){const y=p[x],{isExternal:O,modifiers:w,hasImportantModifier:C,baseClassName:P,maybePostfixModifierPosition:S}=r(y);if(O){c=y+(c.length>0?" "+c:c);continue}let z=!!S,D=t(z?P.substring(0,S):P);if(!D){if(!z){c=y+(c.length>0?" "+c:c);continue}if(D=t(P),!D){c=y+(c.length>0?" "+c:c);continue}z=!1}const $=w.length===0?"":w.length===1?w[0]:n(w).join(":"),G=C?$+me:$,L=G+D;if(i.indexOf(L)>-1)continue;i.push(L);const k=s(D,z);for(let M=0;M<k.length;++M){const F=k[M];i.push(G+F)}c=y+(c.length>0?" "+c:c)}return c},ut=(...e)=>{let o=0,r,t,s="";for(;o<e.length;)(r=e[o++])&&(t=Ae(r))&&(s&&(s+=" "),s+=t);return s},Ae=e=>{if(typeof e=="string")return e;let o,r="";for(let t=0;t<e.length;t++)e[t]&&(o=Ae(e[t]))&&(r&&(r+=" "),r+=o);return r},ft=(e,...o)=>{let r,t,s,n;const i=c=>{const x=o.reduce((y,O)=>O(y),e());return r=lt(x),t=r.cache.get,s=r.cache.set,n=p,p(c)},p=c=>{const x=t(c);if(x)return x;const y=dt(c,r);return s(c,y),y};return n=i,(...c)=>n(ut(...c))},mt=[],N=e=>{const o=r=>r[e]||mt;return o.isThemeGetter=!0,o},Ie=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ne=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pt=/^\d+\/\d+$/,bt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ht=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,xt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Q=e=>pt.test(e),g=e=>!!e&&!Number.isNaN(Number(e)),Y=e=>!!e&&Number.isInteger(Number(e)),pe=e=>e.endsWith("%")&&g(e.slice(0,-1)),q=e=>bt.test(e),wt=()=>!0,vt=e=>gt.test(e)&&!ht.test(e),De=()=>!1,kt=e=>xt.test(e),Ct=e=>yt.test(e),Pt=e=>!a(e)&&!l(e),St=e=>Z(e,je,De),a=e=>Ie.test(e),J=e=>Z(e,Ge,vt),be=e=>Z(e,Dt,g),Oe=e=>Z(e,Ee,De),zt=e=>Z(e,Te,Ct),ne=e=>Z(e,Le,kt),l=e=>Ne.test(e),oe=e=>ee(e,Ge),At=e=>ee(e,Ot),Me=e=>ee(e,Ee),It=e=>ee(e,je),Nt=e=>ee(e,Te),ie=e=>ee(e,Le,!0),Z=(e,o,r)=>{const t=Ie.exec(e);return t?t[1]?o(t[1]):r(t[2]):!1},ee=(e,o,r=!1)=>{const t=Ne.exec(e);return t?t[1]?o(t[1]):r:!1},Ee=e=>e==="position"||e==="percentage",Te=e=>e==="image"||e==="url",je=e=>e==="length"||e==="size"||e==="bg-size",Ge=e=>e==="length",Dt=e=>e==="number",Ot=e=>e==="family-name",Le=e=>e==="shadow",Mt=ft(()=>{const e=N("color"),o=N("font"),r=N("text"),t=N("font-weight"),s=N("tracking"),n=N("leading"),i=N("breakpoint"),p=N("container"),c=N("spacing"),x=N("radius"),y=N("shadow"),O=N("inset-shadow"),w=N("text-shadow"),C=N("drop-shadow"),P=N("blur"),S=N("perspective"),z=N("aspect"),D=N("ease"),$=N("animate"),G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...L(),l,a],M=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],f=()=>[l,a,c],V=()=>[Q,"full","auto",...f()],U=()=>[Y,"none","subgrid",l,a],te=()=>["auto",{span:["full",Y,l,a]},Y,l,a],X=()=>[Y,"auto",l,a],re=()=>["auto","min","max","fr",l,a],R=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],m=()=>["start","end","center","stretch","center-safe","end-safe"],b=()=>["auto",...f()],h=()=>[Q,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...f()],d=()=>[e,l,a],j=()=>[...L(),Me,Oe,{position:[l,a]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",It,St,{size:[l,a]}],H=()=>[pe,oe,J],_=()=>["","none","full",x,l,a],B=()=>["",g,oe,J],ae=()=>["solid","dashed","dotted","double"],We=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],E=()=>[g,pe,Me,Oe],Ue=()=>["","none",P,l,a],le=()=>["none",g,l,a],ce=()=>["none",g,l,a],xe=()=>[g,l,a],de=()=>[Q,"full",...f()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[q],breakpoint:[q],color:[wt],container:[q],"drop-shadow":[q],ease:["in","out","in-out"],font:[Pt],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[q],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[q],shadow:[q],spacing:["px",g],text:[q],"text-shadow":[q],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Q,a,l,z]}],container:["container"],columns:[{columns:[g,a,l,p]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[Y,"auto",l,a]}],basis:[{basis:[Q,"full","auto",p,...f()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[g,Q,"auto","initial","none",a]}],grow:[{grow:["",g,l,a]}],shrink:[{shrink:["",g,l,a]}],order:[{order:[Y,"first","last","none",l,a]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:f()}],"gap-x":[{"gap-x":f()}],"gap-y":[{"gap-y":f()}],"justify-content":[{justify:[...R(),"normal"]}],"justify-items":[{"justify-items":[...m(),"normal"]}],"justify-self":[{"justify-self":["auto",...m()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...m(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...m(),{baseline:["","last"]}]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...m(),"baseline"]}],"place-self":[{"place-self":["auto",...m()]}],p:[{p:f()}],px:[{px:f()}],py:[{py:f()}],ps:[{ps:f()}],pe:[{pe:f()}],pt:[{pt:f()}],pr:[{pr:f()}],pb:[{pb:f()}],pl:[{pl:f()}],m:[{m:b()}],mx:[{mx:b()}],my:[{my:b()}],ms:[{ms:b()}],me:[{me:b()}],mt:[{mt:b()}],mr:[{mr:b()}],mb:[{mb:b()}],ml:[{ml:b()}],"space-x":[{"space-x":f()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":f()}],"space-y-reverse":["space-y-reverse"],size:[{size:h()}],w:[{w:[p,"screen",...h()]}],"min-w":[{"min-w":[p,"screen","none",...h()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[i]},...h()]}],h:[{h:["screen","lh",...h()]}],"min-h":[{"min-h":["screen","lh","none",...h()]}],"max-h":[{"max-h":["screen","lh",...h()]}],"font-size":[{text:["base",r,oe,J]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,l,be]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pe,a]}],"font-family":[{font:[At,a,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,l,a]}],"line-clamp":[{"line-clamp":[g,"none",l,be]}],leading:[{leading:[n,...f()]}],"list-image":[{"list-image":["none",l,a]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",l,a]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:d()}],"text-color":[{text:d()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[g,"from-font","auto",l,J]}],"text-decoration-color":[{decoration:d()}],"underline-offset":[{"underline-offset":[g,"auto",l,a]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:f()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",l,a]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",l,a]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Y,l,a],radial:["",l,a],conic:[Y,l,a]},Nt,zt]}],"bg-color":[{bg:d()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:d()}],"gradient-via":[{via:d()}],"gradient-to":[{to:d()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:d()}],"border-color-x":[{"border-x":d()}],"border-color-y":[{"border-y":d()}],"border-color-s":[{"border-s":d()}],"border-color-e":[{"border-e":d()}],"border-color-t":[{"border-t":d()}],"border-color-r":[{"border-r":d()}],"border-color-b":[{"border-b":d()}],"border-color-l":[{"border-l":d()}],"divide-color":[{divide:d()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[g,l,a]}],"outline-w":[{outline:["",g,oe,J]}],"outline-color":[{outline:d()}],shadow:[{shadow:["","none",y,ie,ne]}],"shadow-color":[{shadow:d()}],"inset-shadow":[{"inset-shadow":["none",O,ie,ne]}],"inset-shadow-color":[{"inset-shadow":d()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:d()}],"ring-offset-w":[{"ring-offset":[g,J]}],"ring-offset-color":[{"ring-offset":d()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":d()}],"text-shadow":[{"text-shadow":["none",w,ie,ne]}],"text-shadow-color":[{"text-shadow":d()}],opacity:[{opacity:[g,l,a]}],"mix-blend":[{"mix-blend":[...We(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":We()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[g]}],"mask-image-linear-from-pos":[{"mask-linear-from":E()}],"mask-image-linear-to-pos":[{"mask-linear-to":E()}],"mask-image-linear-from-color":[{"mask-linear-from":d()}],"mask-image-linear-to-color":[{"mask-linear-to":d()}],"mask-image-t-from-pos":[{"mask-t-from":E()}],"mask-image-t-to-pos":[{"mask-t-to":E()}],"mask-image-t-from-color":[{"mask-t-from":d()}],"mask-image-t-to-color":[{"mask-t-to":d()}],"mask-image-r-from-pos":[{"mask-r-from":E()}],"mask-image-r-to-pos":[{"mask-r-to":E()}],"mask-image-r-from-color":[{"mask-r-from":d()}],"mask-image-r-to-color":[{"mask-r-to":d()}],"mask-image-b-from-pos":[{"mask-b-from":E()}],"mask-image-b-to-pos":[{"mask-b-to":E()}],"mask-image-b-from-color":[{"mask-b-from":d()}],"mask-image-b-to-color":[{"mask-b-to":d()}],"mask-image-l-from-pos":[{"mask-l-from":E()}],"mask-image-l-to-pos":[{"mask-l-to":E()}],"mask-image-l-from-color":[{"mask-l-from":d()}],"mask-image-l-to-color":[{"mask-l-to":d()}],"mask-image-x-from-pos":[{"mask-x-from":E()}],"mask-image-x-to-pos":[{"mask-x-to":E()}],"mask-image-x-from-color":[{"mask-x-from":d()}],"mask-image-x-to-color":[{"mask-x-to":d()}],"mask-image-y-from-pos":[{"mask-y-from":E()}],"mask-image-y-to-pos":[{"mask-y-to":E()}],"mask-image-y-from-color":[{"mask-y-from":d()}],"mask-image-y-to-color":[{"mask-y-to":d()}],"mask-image-radial":[{"mask-radial":[l,a]}],"mask-image-radial-from-pos":[{"mask-radial-from":E()}],"mask-image-radial-to-pos":[{"mask-radial-to":E()}],"mask-image-radial-from-color":[{"mask-radial-from":d()}],"mask-image-radial-to-color":[{"mask-radial-to":d()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":L()}],"mask-image-conic-pos":[{"mask-conic":[g]}],"mask-image-conic-from-pos":[{"mask-conic-from":E()}],"mask-image-conic-to-pos":[{"mask-conic-to":E()}],"mask-image-conic-from-color":[{"mask-conic-from":d()}],"mask-image-conic-to-color":[{"mask-conic-to":d()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",l,a]}],filter:[{filter:["","none",l,a]}],blur:[{blur:Ue()}],brightness:[{brightness:[g,l,a]}],contrast:[{contrast:[g,l,a]}],"drop-shadow":[{"drop-shadow":["","none",C,ie,ne]}],"drop-shadow-color":[{"drop-shadow":d()}],grayscale:[{grayscale:["",g,l,a]}],"hue-rotate":[{"hue-rotate":[g,l,a]}],invert:[{invert:["",g,l,a]}],saturate:[{saturate:[g,l,a]}],sepia:[{sepia:["",g,l,a]}],"backdrop-filter":[{"backdrop-filter":["","none",l,a]}],"backdrop-blur":[{"backdrop-blur":Ue()}],"backdrop-brightness":[{"backdrop-brightness":[g,l,a]}],"backdrop-contrast":[{"backdrop-contrast":[g,l,a]}],"backdrop-grayscale":[{"backdrop-grayscale":["",g,l,a]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g,l,a]}],"backdrop-invert":[{"backdrop-invert":["",g,l,a]}],"backdrop-opacity":[{"backdrop-opacity":[g,l,a]}],"backdrop-saturate":[{"backdrop-saturate":[g,l,a]}],"backdrop-sepia":[{"backdrop-sepia":["",g,l,a]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":f()}],"border-spacing-x":[{"border-spacing-x":f()}],"border-spacing-y":[{"border-spacing-y":f()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",l,a]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[g,"initial",l,a]}],ease:[{ease:["linear","initial",D,l,a]}],delay:[{delay:[g,l,a]}],animate:[{animate:["none",$,l,a]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,l,a]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[l,a,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":["translate-none"],accent:[{accent:d()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:d()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",l,a]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":f()}],"scroll-mx":[{"scroll-mx":f()}],"scroll-my":[{"scroll-my":f()}],"scroll-ms":[{"scroll-ms":f()}],"scroll-me":[{"scroll-me":f()}],"scroll-mt":[{"scroll-mt":f()}],"scroll-mr":[{"scroll-mr":f()}],"scroll-mb":[{"scroll-mb":f()}],"scroll-ml":[{"scroll-ml":f()}],"scroll-p":[{"scroll-p":f()}],"scroll-px":[{"scroll-px":f()}],"scroll-py":[{"scroll-py":f()}],"scroll-ps":[{"scroll-ps":f()}],"scroll-pe":[{"scroll-pe":f()}],"scroll-pt":[{"scroll-pt":f()}],"scroll-pr":[{"scroll-pr":f()}],"scroll-pb":[{"scroll-pb":f()}],"scroll-pl":[{"scroll-pl":f()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",l,a]}],fill:[{fill:["none",...d()]}],"stroke-w":[{stroke:[g,oe,J,be]}],stroke:[{stroke:["none",...d()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function v(...e){return Mt(qe(e))}const Et={purple:"bg-purple-500",green:"bg-green-500",blue:"bg-blue-500",yellow:"bg-yellow-400 !text-yellow-900",red:"bg-red-500"},_e=({id:e,title:o,price:r,periodLabel:t,features:s,isSelected:n,onSelect:i,isCurrentPlan:p=!1,topBadge:c,discountBadge:x,premiumCallout:y,bottomNote:O,introPriceNote:w,isBestValue:C=!1,ctaButton:P,className:S,children:z,disabled:D=!1,enabled:$=!0,ariaLabel:G,onTrack:L,trackingLabel:k,componentName:M="SubscriptionTile",hideSelectionIndicator:F=!1})=>{const f=!!P,V=!F&&!p&&$,U=$&&!p&&!D,te=n?"bg-blue-600 text-white border-2 border-blue-600 shadow-md":p?"bg-gray-100 dark:bg-gray-800 border-2 border-blue-500 dark:border-blue-400 shadow-md":$?"bg-gray-100 dark:bg-gray-800 border-2 border-gray-200 dark:border-gray-700 shadow-md hover:border-gray-300 dark:hover:border-gray-600":"bg-gray-100 dark:bg-gray-800 border-2 border-gray-200 dark:border-gray-700 opacity-50 shadow-md",X=()=>{U&&!f&&(L?.({action:"select",trackingLabel:k,componentName:M}),i())},re=m=>{U&&!f&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),L?.({action:"select",trackingLabel:k,componentName:M}),i())},R=m=>{m.stopPropagation(),L?.({action:"cta_click",trackingLabel:k,componentName:M}),P?.onClick&&P.onClick()};return u.jsxs("div",{className:v("relative rounded-2xl p-6 transition-all flex flex-col h-full",!U||f?"cursor-default":"cursor-pointer",D&&"cursor-not-allowed",te,S),onClick:X,onKeyDown:re,role:f?"article":"radio","aria-checked":f?void 0:n,"aria-label":G||`${o} - ${r}${t||""}`,"aria-disabled":!U,tabIndex:f||!U?-1:0,children:[c&&u.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:u.jsx("span",{className:v(Et[c.color],"text-white px-4 py-1.5 rounded-full text-sm font-semibold shadow-lg whitespace-nowrap"),children:c.text})}),u.jsxs("div",{className:"flex-1 flex flex-col",children:[u.jsxs("div",{className:v("text-center mb-6",c&&"mt-2"),children:[u.jsx("h3",{className:v(ue.textVariants.heading.h4(),"mb-2",n?"text-white":""),children:o}),u.jsxs("div",{className:"mb-3",children:[u.jsx("span",{className:v("text-4xl font-bold",n?"text-white":"text-gray-900 dark:text-gray-100"),children:r}),t&&u.jsx("span",{className:v("text-lg",n?"text-blue-100":"text-gray-500 dark:text-gray-400"),children:t})]}),x&&u.jsx("div",{className:v("inline-flex items-center px-2 py-1 rounded-full text-sm font-semibold",n?"bg-blue-500 text-white":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"),children:x.text})]}),z,s.length>0&&u.jsx("div",{className:"space-y-3 mb-6",children:s.map((m,b)=>u.jsxs("div",{className:"flex items-start",children:[u.jsx("svg",{className:v("w-5 h-5 mr-3 flex-shrink-0",n?"text-blue-200":"text-green-500"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),u.jsx("span",{className:v("text-sm text-left",n?"text-white":"text-gray-700 dark:text-gray-300"),children:m.replace(/^✓\s*/,"")})]},b))}),y&&u.jsxs("div",{className:v("rounded-lg p-4 mb-4",n?"bg-blue-500/30":"bg-gradient-to-r from-purple-50 to-blue-50 dark:from-purple-900/20 dark:to-blue-900/20"),children:[u.jsx("div",{className:"flex items-center mb-2",children:u.jsx("span",{className:v("font-semibold text-sm",n?"text-white":"text-purple-600 dark:text-purple-400"),children:y.title})}),u.jsx("ul",{className:v("text-xs space-y-1",n?"text-blue-100":"text-gray-600 dark:text-gray-400"),children:y.features.map((m,b)=>u.jsxs("li",{children:["• ",m]},b))})]}),O&&u.jsx("div",{className:v("text-center text-sm font-medium mb-4",n?"text-blue-100":"text-blue-600 dark:text-blue-400"),children:O}),w&&u.jsx("div",{className:v("p-3 rounded-lg",n?"bg-blue-500/30":"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800"),children:u.jsx("p",{className:v("text-sm font-semibold text-center",n?"text-white":"text-yellow-700 dark:text-yellow-300"),children:w})})]}),u.jsxs("div",{className:"h-14 flex-shrink-0 flex items-end justify-center",children:[V&&f&&u.jsx("div",{className:"w-full",children:P.href?u.jsx("a",{href:P.href,className:v("block w-full py-3 font-semibold rounded-lg text-center transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700"),onClick:m=>m.stopPropagation(),children:P.label}):u.jsx("button",{onClick:R,disabled:D,className:v("w-full py-3 font-semibold rounded-lg transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700",D&&"opacity-50 cursor-not-allowed"),children:P.label})}),V&&!f&&u.jsx("div",{className:v("w-5 h-5 rounded-full border-2 flex items-center justify-center",n?"border-white bg-white":"border-gray-300 dark:border-gray-600"),children:n&&u.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-600"})})]})]})},Tt=({title:e,children:o,error:r,variant:t="selection",currentStatus:s,primaryAction:n,secondaryAction:i,minTileWidth:p=240,className:c,headerContent:x,aboveProducts:y,footerContent:O,currentStatusLabel:w="Current Status",freeTileConfig:C,onTrack:P,trackingLabel:S,componentName:z="SubscriptionLayout"})=>{const D=t==="selection"&&n,$=()=>{P?.({action:"primary_action",trackingLabel:S,componentName:z}),n?.onClick()},G=()=>{P?.({action:"secondary_action",trackingLabel:S,componentName:z}),i?.onClick()},L=t==="cta"&&C,k={display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, ${p}px), 1fr))`,gap:"1.5rem"};return u.jsxs("div",{className:c,children:[x,s&&u.jsxs(u.Fragment,{children:[u.jsx("h2",{className:v(ue.textVariants.heading.h3(),"mb-4"),children:w}),s.isActive?u.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 mb-6",children:[u.jsxs("div",{className:"flex items-center mb-2",children:[u.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full mr-3"}),u.jsx("span",{className:"font-semibold text-green-800 dark:text-green-300",children:s.activeContent?.title||"Active Subscription"})]}),s.activeContent?.fields&&s.activeContent.fields.length>0&&u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:s.activeContent.fields.map((M,F)=>u.jsxs("div",{children:[u.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:M.label}),u.jsx("p",{className:"font-semibold text-green-800 dark:text-green-300",children:M.value})]},F))})]}):u.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 mb-6",children:[u.jsxs("div",{className:"flex items-center mb-2",children:[u.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full mr-3"}),u.jsx("span",{className:"font-semibold text-yellow-800 dark:text-yellow-300",children:s.inactiveContent?.title||"No Active Subscription"})]}),s.inactiveContent?.message&&u.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:s.inactiveContent.message})]})]}),u.jsx("h2",{className:v(ue.textVariants.heading.h3(),"mb-4"),children:e}),y,u.jsxs("div",{style:k,children:[L&&u.jsx(_e,{id:"free",title:C.title,price:C.price,periodLabel:C.periodLabel,features:C.features,isSelected:!1,onSelect:()=>{},topBadge:C.topBadge,ctaButton:C.ctaButton}),o]}),O,r&&u.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 mt-6",children:u.jsx("p",{className:"text-red-600 dark:text-red-400",children:r})}),D&&u.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[i&&u.jsx(ye.Button,{onClick:G,disabled:i.disabled||i.loading,variant:"outline",className:"sm:flex-shrink-0",children:i.label}),u.jsx(ye.Button,{onClick:$,disabled:n.disabled||n.loading,className:"flex-1",children:n.label})]})]})};function jt({options:e,value:o,onChange:r,className:t,disabled:s=!1,size:n="md"}){const i={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"};return u.jsx("div",{className:v("inline-flex rounded-lg bg-gray-100 dark:bg-gray-800 p-1",s&&"opacity-50",t),role:"radiogroup",children:e.map(p=>{const c=o===p.value;return u.jsx("button",{type:"button",role:"radio","aria-checked":c,disabled:s,onClick:()=>!s&&r(p.value),className:v(i[n],"font-medium rounded-md transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",c?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",s&&"cursor-not-allowed"),children:p.label},p.value)})})}let ge=null;const Gt=async()=>(ge||(ge=await import("@revenuecat/purchases-js")),ge);let T=null;const Fe=(e,o)=>{const r=e.rcBillingProduct,t=r?.defaultSubscriptionOption,s=typeof o?.entitlement=="string"?o.entitlement:void 0;return{identifier:e.identifier,productId:r?.identifier||void 0,price:r?.currentPrice?.amountMicros?(r.currentPrice.amountMicros/1e6).toFixed(2):"0",priceString:r?.currentPrice?.formattedPrice||"$0",title:r?.title||e.identifier,description:r?.description||"",period:r?.normalPeriodDuration||void 0,introPrice:t?.introPrice?.price?.formattedPrice||void 0,introPriceAmount:t?.introPrice?.price?.amountMicros?(t.introPrice.price.amountMicros/1e6).toFixed(2):void 0,introPricePeriod:t?.introPrice?.periodDuration||void 0,introPriceCycles:t?.introPrice?.cycleCount||void 0,freeTrialPeriod:t?.trial?.periodDuration||void 0,entitlement:s}},he=e=>{const o=Object.keys(e.entitlements.active);if(o.length>0){const r=o[0],t=e.entitlements.active[r];return{isActive:!0,expirationDate:t.expirationDate?new Date(t.expirationDate):void 0,purchaseDate:t.latestPurchaseDate?new Date(t.latestPurchaseDate):void 0,productIdentifier:t.productIdentifier,willRenew:t.willRenew,isSandbox:t.isSandbox,unsubscribeDetectedAt:t.unsubscribeDetectedAt?new Date(t.unsubscribeDetectedAt):void 0,billingIssueDetectedAt:t.billingIssueDetectedAt?new Date(t.billingIssueDetectedAt):void 0,activeEntitlements:o}}return{isActive:!1}},Ve=I.createContext(void 0),Lt=({apiKey:e,userEmail:o,onError:r,onPurchaseSuccess:t,children:s})=>{const[n,i]=I.useState([]),[p,c]=I.useState(null),[x,y]=I.useState(!1),[O,w]=I.useState(null),[C,P]=I.useState(!1),[S,z]=I.useState(null),[D,$]=I.useState(null),[G,L]=I.useState(null),k=!e||e==="your_revenuecat_api_key_here",M=I.useCallback(()=>{i([]),c(null),$(null),L(null),w(null),P(!1),z(null),T=null},[]),F=I.useCallback(async()=>{if(T)try{const m=await T.getOfferings();m.current&&$(m.current);const b=m.all;if(b){L(b);const h=[];for(const d of Object.keys(b)){const j=b[d];if(j?.availablePackages){const K=j.metadata,W=j.availablePackages.map(H=>Fe(H,K));h.push(...W)}}i(h)}else if(m.current){const h=m.current.metadata,d=m.current.availablePackages.map(j=>Fe(j,h));i(d)}}catch(m){const b=m instanceof Error?m.message:"Failed to load offerings";w(b),r?.(m instanceof Error?m:new Error(b))}},[r]),f=I.useCallback(async()=>{if(T)try{const m=await T.getCustomerInfo(),b=he(m);c(b.isActive?b:null)}catch(m){const b=m instanceof Error?m.message:"Failed to load subscription status";w(b),r?.(m instanceof Error?m:new Error(b))}},[r]),V=I.useCallback(async(m,b)=>{if(!m){M();return}if(S&&S!==m&&M(),!(C&&S===m))try{if(y(!0),w(null),k)console.warn("[SubscriptionProvider] RevenueCat API key not configured"),i([]),c(null);else{const h=await Gt(),d={apiKey:e,appUserId:m};T=h.Purchases.configure(d);const j=b||o;if(j&&T)try{await T.setAttributes({email:j})}catch{}await Promise.all([F(),f()])}z(m),P(!0)}catch(h){const d=h instanceof Error?h.message:"Failed to initialize";w(d),c(null),i([]),r?.(h instanceof Error?h:new Error(d))}finally{y(!1)}},[S,C,k,e,o,F,f,r,M]),U=I.useCallback(async(m,b)=>{try{if(y(!0),w(null),k){await new Promise(W=>setTimeout(W,2e3));const K={isActive:!0,expirationDate:new Date(Date.now()+365*24*60*60*1e3),purchaseDate:new Date,productIdentifier:m,willRenew:!0};return c(K),t?.(m),!0}if(!T||!D&&!G)throw new Error("Subscription service not initialized");let h;if(G)for(const K of Object.keys(G)){const W=G[K];if(W?.availablePackages&&(h=W.availablePackages.find(H=>H.identifier===m),h))break}else D&&(h=D.availablePackages.find(W=>W.identifier===m));if(!h)throw new Error(`Package not found: ${m}`);const d=await T.purchase({rcPackage:h,...o?{customerEmail:o}:{}}),j=he(d.customerInfo);return c(j.isActive?j:null),j.isActive&&t?.(m),j.isActive}catch(h){const d=h instanceof Error?h.message:"Purchase failed";return w(d),r?.(h instanceof Error?h:new Error(d)),!1}finally{y(!1)}},[k,D,G,o,t,r]),te=I.useCallback(async m=>{try{if(y(!0),w(null),k)return await new Promise(d=>setTimeout(d,1e3)),w("No previous purchases found"),!1;if(!T)throw new Error("Subscription service not initialized");const b=await T.getCustomerInfo(),h=he(b);return c(h.isActive?h:null),h.isActive||w("No previous purchases found"),h.isActive}catch(b){const h=b instanceof Error?b.message:"Restore failed";return w(h),r?.(b instanceof Error?b:new Error(h)),!1}finally{y(!1)}},[k,r]),X=I.useCallback(async()=>{if(!k)try{w(null),await Promise.all([f(),F()])}catch(m){const b=m instanceof Error?m.message:"Refresh failed";w(b),r?.(m instanceof Error?m:new Error(b))}},[k,f,F,r]),re=I.useCallback(()=>{w(null)},[]);I.useEffect(()=>{if(!C||k||!T)return;const m=setInterval(()=>{f().catch(()=>{})},300*1e3);return()=>clearInterval(m)},[C,k,f]);const R={products:n,currentSubscription:p,isLoading:x,error:O,initialize:V,purchase:U,restore:te,refresh:X,clearError:re};return u.jsx(Ve.Provider,{value:R,children:s})},_t=()=>{const e=I.useContext(Ve);if(!e)throw new Error("useSubscriptionContext must be used within a SubscriptionProvider");return e},$e=()=>{try{const e=[];for(let r=0;r<localStorage.length;r++){const t=localStorage.key(r);t&&(t.includes("revenuecat")||t.includes("rcb")||t.includes("rc_"))&&e.push(t)}e.forEach(r=>localStorage.removeItem(r));const o=[];for(let r=0;r<sessionStorage.length;r++){const t=sessionStorage.key(r);t&&(t.includes("revenuecat")||t.includes("rcb")||t.includes("rc_"))&&o.push(t)}o.forEach(r=>sessionStorage.removeItem(r))}catch{}},Ft=()=>{try{T&&(T.close(),T=null),$e()}catch{}};class Be{constructor(){this.offersCache=new Map,this.currentSubscription=null}loadOfferings(o){this.offersCache.clear();const r=o.all;if(r)for(const[t,s]of Object.entries(r)){const n=this.parseOffer(t,s);this.offersCache.set(t,n)}else if(o.current){const t=this.parseOffer("default",o.current);this.offersCache.set("default",t)}}loadCustomerInfo(o){const r=Object.keys(o.entitlements.active);if(r.length===0){this.currentSubscription={isActive:!1,entitlements:[]};return}const t=r.map(n=>({identifier:n})),s=o.entitlements.active[r[0]];this.currentSubscription={isActive:!0,entitlements:t,productId:s.productIdentifier,expirationDate:s.expirationDate?new Date(s.expirationDate):void 0,willRenew:s.willRenew}}getOffer(o){return this.offersCache.get(o)??null}getOfferIds(){return Array.from(this.offersCache.keys())}getCurrentSubscription(){return this.currentSubscription}parseOffer(o,r){const t=r,s=t.metadata,n=[];if(t.availablePackages)for(const i of t.availablePackages)n.push(this.parsePackage(i,s));return{offerId:o,metadata:s,packages:n}}parsePackage(o,r){const t=o.rcBillingProduct,s=t?.defaultSubscriptionOption,n=this.extractEntitlements(r),i={productId:t?.identifier??o.identifier,name:t?.title??o.identifier,description:t?.description??void 0,price:t?.currentPrice?.amountMicros?t.currentPrice.amountMicros/1e6:0,priceString:t?.currentPrice?.formattedPrice??"$0",currency:t?.currentPrice?.currency??void 0,billingCycle:t?.normalPeriodDuration??void 0,trialPeriod:s?.trial?.periodDuration??void 0,introPrice:s?.introPrice?.price?.formattedPrice??void 0,introPricePeriod:s?.introPrice?.periodDuration??void 0,introPriceCycles:s?.introPrice?.cycleCount??void 0};return{packageId:o.identifier,name:t?.title??o.identifier,product:i,entitlements:n}}extractEntitlements(o){const r=[];if(!o)return r;if(o.entitlement&&typeof o.entitlement=="string"&&r.push({identifier:o.entitlement}),Array.isArray(o.entitlements))for(const t of o.entitlements)typeof t=="string"?r.push({identifier:t}):typeof t=="object"&&t!==null&&typeof t.identifier=="string"&&r.push({identifier:t.identifier});return r}}function Vt(){return new Be}A.SegmentedControl=jt,A.SubscriptionLayout=Tt,A.SubscriptionProvider=Lt,A.SubscriptionService=Be,A.SubscriptionTile=_e,A.clearRevenueCatCheckoutSessions=$e,A.closeRevenueCatInstance=Ft,A.cn=v,A.createSubscriptionService=Vt,A.useSubscriptionContext=_t,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(N,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react/jsx-runtime"),require("@sudobility/design"),require("@sudobility/components"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@sudobility/design","@sudobility/components","react"],d):(N=typeof globalThis<"u"?globalThis:N||self,d(N.SubscriptionComponents={},N.ReactJSXRuntime,N.SudobilityDesign,N.SudobilityComponents,N.React))})(this,(function(N,d,de,ye,D){"use strict";function we(e){var o,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(o=0;o<s;o++)e[o]&&(r=we(e[o]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function qe(){for(var e,o,r=0,t="",s=arguments.length;r<s;r++)(e=arguments[r])&&(o=we(e))&&(t&&(t+=" "),t+=o);return t}const Ke=(e,o)=>{const r=new Array(e.length+o.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let t=0;t<o.length;t++)r[e.length+t]=o[t];return r},Ye=(e,o)=>({classGroupId:e,validator:o}),ve=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),oe="-",ke=[],Xe="arbitrary..",Je=e=>{const o=He(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Re(i);const p=i.split(oe),c=p[0]===""&&p.length>1?1:0;return Ce(p,c,o)},getConflictingClassGroupIds:(i,p)=>{if(p){const c=t[i],x=r[i];return c?x?Ke(x,c):c:x||ke}return r[i]||ke}}},Ce=(e,o,r)=>{if(e.length-o===0)return r.classGroupId;const s=e[o],n=r.nextPart.get(s);if(n){const x=Ce(e,o+1,n);if(x)return x}const i=r.validators;if(i===null)return;const p=o===0?e.join(oe):e.slice(o).join(oe),c=i.length;for(let x=0;x<c;x++){const w=i[x];if(w.validator(p))return w.classGroupId}},Re=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=e.slice(1,-1),r=o.indexOf(":"),t=o.slice(0,r);return t?Xe+t:void 0})(),He=e=>{const{theme:o,classGroups:r}=e;return Qe(r,o)},Qe=(e,o)=>{const r=ve();for(const t in e){const s=e[t];ue(s,r,t,o)}return r},ue=(e,o,r,t)=>{const s=e.length;for(let n=0;n<s;n++){const i=e[n];Ze(i,o,r,t)}},Ze=(e,o,r,t)=>{if(typeof e=="string"){et(e,o,r);return}if(typeof e=="function"){tt(e,o,r,t);return}rt(e,o,r,t)},et=(e,o,r)=>{const t=e===""?o:Pe(o,e);t.classGroupId=r},tt=(e,o,r,t)=>{if(ot(e)){ue(e(t),o,r,t);return}o.validators===null&&(o.validators=[]),o.validators.push(Ye(r,e))},rt=(e,o,r,t)=>{const s=Object.entries(e),n=s.length;for(let i=0;i<n;i++){const[p,c]=s[i];ue(c,Pe(o,p),r,t)}},Pe=(e,o)=>{let r=e;const t=o.split(oe),s=t.length;for(let n=0;n<s;n++){const i=t[n];let p=r.nextPart.get(i);p||(p=ve(),r.nextPart.set(i,p)),r=p}return r},ot=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,st=e=>{if(e<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null);const s=(n,i)=>{r[n]=i,o++,o>e&&(o=0,t=r,r=Object.create(null))};return{get(n){let i=r[n];if(i!==void 0)return i;if((i=t[n])!==void 0)return s(n,i),i},set(n,i){n in r?r[n]=i:s(n,i)}}},fe="!",Se=":",nt=[],ze=(e,o,r,t,s)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:s}),it=e=>{const{prefix:o,experimentalParseClassName:r}=e;let t=s=>{const n=[];let i=0,p=0,c=0,x;const w=s.length;for(let z=0;z<w;z++){const A=s[z];if(i===0&&p===0){if(A===Se){n.push(s.slice(c,z)),c=z+1;continue}if(A==="/"){x=z;continue}}A==="["?i++:A==="]"?i--:A==="("?p++:A===")"&&p--}const E=n.length===0?s:s.slice(c);let y=E,P=!1;E.endsWith(fe)?(y=E.slice(0,-1),P=!0):E.startsWith(fe)&&(y=E.slice(1),P=!0);const S=x&&x>c?x-c:void 0;return ze(n,P,y,S)};if(o){const s=o+Se,n=t;t=i=>i.startsWith(s)?n(i.slice(s.length)):ze(nt,!1,i,void 0,!0)}if(r){const s=t;t=n=>r({className:n,parseClassName:s})}return t},at=e=>{const o=new Map;return e.orderSensitiveModifiers.forEach((r,t)=>{o.set(r,1e6+t)}),r=>{const t=[];let s=[];for(let n=0;n<r.length;n++){const i=r[n],p=i[0]==="[",c=o.has(i);p||c?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(i)):s.push(i)}return s.length>0&&(s.sort(),t.push(...s)),t}},lt=e=>({cache:st(e.cacheSize),parseClassName:it(e),sortModifiers:at(e),...Je(e)}),ct=/\s+/,dt=(e,o)=>{const{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:s,sortModifiers:n}=o,i=[],p=e.trim().split(ct);let c="";for(let x=p.length-1;x>=0;x-=1){const w=p[x],{isExternal:E,modifiers:y,hasImportantModifier:P,baseClassName:S,maybePostfixModifierPosition:z}=r(w);if(E){c=w+(c.length>0?" "+c:c);continue}let A=!!z,M=t(A?S.substring(0,z):S);if(!M){if(!A){c=w+(c.length>0?" "+c:c);continue}if(M=t(S),!M){c=w+(c.length>0?" "+c:c);continue}A=!1}const $=y.length===0?"":y.length===1?y[0]:n(y).join(":"),L=P?$+fe:$,_=L+M;if(i.indexOf(_)>-1)continue;i.push(_);const C=s(M,A);for(let I=0;I<C.length;++I){const G=C[I];i.push(L+G)}c=w+(c.length>0?" "+c:c)}return c},ut=(...e)=>{let o=0,r,t,s="";for(;o<e.length;)(r=e[o++])&&(t=Ae(r))&&(s&&(s+=" "),s+=t);return s},Ae=e=>{if(typeof e=="string")return e;let o,r="";for(let t=0;t<e.length;t++)e[t]&&(o=Ae(e[t]))&&(r&&(r+=" "),r+=o);return r},ft=(e,...o)=>{let r,t,s,n;const i=c=>{const x=o.reduce((w,E)=>E(w),e());return r=lt(x),t=r.cache.get,s=r.cache.set,n=p,p(c)},p=c=>{const x=t(c);if(x)return x;const w=dt(c,r);return s(c,w),w};return n=i,(...c)=>n(ut(...c))},mt=[],O=e=>{const o=r=>r[e]||mt;return o.isThemeGetter=!0,o},Ie=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ne=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pt=/^\d+\/\d+$/,bt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ht=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,xt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,R=e=>pt.test(e),h=e=>!!e&&!Number.isNaN(Number(e)),Y=e=>!!e&&Number.isInteger(Number(e)),me=e=>e.endsWith("%")&&h(e.slice(0,-1)),q=e=>bt.test(e),wt=()=>!0,vt=e=>gt.test(e)&&!ht.test(e),De=()=>!1,kt=e=>xt.test(e),Ct=e=>yt.test(e),Pt=e=>!a(e)&&!l(e),St=e=>H(e,je,De),a=e=>Ie.test(e),J=e=>H(e,Ge,vt),pe=e=>H(e,Dt,h),Oe=e=>H(e,Ee,De),zt=e=>H(e,Te,Ct),se=e=>H(e,Le,kt),l=e=>Ne.test(e),re=e=>Q(e,Ge),At=e=>Q(e,Ot),Me=e=>Q(e,Ee),It=e=>Q(e,je),Nt=e=>Q(e,Te),ne=e=>Q(e,Le,!0),H=(e,o,r)=>{const t=Ie.exec(e);return t?t[1]?o(t[1]):r(t[2]):!1},Q=(e,o,r=!1)=>{const t=Ne.exec(e);return t?t[1]?o(t[1]):r:!1},Ee=e=>e==="position"||e==="percentage",Te=e=>e==="image"||e==="url",je=e=>e==="length"||e==="size"||e==="bg-size",Ge=e=>e==="length",Dt=e=>e==="number",Ot=e=>e==="family-name",Le=e=>e==="shadow",Mt=ft(()=>{const e=O("color"),o=O("font"),r=O("text"),t=O("font-weight"),s=O("tracking"),n=O("leading"),i=O("breakpoint"),p=O("container"),c=O("spacing"),x=O("radius"),w=O("shadow"),E=O("inset-shadow"),y=O("text-shadow"),P=O("drop-shadow"),S=O("blur"),z=O("perspective"),A=O("aspect"),M=O("ease"),$=O("animate"),L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[..._(),l,a],I=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto","contain","none"],f=()=>[l,a,c],V=()=>[R,"full","auto",...f()],U=()=>[Y,"none","subgrid",l,a],Z=()=>["auto",{span:["full",Y,l,a]},Y,l,a],X=()=>[Y,"auto",l,a],ee=()=>["auto","min","max","fr",l,a],m=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],b=()=>["start","end","center","stretch","center-safe","end-safe"],g=()=>["auto",...f()],v=()=>[R,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...f()],u=()=>[e,l,a],K=()=>[..._(),Me,Oe,{position:[l,a]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",It,St,{size:[l,a]}],he=()=>[me,re,J],F=()=>["","none","full",x,l,a],B=()=>["",h,re,J],ie=()=>["solid","dashed","dotted","double"],We=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],T=()=>[h,me,Me,Oe],Ue=()=>["","none",S,l,a],ae=()=>["none",h,l,a],le=()=>["none",h,l,a],xe=()=>[h,l,a],ce=()=>[R,"full",...f()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[q],breakpoint:[q],color:[wt],container:[q],"drop-shadow":[q],ease:["in","out","in-out"],font:[Pt],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[q],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[q],shadow:[q],spacing:["px",h],text:[q],"text-shadow":[q],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",R,a,l,A]}],container:["container"],columns:[{columns:[h,a,l,p]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[Y,"auto",l,a]}],basis:[{basis:[R,"full","auto",p,...f()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[h,R,"auto","initial","none",a]}],grow:[{grow:["",h,l,a]}],shrink:[{shrink:["",h,l,a]}],order:[{order:[Y,"first","last","none",l,a]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:f()}],"gap-x":[{"gap-x":f()}],"gap-y":[{"gap-y":f()}],"justify-content":[{justify:[...m(),"normal"]}],"justify-items":[{"justify-items":[...b(),"normal"]}],"justify-self":[{"justify-self":["auto",...b()]}],"align-content":[{content:["normal",...m()]}],"align-items":[{items:[...b(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...b(),{baseline:["","last"]}]}],"place-content":[{"place-content":m()}],"place-items":[{"place-items":[...b(),"baseline"]}],"place-self":[{"place-self":["auto",...b()]}],p:[{p:f()}],px:[{px:f()}],py:[{py:f()}],ps:[{ps:f()}],pe:[{pe:f()}],pt:[{pt:f()}],pr:[{pr:f()}],pb:[{pb:f()}],pl:[{pl:f()}],m:[{m:g()}],mx:[{mx:g()}],my:[{my:g()}],ms:[{ms:g()}],me:[{me:g()}],mt:[{mt:g()}],mr:[{mr:g()}],mb:[{mb:g()}],ml:[{ml:g()}],"space-x":[{"space-x":f()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":f()}],"space-y-reverse":["space-y-reverse"],size:[{size:v()}],w:[{w:[p,"screen",...v()]}],"min-w":[{"min-w":[p,"screen","none",...v()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[i]},...v()]}],h:[{h:["screen","lh",...v()]}],"min-h":[{"min-h":["screen","lh","none",...v()]}],"max-h":[{"max-h":["screen","lh",...v()]}],"font-size":[{text:["base",r,re,J]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,l,pe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",me,a]}],"font-family":[{font:[At,a,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,l,a]}],"line-clamp":[{"line-clamp":[h,"none",l,pe]}],leading:[{leading:[n,...f()]}],"list-image":[{"list-image":["none",l,a]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",l,a]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:u()}],"text-color":[{text:u()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[h,"from-font","auto",l,J]}],"text-decoration-color":[{decoration:u()}],"underline-offset":[{"underline-offset":[h,"auto",l,a]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:f()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",l,a]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",l,a]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:K()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Y,l,a],radial:["",l,a],conic:[Y,l,a]},Nt,zt]}],"bg-color":[{bg:u()}],"gradient-from-pos":[{from:he()}],"gradient-via-pos":[{via:he()}],"gradient-to-pos":[{to:he()}],"gradient-from":[{from:u()}],"gradient-via":[{via:u()}],"gradient-to":[{to:u()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:u()}],"border-color-x":[{"border-x":u()}],"border-color-y":[{"border-y":u()}],"border-color-s":[{"border-s":u()}],"border-color-e":[{"border-e":u()}],"border-color-t":[{"border-t":u()}],"border-color-r":[{"border-r":u()}],"border-color-b":[{"border-b":u()}],"border-color-l":[{"border-l":u()}],"divide-color":[{divide:u()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[h,l,a]}],"outline-w":[{outline:["",h,re,J]}],"outline-color":[{outline:u()}],shadow:[{shadow:["","none",w,ne,se]}],"shadow-color":[{shadow:u()}],"inset-shadow":[{"inset-shadow":["none",E,ne,se]}],"inset-shadow-color":[{"inset-shadow":u()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:u()}],"ring-offset-w":[{"ring-offset":[h,J]}],"ring-offset-color":[{"ring-offset":u()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":u()}],"text-shadow":[{"text-shadow":["none",y,ne,se]}],"text-shadow-color":[{"text-shadow":u()}],opacity:[{opacity:[h,l,a]}],"mix-blend":[{"mix-blend":[...We(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":We()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[h]}],"mask-image-linear-from-pos":[{"mask-linear-from":T()}],"mask-image-linear-to-pos":[{"mask-linear-to":T()}],"mask-image-linear-from-color":[{"mask-linear-from":u()}],"mask-image-linear-to-color":[{"mask-linear-to":u()}],"mask-image-t-from-pos":[{"mask-t-from":T()}],"mask-image-t-to-pos":[{"mask-t-to":T()}],"mask-image-t-from-color":[{"mask-t-from":u()}],"mask-image-t-to-color":[{"mask-t-to":u()}],"mask-image-r-from-pos":[{"mask-r-from":T()}],"mask-image-r-to-pos":[{"mask-r-to":T()}],"mask-image-r-from-color":[{"mask-r-from":u()}],"mask-image-r-to-color":[{"mask-r-to":u()}],"mask-image-b-from-pos":[{"mask-b-from":T()}],"mask-image-b-to-pos":[{"mask-b-to":T()}],"mask-image-b-from-color":[{"mask-b-from":u()}],"mask-image-b-to-color":[{"mask-b-to":u()}],"mask-image-l-from-pos":[{"mask-l-from":T()}],"mask-image-l-to-pos":[{"mask-l-to":T()}],"mask-image-l-from-color":[{"mask-l-from":u()}],"mask-image-l-to-color":[{"mask-l-to":u()}],"mask-image-x-from-pos":[{"mask-x-from":T()}],"mask-image-x-to-pos":[{"mask-x-to":T()}],"mask-image-x-from-color":[{"mask-x-from":u()}],"mask-image-x-to-color":[{"mask-x-to":u()}],"mask-image-y-from-pos":[{"mask-y-from":T()}],"mask-image-y-to-pos":[{"mask-y-to":T()}],"mask-image-y-from-color":[{"mask-y-from":u()}],"mask-image-y-to-color":[{"mask-y-to":u()}],"mask-image-radial":[{"mask-radial":[l,a]}],"mask-image-radial-from-pos":[{"mask-radial-from":T()}],"mask-image-radial-to-pos":[{"mask-radial-to":T()}],"mask-image-radial-from-color":[{"mask-radial-from":u()}],"mask-image-radial-to-color":[{"mask-radial-to":u()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[h]}],"mask-image-conic-from-pos":[{"mask-conic-from":T()}],"mask-image-conic-to-pos":[{"mask-conic-to":T()}],"mask-image-conic-from-color":[{"mask-conic-from":u()}],"mask-image-conic-to-color":[{"mask-conic-to":u()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:K()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",l,a]}],filter:[{filter:["","none",l,a]}],blur:[{blur:Ue()}],brightness:[{brightness:[h,l,a]}],contrast:[{contrast:[h,l,a]}],"drop-shadow":[{"drop-shadow":["","none",P,ne,se]}],"drop-shadow-color":[{"drop-shadow":u()}],grayscale:[{grayscale:["",h,l,a]}],"hue-rotate":[{"hue-rotate":[h,l,a]}],invert:[{invert:["",h,l,a]}],saturate:[{saturate:[h,l,a]}],sepia:[{sepia:["",h,l,a]}],"backdrop-filter":[{"backdrop-filter":["","none",l,a]}],"backdrop-blur":[{"backdrop-blur":Ue()}],"backdrop-brightness":[{"backdrop-brightness":[h,l,a]}],"backdrop-contrast":[{"backdrop-contrast":[h,l,a]}],"backdrop-grayscale":[{"backdrop-grayscale":["",h,l,a]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h,l,a]}],"backdrop-invert":[{"backdrop-invert":["",h,l,a]}],"backdrop-opacity":[{"backdrop-opacity":[h,l,a]}],"backdrop-saturate":[{"backdrop-saturate":[h,l,a]}],"backdrop-sepia":[{"backdrop-sepia":["",h,l,a]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":f()}],"border-spacing-x":[{"border-spacing-x":f()}],"border-spacing-y":[{"border-spacing-y":f()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",l,a]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[h,"initial",l,a]}],ease:[{ease:["linear","initial",M,l,a]}],delay:[{delay:[h,l,a]}],animate:[{animate:["none",$,l,a]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[z,l,a]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[l,a,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],accent:[{accent:u()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:u()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",l,a]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":f()}],"scroll-mx":[{"scroll-mx":f()}],"scroll-my":[{"scroll-my":f()}],"scroll-ms":[{"scroll-ms":f()}],"scroll-me":[{"scroll-me":f()}],"scroll-mt":[{"scroll-mt":f()}],"scroll-mr":[{"scroll-mr":f()}],"scroll-mb":[{"scroll-mb":f()}],"scroll-ml":[{"scroll-ml":f()}],"scroll-p":[{"scroll-p":f()}],"scroll-px":[{"scroll-px":f()}],"scroll-py":[{"scroll-py":f()}],"scroll-ps":[{"scroll-ps":f()}],"scroll-pe":[{"scroll-pe":f()}],"scroll-pt":[{"scroll-pt":f()}],"scroll-pr":[{"scroll-pr":f()}],"scroll-pb":[{"scroll-pb":f()}],"scroll-pl":[{"scroll-pl":f()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",l,a]}],fill:[{fill:["none",...u()]}],"stroke-w":[{stroke:[h,re,J,pe]}],stroke:[{stroke:["none",...u()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function k(...e){return Mt(qe(e))}const Et={purple:"bg-purple-500",green:"bg-green-500",blue:"bg-blue-500",yellow:"bg-yellow-400 !text-yellow-900",red:"bg-red-500"},_e=({id:e,title:o,price:r,periodLabel:t,features:s,isSelected:n,onSelect:i,isCurrentPlan:p=!1,topBadge:c,discountBadge:x,premiumCallout:w,bottomNote:E,introPriceNote:y,isBestValue:P=!1,ctaButton:S,className:z,children:A,disabled:M=!1,enabled:$=!0,ariaLabel:L,onTrack:_,trackingLabel:C,componentName:I="SubscriptionTile",hideSelectionIndicator:G=!1})=>{const f=!!S,V=!G&&!p&&$,U=$&&!p&&!M,Z=n?"bg-blue-600 text-white border-2 border-blue-600 shadow-md":p?"bg-gray-100 dark:bg-gray-800 border-2 border-blue-500 dark:border-blue-400 shadow-md":$?"bg-gray-100 dark:bg-gray-800 border-2 border-gray-200 dark:border-gray-700 shadow-md hover:border-gray-300 dark:hover:border-gray-600":"bg-gray-100 dark:bg-gray-800 border-2 border-gray-200 dark:border-gray-700 opacity-50 shadow-md",X=()=>{U&&!f&&(_?.({action:"select",trackingLabel:C,componentName:I}),i())},ee=b=>{U&&!f&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),_?.({action:"select",trackingLabel:C,componentName:I}),i())},m=b=>{b.stopPropagation(),_?.({action:"cta_click",trackingLabel:C,componentName:I}),S?.onClick&&S.onClick()};return d.jsxs("div",{className:k("relative rounded-2xl p-6 transition-all flex flex-col h-full",!U||f?"cursor-default":"cursor-pointer",M&&"cursor-not-allowed",Z,z),onClick:X,onKeyDown:ee,role:f?"article":"radio","aria-checked":f?void 0:n,"aria-label":L||`${o} - ${r}${t||""}`,"aria-disabled":!U,tabIndex:f||!U?-1:0,children:[c&&d.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:d.jsx("span",{className:k(Et[c.color],"text-white px-4 py-1.5 rounded-full text-sm font-semibold shadow-lg whitespace-nowrap"),children:c.text})}),d.jsxs("div",{className:"flex-1 flex flex-col",children:[d.jsxs("div",{className:k("text-center mb-6",c&&"mt-2"),children:[d.jsx("h3",{className:k(de.textVariants.heading.h4(),"mb-2",n?"text-white":""),children:o}),d.jsxs("div",{className:"mb-3",children:[d.jsx("span",{className:k("text-4xl font-bold",n?"text-white":"text-gray-900 dark:text-gray-100"),children:r}),t&&d.jsx("span",{className:k("text-lg",n?"text-blue-100":"text-gray-500 dark:text-gray-400"),children:t})]}),x&&d.jsx("div",{className:k("inline-flex items-center px-2 py-1 rounded-full text-sm font-semibold",n?"bg-blue-500 text-white":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"),children:x.text})]}),A,s.length>0&&d.jsx("div",{className:"space-y-3 mb-6",children:s.map((b,g)=>d.jsxs("div",{className:"flex items-start",children:[d.jsx("svg",{className:k("w-5 h-5 mr-3 flex-shrink-0",n?"text-blue-200":"text-green-500"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),d.jsx("span",{className:k("text-sm text-left",n?"text-white":"text-gray-700 dark:text-gray-300"),children:b.replace(/^✓\s*/,"")})]},g))}),w&&d.jsxs("div",{className:k("rounded-lg p-4 mb-4",n?"bg-blue-500/30":"bg-gradient-to-r from-purple-50 to-blue-50 dark:from-purple-900/20 dark:to-blue-900/20"),children:[d.jsx("div",{className:"flex items-center mb-2",children:d.jsx("span",{className:k("font-semibold text-sm",n?"text-white":"text-purple-600 dark:text-purple-400"),children:w.title})}),d.jsx("ul",{className:k("text-xs space-y-1",n?"text-blue-100":"text-gray-600 dark:text-gray-400"),children:w.features.map((b,g)=>d.jsxs("li",{children:["• ",b]},g))})]}),E&&d.jsx("div",{className:k("text-center text-sm font-medium mb-4",n?"text-blue-100":"text-blue-600 dark:text-blue-400"),children:E}),y&&d.jsx("div",{className:k("p-3 rounded-lg",n?"bg-blue-500/30":"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800"),children:d.jsx("p",{className:k("text-sm font-semibold text-center",n?"text-white":"text-yellow-700 dark:text-yellow-300"),children:y})})]}),d.jsxs("div",{className:"h-14 flex-shrink-0 flex items-end justify-center",children:[V&&f&&d.jsx("div",{className:"w-full",children:S.href?d.jsx("a",{href:S.href,className:k("block w-full py-3 font-semibold rounded-lg text-center transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700"),onClick:b=>b.stopPropagation(),children:S.label}):d.jsx("button",{onClick:m,disabled:M,className:k("w-full py-3 font-semibold rounded-lg transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700",M&&"opacity-50 cursor-not-allowed"),children:S.label})}),V&&!f&&d.jsx("div",{className:k("w-5 h-5 rounded-full border-2 flex items-center justify-center",n?"border-white bg-white":"border-gray-300 dark:border-gray-600"),children:n&&d.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-600"})})]})]})},Tt=({title:e,children:o,error:r,variant:t="selection",currentStatus:s,primaryAction:n,secondaryAction:i,minTileWidth:p=240,className:c,headerContent:x,aboveProducts:w,footerContent:E,currentStatusLabel:y="Current Status",freeTileConfig:P,onTrack:S,trackingLabel:z,componentName:A="SubscriptionLayout"})=>{const M=t==="selection"&&n,$=()=>{S?.({action:"primary_action",trackingLabel:z,componentName:A}),n?.onClick()},L=()=>{S?.({action:"secondary_action",trackingLabel:z,componentName:A}),i?.onClick()},_=t==="cta"&&P,C={display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, ${p}px), 1fr))`,gap:"1.5rem"};return d.jsxs("div",{className:c,children:[x,s&&d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:k(de.textVariants.heading.h3(),"mb-4"),children:y}),s.isActive?d.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 mb-6",children:[d.jsxs("div",{className:"flex items-center mb-2",children:[d.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full mr-3"}),d.jsx("span",{className:"font-semibold text-green-800 dark:text-green-300",children:s.activeContent?.title||"Active Subscription"})]}),s.activeContent?.fields&&s.activeContent.fields.length>0&&d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:s.activeContent.fields.map((I,G)=>d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:I.label}),d.jsx("p",{className:"font-semibold text-green-800 dark:text-green-300",children:I.value})]},G))})]}):d.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 mb-6",children:[d.jsxs("div",{className:"flex items-center mb-2",children:[d.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full mr-3"}),d.jsx("span",{className:"font-semibold text-yellow-800 dark:text-yellow-300",children:s.inactiveContent?.title||"No Active Subscription"})]}),s.inactiveContent?.message&&d.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:s.inactiveContent.message})]})]}),d.jsx("h2",{className:k(de.textVariants.heading.h3(),"mb-4"),children:e}),w,d.jsxs("div",{style:C,children:[_&&d.jsx(_e,{id:"free",title:P.title,price:P.price,periodLabel:P.periodLabel,features:P.features,isSelected:!1,onSelect:()=>{},topBadge:P.topBadge,ctaButton:P.ctaButton}),o]}),E,r&&d.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 mt-6",children:d.jsx("p",{className:"text-red-600 dark:text-red-400",children:r})}),M&&d.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[i&&d.jsx(ye.Button,{onClick:L,disabled:i.disabled||i.loading,variant:"outline",className:"sm:flex-shrink-0",children:i.label}),d.jsx(ye.Button,{onClick:$,disabled:n.disabled||n.loading,className:"flex-1",children:n.label})]})]})};function jt({options:e,value:o,onChange:r,className:t,disabled:s=!1,size:n="md"}){const i={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"};return d.jsx("div",{className:k("inline-flex rounded-lg bg-gray-100 dark:bg-gray-800 p-1",s&&"opacity-50",t),role:"radiogroup",children:e.map(p=>{const c=o===p.value;return d.jsx("button",{type:"button",role:"radio","aria-checked":c,disabled:s,onClick:()=>!s&&r(p.value),className:k(i[n],"font-medium rounded-md transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",c?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",s&&"cursor-not-allowed"),children:p.label},p.value)})})}let be=null;const Gt=async()=>(be||(be=await import("@revenuecat/purchases-js")),be);let j=null;const Fe=(e,o)=>{const r=e.rcBillingProduct,t=r?.defaultSubscriptionOption,s=typeof o?.entitlement=="string"?o.entitlement:void 0;return{identifier:e.identifier,productId:r?.identifier||void 0,price:r?.currentPrice?.amountMicros?(r.currentPrice.amountMicros/1e6).toFixed(2):"0",priceString:r?.currentPrice?.formattedPrice||"$0",title:r?.title||e.identifier,description:r?.description||"",period:r?.normalPeriodDuration||void 0,introPrice:t?.introPrice?.price?.formattedPrice||void 0,introPriceAmount:t?.introPrice?.price?.amountMicros?(t.introPrice.price.amountMicros/1e6).toFixed(2):void 0,introPricePeriod:t?.introPrice?.periodDuration||void 0,introPriceCycles:t?.introPrice?.cycleCount||void 0,freeTrialPeriod:t?.trial?.periodDuration||void 0,entitlement:s}},ge=e=>{const o=Object.keys(e.entitlements.active);if(o.length>0){const r=o[0],t=e.entitlements.active[r];return{isActive:!0,expirationDate:t.expirationDate?new Date(t.expirationDate):void 0,purchaseDate:t.latestPurchaseDate?new Date(t.latestPurchaseDate):void 0,productIdentifier:t.productIdentifier,willRenew:t.willRenew,isSandbox:t.isSandbox,unsubscribeDetectedAt:t.unsubscribeDetectedAt?new Date(t.unsubscribeDetectedAt):void 0,billingIssueDetectedAt:t.billingIssueDetectedAt?new Date(t.billingIssueDetectedAt):void 0,activeEntitlements:o}}return{isActive:!1}},Ve=D.createContext(void 0),Lt=({apiKey:e,userEmail:o,onError:r,onPurchaseSuccess:t,children:s})=>{const[n,i]=D.useState([]),[p,c]=D.useState(null),[x,w]=D.useState(!1),[E,y]=D.useState(null),[P,S]=D.useState(!1),[z,A]=D.useState(null),[M,$]=D.useState(null),[L,_]=D.useState(null),C=!e||e==="your_revenuecat_api_key_here";D.useCallback(()=>{i([]),c(null),$(null),_(null),y(null),S(!1),A(null),j=null},[]);const I=D.useCallback(async()=>{if(j)try{const m=await j.getOfferings();m.current&&$(m.current);const b=m.all;if(b){_(b);const g=[];for(const v of Object.keys(b)){const u=b[v];if(u?.availablePackages){const K=u.metadata,W=u.availablePackages.map(te=>Fe(te,K));g.push(...W)}}i(g)}else if(m.current){const g=m.current.metadata,v=m.current.availablePackages.map(u=>Fe(u,g));i(v)}}catch(m){const b=m instanceof Error?m.message:"Failed to load offerings";y(b),r?.(m instanceof Error?m:new Error(b))}},[r]),G=D.useCallback(async()=>{if(j)try{const m=await j.getCustomerInfo(),b=ge(m);c(b.isActive?b:null)}catch(m){const b=m instanceof Error?m.message:"Failed to load subscription status";y(b),r?.(m instanceof Error?m:new Error(b))}},[r]),f=D.useCallback(async(m,b)=>{if(z!==m&&z&&(c(null),y(null)),!(P&&z===m))try{if(w(!0),y(null),C)console.warn("[SubscriptionProvider] RevenueCat API key not configured"),i([]),c(null);else{j=(await Gt()).Purchases.configure(m?{apiKey:e,appUserId:m}:{apiKey:e});const v=b||o;if(v&&j)try{await j.setAttributes({email:v})}catch{}m?await Promise.all([I(),G()]):await I()}A(m??null),S(!0)}catch(g){const v=g instanceof Error?g.message:"Failed to initialize";y(v),c(null),i([]),r?.(g instanceof Error?g:new Error(v))}finally{w(!1)}},[z,P,C,e,o,I,G,r]),V=D.useCallback(async(m,b)=>{try{if(w(!0),y(null),C){await new Promise(W=>setTimeout(W,2e3));const K={isActive:!0,expirationDate:new Date(Date.now()+365*24*60*60*1e3),purchaseDate:new Date,productIdentifier:m,willRenew:!0};return c(K),t?.(m),!0}if(!j||!M&&!L)throw new Error("Subscription service not initialized");let g;if(L)for(const K of Object.keys(L)){const W=L[K];if(W?.availablePackages&&(g=W.availablePackages.find(te=>te.identifier===m),g))break}else M&&(g=M.availablePackages.find(W=>W.identifier===m));if(!g)throw new Error(`Package not found: ${m}`);const v=await j.purchase({rcPackage:g,...o?{customerEmail:o}:{}}),u=ge(v.customerInfo);return c(u.isActive?u:null),u.isActive&&t?.(m),u.isActive}catch(g){const v=g instanceof Error?g.message:"Purchase failed";return y(v),r?.(g instanceof Error?g:new Error(v)),!1}finally{w(!1)}},[C,M,L,o,t,r]),U=D.useCallback(async m=>{try{if(w(!0),y(null),C)return await new Promise(v=>setTimeout(v,1e3)),y("No previous purchases found"),!1;if(!j)throw new Error("Subscription service not initialized");const b=await j.getCustomerInfo(),g=ge(b);return c(g.isActive?g:null),g.isActive||y("No previous purchases found"),g.isActive}catch(b){const g=b instanceof Error?b.message:"Restore failed";return y(g),r?.(b instanceof Error?b:new Error(g)),!1}finally{w(!1)}},[C,r]),Z=D.useCallback(async()=>{if(!C)try{y(null),await Promise.all([G(),I()])}catch(m){const b=m instanceof Error?m.message:"Refresh failed";y(b),r?.(m instanceof Error?m:new Error(b))}},[C,G,I,r]),X=D.useCallback(()=>{y(null)},[]);D.useEffect(()=>{if(!P||C||!j)return;const m=setInterval(()=>{G().catch(()=>{})},300*1e3);return()=>clearInterval(m)},[P,C,G]);const ee={products:n,currentSubscription:p,isLoading:x,error:E,initialize:f,purchase:V,restore:U,refresh:Z,clearError:X};return d.jsx(Ve.Provider,{value:ee,children:s})},_t=()=>{const e=D.useContext(Ve);if(!e)throw new Error("useSubscriptionContext must be used within a SubscriptionProvider");return e},$e=()=>{try{const e=[];for(let r=0;r<localStorage.length;r++){const t=localStorage.key(r);t&&(t.includes("revenuecat")||t.includes("rcb")||t.includes("rc_"))&&e.push(t)}e.forEach(r=>localStorage.removeItem(r));const o=[];for(let r=0;r<sessionStorage.length;r++){const t=sessionStorage.key(r);t&&(t.includes("revenuecat")||t.includes("rcb")||t.includes("rc_"))&&o.push(t)}o.forEach(r=>sessionStorage.removeItem(r))}catch{}},Ft=()=>{try{j&&(j.close(),j=null),$e()}catch{}};class Be{constructor(){this.offersCache=new Map,this.currentSubscription=null}loadOfferings(o){this.offersCache.clear();const r=o.all;if(r)for(const[t,s]of Object.entries(r)){const n=this.parseOffer(t,s);this.offersCache.set(t,n)}else if(o.current){const t=this.parseOffer("default",o.current);this.offersCache.set("default",t)}}loadCustomerInfo(o){const r=Object.keys(o.entitlements.active);if(r.length===0){this.currentSubscription={isActive:!1,entitlements:[]};return}const t=r.map(n=>({identifier:n})),s=o.entitlements.active[r[0]];this.currentSubscription={isActive:!0,entitlements:t,productId:s.productIdentifier,expirationDate:s.expirationDate?new Date(s.expirationDate):void 0,willRenew:s.willRenew}}getOffer(o){return this.offersCache.get(o)??null}getOfferIds(){return Array.from(this.offersCache.keys())}getCurrentSubscription(){return this.currentSubscription}parseOffer(o,r){const t=r,s=t.metadata,n=[];if(t.availablePackages)for(const i of t.availablePackages)n.push(this.parsePackage(i,s));return{offerId:o,metadata:s,packages:n}}parsePackage(o,r){const t=o.rcBillingProduct,s=t?.defaultSubscriptionOption,n=this.extractEntitlements(r),i={productId:t?.identifier??o.identifier,name:t?.title??o.identifier,description:t?.description??void 0,price:t?.currentPrice?.amountMicros?t.currentPrice.amountMicros/1e6:0,priceString:t?.currentPrice?.formattedPrice??"$0",currency:t?.currentPrice?.currency??void 0,billingCycle:t?.normalPeriodDuration??void 0,trialPeriod:s?.trial?.periodDuration??void 0,introPrice:s?.introPrice?.price?.formattedPrice??void 0,introPricePeriod:s?.introPrice?.periodDuration??void 0,introPriceCycles:s?.introPrice?.cycleCount??void 0};return{packageId:o.identifier,name:t?.title??o.identifier,product:i,entitlements:n}}extractEntitlements(o){const r=[];if(!o)return r;if(o.entitlement&&typeof o.entitlement=="string"&&r.push({identifier:o.entitlement}),Array.isArray(o.entitlements))for(const t of o.entitlements)typeof t=="string"?r.push({identifier:t}):typeof t=="object"&&t!==null&&typeof t.identifier=="string"&&r.push({identifier:t.identifier});return r}}function Vt(){return new Be}N.SegmentedControl=jt,N.SubscriptionLayout=Tt,N.SubscriptionProvider=Lt,N.SubscriptionService=Be,N.SubscriptionTile=_e,N.clearRevenueCatCheckoutSessions=$e,N.closeRevenueCatInstance=Ft,N.cn=k,N.createSubscriptionService=Vt,N.useSubscriptionContext=_t,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
@@ -1 +1 @@
1
- {"version":3,"file":"subscription-provider.d.ts","sourceRoot":"","sources":["../src/subscription-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAGV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAsGjB,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IAC3E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA+XpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAO,wBAQzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,QAAO,IAgClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,IAU1C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"subscription-provider.d.ts","sourceRoot":"","sources":["../src/subscription-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAGV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAqGjB,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IAC3E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAsYpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAO,wBAQzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,QAAO,IAgClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,IAU1C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/subscription-components",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "description": "Subscription UI components for React with RevenueCat integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.umd.js",
@@ -54,7 +54,7 @@
54
54
  "@eslint/js": "^9.38.0",
55
55
  "@heroicons/react": "^2.2.0",
56
56
  "@revenuecat/purchases-js": "^1.5.0",
57
- "@sudobility/components": "^4.0.160",
57
+ "@sudobility/components": "^4.0.163",
58
58
  "@sudobility/design": "^1.1.18",
59
59
  "@testing-library/dom": "^10.4.0",
60
60
  "@testing-library/jest-dom": "^6.4.2",