import{p as e,s as t,i as o,j as s,r as i,l as r,m as n,O as c}from"./p-BxEPsDRj.js";import{n as a,c as l,r as d}from"./p-CrMmJdZ6.js";import{o as h}from"./p-zNe_7rLp.js";import{e as p,n as u}from"./p-B9-TeWdB.js";const b=e({isLegalCheckboxChecked:false});const x={state:b,subscribe(e){return o(b,(()=>e(b)))},subscribeKey(e,o){return t(b,e,o)},setIsLegalCheckboxChecked(e){b.isLegalCheckboxChecked=e}};var f=s`
  label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    column-gap: ${({spacing:e})=>e[2]};
  }

  label > input[type='checkbox'] {
    height: 0;
    width: 0;
    opacity: 0;
    position: absolute;
  }

  label > span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    border: 1px solid ${({colors:e})=>e.neutrals400};
    color: ${({colors:e})=>e.white};
    background-color: transparent;
    will-change: border-color, background-color;
  }

  label > span > wui-icon {
    opacity: 0;
    will-change: opacity;
  }

  label > input[type='checkbox']:checked + span > wui-icon {
    color: ${({colors:e})=>e.white};
  }

  label > input[type='checkbox']:not(:checked) > span > wui-icon {
    color: ${({colors:e})=>e.neutrals900};
  }

  label > input[type='checkbox']:checked + span > wui-icon {
    opacity: 1;
  }

  /* -- Sizes --------------------------------------------------- */
  label[data-size='lg'] > span {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border-radius: ${({borderRadius:e})=>e[10]};
  }

  label[data-size='md'] > span {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    border-radius: ${({borderRadius:e})=>e[2]};
  }

  label[data-size='sm'] > span {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    border-radius: ${({borderRadius:e})=>e[1]};
  }

  /* -- Focus states --------------------------------------------------- */
  label > input[type='checkbox']:focus-visible + span,
  label > input[type='checkbox']:focus + span {
    border: 1px solid ${({tokens:e})=>e.core.borderAccentPrimary};
    box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2);
  }

  /* -- Checked states --------------------------------------------------- */
  label > input[type='checkbox']:checked + span {
    background-color: ${({tokens:e})=>e.core.iconAccentPrimary};
    border: 1px solid transparent;
  }

  /* -- Hover states --------------------------------------------------- */
  input[type='checkbox']:not(:checked):not(:disabled) + span:hover {
    border: 1px solid ${({colors:e})=>e.neutrals700};
    background-color: ${({colors:e})=>e.neutrals800};
    box-shadow: none;
  }

  input[type='checkbox']:checked:not(:disabled) + span:hover {
    border: 1px solid transparent;
    background-color: ${({colors:e})=>e.accent080};
    box-shadow: none;
  }

  /* -- Disabled state --------------------------------------------------- */
  label > input[type='checkbox']:checked:disabled + span {
    border: 1px solid transparent;
    opacity: 0.3;
  }

  label > input[type='checkbox']:not(:checked):disabled + span {
    border: 1px solid ${({colors:e})=>e.neutrals700};
  }

  label:has(input[type='checkbox']:disabled) {
    cursor: auto;
  }

  label > input[type='checkbox']:disabled + span {
    cursor: not-allowed;
  }
`;var k=undefined&&undefined.__decorate||function(e,t,o,s){var i=arguments.length,r=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,o):s,n;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r=Reflect.decorate(e,t,o,s);else for(var c=e.length-1;c>=0;c--)if(n=e[c])r=(i<3?n(r):i>3?n(t,o,r):n(t,o))||r;return i>3&&r&&Object.defineProperty(t,o,r),r};const g={lg:"md",md:"sm",sm:"sm"};let y=class e extends r{constructor(){super(...arguments);this.inputElementRef=p();this.checked=undefined;this.disabled=false;this.size="md"}render(){const e=g[this.size];return n`
      <label data-size=${this.size}>
        <input
          ${u(this.inputElementRef)}
          ?checked=${h(this.checked)}
          ?disabled=${this.disabled}
          type="checkbox"
          @change=${this.dispatchChangeEvent}
        />
        <span>
          <wui-icon name="checkmarkBold" size=${e}></wui-icon>
        </span>
        <slot></slot>
      </label>
    `}dispatchChangeEvent(){this.dispatchEvent(new CustomEvent("checkboxChange",{detail:this.inputElementRef.value?.checked,bubbles:true,composed:true}))}};y.styles=[i,f];k([a({type:Boolean})],y.prototype,"checked",void 0);k([a({type:Boolean})],y.prototype,"disabled",void 0);k([a()],y.prototype,"size",void 0);y=k([l("wui-checkbox")],y);var m=s`
  :host {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  wui-checkbox {
    padding: ${({spacing:e})=>e["3"]};
  }
  a {
    text-decoration: none;
    color: ${({tokens:e})=>e.theme.textSecondary};
    font-weight: 500;
  }
`;var w=undefined&&undefined.__decorate||function(e,t,o,s){var i=arguments.length,r=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,o):s,n;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r=Reflect.decorate(e,t,o,s);else for(var c=e.length-1;c>=0;c--)if(n=e[c])r=(i<3?n(r):i>3?n(t,o,r):n(t,o))||r;return i>3&&r&&Object.defineProperty(t,o,r),r};let v=class e extends r{constructor(){super();this.unsubscribe=[];this.checked=x.state.isLegalCheckboxChecked;this.unsubscribe.push(x.subscribeKey("isLegalCheckboxChecked",(e=>{this.checked=e})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const{termsConditionsUrl:e,privacyPolicyUrl:t}=c.state;const o=c.state.features?.legalCheckbox;if(!e&&!t){return null}if(!o){return null}return n`
      <wui-checkbox
        ?checked=${this.checked}
        @checkboxChange=${this.onCheckboxChange.bind(this)}
        data-testid="wui-checkbox"
      >
        <wui-text color="secondary" variant="sm-regular" align="left">
          I agree to our ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()}
        </wui-text>
      </wui-checkbox>
    `}andTemplate(){const{termsConditionsUrl:e,privacyPolicyUrl:t}=c.state;return e&&t?"and":""}termsTemplate(){const{termsConditionsUrl:e}=c.state;if(!e){return null}return n`<a rel="noreferrer" target="_blank" href=${e}>terms of service</a>`}privacyTemplate(){const{privacyPolicyUrl:e}=c.state;if(!e){return null}return n`<a rel="noreferrer" target="_blank" href=${e}>privacy policy</a>`}onCheckboxChange(){x.setIsLegalCheckboxChecked(!this.checked)}};v.styles=[m];w([d()],v.prototype,"checked",void 0);v=w([l("w3m-legal-checkbox")],v);var $=s`
  :host {
    display: block;
    width: 100px;
    height: 100px;
  }

  svg {
    width: 100px;
    height: 100px;
  }

  rect {
    fill: none;
    stroke: ${e=>e.colors.accent100};
    stroke-width: 3px;
    stroke-linecap: round;
    animation: dash 1s linear infinite;
  }

  @keyframes dash {
    to {
      stroke-dashoffset: 0px;
    }
  }
`;var C=undefined&&undefined.__decorate||function(e,t,o,s){var i=arguments.length,r=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,o):s,n;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r=Reflect.decorate(e,t,o,s);else for(var c=e.length-1;c>=0;c--)if(n=e[c])r=(i<3?n(r):i>3?n(t,o,r):n(t,o))||r;return i>3&&r&&Object.defineProperty(t,o,r),r};let j=class e extends r{constructor(){super(...arguments);this.radius=36}render(){return this.svgLoaderTemplate()}svgLoaderTemplate(){const e=this.radius>50?50:this.radius;const t=36;const o=t-e;const s=116+o;const i=245+o;const r=360+o*1.75;return n`
      <svg viewBox="0 0 110 110" width="110" height="110">
        <rect
          x="2"
          y="2"
          width="106"
          height="106"
          rx=${e}
          stroke-dasharray="${s} ${i}"
          stroke-dashoffset=${r}
        />
      </svg>
    `}};j.styles=[i,$];C([a({type:Number})],j.prototype,"radius",void 0);j=C([l("wui-loading-thumbnail")],j);export{x as O};
//# sourceMappingURL=p-UDfqWbD9.js.map