(()=>{var{useState:r,useEffect:m,useCallback:h}=React,u={general:{enabled:!0,scan_thresholds:281,scan_behavior_toggles:{include_forms_and_editable:!1,auto_scan_on_boot:!0,auto_observe_dom:!0,auto_hook_expansion_triggers:!0},cache_settings:{enabled:!0,ttl_ms:1e3*60*60*24*7,max_entries:200},display_defaults:{original_open:!1,shade_open:!0}},safety:{root_safety_enabled:!0,local_serious_regex_gate_enabled:!1,safety_prompt_policy_version:"1.0",safety_behavior_mode:"standard"},provider:{api_endpoint:"https://api.openai.com/v1/chat/completions",model:"gpt-4.1-nano",remote_provider_allowed:!1,endpoint_classification:"remote",byok_mode:!0},lenses:{builtin_lens_enabled_states:[{id:"tldr",enabled:!0},{id:"im_10",enabled:!0},{id:"llama_hunter_d",enabled:!1}],default_enabled_lens_list:["tldr","im_10"],lens_ordering:[],per_lens_prompt_definitions:{}},advertising:{arpeggio_plug_text:"arpeggio.one \xB7 Art-Sea LLC",marquee_enabled_in_button_mode:!0,marquee_speed:18}},p=new window.LlamaStorageAdapter,f=new window.LlamaNetworkAdapter,v=({settings:a,setSettings:t,localSecrets:s,setLocalSecrets:o,isLoggedIn:c})=>{let[n,d]=r("general"),l=(e,i)=>{t({...a,general:{...a.general,[e]:i}})},_=(e,i)=>{t({...a,provider:{...a.provider,[e]:i}})};return React.createElement("div",{className:"p-3 bg-dark text-light border-0"},React.createElement("ul",{className:"nav nav-pills nav-fill mb-3 small"},["general","provider","lenses"].map(e=>React.createElement("li",{className:"nav-item",key:e},React.createElement("button",{className:`nav-link py-1 ${n===e?"active":""}`,onClick:()=>d(e)},e.charAt(0).toUpperCase()+e.slice(1))))),React.createElement("div",{className:"tab-content"},n==="general"&&React.createElement("div",{className:"settings-section"},React.createElement("div",{className:"form-check form-switch mb-3"},React.createElement("input",{className:"form-check-input",type:"checkbox",checked:a.general.enabled,onChange:e=>l("enabled",e.target.checked)}),React.createElement("label",{className:"form-check-label"},"Enable Llamma Shades")),React.createElement("div",{className:"mb-3"},React.createElement("label",{className:"form-label small"},"Scan Threshold (chars): ",a.general.scan_thresholds),React.createElement("input",{type:"range",className:"form-range",min:"100",max:"3000",step:"10",value:a.general.scan_thresholds,onChange:e=>l("scan_thresholds",parseInt(e.target.value))}))),n==="provider"&&React.createElement("div",{className:"settings-section"},React.createElement("div",{className:"mb-3"},React.createElement("label",{className:"form-label small"},"API Endpoint"),React.createElement("input",{type:"text",className:"form-control form-control-sm",value:a.provider.api_endpoint,onChange:e=>_("api_endpoint",e.target.value)})),React.createElement("div",{className:"mb-3"},React.createElement("label",{className:"form-label small"},"API Key (Stored Locally)"),React.createElement("input",{type:"password",className:"form-control form-control-sm",value:s.api_key,onChange:e=>o({...s,api_key:e.target.value}),placeholder:"sk-..."})))))},g=()=>{let[a,t]=r(u),[s,o]=r({api_key:""}),[c,n]=r(!1);return m(()=>{async function d(){let l=await p.get(["llammaShades.settingsBundle.v1","llammaShades.localSecrets.v1"]);l["llammaShades.settingsBundle.v1"]&&t(l["llammaShades.settingsBundle.v1"]),l["llammaShades.localSecrets.v1"]&&o(l["llammaShades.localSecrets.v1"])}d()},[]),m(()=>{p.set({"llammaShades.settingsBundle.v1":a,"llammaShades.localSecrets.v1":s})},[a,s]),React.createElement("div",{className:"llama-shades-extension-popup"},React.createElement("h5",{className:"p-3 mb-0 border-bottom border-secondary d-flex align-items-center"},React.createElement("span",{className:"me-2"},"\u{1F999}")," Llamma Shades"),React.createElement(v,{settings:a,setSettings:t,localSecrets:s,setLocalSecrets:o,isLoggedIn:c}),React.createElement("div",{className:"p-2 border-top border-secondary text-center small text-muted"},a.advertising.arpeggio_plug_text))},b=ReactDOM.createRoot(document.getElementById("llama-shades-popup-root"));b.render(React.createElement(g,null));})();
