// @bun
var{defineProperty:Y,getOwnPropertyNames:y,getOwnPropertyDescriptor:B}=Object,D=Object.prototype.hasOwnProperty;function E(q){return this[q]}var V=(q)=>{var w=(_??=new WeakMap).get(q),A;if(w)return w;if(w=Y({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var F of y(q))if(!D.call(w,F))Y(w,F,{get:E.bind(q,F),enumerable:!(A=B(q,F))||A.enumerable})}return _.set(q,w),w},_;var G=(q)=>q;function J(q,w){this[q]=G.bind(null,w)}var b=(q,w)=>{for(var A in w)Y(q,A,{get:w[A],enumerable:!0,configurable:!0,set:J.bind(w,A)})};var d=(q,w)=>()=>(q&&(w=q(q=0)),w);var H=import.meta.require;function Z(q){if(!q)return[];if(Array.isArray(q))return q;return Object.entries(q).map(([w,A])=>({value:w,label:A}))}function m(q,w,A){let{type:F,title:K}=q;switch(F){case"text":return $(K||"",w,A);case"number":return M(K||"",w,A,q);case"boolean":return N(K||"",w,A);case"select":return R(K||"",w,A,q);case"radio":return k(K||"",w,A,q);case"color":return z(K||"",w,A);case"textarea":return O(K||"",w,A);case"slider":return S(K||"",w,A,q);case"json":return L(K||"",w,A);case"date":return T(K||"",w,A);case"buttongroup":return x(K||"",w,A,q);default:return $(K||"",w,A)}}function $(q,w,A){return`
    <div class="stx-control stx-control-text">
      <label class="stx-control-label">${I(q)}</label>
      <input
        type="text"
        class="stx-control-input"
        value="${I(String(w||""))}"
        onchange="${A}"
      />
    </div>
  `}function M(q,w,A,F){let K=F.min!==void 0?`min="${F.min}"`:"",U=F.max!==void 0?`max="${F.max}"`:"",P=F.step!==void 0?`step="${F.step}"`:"";return`
    <div class="stx-control stx-control-number">
      <label class="stx-control-label">${I(q)}</label>
      <input
        type="number"
        class="stx-control-input"
        value="${w??0}"
        ${K} ${U} ${P}
        onchange="${A}"
      />
    </div>
  `}function N(q,w,A){return`
    <div class="stx-control stx-control-checkbox">
      <label class="stx-control-label">
        <input
          type="checkbox"
          class="stx-control-checkbox-input"
          ${w?"checked":""}
          onchange="${A}"
        />
        <span>${I(q)}</span>
      </label>
    </div>
  `}function R(q,w,A,F){let U=Z(F.options).map((P)=>{let Q=typeof P==="object"?P.value:P,W=typeof P==="object"?P.label:P,X=Q===w?"selected":"";return`<option value="${I(String(Q))}" ${X}>${I(String(W))}</option>`}).join("");return`
    <div class="stx-control stx-control-select">
      <label class="stx-control-label">${I(q)}</label>
      <select class="stx-control-input" onchange="${A}">
        ${U}
      </select>
    </div>
  `}function k(q,w,A,F){let K=Z(F.options),U=`radio-${q.toLowerCase().replace(/\s+/g,"-")}`,P=K.map((Q)=>{let W=typeof Q==="object"?Q.value:Q,X=typeof Q==="object"?Q.label:Q,j=W===w?"checked":"";return`
        <label class="stx-control-radio-option">
          <input
            type="radio"
            name="${U}"
            value="${I(String(W))}"
            ${j}
            onchange="${A}"
          />
          <span>${I(String(X))}</span>
        </label>
      `}).join("");return`
    <div class="stx-control stx-control-radio">
      <label class="stx-control-label">${I(q)}</label>
      <div class="stx-control-radio-group">
        ${P}
      </div>
    </div>
  `}function z(q,w,A){return`
    <div class="stx-control stx-control-color">
      <label class="stx-control-label">${I(q)}</label>
      <div class="stx-control-color-wrapper">
        <input
          type="color"
          class="stx-control-color-input"
          value="${I(w||"#000000")}"
          onchange="${A}"
        />
        <input
          type="text"
          class="stx-control-input stx-control-color-text"
          value="${I(w||"#000000")}"
          onchange="${A}"
        />
      </div>
    </div>
  `}function O(q,w,A){return`
    <div class="stx-control stx-control-textarea">
      <label class="stx-control-label">${I(q)}</label>
      <textarea
        class="stx-control-textarea-input"
        onchange="${A}"
      >${I(String(w||""))}</textarea>
    </div>
  `}function S(q,w,A,F){let K=F.min??0,U=F.max??100,P=F.step??1;return`
    <div class="stx-control stx-control-slider">
      <label class="stx-control-label">${I(q)}</label>
      <div class="stx-control-slider-wrapper">
        <input
          type="range"
          class="stx-control-slider-input"
          value="${w??K}"
          min="${K}"
          max="${U}"
          step="${P}"
          onchange="${A}"
          oninput="this.nextElementSibling.textContent = this.value"
        />
        <span class="stx-control-slider-value">${w??K}</span>
      </div>
    </div>
  `}function L(q,w,A){let F=typeof w==="string"?w:JSON.stringify(w,null,2);return`
    <div class="stx-control stx-control-json">
      <label class="stx-control-label">${I(q)}</label>
      <textarea
        class="stx-control-json-input"
        onchange="${A}"
      >${I(F)}</textarea>
    </div>
  `}function T(q,w,A){return`
    <div class="stx-control stx-control-date">
      <label class="stx-control-label">${I(q)}</label>
      <input
        type="date"
        class="stx-control-input"
        value="${I(w||"")}"
        onchange="${A}"
      />
    </div>
  `}function s(){return`
    .stx-control {
      margin-bottom: 12px;
    }
    .stx-control-label {
      display: block;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-secondary, #666);
      margin-bottom: 4px;
    }
    .stx-control-input {
      width: 100%;
      padding: 6px 8px;
      border: 1px solid var(--border, #ddd);
      border-radius: 4px;
      font-size: 13px;
      background: var(--bg, #fff);
      color: var(--text, #333);
    }
    .stx-control-input:focus {
      outline: none;
      border-color: var(--primary, #3b82f6);
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
    }
    .stx-control-checkbox {
      display: flex;
      align-items: center;
    }
    .stx-control-checkbox label {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
    }
    .stx-control-checkbox-input {
      width: 16px;
      height: 16px;
    }
    .stx-control-radio-group {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .stx-control-radio-option {
      display: flex;
      align-items: center;
      gap: 4px;
      cursor: pointer;
      font-size: 13px;
    }
    .stx-control-color-wrapper {
      display: flex;
      gap: 8px;
    }
    .stx-control-color-input {
      width: 40px;
      height: 32px;
      padding: 2px;
      border: 1px solid var(--border, #ddd);
      border-radius: 4px;
      cursor: pointer;
    }
    .stx-control-color-text {
      flex: 1;
    }
    .stx-control-textarea-input,
    .stx-control-json-input {
      width: 100%;
      min-height: 80px;
      padding: 8px;
      border: 1px solid var(--border, #ddd);
      border-radius: 4px;
      font-size: 13px;
      font-family: inherit;
      resize: vertical;
      background: var(--bg, #fff);
      color: var(--text, #333);
    }
    .stx-control-json-input {
      font-family: monospace;
      font-size: 12px;
    }
    .stx-control-slider-wrapper {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .stx-control-slider-input {
      flex: 1;
    }
    .stx-control-slider-value {
      min-width: 40px;
      text-align: right;
      font-size: 13px;
      color: var(--text-secondary, #666);
    }
  `}function x(q,w,A,F){let U=Z(F.options).map((P)=>{let Q=typeof P==="object"?P.value:P,W=typeof P==="object"?P.label:P;return`
        <button
          type="button"
          class="stx-control-btn-group-btn ${Q===w?"active":""}"
          data-value="${I(String(Q))}"
          onclick="${A}"
        >${I(String(W))}</button>
      `}).join("");return`
    <div class="stx-control stx-control-btn-group">
      <label class="stx-control-label">${I(q)}</label>
      <div class="stx-control-btn-group-wrapper">
        ${U}
      </div>
    </div>
  `}function I(q){return q.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}export{O as renderTextareaControl,$ as renderTextControl,S as renderSliderControl,R as renderSelectControl,k as renderRadioControl,M as renderNumberControl,L as renderJsonControl,T as renderDateControl,m as renderControl,z as renderColorControl,N as renderCheckboxControl,x as renderButtonGroupControl,s as getControlStyles};
