@seaveyon/harness-switch 0.22.0 → 0.23.0
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.
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
|
|
60
60
|
`)}t.write("payload.value = newResult;"),t.write("return payload;");let l=t.compile();return(t,n)=>l(e,t,n)})(t.shape)),c=n(c,u),s)?tA([],d,c,u,r,e):c:a(c,u):(c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c)}});function tI(e,t,n,r){for(let n of e)if(0===n.issues.length)return t.value=n.value,t;let a=e.filter(e=>!eR(e));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>eM(e,r,K())))}),t)}let tM=$("$ZodUnion",(e,t)=>{e7.init(e,t),ew(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ew(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ew(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ew(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>eb(e.source)).join("|")})$`)}});let n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,a)=>{if(n)return n(r,a);let o=!1,i=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},a);if(t instanceof Promise)i.push(t),o=!0;else{if(0===t.issues.length)return t;i.push(t)}}return o?Promise.all(i).then(t=>tI(t,r,e,a)):tI(i,r,e,a)}}),tD=$("$ZodIntersection",(e,t)=>{e7.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,a=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([t,n])=>tF(e,t,n)):tF(e,a,o)}});function tF(e,t,n){let r,a=new Map;for(let n of t.issues)if("unrecognized_keys"===n.code)for(let e of(r??(r=n),n.keys))a.has(e)||a.set(e,{}),a.get(e).l=!0;else e.issues.push(n);for(let t of n.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)a.has(e)||a.set(e,{}),a.get(e).r=!0;else e.issues.push(t);let o=[...a].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&r&&e.issues.push({...r,keys:o}),eR(e))return e;let i=function e(t,n){if(t===n||t instanceof Date&&n instanceof Date&&+t==+n)return{valid:!0,data:t};if(eP(t)&&eP(n)){let r=Object.keys(n),a=Object.keys(t).filter(e=>-1!==r.indexOf(e)),o={...t,...n};for(let r of a){let a=e(t[r],n[r]);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};o[r]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let a=0;a<t.length;a++){let o=e(t[a],n[a]);if(!o.valid)return{valid:!1,mergeErrorPath:[a,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}(t.value,n.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}let t$=$("$ZodRecord",(e,t)=>{e7.init(e,t),e._zod.parse=(n,r)=>{let a=n.value;if(!eP(a))return n.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),n;let o=[],i=t.keyType._zod.values;if(i){let l;n.value={};let s=new Set;for(let l of i)if("string"==typeof l||"number"==typeof l||"symbol"==typeof l){s.add("number"==typeof l?l.toString():l);let i=t.keyType._zod.run({value:l,issues:[]},r);if(i instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(i.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:i.issues.map(e=>eM(e,r,K())),input:l,path:[l],inst:e});continue}let c=i.value,u=t.valueType._zod.run({value:a[l],issues:[]},r);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&n.issues.push(...eL(l,e.issues)),n.value[c]=e.value})):(u.issues.length&&n.issues.push(...eL(l,u.issues)),n.value[c]=u.value)}for(let e in a)s.has(e)||(l=l??[]).push(e);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:l})}else for(let i of(n.value={},Reflect.ownKeys(a))){if("__proto__"===i||!Object.prototype.propertyIsEnumerable.call(a,i))continue;let l=t.keyType._zod.run({value:i,issues:[]},r);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof i&&ef.test(i)&&l.issues.length){let e=t.keyType._zod.run({value:Number(i),issues:[]},r);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(l=e)}if(l.issues.length){"loose"===t.mode?n.value[i]=a[i]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(e=>eM(e,r,K())),input:i,path:[i],inst:e});continue}let s=t.valueType._zod.run({value:a[i],issues:[]},r);s instanceof Promise?o.push(s.then(e=>{e.issues.length&&n.issues.push(...eL(i,e.issues)),n.value[l.value]=e.value})):(s.issues.length&&n.issues.push(...eL(i,s.issues)),n.value[l.value]=s.value)}return o.length?Promise.all(o).then(()=>n):n}}),tU=$("$ZodEnum",(e,t)=>{e7.init(e,t);let n=eg(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>e_.has(typeof e)).map(e=>"string"==typeof e?ez(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{let o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),tH=$("$ZodLiteral",(e,t)=>{if(e7.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?ez(e):e?ez(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,a)=>{let o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),tB=$("$ZodTransform",(e,t)=>{e7.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new H(e.constructor.name);let a=t.transform(n.value,n);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(n.value=e,n.fallback=!0,n));if(a instanceof Promise)throw new U;return n.value=a,n.fallback=!0,n}});function tK(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let tV=$("$ZodOptional",(e,t)=>{e7.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ew(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ew(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${eb(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){let r=e.value,a=t.innerType._zod.run(e,n);return a instanceof Promise?a.then(e=>tK(e,r)):tK(a,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),tq=$("$ZodExactOptional",(e,t)=>{tV.init(e,t),ew(e._zod,"values",()=>t.innerType._zod.values),ew(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),tW=$("$ZodNullable",(e,t)=>{e7.init(e,t),ew(e._zod,"optin",()=>t.innerType._zod.optin),ew(e._zod,"optout",()=>t.innerType._zod.optout),ew(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${eb(e.source)}|null)$`):void 0}),ew(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),tZ=$("$ZodDefault",(e,t)=>{e7.init(e,t),e._zod.optin="optional",ew(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>tG(e,t)):tG(r,t)}});function tG(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let tJ=$("$ZodPrefault",(e,t)=>{e7.init(e,t),e._zod.optin="optional",ew(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),tQ=$("$ZodNonOptional",(e,t)=>{e7.init(e,t),ew(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{let a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(t=>tY(t,e)):tY(a,e)}});function tY(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let tX=$("$ZodCatch",(e,t)=>{e7.init(e,t),e._zod.optin="optional",ew(e._zod,"optout",()=>t.innerType._zod.optout),ew(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>eM(e,n,K()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>eM(e,n,K()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),t0=$("$ZodPipe",(e,t)=>{e7.init(e,t),ew(e._zod,"values",()=>t.in._zod.values),ew(e._zod,"optin",()=>t.in._zod.optin),ew(e._zod,"optout",()=>t.out._zod.optout),ew(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>t1(e,t.in,n)):t1(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>t1(e,t.out,n)):t1(r,t.out,n)}});function t1(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}let t2=$("$ZodReadonly",(e,t)=>{e7.init(e,t),ew(e._zod,"propValues",()=>t.innerType._zod.propValues),ew(e._zod,"values",()=>t.innerType._zod.values),ew(e._zod,"optin",()=>t.innerType?._zod?.optin),ew(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t4):t4(r)}});function t4(e){return e.value=Object.freeze(e.value),e}let t3=$("$ZodCustom",(e,t)=>{e$.init(e,t),e7.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,a=t.fn(r);if(a instanceof Promise)return a.then(t=>t5(t,n,r,e));t5(a,n,r,e)}});function t5(e,t,n,r){if(!e){let e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(eF(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(p=globalThis).__zod_globalRegistry??(p.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let t6=globalThis.__zod_globalRegistry;function t8(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...eA(t)})}function t9(e,t){return new eU({check:"max_length",...eA(t),maximum:e})}function t7(e,t){return new eH({check:"min_length",...eA(t),minimum:e})}function ne(e,t){return new eB({check:"length_equals",...eA(t),length:e})}function nt(e){return new eQ({check:"overwrite",tx:e})}function nn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??t6,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function nr(e,t,n={path:[],schemaPath:[]}){var r;let a=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);let l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,r);else{let n=i.schema,o=t.processors[a.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);o(e,t,n,r)}let o=e._zod.parent;o&&(i.ref||(i.ref=o),nr(o,t,r),t.seen.get(o).isParent=!0)}let s=t.metadataRegistry.get(e);return s&&Object.assign(i.schema,s),"input"===t.io&&function e(t,n){let r=n??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let a=t._zod.def;if("transform"===a.type)return!0;if("array"===a.type)return e(a.element,r);if("set"===a.type)return e(a.valueType,r);if("lazy"===a.type)return e(a.getter(),r);if("promise"===a.type||"optional"===a.type||"nonoptional"===a.type||"nullable"===a.type||"readonly"===a.type||"default"===a.type||"prefault"===a.type)return e(a.innerType,r);if("intersection"===a.type)return e(a.left,r)||e(a.right,r);if("record"===a.type||"map"===a.type)return e(a.keyType,r)||e(a.valueType,r);if("pipe"===a.type)return!!t._zod.traits.has("$ZodCodec")||e(a.in,r)||e(a.out,r);if("object"===a.type){for(let t in a.shape)if(e(a.shape[t],r))return!0;return!1}if("union"===a.type){for(let t of a.options)if(e(t,r))return!0;return!1}if("tuple"===a.type){for(let t of a.items)if(e(t,r))return!0;if(a.rest&&e(a.rest,r))return!0}return!1}(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function na(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let a=t=>{if(t[1].schema.$ref)return;let r=t[1],{ref:a,defId:o}=(t=>{let r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let n=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(n)return{ref:a(n)};let o=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=o,{defId:o,ref:`${a("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};let a=`#/${r}/`,o=t[1].schema.id??`__schema${e.counter++}`;return{defId:o,ref:a+o}})(t);r.def={...r.schema},o&&(r.defId=o);let i=r.schema;for(let e in i)delete i[e];i.$ref=a};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
61
61
|
|
|
62
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&"ref"===e.reused){a(n);continue}}}function no(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=t=>{let n=e.seen.get(t);if(null===n.ref)return;let a=n.def??n.schema,o={...a},i=n.ref;if(n.ref=null,i){r(i);let n=e.seen.get(i),l=n.schema;if(l.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(a.allOf=a.allOf??[],a.allOf.push(l)):Object.assign(a,l),Object.assign(a,o),t._zod.parent===i)for(let e in a)"$ref"!==e&&"allOf"!==e&&(e in o||delete a[e]);if(l.$ref&&n.def)for(let e in a)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(a[e])===JSON.stringify(n.def[e])&&delete a[e]}let l=t._zod.parent;if(l&&l!==i){r(l);let t=e.seen.get(l);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(let e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");a.$id=e.external.uri(n)}Object.assign(a,n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;void 0!==o&&a.id===o&&delete a.id;let i=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?a.$defs=i:a.definitions=i);try{let n=JSON.parse(JSON.stringify(a));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:ni(t,"input",e.processors),output:ni(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw Error("Error converting schema to JSON.")}}let ni=(e,t,n={})=>r=>{let{libraryOptions:a,target:o}=r??{},i=nn({...a??{},target:o,io:t,processors:n});return nr(e,i),na(i,e),no(i,e)},nl={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ns=(e,t,n,r)=>{let a=e._zod.def;nr(a.innerType,t,r),t.seen.get(e).ref=a.innerType},nc=$("ZodISODateTime",(e,t)=>{tp.init(e,t),nT.init(e,t)}),nu=$("ZodISODate",(e,t)=>{th.init(e,t),nT.init(e,t)}),nd=$("ZodISOTime",(e,t)=>{tm.init(e,t),nT.init(e,t)}),nf=$("ZodISODuration",(e,t)=>{tg.init(e,t),nT.init(e,t)}),np=$("ZodError",(e,t)=>{e0.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let n={_errors:[]},r=(e,a=[])=>{for(let o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...a,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...a,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...a,...o.path]);else{let e=[...a,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,a=0;for(;a<e.length;){let n=e[a];a===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(o))):r[n]=r[n]||{_errors:[]},r=r[n],a++}}}};return r(e),n})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let n={},r=[];for(let a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ey,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ey,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),nh=e2(np),nm=e4(np),ng=e3(np),ny=e6(np),nv=(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return e2(np)(e,t,r)},nb=(e,t,n)=>e2(np)(e,t,n),nx=async(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return e4(np)(e,t,r)},nw=async(e,t,n)=>e4(np)(e,t,n),nk=(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return e3(np)(e,t,r)},nj=(e,t,n)=>e3(np)(e,t,n),nS=async(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return e6(np)(e,t,r)},nO=async(e,t,n)=>e6(np)(e,t,n),nC=new WeakMap;function nN(e,t,n){let r=Object.getPrototypeOf(e),a=nC.get(r);if(a||(a=new Set,nC.set(r,a)),!a.has(t))for(let e in a.add(t),n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let nP=$("ZodType",(e,t)=>(e7.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ni(e,"input"),output:ni(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{let r=nn({...n,processors:t});return nr(e,r),na(r,e),no(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>nh(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ng(e,t,n),e.parseAsync=async(t,n)=>nm(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ny(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>nv(e,t,n),e.decode=(t,n)=>nb(e,t,n),e.encodeAsync=async(t,n)=>nx(e,t,n),e.decodeAsync=async(t,n)=>nw(e,t,n),e.safeEncode=(t,n)=>nk(e,t,n),e.safeDecode=(t,n)=>nj(e,t,n),e.safeEncodeAsync=async(t,n)=>nS(e,t,n),e.safeDecodeAsync=async(t,n)=>nO(e,t,n),nN(e,"ZodType",{check(...e){let t=this.def;return this.clone(ej(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eT(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new rv({type:"custom",check:"custom",fn:e,...eA(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var n;let r,a;return n=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(eF(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(eF(e)))},e(t.value,t)),(a=new e$({check:"custom",...eA(t)}))._zod.check=n,r=a}(e,t))},overwrite(e){return this.check(nt(e))},optional(){return rl(this)},exactOptional(){var e;return e=this,new rs({type:"optional",innerType:e})},nullable(){return ru(this)},nullish(){return rl(ru(this))},nonoptional(e){var t;return t=this,new rp({type:"nonoptional",innerType:t,...eA(e)})},array(){return n3(this)},or(e){return new n8({type:"union",options:[this,e],...eA(void 0)})},and(e){var t;return t=this,new n9({type:"intersection",left:t,right:e})},transform(e){return rg(this,new ro({type:"transform",transform:e}))},default(e){var t,n;return t=this,n=e,new rd({type:"default",innerType:t,get defaultValue(){return"function"==typeof n?n():eE(n)}})},prefault(e){var t,n;return t=this,n=e,new rf({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof n?n():eE(n)}})},catch(e){var t,n;return t=this,new rh({type:"catch",innerType:t,catchValue:"function"==typeof(n=e)?n:()=>n})},pipe(e){return rg(this,e)},readonly(){var e;return e=this,new ry({type:"readonly",innerType:e})},describe(e){let t=this.clone();return t6.add(t,{description:e}),t},meta(...e){if(0===e.length)return t6.get(this);let t=this.clone();return t6.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>t6.get(e)?.description,configurable:!0}),e)),nE=$("_ZodString",(e,t)=>{te.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{n.type="string";let{minimum:a,maximum:o,format:i,patterns:l,contentEncoding:s}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),i&&(n.format=nl[i]??i,""===n.format&&delete n.format,"time"===i&&delete n.format),s&&(n.contentEncoding=s),l&&l.size>0){let e=[...l];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n,0);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,nN(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new eV({check:"string_format",format:"regex",...eA(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new eZ({check:"string_format",format:"includes",...eA(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new eG({check:"string_format",format:"starts_with",...eA(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new eJ({check:"string_format",format:"ends_with",...eA(t),suffix:e})}(...e))},min(...e){return this.check(t7(...e))},max(...e){return this.check(t9(...e))},length(...e){return this.check(ne(...e))},nonempty(...e){return this.check(t7(1,...e))},lowercase(e){return this.check(new eq({check:"string_format",format:"lowercase",...eA(e)}))},uppercase(e){return this.check(new eW({check:"string_format",format:"uppercase",...eA(e)}))},trim(){return this.check(nt(e=>e.trim()))},normalize(...e){return this.check(function(e){return nt(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(nt(e=>e.toLowerCase()))},toUpperCase(){return this.check(nt(e=>e.toUpperCase()))},slugify(){return this.check(nt(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),n_=$("ZodString",(e,t)=>{te.init(e,t),nE.init(e,t),e.email=t=>e.check(new nA({type:"string",format:"email",check:"string_format",abort:!1,...eA(t)})),e.url=t=>e.check(new nI({type:"string",format:"url",check:"string_format",abort:!1,...eA(t)})),e.jwt=t=>e.check(new nQ({type:"string",format:"jwt",check:"string_format",abort:!1,...eA(t)})),e.emoji=t=>e.check(new nM({type:"string",format:"emoji",check:"string_format",abort:!1,...eA(t)})),e.guid=t=>e.check(t8(nR,t)),e.uuid=t=>e.check(new nL({type:"string",format:"uuid",check:"string_format",abort:!1,...eA(t)})),e.uuidv4=t=>e.check(new nL({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eA(t)})),e.uuidv6=t=>e.check(new nL({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eA(t)})),e.uuidv7=t=>e.check(new nL({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eA(t)})),e.nanoid=t=>e.check(new nD({type:"string",format:"nanoid",check:"string_format",abort:!1,...eA(t)})),e.guid=t=>e.check(t8(nR,t)),e.cuid=t=>e.check(new nF({type:"string",format:"cuid",check:"string_format",abort:!1,...eA(t)})),e.cuid2=t=>e.check(new n$({type:"string",format:"cuid2",check:"string_format",abort:!1,...eA(t)})),e.ulid=t=>e.check(new nU({type:"string",format:"ulid",check:"string_format",abort:!1,...eA(t)})),e.base64=t=>e.check(new nZ({type:"string",format:"base64",check:"string_format",abort:!1,...eA(t)})),e.base64url=t=>e.check(new nG({type:"string",format:"base64url",check:"string_format",abort:!1,...eA(t)})),e.xid=t=>e.check(new nH({type:"string",format:"xid",check:"string_format",abort:!1,...eA(t)})),e.ksuid=t=>e.check(new nB({type:"string",format:"ksuid",check:"string_format",abort:!1,...eA(t)})),e.ipv4=t=>e.check(new nK({type:"string",format:"ipv4",check:"string_format",abort:!1,...eA(t)})),e.ipv6=t=>e.check(new nV({type:"string",format:"ipv6",check:"string_format",abort:!1,...eA(t)})),e.cidrv4=t=>e.check(new nq({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eA(t)})),e.cidrv6=t=>e.check(new nW({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eA(t)})),e.e164=t=>e.check(new nJ({type:"string",format:"e164",check:"string_format",abort:!1,...eA(t)})),e.datetime=t=>e.check(new nc({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eA(t)})),e.date=t=>e.check(new nu({type:"string",format:"date",check:"string_format",...eA(t)})),e.time=t=>e.check(new nd({type:"string",format:"time",check:"string_format",precision:null,...eA(t)})),e.duration=t=>e.check(new nf({type:"string",format:"duration",check:"string_format",...eA(t)}))});function nz(e){return new n_({type:"string",...eA(e)})}let nT=$("ZodStringFormat",(e,t)=>{tt.init(e,t),nE.init(e,t)}),nA=$("ZodEmail",(e,t)=>{ta.init(e,t),nT.init(e,t)}),nR=$("ZodGUID",(e,t)=>{tn.init(e,t),nT.init(e,t)}),nL=$("ZodUUID",(e,t)=>{tr.init(e,t),nT.init(e,t)}),nI=$("ZodURL",(e,t)=>{to.init(e,t),nT.init(e,t)}),nM=$("ZodEmoji",(e,t)=>{ti.init(e,t),nT.init(e,t)}),nD=$("ZodNanoID",(e,t)=>{tl.init(e,t),nT.init(e,t)}),nF=$("ZodCUID",(e,t)=>{ts.init(e,t),nT.init(e,t)}),n$=$("ZodCUID2",(e,t)=>{tc.init(e,t),nT.init(e,t)}),nU=$("ZodULID",(e,t)=>{tu.init(e,t),nT.init(e,t)}),nH=$("ZodXID",(e,t)=>{td.init(e,t),nT.init(e,t)}),nB=$("ZodKSUID",(e,t)=>{tf.init(e,t),nT.init(e,t)}),nK=$("ZodIPv4",(e,t)=>{ty.init(e,t),nT.init(e,t)}),nV=$("ZodIPv6",(e,t)=>{tv.init(e,t),nT.init(e,t)}),nq=$("ZodCIDRv4",(e,t)=>{tb.init(e,t),nT.init(e,t)}),nW=$("ZodCIDRv6",(e,t)=>{tx.init(e,t),nT.init(e,t)}),nZ=$("ZodBase64",(e,t)=>{tk.init(e,t),nT.init(e,t)}),nG=$("ZodBase64URL",(e,t)=>{tj.init(e,t),nT.init(e,t)}),nJ=$("ZodE164",(e,t)=>{tS.init(e,t),nT.init(e,t)}),nQ=$("ZodJWT",(e,t)=>{tO.init(e,t),nT.init(e,t)}),nY=$("ZodBoolean",(e,t)=>{tC.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.type="boolean"}});function nX(e){return new nY({type:"boolean",...eA(e)})}let n0=$("ZodUnknown",(e,t)=>{tN.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function n1(){return new n0({type:"unknown"})}let n2=$("ZodNever",(e,t)=>{tP.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.not={}}}),n4=$("ZodArray",(e,t)=>{t_.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a=e._zod.def,{minimum:o,maximum:i}=e._zod.bag;"number"==typeof o&&(n.minItems=o),"number"==typeof i&&(n.maxItems=i),n.type="array",n.items=nr(a.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,nN(e,"ZodArray",{min(e,t){return this.check(t7(e,t))},nonempty(e){return this.check(t7(1,e))},max(e,t){return this.check(t9(e,t))},length(e,t){return this.check(ne(e,t))},unwrap(){return this.element}})});function n3(e,t){return new n4({type:"array",element:e,...eA(t)})}let n5=$("ZodObject",(e,t)=>{tL.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a=e._zod.def;n.type="object",n.properties={};let o=a.shape;for(let e in o)n.properties[e]=nr(o[e],t,{...r,path:[...r.path,"properties",e]});let i=new Set([...new Set(Object.keys(o))].filter(e=>{let n=a.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));i.size>0&&(n.required=Array.from(i)),a.catchall?._zod.def.type==="never"?n.additionalProperties=!1:a.catchall?a.catchall&&(n.additionalProperties=nr(a.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(n.additionalProperties=!1)})(e,t,n,r),ew(e,"shape",()=>t.shape),nN(e,"ZodObject",{keyof(){return rn(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:n1()})},loose(){return this.clone({...this._zod.def,catchall:n1()})},strict(){return this.clone({...this._zod.def,catchall:new n2({type:"never",...eA(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!eP(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=ej(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ek(this,"shape",n),n}});return eT(e,r)}(this,e)},safeExtend(e){var t=this;if(!eP(e))throw Error("Invalid input to safeExtend: expected a plain object");let n=ej(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return ek(this,"shape",n),n}});return eT(t,n)},merge(e){var t=this;if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=ej(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return ek(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return eT(t,n)},pick(e){return function(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let a=ej(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ek(this,"shape",e),e},checks:[]});return eT(e,a)}(this,e)},omit(e){return function(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let a=ej(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ek(this,"shape",r),r},checks:[]});return eT(e,a)}(this,e)},partial(...e){return function(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let a=ej(t._zod.def,{get shape(){let r=t._zod.def.shape,a={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(a[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(let t in r)a[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return ek(this,"shape",a),a},checks:[]});return eT(t,a)}(ri,this,e[0])},required(...e){var t,n;let r;return t=this,n=e[0],r=ej(t._zod.def,{get shape(){let e=t._zod.def.shape,r={...e};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=new rp({type:"nonoptional",innerType:e[t]}))}else for(let t in e)r[t]=new rp({type:"nonoptional",innerType:e[t]});return ek(this,"shape",r),r}}),eT(t,r)}})});function n6(e,t){return new n5({type:"object",shape:e??{},...eA(t)})}let n8=$("ZodUnion",(e,t)=>{tM.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a,o,i;return o=!1===(a=e._zod.def).inclusive,i=a.options.map((e,n)=>nr(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]})),void(o?n.oneOf=i:n.anyOf=i)},e.options=t.options}),n9=$("ZodIntersection",(e,t)=>{tD.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a,o,i,l;return o=nr((a=e._zod.def).left,t,{...r,path:[...r.path,"allOf",0]}),i=nr(a.right,t,{...r,path:[...r.path,"allOf",1]}),void(n.allOf=[...(l=e=>"allOf"in e&&1===Object.keys(e).length)(o)?o.allOf:[o],...l(i)?i.allOf:[i]])}}),n7=$("ZodRecord",(e,t)=>{t$.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a=e._zod.def;n.type="object";let o=a.keyType,i=o._zod.bag,l=i?.patterns;if("loose"===a.mode&&l&&l.size>0){let e=nr(a.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});for(let t of(n.patternProperties={},l))n.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(n.propertyNames=nr(a.keyType,t,{...r,path:[...r.path,"propertyNames"]})),n.additionalProperties=nr(a.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let s=o._zod.values;if(s){let e=[...s].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(n.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function re(e,t,n){return new n7(t&&t._zod?{type:"record",keyType:e,valueType:t,...eA(n)}:{type:"record",keyType:nz(),valueType:e,...eA(t)})}let rt=$("ZodEnum",(e,t)=>{tU.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;(a=eg(e._zod.def.entries)).every(e=>"number"==typeof e)&&(n.type="number"),a.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=a},e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let a={};for(let r of e)if(n.has(r))a[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new rt({...t,checks:[],...eA(r),entries:a})},e.exclude=(e,r)=>{let a={...t.entries};for(let t of e)if(n.has(t))delete a[t];else throw Error(`Key ${t} not found in enum`);return new rt({...t,checks:[],...eA(r),entries:a})}});function rn(e,t){return new rt({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...eA(t)})}let rr=$("ZodLiteral",(e,t)=>{tH.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a=e._zod.def,o=[];for(let e of a.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else o.push(Number(e));else o.push(e);if(0===o.length);else if(1===o.length){let e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n,0),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ra(e,t){return new rr({type:"literal",values:Array.isArray(e)?e:[e],...eA(t)})}let ro=$("ZodTransform",(e,t)=>{tB.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,e,0,0),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new H(e.constructor.name);n.addIssue=r=>{"string"==typeof r?n.issues.push(eF(r,n.value,t)):(r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=e),n.issues.push(eF(r)))};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}}),ri=$("ZodOptional",(e,t)=>{tV.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rl(e){return new ri({type:"optional",innerType:e})}let rs=$("ZodExactOptional",(e,t)=>{tq.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),rc=$("ZodNullable",(e,t)=>{tW.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a,o,i;return o=nr((a=e._zod.def).innerType,t,r),i=t.seen.get(e),void("openapi-3.0"===t.target?(i.ref=a.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function ru(e){return new rc({type:"nullable",innerType:e})}let rd=$("ZodDefault",(e,t)=>{tZ.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;nr((a=e._zod.def).innerType,t,r),t.seen.get(e).ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),rf=$("ZodPrefault",(e,t)=>{tJ.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;nr((a=e._zod.def).innerType,t,r),t.seen.get(e).ref=a.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},e.unwrap=()=>e._zod.def.innerType}),rp=$("ZodNonOptional",(e,t)=>{tQ.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;nr((a=e._zod.def).innerType,t,r),t.seen.get(e).ref=a.innerType},e.unwrap=()=>e._zod.def.innerType}),rh=$("ZodCatch",(e,t)=>{tX.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a,o=e._zod.def;nr(o.innerType,t,r),t.seen.get(e).ref=o.innerType;try{a=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}n.default=a})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),rm=$("ZodPipe",(e,t)=>{t0.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a,o,i;return o=(a=e._zod.def).in._zod.traits.has("$ZodTransform"),void(nr(i="input"===t.io?o?a.out:a.in:a.out,t,r),t.seen.get(e).ref=i)},e.in=t.in,e.out=t.out});function rg(e,t){return new rm({type:"pipe",in:e,out:t})}let ry=$("ZodReadonly",(e,t)=>{t2.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;nr((a=e._zod.def).innerType,t,r),t.seen.get(e).ref=a.innerType,n.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),rv=$("ZodCustom",(e,t)=>{t3.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,e,0,0)});var rb=nz().trim().min(1,"名称不能为空").max(120,"名称不能超过 ".concat(120," 个字符")).refine(function(e){return!e.includes("/")&&!e.includes("\\")},"名称不能包含斜杠"),rx=function(e){return nz().max(e)},rw=nz().min(1).max(120),rk=rn(D),rj=re(rw,rx(4096)),rS=re(rw,rx(1048576)),rO=rn(["skip","overwrite"]);n6({password:rx(4096)}),n6({name:rb,baseUrl:rx(2048).optional(),apiKey:rx(4096).optional(),model:rx(120).optional(),notes:rx(4096).optional(),extras:rj.optional(),overrides:rS.optional(),providerId:rx(120).optional(),providerEndpoint:rx(120).optional()}).partial();var rC=n3(n6({key:nz().trim().min(1,"endpoint key 不能为空").max(60,"endpoint key 过长").refine(function(e){return!e.includes("/")&&!e.includes("\\")},"endpoint key 不能包含斜杠"),label:rx(120).optional(),baseUrl:nz().trim().min(1,"endpoint 需要 baseUrl").max(2048)})).max(50).refine(function(e){return new Set(e.map(function(e){return e.key})).size===e.length},"endpoint key 不能重复");n6({name:rb,apiKey:nz().min(1,"apiKey 不能为空").max(4096),endpoints:rC.optional(),notes:rx(4096).optional()}),n6({name:rb.optional(),apiKey:rx(4096).optional(),endpoints:rC.optional(),notes:rx(4096).optional()}),n6({sourceUser:nz().trim().min(1,"来源用户不能为空").max(120),conflictPolicy:rO.optional(),overwriteHarnesses:n3(rk).optional(),migrateCodexLoginCache:nX().optional()});var rN=n6({format:ra("harness-switch-encrypted-export"),version:ra(1),kdf:n6({name:ra("scrypt"),salt:nz().min(1)}),cipher:n6({name:ra("aes-256-gcm"),iv:nz().min(1),tag:nz().min(1),data:nz().min(1)})});n6({passphrase:rx(4096),includeCodexLoginCache:nX().optional()}),n6({envelope:rN,passphrase:rx(4096),conflictPolicy:rO.optional(),restoreActive:nX().optional(),migrateCodexLoginCache:nX().optional()});var rP=n6({id:nz().min(1).max(240),name:rb,target:rn(["profile","vault"]),apiKey:rx(4096).optional(),providerId:rx(120).optional(),providerName:rb.optional(),overwrite:nX().optional()});n6({selections:n3(rP).min(1,"请至少选择一条配置").max(200)}),n6({baseUrl:nz().trim().min(1,"baseUrl 不能为空").max(2048),apiKey:rx(4096).optional(),providerId:rx(120).optional()}),n6({endpoint:rx(120).optional()}),n6({clientId:rx(100).optional()}),n6({deviceCode:nz().min(1).max(200),clientId:rx(100).optional()}),n6({token:nz().trim().min(1,"Token 不能为空").max(500)}),n6({passphrase:rx(4096),includeCodexLoginCache:nX().optional()}),n6({passphrase:rx(4096),conflictPolicy:rO.optional(),restoreActive:nX().optional()}),n6({passphrase:rx(4096),conflictPolicy:rO.optional(),restoreActive:nX().optional(),migrateCodexLoginCache:nX().optional()}),n6({});let rE=O("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);function r_(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=function e(t){var n,r,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(r=e(t[n]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}(e))&&(r&&(r+=" "),r+=t);return r}let rz=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,rT=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return r_(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{let t=null==n?void 0:n[e],r=null==o?void 0:o[e];if(null===t)return null;let i=rz(t)||rz(r);return a[e][i]}),l=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return r_(e,i,null==t||null==(r=t.compoundVariants)?void 0:r.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...l}[t]):({...o,...l})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)},rA=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rR=[],rL=(e,t,n)=>{if(0==e.length-t)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let n=rL(e,t+1,a);if(n)return n}let o=n.validators;if(null===o)return;let i=0===t?e.join("-"):e.slice(t).join("-"),l=o.length;for(let e=0;e<l;e++){let t=o[e];if(t.validator(i))return t.classGroupId}},rI=(e,t)=>{let n=rA();for(let r in e)rM(e[r],n,r,t);return n},rM=(e,t,n,r)=>{let a=e.length;for(let o=0;o<a;o++)rD(e[o],t,n,r)},rD=(e,t,n,r)=>{"string"==typeof e?rF(e,t,n):"function"==typeof e?r$(e,t,n,r):rU(e,t,n,r)},rF=(e,t,n)=>{(""===e?t:rH(t,e)).classGroupId=n},r$=(e,t,n,r)=>{rB(e)?rM(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:n,validator:e}))},rU=(e,t,n,r)=>{let a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){let[o,i]=a[e];rM(i,rH(t,o),n,r)}},rH=(e,t)=>{let n=e,r=t.split("-"),a=r.length;for(let e=0;e<a;e++){let t=r[e],a=n.nextPart.get(t);a||(a=rA(),n.nextPart.set(t,a)),n=a}return n},rB=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,rK=[],rV=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),rq=/\s+/,rW=e=>{let t;if("string"==typeof e)return e;let n="";for(let r=0;r<e.length;r++)e[r]&&(t=rW(e[r]))&&(n&&(n+=" "),n+=t);return n},rZ=[],rG=e=>{let t=t=>t[e]||rZ;return t.isThemeGetter=!0,t},rJ=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rQ=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rY=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,rX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r0=/\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$/,r1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,r2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,r3=e=>rY.test(e),r5=e=>!!e&&!Number.isNaN(Number(e)),r6=e=>!!e&&Number.isInteger(Number(e)),r8=e=>e.endsWith("%")&&r5(e.slice(0,-1)),r9=e=>rX.test(e),r7=()=>!0,ae=e=>r0.test(e)&&!r1.test(e),at=()=>!1,an=e=>r2.test(e),ar=e=>r4.test(e),aa=e=>!al(e)&&!am(e),ao=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),ai=e=>aj(e,aN,at),al=e=>rJ.test(e),as=e=>aj(e,aP,ae),ac=e=>aj(e,aE,r5),au=e=>aj(e,az,r7),ad=e=>aj(e,a_,at),af=e=>aj(e,aO,at),ap=e=>aj(e,aC,ar),ah=e=>aj(e,aT,an),am=e=>rQ.test(e),ag=e=>aS(e,aP),ay=e=>aS(e,a_),av=e=>aS(e,aO),ab=e=>aS(e,aN),ax=e=>aS(e,aC),aw=e=>aS(e,aT,!0),ak=e=>aS(e,az,!0),aj=(e,t,n)=>{let r=rJ.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},aS=(e,t,n=!1)=>{let r=rQ.exec(e);return!!r&&(r[1]?t(r[1]):n)},aO=e=>"position"===e||"percentage"===e,aC=e=>"image"===e||"url"===e,aN=e=>"length"===e||"size"===e||"bg-size"===e,aP=e=>"length"===e,aE=e=>"number"===e,a_=e=>"family-name"===e,az=e=>"number"===e||"weight"===e,aT=e=>"shadow"===e,aA=((e,...t)=>{let n,r,a,o,i=e=>{let t=r(e);if(t)return t;let o=((e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o,postfixLookupClassGroupIds:i}=t,l=[],s=e.trim().split(rq),c="";for(let e=s.length-1;e>=0;e-=1){let t,u=s[e],{isExternal:d,modifiers:f,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:m}=n(u);if(d){c=u+(c.length>0?" "+c:c);continue}let g=!!m;if(g){let e=(t=r(h.substring(0,m)))&&i[t]?r(h):void 0;e&&e!==t&&(t=e,g=!1)}else t=r(h);if(!t){if(!g||!(t=r(h))){c=u+(c.length>0?" "+c:c);continue}g=!1}let y=0===f.length?"":1===f.length?f[0]:o(f).join(":"),v=p?y+"!":y,b=v+t;if(l.indexOf(b)>-1)continue;l.push(b);let x=a(t,g);for(let e=0;e<x.length;++e){let t=x[e];l.push(v+t)}c=u+(c.length>0?" "+c:c)}return c})(e,n);return a(e,o),o};return o=l=>{var s;let c;return r=(n={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),a=(a,o)=>{n[a]=o,++t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(a(e,t),t):void 0},set(e,t){e in n?n[e]=t:a(e,t)}}})((s=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t,n=[],r=0,a=0,o=0,i=e.length;for(let l=0;l<i;l++){let i=e[l];if(0===r&&0===a){if(":"===i){n.push(e.slice(o,l)),o=l+1;continue}if("/"===i){t=l;continue}}"["===i?r++:"]"===i?r--:"("===i?a++:")"===i&&a--}let l=0===n.length?e:e.slice(o),s=l,c=!1;return l.endsWith("!")?(s=l.slice(0,-1),c=!0):l.startsWith("!")&&(s=l.slice(1),c=!0),rV(n,c,s,t&&t>o?t-o:void 0)};if(t){let e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):rV(rK,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r})(s),sortModifiers:(c=new Map,s.orderSensitiveModifiers.forEach((e,t)=>{c.set(e,1e6+t)}),e=>{let t=[],n=[];for(let r=0;r<e.length;r++){let a=e[r],o="["===a[0],i=c.has(a);o||i?(n.length>0&&(n.sort(),t.push(...n),n=[]),t.push(a)):n.push(a)}return n.length>0&&(n.sort(),t.push(...n)),t}),postfixLookupClassGroupIds:(e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t})(s),...(e=>{let t=(e=>{let{theme:t,classGroups:n}=e;return rI(n,t)})(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var n;let t,r,a;return -1===(n=e).slice(1,-1).indexOf(":")?void 0:(r=(t=n.slice(1,-1)).indexOf(":"),(a=t.slice(0,r))?"arbitrary.."+a:void 0)}let r=e.split("-"),a=+(""===r[0]&&r.length>1);return rL(r,a,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],a=n[e];if(t){if(a){let e=Array(a.length+t.length);for(let t=0;t<a.length;t++)e[t]=a[t];for(let n=0;n<t.length;n++)e[a.length+n]=t[n];return e}return t}return a||rR}return n[e]||rR}}})(s)}).cache.get,a=n.cache.set,o=i,i(l)},(...e)=>o(((...e)=>{let t,n,r=0,a="";for(;r<e.length;)(t=e[r++])&&(n=rW(t))&&(a&&(a+=" "),a+=n);return a})(...e))})(()=>{let e=rG("color"),t=rG("font"),n=rG("text"),r=rG("font-weight"),a=rG("tracking"),o=rG("leading"),i=rG("breakpoint"),l=rG("container"),s=rG("spacing"),c=rG("radius"),u=rG("shadow"),d=rG("inset-shadow"),f=rG("text-shadow"),p=rG("drop-shadow"),h=rG("blur"),m=rG("perspective"),g=rG("aspect"),y=rG("ease"),v=rG("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...x(),am,al],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],S=()=>[am,al,s],O=()=>[r3,"full","auto",...S()],C=()=>[r6,"none","subgrid",am,al],N=()=>["auto",{span:["full",r6,am,al]},r6,am,al],P=()=>[r6,"auto",am,al],E=()=>["auto","min","max","fr",am,al],_=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...S()],A=()=>[r3,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],R=()=>[r3,"screen","full","dvw","lvw","svw","min","max","fit",...S()],L=()=>[r3,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],I=()=>[e,am,al],M=()=>[...x(),av,af,{position:[am,al]}],D=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",ab,ai,{size:[am,al]}],$=()=>[r8,ag,as],U=()=>["","none","full",c,am,al],H=()=>["",r5,ag,as],B=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[r5,r8,av,af],q=()=>["","none",h,am,al],W=()=>["none",r5,am,al],Z=()=>["none",r5,am,al],G=()=>[r5,am,al],J=()=>[r3,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[r9],breakpoint:[r9],color:[r7],container:[r9],"drop-shadow":[r9],ease:["in","out","in-out"],font:[aa],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[r9],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[r9],shadow:[r9],spacing:["px",r5],text:[r9],"text-shadow":[r9],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",r3,al,am,g]}],container:["container"],"container-type":[{"@container":["","normal","size",am,al]}],"container-named":[ao],columns:[{columns:[r5,al,am,l]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:w()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{"inset-s":O(),start:O()}],end:[{"inset-e":O(),end:O()}],"inset-bs":[{"inset-bs":O()}],"inset-be":[{"inset-be":O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[r6,"auto",am,al]}],basis:[{basis:[r3,"full","auto",l,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[r5,r3,"auto","initial","none",al]}],grow:[{grow:["",r5,am,al]}],shrink:[{shrink:["",r5,am,al]}],order:[{order:[r6,"first","last","none",am,al]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[..._(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",..._()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":_()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mbs:[{mbs:T()}],mbe:[{mbe:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",...L()]}],"min-block-size":[{"min-block":["auto",...L()]}],"max-block-size":[{"max-block":["none",...L()]}],w:[{w:[l,"screen",...A()]}],"min-w":[{"min-w":[l,"screen","none",...A()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",n,ag,as]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ak,au]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",r8,al]}],"font-family":[{font:[ay,ad,t]}],"font-features":[{"font-features":[al]}],"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:[a,am,al]}],"line-clamp":[{"line-clamp":[r5,"none",am,ac]}],leading:[{leading:[o,...S()]}],"list-image":[{"list-image":["none",am,al]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",am,al]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:[r5,"from-font","auto",am,as]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[r5,"auto",am,al]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[r6,am,al]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",am,al]}],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",am,al]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:D()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},r6,am,al],radial:["",am,al],conic:[r6,am,al]},ax,ap]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...B(),"hidden","none"]}],"divide-style":[{divide:[...B(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...B(),"none","hidden"]}],"outline-offset":[{"outline-offset":[r5,am,al]}],"outline-w":[{outline:["",r5,ag,as]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",u,aw,ah]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",d,aw,ah]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[r5,as]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",f,aw,ah]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[r5,am,al]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"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":[r5]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[am,al]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":x()}],"mask-image-conic-pos":[{"mask-conic":[r5]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:D()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",am,al]}],filter:[{filter:["","none",am,al]}],blur:[{blur:q()}],brightness:[{brightness:[r5,am,al]}],contrast:[{contrast:[r5,am,al]}],"drop-shadow":[{"drop-shadow":["","none",p,aw,ah]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",r5,am,al]}],"hue-rotate":[{"hue-rotate":[r5,am,al]}],invert:[{invert:["",r5,am,al]}],saturate:[{saturate:[r5,am,al]}],sepia:[{sepia:["",r5,am,al]}],"backdrop-filter":[{"backdrop-filter":["","none",am,al]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[r5,am,al]}],"backdrop-contrast":[{"backdrop-contrast":[r5,am,al]}],"backdrop-grayscale":[{"backdrop-grayscale":["",r5,am,al]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[r5,am,al]}],"backdrop-invert":[{"backdrop-invert":["",r5,am,al]}],"backdrop-opacity":[{"backdrop-opacity":[r5,am,al]}],"backdrop-saturate":[{"backdrop-saturate":[r5,am,al]}],"backdrop-sepia":[{"backdrop-sepia":["",r5,am,al]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",am,al]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[r5,"initial",am,al]}],ease:[{ease:["linear","initial",y,am,al]}],delay:[{delay:[r5,am,al]}],animate:[{animate:["none",v,am,al]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,am,al]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:W()}],"rotate-x":[{"rotate-x":W()}],"rotate-y":[{"rotate-y":W()}],"rotate-z":[{"rotate-z":W()}],scale:[{scale:Z()}],"scale-x":[{"scale-x":Z()}],"scale-y":[{"scale-y":Z()}],"scale-z":[{"scale-z":Z()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[am,al,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:J()}],"translate-x":[{"translate-x":J()}],"translate-y":[{"translate-y":J()}],"translate-z":[{"translate-z":J()}],"translate-none":["translate-none"],zoom:[{zoom:[r6,am,al]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",am,al]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"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",am,al]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[r5,ag,as,ac]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-bs","border-w-be","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-bs","border-color-be","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-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function aR(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return aA(r_(t))}var aL=rT("inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function aI(e){var t=e.className,n=e.variant,r=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className","variant"]);return(0,g.jsx)("div",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"badge",className:aR(aL({variant:n}),t)},r))}function aM(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function aD(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function aF(e){return(aF=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a$(e,t){return(a$=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function aU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(aU=function(){return!!e})()}var aH=(0,y.lazy)(function(){var e;return(e=function(){return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:return[4,Promise.all([d.e("6150"),d.e("4952")]).then(d.bind(d,1419))];case 1:return[2,{default:e.sent().PierreFileDiff}]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){aM(o,r,a,i,l,"next",e)}function l(e){aM(o,r,a,i,l,"throw",e)}i(void 0)})})()});function aB(e){return null===e.content&&null===e.currentContent?"same":null===e.content?"delete":null===e.currentContent?"create":e.content===e.currentContent?"same":"replace"}function aK(e){var t=e.files;return(0,g.jsx)("div",{className:"space-y-3",children:t.map(function(e){return(0,g.jsx)(aV,{file:e},e.path)})})}function aV(e){var t=e.file,n=(0,x.Bd)().t,r=aB(t);return(0,g.jsxs)("div",{className:"overflow-hidden rounded-xl border",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b bg-muted/40 px-3 py-2",children:[(0,g.jsx)("p",{className:"min-w-0 truncate font-mono text-xs",title:t.path,children:t.path}),(0,g.jsx)(aI,{variant:"secondary",children:n("diff.".concat(r))})]}),(0,g.jsx)(aW,{fallback:(0,g.jsx)(aq,{file:t}),children:(0,g.jsx)(y.Suspense,{fallback:(0,g.jsx)("p",{className:"px-3 py-4 text-sm text-muted-foreground",children:n("diff.rendering")}),children:(0,g.jsx)(aH,{file:t})})})]})}function aq(e){var t,n,r=e.file,a=(0,x.Bd)().t;return(0,g.jsxs)("div",{className:"grid gap-2 p-3 font-mono text-xs",children:[(0,g.jsx)("pre",{className:"whitespace-pre-wrap text-red-400/90",children:null!=(t=r.currentContent)?t:a("diff.absent")}),(0,g.jsx)("p",{className:"font-sans text-muted-foreground",children:a("diff.afterRestore")}),(0,g.jsx)("pre",{className:"whitespace-pre-wrap text-emerald-400/90",children:null!=(n=r.content)?n:a("diff.deletedAfterRestore")})]})}var aW=function(e){var t,n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n,a,o;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=aF(t),e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,aU()?Reflect.construct(t,n||[],aF(this).constructor):t.apply(this,n)),o={failed:!1},(a="state")in e?Object.defineProperty(e,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[a]=o,e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&a$(r,e),n=[{key:"getDerivedStateFromError",value:function(){return{failed:!0}}}],t=[{key:"render",value:function(){return this.state.failed?this.props.fallback:this.props.children}}],aD(r.prototype,t),n&&aD(r,n),r}(y.Component),aZ=Object.defineProperty,aG=(e,t)=>aZ(e,"name",{value:t,configurable:!0});function aJ(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function aQ(...e){return t=>{let n=!1,r=e.map(e=>{let r=aJ(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():aJ(e[t],null)}}}}function aY(...e){return y.useCallback(aQ(...e),e)}aG(aJ,"setRef"),aG(aQ,"composeRefs"),aG(aY,"useComposedRefs");var aX=Object.defineProperty,a0=(e,t)=>aX(e,"name",{value:t,configurable:!0});function a1(e){let t=y.forwardRef((t,n)=>{let{children:r,...a}=t,o=null,i=!1,l=[];a7(r)&&"function"==typeof or&&(r=or(r._payload)),y.Children.forEach(r,e=>{if(a8(e)){i=!0;let t="child"in e.props?e.props.child:e.props.children;a7(t)&&"function"==typeof or&&(t=or(t._payload)),o=a3(e,t),l.push(o?.props?.children)}else l.push(e)}),o?o=y.cloneElement(o,void 0,l):!i&&1===y.Children.count(r)&&y.isValidElement(r)&&(o=r);let s=o?a6(o):void 0,c=aY(n,s);if(!o){if(r||0===r)throw Error(i?on(e):ot(e));return r}let u=a5(a,o.props??{});return o.type!==y.Fragment&&(u.ref=n?c:s),y.cloneElement(o,u)});return t.displayName=`${e}.Slot`,t}a0(a1,"createSlot");var a2=a1("Slot"),a4=Symbol.for("radix.slottable");a0(function(e){let t=a0(e=>"child"in e?e.children(e.child):e.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=a4,t},"createSlottable");var a3=a0((e,t)=>{if("child"in e.props){let t=e.props.child;return y.isValidElement(t)?y.cloneElement(t,void 0,e.props.children(t.props.children)):null}return y.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function a5(e,t){let n={...t};for(let r in t){let a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...e)=>{let t=o(...e);return a(...e),t}:a&&(n[r]=a):"style"===r?n[r]={...a,...o}:"className"===r&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function a6(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(n=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}function a8(e){return y.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===a4}a0(a5,"mergeProps"),a0(a6,"getElementRef"),a0(a8,"isSlottable");var a9=Symbol.for("react.lazy");function a7(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===a9&&"_payload"in e&&oe(e._payload)}function oe(e){return"object"==typeof e&&null!==e&&"then"in e}a0(a7,"isLazyComponent"),a0(oe,"isPromiseLike");var ot=a0(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),on=a0(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),or=v[" use ".trim().toString()],oa=rT("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[10px] text-sm font-medium transition-[color,background-color,border-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-background active:translate-y-px disabled:pointer-events-none disabled:opacity-50 disabled:active:translate-y-0 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-[0_8px_20px_-10px_color-mix(in_srgb,var(--primary)_65%,transparent)] hover:bg-primary/90 hover:shadow-[0_10px_24px_-10px_color-mix(in_srgb,var(--primary)_80%,transparent)]",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/88",outline:"border border-input bg-card shadow-[0_1px_2px_rgb(20_24_40/0.04)] hover:border-ring/35 hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent/75 hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3 text-xs",lg:"h-11 px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}});function oo(e){var t=e.className,n=e.variant,r=e.size,a=e.asChild,o=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className","variant","size","asChild"]);return(0,g.jsx)(void 0!==a&&a?a2:"button",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"button",className:aR(oa({variant:n,size:r,className:t}))},o))}var oi=Object.defineProperty,ol=(e,t)=>oi(e,"name",{value:t,configurable:!0}),os=!!("u">typeof window&&window.document&&window.document.createElement);function oc(e,t,{checkForDefaultPrevented:n=!0}={}){return ol(function(r){if(e?.(r),!1===n||!r||!r.defaultPrevented)return t?.(r)},"handleEvent")}function ou(e){if(!os)throw Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}function od(e){return"IFRAME"===e.tagName}ol(oc,"composeEventHandlers"),ol(function(e){if(!os)throw Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window},"getOwnerWindow"),ol(ou,"getOwnerDocument"),ol(function e(t,n=!1){let{activeElement:r}=ou(t);if(!r?.nodeName)return null;if(od(r)&&r.contentDocument)return e(r.contentDocument.body,n);if(n){let e=r.getAttribute("aria-activedescendant");if(e){let t=ou(r).getElementById(e);if(t)return t}}return r},"getActiveElement"),ol(od,"isFrame");var of=Object.defineProperty,op=(e,t)=>of(e,"name",{value:t,configurable:!0});function oh(e,t=[]){let n=[];function r(t,r){let a=y.createContext(r);a.displayName=t+"Context";let o=n.length;n=[...n,r];let i=op(t=>{let{scope:n,children:r,...i}=t,l=n?.[e]?.[o]||a,s=y.useMemo(()=>i,Object.values(i));return(0,g.jsx)(l.Provider,{value:s,children:r})},"Provider");function l(n,i,s={}){let{optional:c=!1}=s,u=i?.[e]?.[o]||a,d=y.useContext(u);if(d)return d;if(void 0!==r)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return i.displayName=t+"Provider",op(l,"useContext"),[i,l]}op(r,"createContext");let a=op(()=>{let t=n.map(e=>y.createContext(e));return op(function(n){let r=n?.[e]||t;return y.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},"useScope")},"createScope");return a.scopeName=e,[r,om(a,...t)]}function om(...e){let t=e[0];if(1===e.length)return t;let n=op(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return op(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let a=n(e)[`__scope${r}`];return{...t,...a}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}op(function(e,t){let n=y.createContext(t);n.displayName=e+"Context";let r=op(e=>{let{children:t,...r}=e,a=y.useMemo(()=>r,Object.values(r));return(0,g.jsx)(n.Provider,{value:a,children:t})},"Provider");function a(r,o={}){let{optional:i=!1}=o,l=y.useContext(n);if(l)return l;if(void 0!==t)return t;if(!i)throw Error(`\`${r}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",op(a,"useContext"),[r,a]},"createContext"),op(oh,"createContextScope"),op(om,"composeContextScopes");var og=globalThis?.document?y.useLayoutEffect:()=>{},oy=Object.defineProperty,ov=v[" useId ".trim().toString()]||(()=>void 0),ob=0;function ox(e){let[t,n]=y.useState(ov());return og(()=>{e||n(e=>e??String(ob++))},[e]),e||(t?`radix-${t}`:"")}oy(ox,"name",{value:"useId",configurable:!0});var ow=Object.defineProperty,ok=v[" useEffectEvent ".trim().toString()],oj=v[" useInsertionEffect ".trim().toString()];function oS(e){if("function"==typeof ok)return ok(e);let t=y.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});return"function"==typeof oj?oj(()=>{t.current=e}):og(()=>{t.current=e}),y.useMemo(()=>(...e)=>t.current?.(...e),[])}ow(oS,"name",{value:"useEffectEvent",configurable:!0});var oO=Object.defineProperty,oC=(e,t)=>oO(e,"name",{value:t,configurable:!0}),oN=v[" useInsertionEffect ".trim().toString()]||og;function oP({prop:e,defaultProp:t,onChange:n=oC(()=>{},"onChange"),caller:r}){let[a,o,i]=oE({defaultProp:t,onChange:n}),l=void 0!==e,s=l?e:a;return[s,y.useCallback(t=>{if(l){let n=o_(t)?t(e):t;n!==e&&i.current?.(n)}else o(t)},[l,e,o,i])]}function oE({defaultProp:e,onChange:t}){let[n,r]=y.useState(e),a=y.useRef(n),o=y.useRef(t);return oN(()=>{o.current=t},[t]),y.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,r,o]}function o_(e){return"function"==typeof e}oC(oP,"useControllableState"),oC(oE,"useUncontrolledState"),oC(o_,"isFunction");var oz=Symbol("RADIX:SYNC_STATE");oC(function(e,t,n,r){let{prop:a,defaultProp:o,onChange:i,caller:l}=t,s=void 0!==a,c=oS(i),u=[{...n,state:o}];r&&u.push(r);let[d,f]=y.useReducer((t,n)=>{if(n.type===oz)return{...t,state:n.state};let r=e(t,n);return s&&!Object.is(r.state,t.state)&&c(r.state),r},...u),p=d.state,h=y.useRef(p);y.useEffect(()=>{h.current!==p&&(h.current=p,s||c(p))},[p,h,s]);let m=y.useMemo(()=>void 0!==a?{...d,state:a}:d,[d,a]);return y.useEffect(()=>{s&&!Object.is(a,d.state)&&f({type:oz,state:a})},[a,d.state,s]),[m,f]},"useControllableStateReducer");var oT=d(3144),oA=Object.defineProperty,oR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=a1(`Primitive.${t}`),r=y.forwardRef((e,r)=>{let{asChild:a,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,g.jsx)(a?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function oL(e,t){e&&oT.flushSync(()=>e.dispatchEvent(t))}function oI(e){let t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...e)=>t.current?.(...e),[])}oA(oL,"name",{value:"dispatchDiscreteCustomEvent",configurable:!0}),(0,Object.defineProperty)(oI,"name",{value:"useCallbackRef",configurable:!0});var oM=Object.defineProperty,oD=(e,t)=>oM(e,"name",{value:t,configurable:!0}),oF="dismissableLayer.update",o$=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),oU=y.forwardRef(oD(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:l,onDismiss:s,...c}=e,u=y.useContext(o$),[d,f]=y.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=y.useState({}),v=aY(t,f),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=x?b.indexOf(x):-1,k=d?b.indexOf(d):-1,j=u.layersWithOutsidePointerEventsDisabled.size>0,S=k>=w,O=y.useRef(!1),C=oK(e=>{o?.(e),l?.(e),e.defaultPrevented||s?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:O,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:y.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return S&&!t},[u.branches,S])}),N=oV(e=>{if(r&&O.current)return;let t=e.target;![...u.branches].some(e=>e.contains(t))&&(i?.(e),l?.(e),e.defaultPrevented||s?.())},p),P=!!d&&k===b.length-1,E=oI(e=>{"Escape"===e.key&&(a?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))});return y.useEffect(()=>{if(P)return p.addEventListener("keydown",E,{capture:!0}),()=>p.removeEventListener("keydown",E,{capture:!0})},[p,P,E]),y.useEffect(()=>{if(d)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(h=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),oq(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),0===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=h))}},[d,p,n,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),oq())},[d,u]),y.useEffect(()=>{let e=oD(()=>m({}),"handleUpdate");return document.addEventListener(oF,e),()=>document.removeEventListener(oF,e)},[]),(0,g.jsx)(oR.div,{...c,ref:v,style:{pointerEvents:j?S?"auto":"none":void 0,...e.style},onFocusCapture:oc(e.onFocusCapture,N.onFocusCapture),onBlurCapture:oc(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:oc(e.onPointerDownCapture,C.onPointerDownCapture)})},"DismissableLayer"));function oH(){let e=y.useContext(o$),[t,n]=y.useState(null);return y.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}oD(oH,"useDismissableLayerSurface");var oB=oD(()=>!0,"IS_TRUE");function oK(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=oB}=t,l=oI(e),s=y.useRef(!1),c=y.useRef(!1),u=y.useRef(new Map),d=y.useRef(()=>{});return y.useEffect(()=>{function e(){c.current=!1,a.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...o].some(e=>e.contains(t))||u.current.set(e.type,!0),"click"===e.type&&window.setTimeout(()=>{c.current&&d.current()},0)}function p(e){c.current&&u.current.set(e.type,!1)}oD(e,"resetOutsideInteraction"),oD(t,"isOutsideInteractionIntercepted"),oD(f,"handleInteractionCapture"),oD(p,"handleInteractionBubble");let h=oD(o=>{if(o.target&&!s.current){let f=function(){n.removeEventListener("click",d.current);let r=t();e(),r||oW("dismissableLayer.pointerDownOutside",l,p,{discrete:!0})};if(oD(f,"handleAndDispatchPointerDownOutsideEvent"),!i(o.target)){n.removeEventListener("click",d.current),e(),s.current=!1;return}let p={originalEvent:o};c.current=!0,a.current=r&&0===o.button,u.current.clear(),r&&0===o.button?(n.removeEventListener("click",d.current),d.current=f,n.addEventListener("click",d.current,{once:!0})):f()}else n.removeEventListener("click",d.current),e();s.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let e of m)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener("pointerdown",h)},0);return()=>{for(let e of(window.clearTimeout(g),n.removeEventListener("pointerdown",h),n.removeEventListener("click",d.current),m))n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,l,r,a,o,i]),{onPointerDownCapture:oD(()=>s.current=!0,"onPointerDownCapture")}}function oV(e,t=globalThis?.document){let n=oI(e),r=y.useRef(!1);return y.useEffect(()=>{let e=oD(e=>{e.target&&!r.current&&oW("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:oD(()=>r.current=!0,"onFocusCapture"),onBlurCapture:oD(()=>r.current=!1,"onBlurCapture")}}function oq(){let e=new CustomEvent(oF);document.dispatchEvent(e)}function oW(e,t,n,{discrete:r}){let a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?oL(a,o):a.dispatchEvent(o)}oD(oK,"usePointerDownOutside"),oD(oV,"useFocusOutside"),oD(oq,"dispatchUpdate"),oD(oW,"handleAndDispatchCustomEvent");var oZ=Object.defineProperty,oG=(e,t)=>oZ(e,"name",{value:t,configurable:!0}),oJ="focusScope.autoFocusOnMount",oQ="focusScope.autoFocusOnUnmount",oY={bubbles:!1,cancelable:!0},oX=y.forwardRef(oG(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[l,s]=y.useState(null),c=oI(a),u=oI(o),d=y.useRef(null),f=aY(t,s),p=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let e=function(e){if(p.paused||!l)return;let t=e.target;l.contains(t)?d.current=t:o6(d.current,{select:!0})},t=function(e){if(p.paused||!l)return;let t=e.relatedTarget;null!==t&&(l.contains(t)||o6(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&o6(l)};oG(e,"handleFocusIn"),oG(t,"handleFocusOut"),oG(n,"handleMutations"),document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[r,l,p.paused]),y.useEffect(()=>{if(l){o8.add(p);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(oJ,oY);l.addEventListener(oJ,c),l.dispatchEvent(t),t.defaultPrevented||(o0(ie(o2(l)),{select:!0}),document.activeElement===e&&o6(l))}return()=>{l.removeEventListener(oJ,c),setTimeout(()=>{let t=new CustomEvent(oQ,oY);l.addEventListener(oQ,u),l.dispatchEvent(t),t.defaultPrevented||o6(e??document.body,{select:!0}),l.removeEventListener(oQ,u),o8.remove(p)},0)}}},[l,c,u,p]);let h=y.useCallback(e=>{if(!n&&!r||p.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){let t=e.currentTarget,[r,o]=o1(t);r&&o?e.shiftKey||a!==o?e.shiftKey&&a===r&&(e.preventDefault(),n&&o6(o,{select:!0})):(e.preventDefault(),n&&o6(r,{select:!0})):a===t&&e.preventDefault()}},[n,r,p.paused]);return(0,g.jsx)(oR.div,{tabIndex:-1,...i,ref:f,onKeyDown:h})},"FocusScope"));function o0(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(o6(r,{select:t}),document.activeElement!==n)return}function o1(e){let t=o2(e);return[o4(t,e),o4(t.reverse(),e)]}function o2(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:oG(e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}function o4(e,t){let n="function"==typeof t.checkVisibility&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):o3(r,{upTo:t})))return r}function o3(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function o5(e){return e instanceof HTMLInputElement&&"select"in e}function o6(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&o5(e)&&t&&e.select()}}oG(o0,"focusFirst"),oG(o1,"getTabbableEdges"),oG(o2,"getTabbableCandidates"),oG(o4,"findVisible"),oG(o3,"isHidden"),oG(o5,"isSelectableInput"),oG(o6,"focus");var o8=o9();function o9(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),(e=o7(e,t)).unshift(t)},remove(t){e=o7(e,t),e[0]?.resume()}}}function o7(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}function ie(e){return e.filter(e=>"A"!==e.tagName)}oG(o9,"createFocusScopesStack"),oG(o7,"arrayRemove"),oG(ie,"removeLinks");var it=Object.defineProperty,ir=y.forwardRef(it(function(e,t){let{container:n,...r}=e,[a,o]=y.useState(!1);og(()=>o(!0),[]);let i=n||a&&globalThis?.document?.body;return i?oT.createPortal((0,g.jsx)(oR.div,{...r,ref:t}),i):null},"name",{value:"Portal",configurable:!0})),ia=Object.defineProperty,io=(e,t)=>ia(e,"name",{value:t,configurable:!0});function ii(e,t){return y.useReducer((e,n)=>t[e][n]??e,e)}io(ii,"useStateMachine");var il=io(e=>{let{present:t,children:n}=e,r=is(t),a="function"==typeof n?n({present:r.isPresent}):y.Children.only(n),o=iu(r.ref,ip(a));return"function"==typeof n||r.isPresent?y.cloneElement(a,{ref:o}):null},"Presence");function is(e){let[t,n]=y.useState(),r=y.useRef(null),a=y.useRef(e),o=y.useRef("none"),i=y.useRef(void 0),[l,s]=ii(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{"mounted"===l?(o.current=i.current??id(r.current),i.current=void 0):o.current="none"},[l]),og(()=>{let t=r.current,n=a.current;if(n!==e){let r=o.current,l=id(t);e?(i.current=l,s("MOUNT")):"none"===l||t?.display==="none"?s("UNMOUNT"):n&&r!==l?s("ANIMATION_OUT"):s("UNMOUNT"),a.current=e}},[e,s]),og(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,i=io(o=>{let i=id(r.current).includes(CSS.escape(o.animationName));if(o.target===t&&i&&(s("ANIMATION_END"),!a.current)){let r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},"handleAnimationEnd"),l=io(e=>{e.target===t&&(o.current=id(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",l),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",l),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}s("ANIMATION_END")},[t,s]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,i.current=id(t)}else r.current=null;n(e)},[])}}function ic(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function iu(...e){let t=y.useRef(e);return t.current=e,y.useCallback(e=>{let n=t.current,r=!1,a=n.map(t=>{let n=ic(t,e);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let e=0;e<a.length;e++){let t=a[e];"function"==typeof t?t():ic(n[e],null)}}},[])}function id(e){return e?.animationName||"none"}function ip(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(n=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}io(is,"usePresence"),io(ic,"setRef"),io(iu,"useStableComposedRefs"),io(id,"getAnimationName"),io(ip,"getElementRef");var ih=Object.defineProperty,im=(e,t)=>ih(e,"name",{value:t,configurable:!0}),ig=0,iy=null;function iv(){y.useEffect(()=>{iy||(iy={start:ib(),end:ib()});let{start:e,end:t}=iy;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),ig++,()=>{1===ig&&(iy?.start.remove(),iy?.end.remove(),iy=null),ig=Math.max(0,ig-1)}},[])}function ib(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}im(function(e){return iv(),e.children},"FocusGuards"),im(iv,"useFocusGuards"),im(ib,"createFocusGuard");var ix=function(){return(ix=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function iw(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)0>t.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}var ik="right-scroll-bar-position",ij="width-before-scroll-bar";function iS(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var iO="u">typeof window?y.useLayoutEffect:y.useEffect,iC=new WeakMap,iN=(void 0===a&&(a={}),(void 0===o&&(o=function(e){return e}),i=[],l=!1,s={read:function(){if(l)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:null},useMedium:function(e){var t=o(e,l);return i.push(t),function(){i=i.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(l=!0;i.length;){var t=i;i=[],t.forEach(e)}i={push:function(t){return e(t)},filter:function(){return i}}},assignMedium:function(e){l=!0;var t=[];if(i.length){var n=i;i=[],n.forEach(e),t=i}var r=function(){var n=t;t=[],n.forEach(e)},a=function(){return Promise.resolve().then(r)};a(),i={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),i}}}}).options=ix({async:!0,ssr:!1},a),s),iP=function(){},iE=y.forwardRef(function(e,t){var n,r,a,o,i=y.useRef(null),l=y.useState({onScrollCapture:iP,onWheelCapture:iP,onTouchMoveCapture:iP}),s=l[0],c=l[1],u=e.forwardProps,d=e.children,f=e.className,p=e.removeScrollBar,h=e.enabled,m=e.shards,g=e.sideCar,v=e.noRelative,b=e.noIsolation,x=e.inert,w=e.allowPinchZoom,k=e.as,j=e.gapMode,S=iw(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=(n=[i,t],r=function(e){return n.forEach(function(t){return iS(t,e)})},(a=(0,y.useState)(function(){return{value:null,callback:r,facade:{get current(){return a.value},set current(value){var e=a.value;e!==value&&(a.value=value,a.callback(value,e))}}}})[0]).callback=r,o=a.facade,iO(function(){var e=iC.get(o);if(e){var t=new Set(e),r=new Set(n),a=o.current;t.forEach(function(e){r.has(e)||iS(e,null)}),r.forEach(function(e){t.has(e)||iS(e,a)})}iC.set(o,n)},[n]),o),C=ix(ix({},S),s);return y.createElement(y.Fragment,null,h&&y.createElement(g,{sideCar:iN,removeScrollBar:p,shards:m,noRelative:v,noIsolation:b,inert:x,setCallbacks:c,allowPinchZoom:!!w,lockRef:i,gapMode:j}),u?y.cloneElement(y.Children.only(d),ix(ix({},C),{ref:O})):y.createElement(void 0===k?"div":k,ix({},C,{className:f,ref:O}),d))});iE.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},iE.classNames={fullWidth:ij,zeroRight:ik};var i_=function(e){var t=e.sideCar,n=iw(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return y.createElement(r,ix({},n))};i_.isSideCarExport=!0;var iz=function(){var e=0,t=null;return{add:function(n){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=m||d.nc;return t&&e.setAttribute("nonce",t),e}())){var r,a;(r=t).styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n)),a=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(a)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},iT=function(){var e=iz();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},iA=function(){var e=iT();return function(t){return e(t.styles,t.dynamic),null}},iR={left:0,top:0,right:0,gap:0},iL=function(e){return parseInt(e||"",10)||0},iI=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[iL(n),iL(r),iL(a)]},iM=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return iR;var t=iI(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},iD=iA(),iF="data-scroll-locked",i$=function(e,t,n,r){var a=e.left,o=e.top,i=e.right,l=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(l,"px ").concat(r,";\n }\n body[").concat(iF,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(l,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(ik," {\n right: ").concat(l,"px ").concat(r,";\n }\n \n .").concat(ij," {\n margin-right: ").concat(l,"px ").concat(r,";\n }\n \n .").concat(ik," .").concat(ik," {\n right: 0 ").concat(r,";\n }\n \n .").concat(ij," .").concat(ij," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(iF,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(l,"px;\n }\n")},iU=function(){var e=parseInt(document.body.getAttribute(iF)||"0",10);return isFinite(e)?e:0},iH=function(){y.useEffect(function(){return document.body.setAttribute(iF,(iU()+1).toString()),function(){var e=iU()-1;e<=0?document.body.removeAttribute(iF):document.body.setAttribute(iF,e.toString())}},[])},iB=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=void 0===r?"margin":r;iH();var o=y.useMemo(function(){return iM(a)},[a]);return y.createElement(iD,{styles:i$(o,!t,a,n?"":"!important")})},iK=!1;if("u">typeof window)try{var iV=Object.defineProperty({},"passive",{get:function(){return iK=!0,!0}});window.addEventListener("test",iV,iV),window.removeEventListener("test",iV,iV)}catch(e){iK=!1}var iq=!!iK&&{passive:!1},iW=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&(n.overflowY!==n.overflowX||"TEXTAREA"===e.tagName||"visible"!==n[t])},iZ=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),iG(e,r)){var a=iJ(e,r);if(a[1]>a[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},iG=function(e,t){return"v"===e?iW(t,"overflowY"):iW(t,"overflowX")},iJ=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},iQ=function(e,t,n,r,a){var o,i=(o=window.getComputedStyle(t).direction,"h"===e&&"rtl"===o?-1:1),l=i*r,s=n.target,c=t.contains(s),u=!1,d=l>0,f=0,p=0;do{if(!s)break;var h=iJ(e,s),m=h[0],g=h[1]-h[2]-i*m;(m||g)&&iG(e,s)&&(f+=g,p+=m);var y=s.parentNode;s=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return d&&(a&&1>Math.abs(f)||!a&&l>f)?u=!0:!d&&(a&&1>Math.abs(p)||!a&&-l>p)&&(u=!0),u},iY=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},iX=function(e){return[e.deltaX,e.deltaY]},i0=function(e){return e&&"current"in e?e.current:e},i1=0,i2=[];let i4=(c=function(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(i1++)[0],o=y.useState(iA)[0],i=y.useRef(e);y.useEffect(function(){i.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=(function(e,t,n){if(n||2==arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(i0),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=y.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,o=iY(e),l=n.current,s="deltaX"in e?e.deltaX:l[0]-o[0],c="deltaY"in e?e.deltaY:l[1]-o[1],u=e.target,d=Math.abs(s)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var h=iZ(d,u);if(!h)return!0;if(h?a=d:(a="v"===d?"h":"v",h=iZ(d,u)),!h)return!1;if(!r.current&&"changedTouches"in e&&(s||c)&&(r.current=a),!a)return!0;var m=r.current||a;return iQ(m,t,e,"h"===m?s:c,!0)},[]),s=y.useCallback(function(e){if(i2.length&&i2[i2.length-1]===o){var n="deltaY"in e?iX(e):iY(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===n[0]&&r[1]===n[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var a=(i.current.shards||[]).map(i0).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?l(e,a[0]):!i.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=y.useCallback(function(e,n,r,a){var o={name:e,delta:n,target:r,should:a,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=y.useCallback(function(e){n.current=iY(e),r.current=void 0},[]),d=y.useCallback(function(t){c(t.type,iX(t),t.target,l(t,e.lockRef.current))},[]),f=y.useCallback(function(t){c(t.type,iY(t),t.target,l(t,e.lockRef.current))},[]);y.useEffect(function(){return i2.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",s,iq),document.addEventListener("touchmove",s,iq),document.addEventListener("touchstart",u,iq),function(){i2=i2.filter(function(e){return e!==o}),document.removeEventListener("wheel",s,iq),document.removeEventListener("touchmove",s,iq),document.removeEventListener("touchstart",u,iq)}},[]);var p=e.removeScrollBar,h=e.inert;return y.createElement(y.Fragment,null,h?y.createElement(o,{styles:"\n .block-interactivity-".concat(a," {pointer-events: none;}\n .allow-interactivity-").concat(a," {pointer-events: all;}\n")}):null,p?y.createElement(iB,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},iN.useMedium(c),i_);var i3=y.forwardRef(function(e,t){return y.createElement(iE,ix({},e,{ref:t,sideCar:i4}))});i3.classNames=iE.classNames;var i5=new WeakMap,i6=new WeakMap,i8={},i9=0,i7=function(e){return e&&(e.host||i7(e.parentNode))},le=function(e,t,n,r){var a=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var n=i7(e);return n&&t.contains(n)?n:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});i8[n]||(i8[n]=new WeakMap);var o=i8[n],i=[],l=new Set,s=new Set(a),c=function(e){!e||l.has(e)||(l.add(e),c(e.parentNode))};a.forEach(c);var u=function(e){!e||s.has(e)||Array.prototype.forEach.call(e.children,function(e){if(l.has(e))u(e);else try{var t=e.getAttribute(r),a=null!==t&&"false"!==t,s=(i5.get(e)||0)+1,c=(o.get(e)||0)+1;i5.set(e,s),o.set(e,c),i.push(e),1===s&&a&&i6.set(e,!0),1===c&&e.setAttribute(n,"true"),a||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return u(t),l.clear(),i9++,function(){i.forEach(function(e){var t=i5.get(e)-1,a=o.get(e)-1;i5.set(e,t),o.set(e,a),t||(i6.has(e)||e.removeAttribute(r),i6.delete(e)),a||e.removeAttribute(n)}),--i9||(i5=new WeakMap,i5=new WeakMap,i6=new WeakMap,i8={})}},lt=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),le(r,a,n,"aria-hidden")):function(){return null}},ln=Object.defineProperty,lr=(e,t)=>ln(e,"name",{value:t,configurable:!0}),la="Dialog",[lo,li]=oh(la),[ll,ls]=lo(la),lc=lr(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:i=!0}=e,l=y.useRef(null),s=y.useRef(null),[c,u]=oP({prop:r,defaultProp:a??!1,onChange:o,caller:la}),[d,f]=y.useState(0),[p,h]=y.useState(0);return(0,g.jsx)(ll,{scope:t,triggerRef:l,contentRef:s,contentId:ox(),titleId:ox(),descriptionId:ox(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:h,open:c,onOpenChange:u,onOpenToggle:y.useCallback(()=>u(e=>!e),[u]),modal:i,children:n})},"Dialog"),lu=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls("DialogTrigger",n),o=aY(t,a.triggerRef);return(0,g.jsx)(oR.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":lN(a.open),...r,ref:o,onClick:oc(e.onClick,a.onOpenToggle)})},"DialogTrigger")),ld="DialogPortal",[lf,lp]=lo(ld,{forceMount:void 0}),lh=lr(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=ls(ld,t);return(0,g.jsx)(lf,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,g.jsx)(il,{present:n||o.open,children:(0,g.jsx)(ir,{asChild:!0,container:a,children:e})}))})},"DialogPortal"),lm="DialogOverlay",lg=y.forwardRef(lr(function(e,t){let n=lp(lm,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=ls(lm,e.__scopeDialog);return o.modal?(0,g.jsx)(il,{present:r||o.open,children:(0,g.jsx)(lv,{...a,ref:t})}):null},"DialogOverlay")),ly=a1("DialogOverlay.RemoveScroll"),lv=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls(lm,n),o=aY(t,oH());return(0,g.jsx)(i3,{as:ly,allowPinchZoom:!0,shards:[a.contentRef],children:(0,g.jsx)(oR.div,{"data-state":lN(a.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})},"DialogOverlayImpl")),lb="DialogContent",lx=y.forwardRef(lr(function(e,t){let n=lp(lb,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=ls(lb,e.__scopeDialog);return(0,g.jsx)(il,{present:r||o.open,children:o.modal?(0,g.jsx)(lw,{...a,ref:t}):(0,g.jsx)(lk,{...a,ref:t})})},"DialogContent")),lw=y.forwardRef(lr(function(e,t){let n=ls(lb,e.__scopeDialog),r=y.useRef(null),a=aY(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return lt(e)},[]),(0,g.jsx)(lj,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:oc(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:oc(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:oc(e.onFocusOutside,e=>e.preventDefault())})},"DialogContentModal")),lk=y.forwardRef(lr(function(e,t){let n=ls(lb,e.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return(0,g.jsx)(lj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));let o=t.target;n.triggerRef.current?.contains(o)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})},"DialogContentNonModal")),lj=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,l=ls(lb,n);return iv(),(0,g.jsx)(g.Fragment,{children:(0,g.jsx)(oX,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,g.jsx)(oU,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionPresent?l.descriptionId:void 0,"aria-labelledby":l.titlePresent?l.titleId:void 0,"data-state":lN(l.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})},"DialogContentImpl")),lS=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls("DialogTitle",n),{setTitleCount:o}=a;return og(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,g.jsx)(oR.h2,{id:a.titleId,...r,ref:t})},"DialogTitle")),lO=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls("DialogDescription",n),{setDescriptionCount:o}=a;return og(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,g.jsx)(oR.p,{id:a.descriptionId,...r,ref:t})},"DialogDescription")),lC=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls("DialogClose",n);return(0,g.jsx)(oR.button,{type:"button",...r,ref:t,onClick:oc(e.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function lN(e){return e?"open":"closed"}lr(lN,"getState");let lP=O("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function lE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function l_(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function lz(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)(lg,lE({"data-slot":"dialog-overlay",className:aR("fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t)},n))}function lT(e){var t,n,r=e.className,a=e.children,o=l_(e,["className","children"]);return(0,g.jsxs)(lh,{children:[(0,g.jsx)(lz,{}),(0,g.jsxs)(lx,(t=lE({"data-slot":"dialog-content",className:aR("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-card p-6 shadow-2xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-2xl",r)},o),n=n={children:[a,(0,g.jsxs)(lC,{className:"absolute right-4 top-4 cursor-pointer rounded-sm opacity-70 ring-offset-background transition-[opacity,background-color] hover:bg-accent hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 active:bg-accent/80 disabled:pointer-events-none",children:[(0,g.jsx)(lP,{className:"size-4"}),(0,g.jsx)("span",{className:"sr-only",children:"Close"})]})]},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))]})}function lA(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)("div",lE({"data-slot":"dialog-header",className:aR("flex flex-col space-y-1.5 text-center sm:text-left",t)},n))}function lR(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)("div",lE({"data-slot":"dialog-footer",className:aR("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t)},n))}function lL(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)(lS,lE({"data-slot":"dialog-title",className:aR("text-lg font-semibold leading-none tracking-tight",t)},n))}function lI(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)(lO,lE({"data-slot":"dialog-description",className:aR("text-sm text-muted-foreground",t)},n))}function lM(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function lD(e,t,n){return(lD=lB()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&lU(a,n.prototype),a}).apply(null,arguments)}function lF(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l$(e){return(l$=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function lU(e,t){return(lU=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function lH(e){var t="function"==typeof Map?new Map:void 0;return(lH=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return lD(e,arguments,l$(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),lU(n,e)})(e)}function lB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(lB=function(){return!!e})()}var lK=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(e,n){var r,a,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return r=t,a=[n],r=l$(r),lF(o=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,lB()?Reflect.construct(r,a||[],l$(this).constructor):r.apply(this,a)),"status",void 0),lF(o,"code",void 0),lF(o,"params",void 0),o.status=e,o.name="ApiError",o.code=i.code,o.params=i.params,o}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&lU(t,e),t}(lH(Error));function lV(e){return"/api/harnesses/".concat(e,"/profiles")}function lq(e,t){return"".concat(lV(e),"/").concat(encodeURIComponent(t))}function lW(e){return e?"/api/backups/".concat(encodeURIComponent(e)):"/api/backups"}function lZ(){return"/api/providers"}function lG(e){return"".concat(lZ(),"/").concat(encodeURIComponent(e))}function lJ(e){return e?"/api/drift/".concat(encodeURIComponent(e)):"/api/drift"}function lQ(){return"/api/scan"}function lY(e){return e?"/api/operations?harness=".concat(encodeURIComponent(e)):"/api/operations"}function lX(e){var t;return(t=function(e){var t,n,r,a,o,i=arguments;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:var s,c;return n=new Headers((t=i.length>1&&void 0!==i[1]?i[1]:{}).headers),t.body&&!n.has("Content-Type")&&n.set("Content-Type","application/json"),[4,fetch(e,(s=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){lF(e,t,n[t])})}return e}({credentials:"include"},t),c=c={headers:n},Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(c)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(c)).forEach(function(e){Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(c,e))}),s))];case 1:return[4,(r=l.sent()).json().catch(function(){return{}})];case 2:if(a=l.sent(),!r.ok)throw new lK(r.status,null!=(o=a.error)?o:"",{code:a.code,params:a.params});return[2,a]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(e){lM(o,r,a,i,l,"next",e)}function l(e){lM(o,r,a,i,l,"throw",e)}i(void 0)})}).apply(this,arguments)}function l0(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l1(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function l2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function l4(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function l3(e){return e.startsWith("warning.")||e.startsWith("error.")?e:"error.".concat(e)}function l5(e){return e.code?{key:l3(e.code),params:e.params,scope:e.scope,fallback:e.message}:{key:"error.unknown",fallback:e.message,scope:e.scope}}function l6(e){return l1(e,lK)?l5({message:e.message,code:e.code,params:e.params}):{key:"error.unknown",fallback:l1(e,Error)?e.message:String(e)}}function l8(e,t){var n=l6(e);return"error.unknown"===n.key?l4(l2({},n),{key:t}):n}var l9=new Set(["drift.adoptFailed","drift.reapplyFailed","vault.deleteFailed","vault.saveFailed","vault.revealFailed","operations.undoFailed","import.failed","activate.loadFailed","backup.loadFailed","backup.diffFailed"]);function l7(e,t){if(t.fallback&&("error.unknown"===t.key||l9.has(t.key))){var n,r,a,o=null!=(a=t.fallback)?a:t.key;return t.scope?"".concat(t.scope,": ").concat(o):o}var i=Object.fromEntries(Object.entries(null!=(n=t.paramKeys)?n:{}).map(function(t){var n=function(e){if(Array.isArray(e))return e}(t)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(t)||function(e){if(e){if("string"==typeof e)return l0(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l0(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();return[n[0],e(n[1])]})),l=e(t.key,l4(l2({},t.params,i),{defaultValue:null!=(r=t.fallback)?r:t.key}));return t.scope?"".concat(t.scope,": ").concat(l):l}let se=e=>{let t,n=new Set,r=(e,r)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=r?r:"object"!=typeof a||null===a)?a:Object.assign({},t,a),n.forEach(n=>n(t,e))}},a=()=>t,o={setState:r,getState:a,getInitialState:()=>i,subscribe:e=>(n.add(e),()=>n.delete(e))},i=t=e(r,a,o);return o};function st(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sn(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function sr(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){sn(o,r,a,i,l,"next",e)}function l(e){sn(o,r,a,i,l,"throw",e)}i(void 0)})}}function sa(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function so(e){return function(e){if(Array.isArray(e))return st(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return st(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return st(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function si(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function sl(e,t,n){var r,a;return t?{key:e,params:(r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},n),a=a={user:t},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(a,e))}),r)}:{key:e,params:n,paramKeys:{user:"notice.currentUser"}}}var ss=(t=(r=function(e,t){return{sessionChecked:!1,authenticated:!1,currentUser:"",users:[],usersLoading:!1,loading:!1,error:null,envFile:"",harnesses:[],backups:[],notice:null,providers:null,providersLoading:!1,providersError:null,doctor:null,doctorUpdatedAvailable:!1,doctorLoading:!1,doctorError:null,drift:null,driftLoading:!1,driftError:null,scan:null,scanLoading:!1,scanError:null,operations:null,operationsLoading:!1,operationsError:null,loadSession:function(){return sr(function(){var n;return si(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),[4,lX("/api/auth/session")];case 1:return e({authenticated:!0,sessionChecked:!0,currentUser:r.sent().currentUser,error:null}),[4,t().loadUsers()];case 2:return r.sent(),[4,Promise.all([t().loadHarnesses(),t().loadBackups()])];case 3:return r.sent(),[4,t().loadDrift()];case 4:return r.sent(),[3,6];case 5:return e({authenticated:!1,sessionChecked:!0,error:sa(n=r.sent(),lK)&&401===n.status?null:l6(n)}),[3,6];case 6:return[2]}})})()},login:function(n){return sr(function(){var r;return si(this,function(a){switch(a.label){case 0:e({loading:!0,error:null}),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,lX("/api/auth/login",{method:"POST",body:JSON.stringify({password:n})})];case 2:return e({authenticated:!0,loading:!1,currentUser:a.sent().currentUser}),[4,t().loadUsers()];case 3:return a.sent(),[4,t().loadHarnesses()];case 4:return a.sent(),[3,6];case 5:throw e({loading:!1,error:l6(r=a.sent())}),r;case 6:return[2]}})})()},logout:function(){return sr(function(){return si(this,function(t){switch(t.label){case 0:return[4,lX("/api/auth/logout",{method:"POST"})];case 1:return t.sent(),e({authenticated:!1,currentUser:"",users:[],harnesses:[],backups:[],envFile:"",providers:null,doctor:null,doctorUpdatedAvailable:!1,drift:null}),[2]}})})()},loadUsers:function(){return sr(function(){var t;return si(this,function(n){switch(n.label){case 0:e({usersLoading:!0}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,lX("/api/users")];case 2:return e({users:(t=n.sent()).items,currentUser:t.currentUser,usersLoading:!1}),[3,4];case 3:return e({usersLoading:!1,error:l6(n.sent())}),[3,4];case 4:return[2]}})})()},switchUser:function(n){return sr(function(){var r;return si(this,function(a){switch(a.label){case 0:if(!n||n===t().currentUser)return[2];e({usersLoading:!0,loading:!0,error:null}),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,lX("/api/users/".concat(encodeURIComponent(n),"/select"),{method:"POST"})];case 2:return a.sent(),e({currentUser:n,harnesses:[],backups:[],envFile:"",providers:null,doctor:null,doctorUpdatedAvailable:!1,drift:null}),[4,t().loadUsers()];case 3:return a.sent(),[4,Promise.all([t().loadHarnesses(),t().loadBackups()])];case 4:return a.sent(),e({usersLoading:!1,loading:!1}),[3,6];case 5:throw e({usersLoading:!1,loading:!1,error:l6(r=a.sent())}),r;case 6:return[2]}})})()},loadHarnesses:function(){return sr(function(){var n,r;return si(this,function(a){switch(a.label){case 0:e({loading:!0,error:null}),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,lX("/api/harnesses")];case 2:return e({harnesses:(n=a.sent()).items,envFile:n.envFile,loading:!1}),[4,t().loadDrift()];case 3:return a.sent(),[3,5];case 4:if(sa(r=a.sent(),lK)&&401===r.status)return e({authenticated:!1,loading:!1,harnesses:[]}),[2];return e({loading:!1,error:l6(r)}),[3,5];case 5:return[2]}})})()},createProfile:function(e,n){return sr(function(){return si(this,function(r){switch(r.label){case 0:return[4,lX(lV(e),{method:"POST",body:JSON.stringify(n)})];case 1:return r.sent(),[4,t().loadHarnesses()];case 2:return r.sent(),[2]}})})()},updateProfile:function(e,n,r){return sr(function(){return si(this,function(a){switch(a.label){case 0:return[4,lX(lq(e,n),{method:"PATCH",body:JSON.stringify(r)})];case 1:return a.sent(),[4,t().loadHarnesses()];case 2:return a.sent(),[2]}})})()},deleteProfile:function(e,n){return sr(function(){return si(this,function(r){switch(r.label){case 0:return[4,lX(lq(e,n),{method:"DELETE"})];case 1:return r.sent(),[4,t().loadHarnesses()];case 2:return r.sent(),[2]}})})()},activateProfile:function(n,r){return sr(function(){var a,o,i,l;return si(this,function(s){switch(s.label){case 0:return[4,lX("".concat(lq(n,r),"/activate"),{method:"POST"})];case 1:return i=s.sent(),l=null!=(a=null==(o=t().harnesses.find(function(e){return e.id===n}))?void 0:o.label)?a:n,e({notice:[sl("notice.activated",t().currentUser,{harness:l,profile:r}),{key:"notice.activatedHint"}].concat(so(i.warnings.map(l5)))}),[4,t().loadHarnesses()];case 2:return s.sent(),[2]}})})()},activateOfficial:function(n){return sr(function(){var r,a,o,i;return si(this,function(l){switch(l.label){case 0:return[4,lX("/api/harnesses/".concat(n,"/official/activate"),{method:"POST"})];case 1:return o=l.sent(),i=null!=(r=null==(a=t().harnesses.find(function(e){return e.id===n}))?void 0:a.label)?r:n,e({notice:[sl("notice.officialRestored",t().currentUser,{harness:i}),{key:"notice.officialHint"}].concat(so(o.warnings.map(l5)))}),[4,t().loadHarnesses()];case 2:return l.sent(),[2]}})})()},previewProfile:function(e,t){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX("".concat(lq(e,t),"/preview"))];case 1:return[2,n.sent().targets]}})})()},loadBackups:function(){return sr(function(){var t;return si(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,lX(lW())];case 1:return e({backups:n.sent().items}),[3,3];case 2:return sa(t=n.sent(),lK)&&401===t.status||e({error:l6(t)}),[3,3];case 3:return[2]}})})()},loadBackupDetail:function(e){return sr(function(){return si(this,function(t){return[2,lX(lW(e))]})})()},restoreBackup:function(n){return sr(function(){return si(this,function(r){switch(r.label){case 0:return[4,lX("".concat(lW(n),"/restore"),{method:"POST"})];case 1:return r.sent(),e({notice:[{key:"backup.written"}]}),[4,Promise.all([t().loadHarnesses(),t().loadBackups()])];case 2:return r.sent(),[2]}})})()},loadProviders:function(){return sr(function(){var t;return si(this,function(n){switch(n.label){case 0:e({providersLoading:!0,providersError:null}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,lX(lZ())];case 2:return e({providers:n.sent().items,providersLoading:!1}),[3,4];case 3:if(sa(t=n.sent(),lK)&&401===t.status)return e({authenticated:!1,providersLoading:!1,providers:[]}),[2];return e({providersLoading:!1,providersError:l6(t)}),[3,4];case 4:return[2]}})})()},createProvider:function(e){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX(lZ(),{method:"POST",body:JSON.stringify(e)})];case 1:return n.sent(),[4,t().loadProviders()];case 2:return n.sent(),[2]}})})()},updateProvider:function(e,n){return sr(function(){var r;return si(this,function(a){switch(a.label){case 0:return[4,lX(lG(e),{method:"PATCH",body:JSON.stringify(n)})];case 1:return r=a.sent(),[4,t().loadProviders()];case 2:return a.sent(),[4,t().loadHarnesses()];case 3:return a.sent(),[4,t().loadDrift()];case 4:return a.sent(),[2,r]}})})()},deleteProvider:function(e){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX(lG(e),{method:"DELETE"})];case 1:return n.sent(),[4,t().loadProviders()];case 2:return n.sent(),[2]}})})()},revealProvider:function(e){return sr(function(){return si(this,function(t){return[2,lX("".concat(lG(e),"/reveal"))]})})()},probeDraft:function(e){return sr(function(){return si(this,function(t){switch(t.label){case 0:return[4,lX("/api/probe",{method:"POST",body:JSON.stringify(e)})];case 1:return[2,t.sent().result]}})})()},probeProfile:function(e,t){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX("".concat(lq(e,t),"/probe"),{method:"POST",body:JSON.stringify({})})];case 1:return[2,n.sent().result]}})})()},probeVaultEntry:function(e,t){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX("".concat(lG(e),"/probe"),{method:"POST",body:JSON.stringify(t?{endpoint:t}:{})})];case 1:return[2,n.sent().result]}})})()},loadDoctor:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:e({doctorLoading:!0,doctorError:null}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,lX(n?"/api/doctor?harness=".concat(encodeURIComponent(n)):"/api/doctor")];case 2:return a=i.sent(),e({doctor:so((null!=(r=t().doctor)?r:[]).filter(function(e){return e.harness!==n})).concat(so(a.items.filter(function(e){return e.harness===n}))),doctorUpdatedAvailable:a.updatedAvailable,doctorLoading:!1}),[3,4];case 3:if(sa(o=i.sent(),lK)&&401===o.status)return e({authenticated:!1,doctorLoading:!1,doctor:[]}),[2];return e({doctorLoading:!1,doctorError:l6(o)}),[3,4];case 4:return[2]}})})()},loadDrift:function(){return sr(function(){var t,n;return si(this,function(r){switch(r.label){case 0:e({driftLoading:!0,driftError:null}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,lX(lJ())];case 2:return e({drift:null!=(t=r.sent().items)?t:[],driftLoading:!1}),[3,4];case 3:if(sa(n=r.sent(),lK)&&401===n.status)return e({authenticated:!1,driftLoading:!1,drift:[]}),[2];return e({driftLoading:!1,driftError:l6(n)}),[3,4];case 4:return[2]}})})()},reapplyDrift:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:return[4,lX("".concat(lJ(n),"/reapply"),{method:"POST"})];case 1:return o=i.sent(),e({notice:[{key:"drift.reapplied",params:{harness:null!=(r=null==(a=t().harnesses.find(function(e){return e.id===n}))?void 0:a.label)?r:n}}]}),[4,t().loadDrift()];case 2:return i.sent(),[2,o.files]}})})()},adoptDrift:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:return[4,lX("".concat(lJ(n),"/adopt"),{method:"POST"})];case 1:return o=i.sent(),e({notice:[{key:"drift.adopted",params:{harness:null!=(r=null==(a=t().harnesses.find(function(e){return e.id===n}))?void 0:a.label)?r:n}}]}),[4,t().loadHarnesses()];case 2:return i.sent(),[2,o]}})})()},loadScan:function(){return sr(function(){var t;return si(this,function(n){switch(n.label){case 0:e({scanLoading:!0,scanError:null}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,lX(lQ())];case 2:return e({scan:n.sent().items,scanLoading:!1}),[3,4];case 3:if(sa(t=n.sent(),lK)&&401===t.status)return e({authenticated:!1,scanLoading:!1,scan:[]}),[2];return e({scanLoading:!1,scanError:l6(t)}),[3,4];case 4:return[2]}})})()},importScan:function(e){return sr(function(){var n;return si(this,function(r){switch(r.label){case 0:return[4,lX("".concat(lQ(),"/import"),{method:"POST",body:JSON.stringify({selections:e})})];case 1:return n=r.sent(),[4,Promise.all([t().loadHarnesses(),t().loadProviders(),t().loadScan()])];case 2:return r.sent(),[2,n]}})})()},loadOperations:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:e({operationsLoading:!0,operationsError:null}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,lX(lY(n))];case 2:return a=i.sent(),e({operations:so((null!=(r=t().operations)?r:[]).filter(function(e){return e.harness!==n})).concat(so(a.items.filter(function(e){return e.harness===n}))),operationsLoading:!1}),[3,4];case 3:if(sa(o=i.sent(),lK)&&401===o.status)return e({authenticated:!1,operationsLoading:!1,operations:[]}),[2];return e({operationsLoading:!1,operationsError:l6(o)}),[3,4];case 4:return[2]}})})()},undoOperation:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:return[4,lX("".concat(lY(),"/").concat(encodeURIComponent(n),"/undo"),{method:"POST"})];case 1:return o=i.sent().receipt,e({notice:[{key:"operations.undone",params:{harness:null!=(r=null==(a=t().harnesses.find(function(e){return e.id===o.harness}))?void 0:a.label)?r:o.harness}}]}),[4,Promise.all([t().loadHarnesses(),t().loadBackups(),t().loadOperations(o.harness)])];case 2:return i.sent(),[2]}})})()},setNotice:function(t){return e({notice:t})},clearNotice:function(){return e({notice:null})}}},se(r)),Object.assign(n=e=>(function(e,t=e=>e){let n=y.useSyncExternalStore(e.subscribe,y.useCallback(()=>t(e.getState()),[e,t]),y.useCallback(()=>t(e.getInitialState()),[e,t]));return y.useDebugValue(n),n})(t,e),t),n);function sc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function su(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sc(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sd(e){var t,n=e.harnessId,r=(0,x.s9)().locale,a=(0,x.Bd)().t,o=ss(function(e){return e.backups}),i=ss(function(e){return e.loadBackups}),l=ss(function(e){return e.loadBackupDetail}),s=ss(function(e){return e.restoreBackup}),c=su((0,y.useState)(!1),2),u=c[0],d=c[1],f=su((0,y.useState)(null),2),p=f[0],h=f[1],m=su((0,y.useState)(null),2),v=m[0],b=m[1],w=su((0,y.useState)(null),2),k=w[0],j=w[1],S=su((0,y.useState)(!1),2),O=S[0],C=S[1],N=o.filter(function(e){return e.harness===n}),P=null!=(t=o.find(function(e){return e.id===p}))?t:null,E=F[n];return(0,y.useEffect)(function(){i()},[i]),(0,y.useEffect)(function(){d(!1),h(null)},[n]),(0,y.useEffect)(function(){if(!p){b(null),j(null),C(!1);return}var e=!1;return b(null),j(null),C(!0),l(p).then(function(t){e||b(t)}).catch(function(t){e||j(l8(t,"backup.diffFailed"))}).finally(function(){e||C(!1)}),function(){e=!0}},[p,l]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(oo,{className:"w-full justify-between",size:"sm",variant:"outline",onClick:function(){return d(!0)},children:[(0,g.jsx)(rE,{}),a("backup.history"),N.length>0?(0,g.jsx)(aI,{variant:"secondary",children:N.length}):null]}),(0,g.jsx)(lc,{open:u,onOpenChange:d,children:(0,g.jsxs)(lT,{className:"max-w-xl",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:a("backup.historyTitle",{harness:E})}),(0,g.jsx)(lI,{children:a("backup.historyIntro")})]}),0===N.length?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:a("backup.empty")}):(0,g.jsx)("ul",{className:"max-h-80 divide-y overflow-y-auto rounded-xl border",children:N.map(function(e){var t,n,o;return(0,g.jsxs)("li",{className:"flex items-center gap-3 px-3 py-2.5 hover:bg-muted/30",children:[(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,g.jsx)("p",{className:"truncate text-sm font-medium",children:e.profile}),e.current?(0,g.jsx)(aI,{children:a("backup.currentBadge")}):null]}),(0,g.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[(t=e.createdAt,n=r,Number.isNaN((o=new Date(t)).getTime())?t:o.toLocaleString(n))," \xb7"," ",a("backup.fileCount",{count:e.files.length}),e.files.some(function(e){return!e.existed})?" \xb7 ".concat(a("backup.withDeletions")):""]})]}),e.current?null:(0,g.jsx)(oo,{size:"sm",variant:"outline",className:"shrink-0",onClick:function(){return h(e.id)},children:a("backup.restore")})]},e.id)})})]})}),(0,g.jsx)(lc,{open:null!==P,onOpenChange:function(e){return!e&&h(null)},children:(0,g.jsxs)(lT,{className:"flex max-h-[85vh] w-[min(64rem,calc(100vw-2rem))] max-w-5xl flex-col overflow-hidden",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:a("backup.restoreHistoryTitle")}),(0,g.jsx)(lI,{children:a("backup.restoreHistoryBody")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[O?(0,g.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:a("backup.comparing")}):null,k?(0,g.jsx)("p",{className:"py-8 text-center text-sm text-destructive",children:l7(a,k)}):null,v?(0,g.jsx)(aK,{files:v.files}):null]}),(0,g.jsxs)(lR,{children:[(0,g.jsx)(oo,{variant:"outline",onClick:function(){return h(null)},children:a("common.cancel")}),(0,g.jsx)(oo,{disabled:O||null!==k||null===v,onClick:function(){p&&s(p).then(function(){h(null),d(!1)})},children:a("backup.confirmRestore")})]})]})})]})}let sf=O("stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]),sp=O("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),sh=O("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);var sm={ok:"bg-emerald-500",warn:"bg-amber-500",error:"bg-red-500",unknown:"bg-slate-400"};function sg(e){var t,n=e.harnessId,r=e.open,a=e.onOpenChange,o=(0,x.Bd)().t,i=ss(function(e){return e.doctor}),l=ss(function(e){return e.doctorLoading}),s=ss(function(e){return e.doctorError}),c=ss(function(e){return e.doctorUpdatedAvailable}),u=ss(function(e){return e.loadDoctor}),d=null!=(t=null==i?void 0:i.find(function(e){return e.harness===n}))?t:null;(0,y.useEffect)(function(){r&&null===d&&u(n)},[r,d,n,u]);var f=function(e){var t={ok:0,warn:0,error:0,unknown:0};if(!e)return t;var n=!0,r=!1,a=void 0;try{for(var o,i=e.checks[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l=o.value;t[l.status]++}}catch(e){r=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw a}}return t}(d),p=F[n];return(0,g.jsx)(lc,{open:r,onOpenChange:a,children:(0,g.jsxs)(lT,{className:"flex max-h-[88vh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl",children:[(0,g.jsxs)(lA,{className:"shrink-0 space-y-1.5 px-6 pb-4 pt-6 pr-12",children:[(0,g.jsx)(lL,{children:o("doctor.titleFor",{harness:p})}),(0,g.jsx)(lI,{children:o("doctor.intro")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-6",children:[l&&null===d?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:o("doctor.checking")}):null,s?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,s)}):null,d?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[f.ok>0?(0,g.jsx)(aI,{variant:"secondary",children:o("doctor.countOk",{count:f.ok})}):null,f.warn>0?(0,g.jsx)(aI,{variant:"outline",className:"border-amber-500/30 text-amber-700 dark:text-amber-300",children:o("doctor.countWarn",{count:f.warn})}):null,f.error>0?(0,g.jsx)(aI,{variant:"destructive",children:o("doctor.countError",{count:f.error})}):null,f.unknown>0?(0,g.jsx)(aI,{variant:"outline",children:o("doctor.countUnknown",{count:f.unknown})}):null,c?(0,g.jsxs)("span",{className:"ml-auto flex items-center gap-1 text-xs text-emerald-600 dark:text-emerald-400",children:[(0,g.jsx)(sh,{className:"size-3.5"}),o("doctor.updateAvailable")]}):null]}),(0,g.jsx)(sy,{checks:d.checks})]}):null,null!==d||l||s?null:(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:o("doctor.notRun")})]}),(0,g.jsxs)(lR,{className:"shrink-0 px-6 py-4",children:[(0,g.jsxs)(oo,{variant:"outline",disabled:l,onClick:function(){u(n)},children:[(0,g.jsx)(sp,{className:l?"animate-spin":void 0}),o("doctor.rerun")]}),(0,g.jsx)(oo,{onClick:function(){return a(!1)},children:o("doctor.close")})]})]})})}function sy(e){var t=e.checks,n=(0,x.Bd)().t;return 0===t.length?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:n("doctor.noChecks")}):(0,g.jsx)("ul",{className:"divide-y rounded-xl border",children:t.map(function(e){var t;return(0,g.jsxs)("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[(0,g.jsx)("span",{className:aR("mt-1.5 size-2 shrink-0 rounded-full",sm[e.status]),"aria-hidden":!0}),(0,g.jsx)("div",{className:"min-w-0 flex-1",children:(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,g.jsx)("p",{className:"text-sm leading-relaxed",children:l7(n,{key:null!=(t=e.code)?t:"doctor.unknownCheck",params:e.params,fallback:e.label})}),(0,g.jsx)("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:n("doctor.status.".concat(e.status))})]})})]},e.id)})})}var sv=Object.defineProperty,sb=(e,t)=>sv(e,"name",{value:t,configurable:!0}),[sx,sw]=oh("AlertDialog",[li]),sk=li(),sj=sb(e=>{let{__scopeAlertDialog:t,...n}=e,r=sk(t);return(0,g.jsx)(lc,{...r,...n,modal:!0})},"AlertDialog");y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lu,{...a,...r,ref:t})},"AlertDialogTrigger"));var sS=sb(e=>{let{__scopeAlertDialog:t,...n}=e,r=sk(t);return(0,g.jsx)(lh,{...r,...n})},"AlertDialogPortal"),sO=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lg,{...a,...r,ref:t})},"AlertDialogOverlay")),[sC,sN]=sx("AlertDialogContent"),sP=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,children:r,...a}=e,o=sk(n),i=aY(t,y.useRef(null)),l=y.useRef(null);return(0,g.jsx)(sC,{scope:n,cancelRef:l,children:(0,g.jsx)(lx,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:oc(a.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},"AlertDialogContent")),sE=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lS,{...a,...r,ref:t})},"AlertDialogTitle")),s_=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lO,{...a,...r,ref:t})},"AlertDialogDescription")),sz=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lC,{...a,...r,ref:t})},"AlertDialogAction")),sT=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=sN("AlertDialogCancel",n),o=sk(n),i=aY(t,a);return(0,g.jsx)(lC,{...o,...r,ref:i})},"AlertDialogCancel"));function sA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function sR(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function sL(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(sO,sA({"data-slot":"alert-dialog-overlay",className:aR("fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t)},n))}function sI(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsxs)(sS,{children:[(0,g.jsx)(sL,{}),(0,g.jsx)(sP,sA({"data-slot":"alert-dialog-content",className:aR("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-card p-6 shadow-2xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-2xl",t)},n))]})}function sM(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)("div",sA({className:aR("flex flex-col space-y-2 text-center sm:text-left",t)},n))}function sD(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)("div",sA({className:aR("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t)},n))}function sF(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(sE,sA({className:aR("text-lg font-semibold",t)},n))}function s$(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(s_,sA({className:aR("text-sm text-muted-foreground",t)},n))}function sU(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(sz,sA({className:aR(oa(),t)},n))}function sH(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(sT,sA({className:aR(oa({variant:"outline"}),"mt-2 sm:mt-0",t)},n))}function sB(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sK(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sB(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sB(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sV(e){switch(e){case"in-sync":return"border-transparent bg-emerald-500/15 text-emerald-600 dark:text-emerald-400";case"drifted":return"border-amber-500/30 text-amber-700 dark:text-amber-300";case"missing":case"invalid":return"border-transparent bg-destructive/15 text-destructive";default:return""}}function sq(e){var t,n=e.harness,r=e.open,a=e.onOpenChange,o=(0,x.Bd)().t,i=ss(function(e){return e.drift}),l=ss(function(e){return e.driftLoading}),s=ss(function(e){return e.reapplyDrift}),c=ss(function(e){return e.adoptDrift}),u=sK((0,y.useState)(null),2),d=u[0],f=u[1],p=sK((0,y.useState)(null),2),h=p[0],m=p[1],v=(0,y.useMemo)(function(){var e;return null!=(e=null==i?void 0:i.find(function(e){return e.harness===n.id}))?e:null},[i,n.id]),b=null!=(t=null==v?void 0:v.files.filter(function(e){return"in-sync"!==e.status}))?t:[],w=(null==v?void 0:v.active)===!0;return(0,g.jsxs)(lc,{open:r,onOpenChange:a,children:[(0,g.jsxs)(lT,{className:"flex max-h-[85vh] w-[min(64rem,calc(100vw-2rem))] max-w-5xl flex-col overflow-hidden",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:o("drift.dialogTitle",{harness:n.label})}),(0,g.jsx)(lI,{children:o(w?"drift.legend":"drift.noActiveProfile")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[l&&null===v?(0,g.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:o("drift.checking")}):null,null!==v||l?null:(0,g.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:o("drift.noData")}),v&&!w?(0,g.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:o("drift.nothingToCompare")}):null,v&&w?(0,g.jsx)("div",{className:"space-y-3",children:0===b.length?(0,g.jsx)("p",{className:"py-4 text-center text-sm text-muted-foreground",children:o("drift.allInSync")}):b.map(function(e){return(0,g.jsx)(sW,{file:e},e.key)})}):null]}),h?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,h)}):null,(0,g.jsxs)(lR,{children:[(0,g.jsx)(oo,{variant:"outline",disabled:null===v||!w,onClick:function(){return f("adopt")},children:o("drift.adopt")}),(0,g.jsx)(oo,{disabled:null===v||!w,onClick:function(){return f("reapply")},children:o("drift.reapply")})]})]}),(0,g.jsx)(sj,{open:"reapply"===d,onOpenChange:function(e){return!e&&f(null)},children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:o("drift.reapplyTitle")}),(0,g.jsx)(s$,{children:o("drift.reapplyBody",{harness:n.label})})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:o("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){f(null),m(null),s(n.id).then(function(){return a(!1)}).catch(function(e){m(l8(e,"drift.reapplyFailed"))})},children:o("drift.confirmReapply")})]})]})}),(0,g.jsx)(sj,{open:"adopt"===d,onOpenChange:function(e){return!e&&f(null)},children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:o("drift.adoptTitle")}),(0,g.jsx)(s$,{children:o("drift.adoptBody")})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:o("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){f(null),m(null),c(n.id).then(function(){return a(!1)}).catch(function(e){m(l8(e,"drift.adoptFailed"))})},children:o("drift.confirmAdopt")})]})]})})]})}function sW(e){var t=e.file,n=(0,x.Bd)().t;return(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,g.jsx)(aI,{className:sV(t.status),children:n("drift.status.".concat(t.status))}),(0,g.jsx)("p",{className:"min-w-0 truncate font-mono text-xs text-muted-foreground",title:t.path,children:t.path})]}),(0,g.jsx)(aK,{files:[{path:t.path,existed:null!==t.currentContent,content:t.expectedContent,currentContent:t.currentContent}]})]})}function sZ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sG(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sZ(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sJ(e){var t,n,r,a=e.harness,o=(0,x.Bd)().t,i=ss(function(e){return e.doctor}),l=ss(function(e){return e.doctorLoading}),s=ss(function(e){return e.doctorError}),c=ss(function(e){return e.loadDoctor}),u=ss(function(e){return e.drift}),d=ss(function(e){return e.driftLoading}),f=ss(function(e){return e.driftError}),p=ss(function(e){return e.loadDrift}),h=sG((0,y.useState)(!1),2),m=h[0],v=h[1],b=sG((0,y.useState)(!1),2),w=b[0],k=b[1],j=null!=(t=null==i?void 0:i.find(function(e){return e.harness===a.id}))?t:null,S=null!=(n=null==u?void 0:u.find(function(e){return e.harness===a.id}))?n:null,O=null!=(r=null==S?void 0:S.files.filter(function(e){return"in-sync"!==e.status}))?r:[],C=null!==S&&S.active&&O.length>0&&"in-sync"!==S.status;return(0,y.useEffect)(function(){c(a.id)},[a.id,c]),(0,y.useEffect)(function(){null===u&&p()},[u,p]),(0,g.jsxs)("section",{className:"rounded-2xl border bg-card p-5 shadow-[0_12px_34px_-28px_rgb(36_39_70/0.38)]",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(sf,{className:"size-4 text-primary"}),(0,g.jsx)("h3",{className:"font-semibold",children:o("doctor.title")}),(0,g.jsx)("span",{className:"ml-auto",children:(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":o("doctor.rerun"),onClick:function(){c(a.id),p()},children:(0,g.jsx)(sp,{className:l||d?"animate-spin":void 0})})})]}),(0,g.jsxs)("div",{className:"mt-4 space-y-3",children:[s?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,s)}):null===j?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:o("doctor.checking")}):(0,g.jsx)(sQ,{report:j}),f?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,f)}):null===S?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:o("drift.checking")}):(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(sY,{report:S}),O.length>0?(0,g.jsxs)("ul",{className:"space-y-1",children:[O.slice(0,3).map(function(e){return(0,g.jsxs)("li",{className:"flex items-center gap-2 text-xs",children:[(0,g.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-destructive/70"}),(0,g.jsx)("span",{className:"truncate font-mono text-muted-foreground",children:e.path.split("/").pop()}),(0,g.jsx)("span",{className:"ml-auto shrink-0 font-mono text-[11px] text-muted-foreground",children:o("drift.status.".concat(e.status))})]},e.key)}),O.length>3?(0,g.jsx)("li",{className:"pl-3.5 text-xs text-muted-foreground",children:o("drift.moreFiles",{count:O.length-3})}):null]}):null]})]}),(0,g.jsxs)("div",{className:"mt-4 grid gap-2 ".concat(C?"grid-cols-2":"grid-cols-1"),children:[(0,g.jsx)(oo,{size:"sm",variant:"outline",disabled:null===j,onClick:function(){return v(!0)},children:o("doctor.viewDetails")}),C?(0,g.jsx)(oo,{size:"sm",variant:"outline",onClick:function(){return k(!0)},children:o("drift.viewDiff")}):null]}),(0,g.jsx)(sg,{harnessId:a.id,open:m,onOpenChange:v}),(0,g.jsx)(sq,{harness:a,open:w,onOpenChange:k})]})}function sQ(e){var t=e.report,n=(0,x.Bd)().t,r=function(e){var t={ok:0,warn:0,error:0,unknown:0},n=!0,r=!1,a=void 0;try{for(var o,i=e.checks[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l=o.value;t[l.status]++}}catch(e){r=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw a}}return t}(t),a=["error","warn","ok","unknown"].filter(function(e){return r[e]>0});return 0===a.length?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:n("doctor.noChecks")}):(0,g.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(function(e){var t,a;return(0,g.jsx)(aI,{variant:"error"===(t=e)?"destructive":"ok"===t?"secondary":"outline",className:"warn"===e?"border-amber-500/30 text-amber-700 dark:text-amber-300":void 0,children:n("doctor.count".concat((a=e,"".concat(a[0].toUpperCase()).concat(a.slice(1)))),{count:r[e]})},e)})})}function sY(e){var t=e.report,n=(0,x.Bd)().t;if(!t.active)return(0,g.jsx)(aI,{variant:"secondary",children:n("harness.inactive")});if("in-sync"===t.status)return(0,g.jsx)(aI,{variant:"secondary",children:n("drift.none")});if("drifted"===t.status){var r=t.files.filter(function(e){return"in-sync"!==e.status}).length;return(0,g.jsx)(aI,{variant:"outline",className:"border-amber-500/30 text-amber-700 dark:text-amber-300",children:n("drift.mismatch",{count:r})})}return(0,g.jsx)(aI,{className:sV(t.status),children:n("drift.status.".concat(t.status))})}let sX=O("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),s0=O("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),s1=O("cloud-upload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]),s2=O("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),s4=O("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),s3=O("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),s5=O("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),s6=O("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),s8=O("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);function s9(e){let[t,n]=y.useState(void 0);return og(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,a;if(!Array.isArray(t)||!t.length)return;let o=t[0];if("borderBoxSize"in o){let e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,a=t.blockSize}else r=e.offsetWidth,a=e.offsetHeight;n({width:r,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(0,Object.defineProperty)(s9,"name",{value:"useSize",configurable:!0});var s7=Object.defineProperty,ce=(e,t)=>s7(e,"name",{value:t,configurable:!0}),ct="Checkbox",[cn,cr]=oh(ct),[ca,co]=cn(ct);function ci(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:a,disabled:o,form:i,name:l,onCheckedChange:s,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,p]=oP({prop:n,defaultProp:a??!1,onChange:s,caller:ct}),[h,m]=y.useState(null),[v,b]=y.useState(null),x=y.useRef(!1),[w,k]=y.useReducer(e=>e+1,0),j=!h||!!i||!!h.closest("form"),S={checked:f,disabled:o,setChecked:p,control:h,setControl:m,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:k,required:c,defaultChecked:!cf(a)&&a,isFormControl:j,bubbleInput:v,setBubbleInput:b};return(0,g.jsx)(ca,{scope:t,...S,children:cd(d)?d(S):r})}ce(ci,"CheckboxProvider");var cl=y.forwardRef(ce(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},a){let{control:o,value:i,disabled:l,checked:s,required:c,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:h,bubbleInput:m}=co("CheckboxTrigger",e),v=aY(a,u),b=y.useRef(s);return y.useEffect(()=>{let e=o?.form;if(e){let t=ce(()=>d(b.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[o,d]),(0,g.jsx)(oR.button,{type:"button",role:"checkbox","aria-checked":cf(s)?"mixed":s,"aria-required":c,"data-state":cp(s),"data-disabled":l?"":void 0,disabled:l,value:i,...r,ref:v,onKeyDown:oc(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:oc(n,e=>{p(),d(e=>!!cf(e)||!e),m&&h&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},"CheckboxTrigger")),cs=y.forwardRef(ce(function(e,t){let{__scopeCheckbox:n,name:r,checked:a,defaultChecked:o,required:i,disabled:l,value:s,onCheckedChange:c,form:u,...d}=e;return(0,g.jsx)(ci,{__scopeCheckbox:n,checked:a,defaultChecked:o,disabled:l,required:i,onCheckedChange:c,name:r,form:u,value:s,internal_do_not_use_render:({isFormControl:e})=>(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(cl,{...d,ref:t,__scopeCheckbox:n}),e&&(0,g.jsx)(cu,{__scopeCheckbox:n})]})})},"Checkbox")),cc=y.forwardRef(ce(function(e,t){let{__scopeCheckbox:n,forceMount:r,...a}=e,o=co("CheckboxIndicator",n);return(0,g.jsx)(il,{present:r||cf(o.checked)||!0===o.checked,children:(0,g.jsx)(oR.span,{"data-state":cp(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),cu=y.forwardRef(ce(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:a,hasConsumerStoppedPropagationRef:o,userInteractionCount:i,checked:l,defaultChecked:s,required:c,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:m}=co("CheckboxBubbleInput",e),v=aY(r,m),b=s9(a),x=y.useRef(!1),w=y.useRef(l),k=y.useRef(i);y.useEffect(()=>{if(!h)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,t=i!==k.current;k.current=i;let n=w.current!==l;w.current=l;let r=!(t&&o.current);if(n&&e){x.current=!t;let n=new Event("click",{bubbles:r});h.indeterminate=cf(l),e.call(h,!cf(l)&&l),h.dispatchEvent(n),x.current=!1}},[h,l,o,i]);let j=y.useRef(!cf(l)&&l);return(0,g.jsx)(oR.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??j.current,required:c,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:v,onClick:oc(t,e=>{x.current&&e.stopPropagation()}),style:{...n.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function cd(e){return"function"==typeof e}function cf(e){return"indeterminate"===e}function cp(e){return cf(e)?"indeterminate":e?"checked":"unchecked"}function ch(e){var t,n,r=e.className,a=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className"]);return(0,g.jsx)(cs,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"checkbox",className:aR("peer size-4 shrink-0 cursor-pointer rounded-[5px] border border-input bg-card shadow-[0_1px_2px_rgb(20_24_40/0.04)] outline-none transition-[border-color,box-shadow,background-color] hover:border-ring/35 focus-visible:border-ring/50 focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:focus-visible:border-destructive aria-invalid:focus-visible:ring-destructive/25 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",r)},a),n=n={children:(0,g.jsx)(cc,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:(0,g.jsx)(s3,{className:"size-3",strokeWidth:3.5})})},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function cm(e){var t=e.className,n=e.type,r=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className","type"]);return(0,g.jsx)("input",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({type:n,"data-slot":"input",className:aR("flex h-10 w-full rounded-[10px] border border-input bg-card px-3 py-1 text-base shadow-[0_1px_2px_rgb(20_24_40/0.04)] transition-[border-color,box-shadow] file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:focus-visible:border-destructive aria-invalid:focus-visible:ring-destructive/25 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t)},r))}ce(cd,"isFunction"),ce(cf,"isIndeterminate"),ce(cp,"getState");var cg=Object.defineProperty,cy=y.forwardRef(cg(function(e,t){return(0,g.jsx)(oR.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},"name",{value:"Label",configurable:!0}));function cv(e){var t=e.className,n=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className"]);return(0,g.jsx)(cy,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"label",className:aR("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t)},n))}function cb(e,[t,n]){return Math.min(n,Math.max(t,e))}(0,Object.defineProperty)(cb,"name",{value:"clamp",configurable:!0});var cx=Object.defineProperty,cw=(e,t)=>cx(e,"name",{value:t,configurable:!0});function ck(e){let t=e+"CollectionProvider",[n,r]=oh(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=cw(e=>{let{scope:t,children:n}=e,r=y.useRef(null),o=y.useRef(new Map).current;return(0,g.jsx)(a,{scope:t,itemMap:o,collectionRef:r,children:n})},"CollectionProvider");i.displayName=t;let l=e+"CollectionSlot",s=a1(l),c=y.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=aY(t,o(l,n).collectionRef);return(0,g.jsx)(s,{ref:a,children:r})});c.displayName=l;let u=e+"CollectionItemSlot",d="data-radix-collection-item",f=a1(u),p=y.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,i=y.useRef(null),l=aY(t,i),s=o(u,n);return y.useEffect(()=>(s.itemMap.set(i,{ref:i,...a}),()=>void s.itemMap.delete(i))),(0,g.jsx)(f,{...{[d]:""},ref:l,children:r})});function h(t){let n=o(e+"CollectionConsumer",t);return y.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return p.displayName=u,cw(h,"useCollection"),[{Provider:i,Slot:c,ItemSlot:p},h,r]}cw(ck,"createCollection");var cj=new WeakMap,cS=class e extends Map{static{cw(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],cj.set(this,!0)}set(e,t){return cj.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r,a=this.has(t),o=this.#e.length,i=cN(e),l=i>=0?i:o+i,s=l<0||l>=o?-1:l;if(s===this.size||a&&s===this.size-1||-1===s)return this.set(t,n),this;let c=this.size+ +!a;i<0&&l++;let u=[...this.#e],d=!1;for(let e=l;e<c;e++)if(l===e){let o=u[e];u[e]===t&&(o=u[e+1]),a&&this.delete(t),r=this.get(o),this.set(t,n)}else{d||u[e-1]!==t||(d=!0);let n=u[d?e:e-1],a=r;r=this.get(n),this.delete(n),this.set(n,a)}return this}with(t,n,r){let a=new e(this);return a.insert(t,n,r),a}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=cO(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=cO(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return cO(this.#e,e)}from(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return -1}filter(t,n){let r=[],a=0;for(let e of this)Reflect.apply(t,n,[e,a,this])&&r.push(e),a++;return new e(r)}map(t,n){let r=[],a=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,a,this])]),a++;return new e(r)}reduce(...e){let[t,n]=e,r=0,a=n??this.at(0);for(let n of this)a=0===r&&1===e.length?n:Reflect.apply(t,this,[a,n,r,this]),r++;return a}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let a=this.at(n);r=n===this.size-1&&1===e.length?a:Reflect.apply(t,this,[r,a,n,this])}return r}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,a=this.size-1;if(void 0===t)return r;t<0&&(t+=this.size),void 0!==n&&n>0&&(a=n-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function cO(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let n=cC(e,t);return -1===n?void 0:e[n]}function cC(e,t){let n=e.length,r=cN(t),a=r>=0?r:n+r;return a<0||a>=n?-1:a}function cN(e){return e!=e||0===e?0:Math.trunc(e)}function cP(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null==e||null==t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}function cE(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function c_(e,t){return e[1].element&&t[1].element?cE(e[1].element,t[1].element)?-1:1:0}function cz(e){return new MutationObserver(t=>{for(let n of t)if("childList"===n.type)return void e()})}cw(cO,"at"),cw(cC,"toSafeIndex"),cw(cN,"toSafeInteger"),cw(function(e){let t=e+"CollectionProvider",[n,r]=oh(t),[a,o]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new cS,setItemMap:cw(()=>void 0,"setItemMap")}),i=cw(({state:e,...t})=>e?(0,g.jsx)(s,{...t,state:e}):(0,g.jsx)(l,{...t}),"CollectionProvider");i.displayName=t;let l=cw(e=>{let t=m();return(0,g.jsx)(s,{...e,state:t})},"CollectionInit");l.displayName=t+"Init";let s=cw(e=>{let{scope:t,children:n,state:r}=e,o=y.useRef(null),[i,l]=y.useState(null),s=aY(o,l),[c,u]=r;return y.useEffect(()=>{if(!i)return;let e=cz(()=>{});return e.observe(i,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[i]),(0,g.jsx)(a,{scope:t,itemMap:c,setItemMap:u,collectionRef:s,collectionRefObject:o,collectionElement:i,children:n})},"CollectionProviderImpl");s.displayName=t+"Impl";let c=e+"CollectionSlot",u=a1(c),d=y.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=aY(t,o(c,n).collectionRef);return(0,g.jsx)(u,{ref:a,children:r})});d.displayName=c;let f=e+"CollectionItemSlot",p=a1(f),h=y.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,i=y.useRef(null),[l,s]=y.useState(null),c=aY(t,i,s),{setItemMap:u}=o(f,n),d=y.useRef(a);cP(d.current,a)||(d.current=a);let h=d.current;return y.useEffect(()=>(u(e=>l?e.has(l)?e.set(l,{...h,element:l}).toSorted(c_):(e.set(l,{...h,element:l}),e.toSorted(c_)):e),()=>{u(e=>l&&e.has(l)?(e.delete(l),new cS(e)):e)}),[l,h,u]),(0,g.jsx)(p,{"data-radix-collection-item":"",ref:c,children:r})});function m(){return y.useState(new cS)}function v(t){let{itemMap:n}=o(e+"CollectionConsumer",t);return n}return h.displayName=f,cw(m,"useInitCollection"),cw(v,"useCollection"),[{Provider:i,Slot:d,ItemSlot:h},{createCollectionScope:r,useCollection:v,useInitCollection:m}]},"createCollection"),cw(cP,"shallowEqual"),cw(cE,"isElementPreceding"),cw(c_,"sortByDocumentPosition"),cw(cz,"getChildListObserver");var cT=Object.defineProperty,cA=y.createContext(void 0);function cR(e){let t=y.useContext(cA);return e||t||"ltr"}cT(cR,"name",{value:"useDirection",configurable:!0});let cL=["top","right","bottom","left"],cI=Math.min,cM=Math.max,cD=Math.round,cF=Math.floor,c$=e=>({x:e,y:e}),cU={left:"right",right:"left",bottom:"top",top:"bottom"};function cH(e,t){return"function"==typeof e?e(t):e}function cB(e){return e.split("-")[0]}function cK(e){return e.split("-")[1]}function cV(e){return"x"===e?"y":"x"}function cq(e){return"y"===e?"height":"width"}function cW(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function cZ(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let cG=["left","right"],cJ=["right","left"],cQ=["top","bottom"],cY=["bottom","top"];function cX(e){let t=cB(e);return cU[t]+e.slice(t.length)}function c0(e){var t,n,r,a;return"number"!=typeof e?{top:null!=(t=e.top)?t:0,right:null!=(n=e.right)?n:0,bottom:null!=(r=e.bottom)?r:0,left:null!=(a=e.left)?a:0}:{top:e,right:e,bottom:e,left:e}}function c1(e){let{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function c2(e,t,n){let r,{reference:a,floating:o}=e,i=cW(t),l=cV(cW(t)),s=cq(l),c=cB(t),u=a.x+a.width/2-o.width/2,d=a.y+a.height/2-o.height/2,f=a[s]/2-o[s]/2;switch(c){case"top":r={x:u,y:a.y-o.height};break;case"bottom":r={x:u,y:a.y+a.height};break;case"right":r={x:a.x+a.width,y:d};break;case"left":r={x:a.x-o.width,y:d};break;default:r={x:a.x,y:a.y}}let p=cK(t);return p&&(r[l]+=f*("end"===p?1:-1)*(n&&"y"===i?-1:1)),r}async function c4(e,t){var n;void 0===t&&(t={});let{x:r,y:a,platform:o,rects:i,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=cH(t,e),h=c0(p),m=l[f?"floating"===d?"reference":"floating":d],g=c1(await o.getClippingRect({element:null==(n=await (null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await (null==o.getDocumentElement?void 0:o.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:s})),y="floating"===d?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,v=await (null==o.getOffsetParent?void 0:o.getOffsetParent(l.floating)),b=await (null==o.isElement?void 0:o.isElement(v))&&await (null==o.getScale?void 0:o.getScale(v))||{x:1,y:1},x=c1(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:s}):y);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}let c3=async(e,t,n)=>{let{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:c4},s=await (null==i.isRTL?void 0:i.isRTL(t)),c=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:d}=c2(c,r,s),f=r,p=0,h={};for(let n=0;n<o.length;n++){let m=o[n];if(!m)continue;let{name:g,fn:y}=m,{x:v,y:b,data:x,reset:w}=await y({x:u,y:d,initialPlacement:r,placement:f,strategy:a,middlewareData:h,rects:c,platform:l,elements:{reference:e,floating:t}});u=null!=v?v:u,d=null!=b?b:d,h[g]={...h[g],...x},w&&p<50&&(p++,"object"==typeof w&&(w.placement&&(f=w.placement),w.rects&&(c=!0===w.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):w.rects),{x:u,y:d}=c2(c,f,s)),n=-1)}return{x:u,y:d,placement:f,strategy:a,middlewareData:h}};function c5(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function c6(e){return cL.some(t=>e[t]>=0)}let c8=new Set(["left","top"]);async function c9(e,t){let{placement:n,platform:r,elements:a}=e,o=await (null==r.isRTL?void 0:r.isRTL(a.floating)),i=cB(n),l=cK(n),s="y"===cW(n),c=c8.has(i)?-1:1,u=o&&s?-1:1,d=cH(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&"number"==typeof h&&(p="end"===l?-1*h:h),s?{x:p*u,y:f*c}:{x:f*c,y:p*u}}function c7(){return"u">typeof window}function ue(e){return ur(e)?(e.nodeName||"").toLowerCase():"#document"}function ut(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function un(e){var t;return null==(t=(ur(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ur(e){return!!c7()&&(e instanceof Node||e instanceof ut(e).Node)}function ua(e){return!!c7()&&(e instanceof Element||e instanceof ut(e).Element)}function uo(e){return!!c7()&&(e instanceof HTMLElement||e instanceof ut(e).HTMLElement)}function ui(e){return!(!c7()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ut(e).ShadowRoot)}function ul(e){let{overflow:t,overflowX:n,overflowY:r,display:a}=um(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==a&&"contents"!==a}function us(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let uc=/transform|translate|scale|rotate|perspective|filter/,uu=/paint|layout|strict|content/,ud=e=>!!e&&"none"!==e;function uf(e){let t=ua(e)?um(e):e;return ud(t.transform)||ud(t.translate)||ud(t.scale)||ud(t.rotate)||ud(t.perspective)||!up()&&(ud(t.backdropFilter)||ud(t.filter))||uc.test(t.willChange||"")||uu.test(t.contain||"")}function up(){return null==e&&(e="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),e}function uh(e){return/^(html|body|#document)$/.test(ue(e))}function um(e){return ut(e).getComputedStyle(e)}function ug(e){return ua(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uy(e){if("html"===ue(e))return e;let t=e.assignedSlot||e.parentNode||ui(e)&&e.host||un(e);return ui(t)?t.host:t}function uv(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let a=function e(t){let n=uy(t);return uh(n)?(t.ownerDocument||t).body:uo(n)&&ul(n)?n:e(n)}(e),o=a===(null==(r=e.ownerDocument)?void 0:r.body),i=ut(a);if(!o)return t.concat(a,uv(a,[],n));{let e=ub(i);return t.concat(i,i.visualViewport||[],ul(a)?a:[],e&&n?uv(e):[])}}function ub(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ux(e){let t=um(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,a=uo(e),o=a?e.offsetWidth:n,i=a?e.offsetHeight:r,l=cD(n)!==o||cD(r)!==i;return l&&(n=o,r=i),{width:n,height:r,$:l}}function uw(e){return ua(e)?e:e.contextElement}function uk(e){let t=uw(e);if(!uo(t))return c$(1);let n=t.getBoundingClientRect(),{width:r,height:a,$:o}=ux(t),i=(o?cD(n.width):n.width)/r,l=(o?cD(n.height):n.height)/a;return i&&Number.isFinite(i)||(i=1),l&&Number.isFinite(l)||(l=1),{x:i,y:l}}let uj=c$(0);function uS(e){let t=ut(e);return up()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:uj}function uO(e,t,n,r){var a;void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),i=uw(e),l=c$(1);t&&(r?ua(r)&&(l=uk(r)):l=uk(e));let s=(void 0===(a=n)&&(a=!1),r&&a&&r===ut(i))?uS(i):c$(0),c=(o.left+s.x)/l.x,u=(o.top+s.y)/l.y,d=o.width/l.x,f=o.height/l.y;if(i&&r){let e=ut(i),t=ua(r)?ut(r):r,n=e,a=ub(n);for(;a&&t!==n;){let e=uk(a),t=a.getBoundingClientRect(),r=um(a),o=t.left+(a.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,u*=e.y,d*=e.x,f*=e.y,c+=o,u+=i,a=ub(n=ut(a))}}return c1({width:d,height:f,x:c,y:u})}function uC(e,t){let n=ug(e).scrollLeft;return t?t.left+n:uO(un(e)).left+n}function uN(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-uC(e,n),y:n.top+t.scrollTop}}function uP(e,t,n){var r;let a;if("viewport"===t||"layoutViewport"===t)a=function(e,t,n){void 0===n&&(n="viewport");let r="layoutViewport"===n,a=ut(e),o=un(e),i=a.visualViewport,l=o.clientWidth,s=o.clientHeight,c=0,u=0;if(i){let e=!up()||"fixed"===t;r?e||(c=-i.offsetLeft,u=-i.offsetTop):(l=i.width,s=i.height,e&&(c=i.offsetLeft,u=i.offsetTop))}if(0>=uC(o)){let e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(o.clientWidth-t.clientWidth-r),i="stable both-edges"===getComputedStyle(o).scrollbarGutter?a/2:a;i<=25&&(l-=i)}return{width:l,height:s,x:c,y:u}}(e,n,t);else if("document"===t){let t,n,o,i,l,s;t=ug(r=un(e)),n=r.ownerDocument.body,o=cM(r.scrollWidth,r.clientWidth,n.scrollWidth,n.clientWidth),i=cM(r.scrollHeight,r.clientHeight,n.scrollHeight,n.clientHeight),l=-t.scrollLeft+uC(r),s=-t.scrollTop,"rtl"===um(n).direction&&(l+=cM(r.clientWidth,n.clientWidth)-o),a={width:o,height:i,x:l,y:s}}else if(ua(t)){let e,r,o,i,l,s;r=(e=uO(t,!0,"fixed"===n)).top+t.clientTop,o=e.left+t.clientLeft,i=uk(t),l=t.clientWidth*i.x,s=t.clientHeight*i.y,a={width:l,height:s,x:o*i.x,y:r*i.y}}else{let n=uS(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return c1(a)}function uE(e){return"static"===um(e).position}function u_(e,t){if(!uo(e)||"fixed"===um(e).position)return null;if(t)return t(e);let n=e.offsetParent;return un(e)===n&&(n=n.ownerDocument.body),n}function uz(e,t){var n;let r=ut(e);if(us(e))return r;if(!uo(e)){let t=uy(e);for(;t&&!uh(t);){if(ua(t)&&!uE(t))return t;t=uy(t)}return r}let a=u_(e,t);for(;a&&(n=a,/^(table|td|th)$/.test(ue(n)))&&uE(a);)a=u_(a,t);return a&&uh(a)&&uE(a)&&!uf(a)?r:a||function(e){let t=uy(e);for(;uo(t)&&!uh(t);){if(uf(t))return t;if(us(t))break;t=uy(t)}return null}(e)||r}let uT=async function(e){let t=this.getOffsetParent||uz,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=uo(t),a=un(t),o="fixed"===n,i=uO(e,!0,o,t),l={scrollLeft:0,scrollTop:0},s=c$(0);if((r||!o)&&(("body"!==ue(t)||ul(a))&&(l=ug(t)),r)){let e=uO(t,!0,o,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}!r&&a&&(s.x=uC(a));let c=!a||r||o?c$(0):uN(a,l);return{x:i.left+l.scrollLeft-s.x-c.x,y:i.top+l.scrollTop-s.y-c.y,width:i.width,height:i.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},uA={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e,o="fixed"===a,i=un(r),l=!!t&&us(t.floating);if(r===i||l&&o)return n;let s={scrollLeft:0,scrollTop:0},c=c$(1),u=c$(0),d=uo(r);if((d||!o)&&(("body"!==ue(r)||ul(i))&&(s=ug(r)),d)){let e=uO(r);c=uk(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=!i||d||o?c$(0):uN(i,s);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-s.scrollTop*c.y+u.y+f.y}},getDocumentElement:un,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e,o=[..."clippingAncestors"===n?us(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=uv(e,[],!1).filter(e=>ua(e)&&"body"!==ue(e)),a=null,o="fixed"===um(e).position,i=o?uy(e):e;for(;ua(i)&&!uh(i);){let e=um(i),t=uf(i),n=a?a.position:o?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?a=e:r=r.filter(e=>e!==i),i=uy(i)}return t.set(e,r),r}(t,this._c):[].concat(n),r],i=uP(t,o[0],a),l=i.top,s=i.right,c=i.bottom,u=i.left;for(let e=1;e<o.length;e++){let n=uP(t,o[e],a);l=cM(n.top,l),s=cI(n.right,s),c=cI(n.bottom,c),u=cM(n.left,u)}return{width:s-u,height:c-l,x:u,y:l}},getOffsetParent:uz,getElementRects:uT,getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){let{width:t,height:n}=ux(e);return{width:t,height:n}},getScale:uk,isElement:ua,isRTL:function(e){return"rtl"===um(e).direction}};function uR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let uL=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:a,rects:o,platform:i,elements:l,middlewareData:s}=t,{element:c,padding:u=0}=cH(e,t)||{};if(null==c)return{};let d=c0(u),f={x:n,y:r},p=cV(cW(a)),h=cq(p),m=await i.getDimensions(c),g="y"===p,y=g?"clientHeight":"clientWidth",v=o.reference[h]+o.reference[p]-f[p]-o.floating[h],b=f[p]-o.reference[p],x=await (null==i.getOffsetParent?void 0:i.getOffsetParent(c)),w=x?x[y]:0;w&&await (null==i.isElement?void 0:i.isElement(x))||(w=l.floating[y]||o.floating[h]);let k=w/2-m[h]/2-1,j=cI(d[g?"top":"left"],k),S=cI(d[g?"bottom":"right"],k),O=w-m[h]-S,C=w/2-m[h]/2+(v/2-b/2),N=cM(j,cI(C,O)),P=!s.arrow&&null!=cK(a)&&C!==N&&o.reference[h]/2-(C<j?j:S)-m[h]/2<0,E=P?C<j?C-j:C-O:0;return{[p]:f[p]+E,data:{[p]:N,centerOffset:C-N-E,...P&&{alignmentOffset:E}},reset:P}}});var uI="u">typeof document?y.useLayoutEffect:function(){};function uM(e,t){let n,r,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!uM(e[r],t[r]))return!1;return!0}if((n=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!=r--;){let n=a[r];if(("_owner"!==n||!e.$$typeof)&&!uM(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function uD(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function uF(e,t){let n=uD(e);return Math.round(t*n)/n}function u$(e){let t=y.useRef(e);return uI(()=>{t.current=e}),t}var uU=Object.defineProperty,uH=(e,t)=>uU(e,"name",{value:t,configurable:!0}),uB="Popper",[uK,uV]=oh(uB),[uq,uW]=uK(uB),uZ=uH(e=>{let{__scopePopper:t,children:n}=e,[r,a]=y.useState(null),[o,i]=y.useState(void 0);return(0,g.jsx)(uq,{scope:t,anchor:r,onAnchorChange:a,placementState:o,setPlacementState:i,children:n})},"Popper"),uG=y.forwardRef(uH(function(e,t){let{__scopePopper:n,virtualRef:r,...a}=e,o=uW("PopperAnchor",n),i=y.useRef(null),l=o.onAnchorChange,s=aY(t,y.useCallback(e=>{i.current=e,e&&l(e)},[l])),c=y.useRef(null);y.useEffect(()=>{if(!r)return;let e=c.current;c.current=r.current,e!==c.current&&l(c.current)});let u=o.placementState&&u2(o.placementState),d=u?.[0],f=u?.[1];return r?null:(0,g.jsx)(oR.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...a,ref:s})},"PopperAnchor")),uJ="PopperContent",[uQ,uY]=uK(uJ),uX=y.forwardRef(uH(function(e,t){var n,r,a,o,i,l,s,c,u,d,f,p,h,m,v,b,x,w,k,j,S;let O,C,N,P,E,_,{__scopePopper:z,side:T="bottom",sideOffset:A=0,align:R="center",alignOffset:L=0,arrowPadding:I=0,avoidCollisions:M=!0,collisionBoundary:D=[],collisionPadding:F=0,sticky:$="partial",hideWhenDetached:U=!1,updatePositionStrategy:H="optimized",onPlaced:B,...K}=e,V=uW(uJ,z),[q,W]=y.useState(null),Z=aY(t,W),[G,J]=y.useState(null),Q=s9(G),Y=Q?.width??0,X=Q?.height??0,ee="number"==typeof F?F:{top:0,right:0,bottom:0,left:0,...F},et=Array.isArray(D)?D:[D],en=et.length>0,er={padding:ee,boundary:et.filter(u0),altBoundary:en},{refs:ea,floatingStyles:eo,placement:ei,isPositioned:el,middlewareData:es}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:i}={},transform:l=!0,whileElementsMounted:s,open:c}=e,[u,d]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=y.useState(r);uM(f,r)||p(r);let[h,m]=y.useState(null),[g,v]=y.useState(null),b=y.useCallback(e=>{e!==j.current&&(j.current=e,m(e))},[]),x=y.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),w=o||h,k=i||g,j=y.useRef(null),S=y.useRef(null),O=y.useRef(u),C=null!=s,N=u$(s),P=u$(a),E=u$(c),_=y.useCallback(()=>{var e,r;let a,o,i;if(!j.current||!S.current)return;let l={placement:t,strategy:n,middleware:f};P.current&&(l.platform=P.current),(e=j.current,r=S.current,a=new Map,o=null!=l?l:{},i={...uA,...o.platform,_c:a},c3(e,r,{...o,platform:i})).then(e=>{let t={...e,isPositioned:!1!==E.current};z.current&&!uM(O.current,t)&&(O.current=t,oT.flushSync(()=>{d(t)}))})},[f,t,n,P,E]);uI(()=>{!1===c&&O.current.isPositioned&&(O.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[c]);let z=y.useRef(!1);uI(()=>(z.current=!0,()=>{z.current=!1}),[]),uI(()=>{if(w&&(j.current=w),k&&(S.current=k),w&&k){if(N.current)return N.current(w,k,_);_()}},[w,k,_,N,C]);let T=y.useMemo(()=>({reference:j,floating:S,setReference:b,setFloating:x}),[b,x]),A=y.useMemo(()=>({reference:w,floating:k}),[w,k]),R=y.useMemo(()=>{let e={position:n,left:0,top:0};if(!A.floating)return e;let t=uF(A.floating,u.x),r=uF(A.floating,u.y);return l?{...e,transform:"translate("+t+"px, "+r+"px)",...uD(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,l,A.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:_,refs:T,elements:A,floatingStyles:R}),[u,_,T,A,R])}({strategy:"fixed",placement:T+("center"!==R?"-"+R:""),whileElementsMounted:uH((...e)=>(function(e,t,n,r){let a;void 0===r&&(r={});let{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,u=uw(e),d=o||i?[...u?uv(u):[],...t?uv(t):[]]:[];d.forEach(e=>{o&&e.addEventListener("scroll",n),i&&e.addEventListener("resize",n)});let f=u&&s?function(e,t,n){let r,a=null,o=un(e);function i(){var e;clearTimeout(r),null==(e=a)||e.disconnect(),a=null}function l(n,s){void 0===n&&(n=!1),void 0===s&&(s=1),i();let c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(n||t(),!f||!p)return;let h={rootMargin:-cF(d)+"px "+-cF(o.clientWidth-(u+f))+"px "+-cF(o.clientHeight-(d+p))+"px "+-cF(u)+"px",threshold:cM(0,cI(1,s))||1},m=!0;function g(t){let n=t[0].intersectionRatio;if(!uR(c,e.getBoundingClientRect()))return l();if(n!==s){if(!m)return l();n?l(!1,n):r=setTimeout(()=>{l(!1,1e-7)},1e3)}m=!1}try{a=new IntersectionObserver(g,{...h,root:o.ownerDocument})}catch(e){a=new IntersectionObserver(g,h)}a.observe(e)}let s=ut(e),c=()=>l(n);return s.addEventListener("resize",c),l(!0),()=>{s.removeEventListener("resize",c),i()}}(u,n,i):null,p=-1,h=null;l&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let m=c?uO(e):null;return c&&function t(){let r=uO(e);m&&!uR(m,r)&&n(),m=r,a=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==f||f(),null==(e=h)||e.disconnect(),h=null,c&&cancelAnimationFrame(a)}})(...e,{animationFrame:"always"===H}),"whileElementsMounted"),elements:{reference:V.anchor},middleware:[{name:(O={name:"offset",options:a=n={mainAxis:A+X,alignmentAxis:L},async fn(e){var t,n;let{x:r,y:o,placement:i,middlewareData:l}=e,s=await c9(e,a);return i===(null==(t=l.offset)?void 0:t.placement)&&null!=(n=l.arrow)&&n.alignmentOffset?{}:{x:r+s.x,y:o+s.y,data:{...s,placement:i}}}}).name,fn:O.fn,options:[n,r]},M&&{name:(C={name:"shift",options:u=s={mainAxis:!0,crossAxis:!1,limiter:"partial"===$?{fn:(void 0===(l=o)&&(l={}),{options:l,fn(e){var t,n,r,a;let{x:o,y:i,placement:s,rects:c,middlewareData:u}=e,{offset:d=0,mainAxis:f=!0,crossAxis:p=!0}=cH(l,e),h={x:o,y:i},m=cW(s),g=cV(m),y=h[g],v=h[m],b=cH(d,e),x="number"==typeof b?{mainAxis:b,crossAxis:0}:{mainAxis:null!=(t=b.mainAxis)?t:0,crossAxis:null!=(n=b.crossAxis)?n:0};if(f){let e="y"===g?"height":"width",t=c.reference[g]-c.floating[e]+x.mainAxis,n=c.reference[g]+c.reference[e]-x.mainAxis;y<t?y=t:y>n&&(y=n)}if(p){let e="y"===g?"width":"height",t=c8.has(cB(s)),n=c.reference[m]-c.floating[e]+(t&&(null==(r=u.offset)?void 0:r[m])||0)+(t?0:x.crossAxis),o=c.reference[m]+c.reference[e]+(t?0:(null==(a=u.offset)?void 0:a[m])||0)-(t?x.crossAxis:0);v<n?v=n:v>o&&(v=o)}return{[g]:y,[m]:v}}}).fn,options:[o,i]}:void 0,...er},async fn(e){let{x:t,y:n,placement:r,platform:a}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=cH(u,e),c={x:t,y:n},d=await a.detectOverflow(e,s),f=cW(r),p=cV(f),h=c[p],m=c[f],g=(e,t)=>cM(t+d["y"===e?"top":"left"],cI(t,t-d["y"===e?"bottom":"right"]));o&&(h=g(p,h)),i&&(m=g(f,m));let y=l.fn({...e,[p]:h,[f]:m});return{...y,data:{x:y.x-t,y:y.y-n,enabled:{[p]:o,[f]:i}}}}}).name,fn:C.fn,options:[s,c]},M&&{name:(N={name:"flip",options:p=d={...er},async fn(e){var t,n,r,a,o,i,l,s;let c,u,d,{placement:f,middlewareData:h,rects:m,initialPlacement:g,platform:y,elements:v}=e,{mainAxis:b=!0,crossAxis:x=!0,fallbackPlacements:w,fallbackStrategy:k="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:S=!0,...O}=cH(p,e);if(null!=(t=h.arrow)&&t.alignmentOffset)return{};let C=cB(f),N=cW(g),P=cB(g)===g,E=await (null==y.isRTL?void 0:y.isRTL(v.floating)),_=w||(P||!S?[cX(g)]:(c=cX(g),[cZ(g),c,cZ(c)])),z="none"!==j;!w&&z&&_.push(...(u=cK(g),d=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?cJ:cG;return t?cG:cJ;case"left":case"right":return t?cQ:cY;default:return[]}}(cB(g),"start"===j,E),u&&(d=d.map(e=>e+"-"+u),S&&(d=d.concat(d.map(cZ)))),d));let T=[g,..._],A=await y.detectOverflow(e,O),R=[],L=(null==(n=h.flip)?void 0:n.overflows)||[];if(b&&R.push(A[C]),x){let e,t,n,r,a=(i=f,l=m,void 0===(s=E)&&(s=!1),e=cK(i),n=cq(t=cV(cW(i))),r="x"===t?e===(s?"end":"start")?"right":"left":"start"===e?"bottom":"top",l.reference[n]>l.floating[n]&&(r=cX(r)),[r,cX(r)]);R.push(A[a[0]],A[a[1]])}if(L=[...L,{placement:f,overflows:R}],!R.every(e=>e<=0)){let e=((null==(r=h.flip)?void 0:r.index)||0)+1,t=T[e];if(t&&("alignment"!==x||N===cW(t)||L.every(e=>cW(e.placement)!==N||e.overflows[0]>0)))return{data:{index:e,overflows:L},reset:{placement:t}};let n=null==(a=L.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!n)switch(k){case"bestFit":{let e=null==(o=L.filter(e=>{if(z){let t=cW(e.placement);return t===N||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(n=e);break}case"initialPlacement":n=g}if(f!==n)return{reset:{placement:n}}}return{}}}).name,fn:N.fn,options:[d,f]},{name:(P={name:"size",options:v=h={...er,apply:uH(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${n}px`),i.setProperty("--radix-popper-available-height",`${r}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)},"apply")},async fn(e){let t,n,{placement:r,rects:a,platform:o,elements:i}=e,{apply:l=()=>{},...s}=cH(v,e),c=await o.detectOverflow(e,s),u=cB(r),d=cK(r),f="y"===cW(r),{width:p,height:h}=a.floating;"top"===u||"bottom"===u?(t=u,n=d===(await (null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(n=u,t="end"===d?"top":"bottom");let m=h-c.top-c.bottom,g=p-c.left-c.right,y=cI(h-c[t],m),b=cI(p-c[n],g),x=e.middlewareData.shift,w=!x,k=y,j=b;null!=x&&x.enabled.x&&(j=g),null!=x&&x.enabled.y&&(k=m),w&&!d&&(f?j=p-2*cM(c.left,c.right):k=h-2*cM(c.top,c.bottom)),await l({...e,availableWidth:j,availableHeight:k});let S=await o.getDimensions(i.floating);return p!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}).name,fn:P.fn,options:[h,m]},G&&{name:(E={name:"arrow",options:w=b={element:G,padding:I},fn(e){let{element:t,padding:n}="function"==typeof w?w(e):w;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?uL({element:t.current,padding:n}).fn(e):{}:t?uL({element:t,padding:n}).fn(e):{}}}).name,fn:E.fn,options:[b,x]},u1({arrowWidth:Y,arrowHeight:X}),U&&{name:(_={name:"hide",options:S=k={strategy:"referenceHidden",...er,boundary:en?er.boundary:void 0},async fn(e){let{rects:t,platform:n}=e,{strategy:r="referenceHidden",...a}=cH(S,e);switch(r){case"referenceHidden":{let r=c5(await n.detectOverflow(e,{...a,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:r,referenceHidden:c6(r)}}}case"escaped":{let r=c5(await n.detectOverflow(e,{...a,altBoundary:!0}),t.floating);return{data:{escapedOffsets:r,escaped:c6(r)}}}default:return{}}}}).name,fn:_.fn,options:[k,j]}]}),ec=V.setPlacementState;og(()=>(ec(ei),()=>{ec(void 0)}),[ei,ec]);let[eu,ed]=u2(ei),ef=oI(B);og(()=>{el&&ef?.()},[el,ef]);let ep=es.arrow?.x,eh=es.arrow?.y,em=es.arrow?.centerOffset!==0,[eg,ey]=y.useState();return og(()=>{q&&ey(window.getComputedStyle(q).zIndex)},[q]),(0,g.jsx)("div",{ref:ea.setFloating,"data-radix-popper-content-wrapper":"",style:{...eo,transform:el?eo.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eg,"--radix-popper-transform-origin":[es.transformOrigin?.x,es.transformOrigin?.y].join(" "),...es.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,g.jsx)(uQ,{scope:z,placedSide:eu,placedAlign:ed,onArrowChange:J,arrowX:ep,arrowY:eh,shouldHideArrow:em,children:(0,g.jsx)(oR.div,{"data-side":eu,"data-align":ed,...K,ref:Z,style:{...K.style,animation:el?K.style?.animation:"none"}})})})},"PopperContent"));function u0(e){return null!==e}uH(u0,"isNotNull");var u1=uH(e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:a}=t,o=a.arrow?.centerOffset!==0,i=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[s,c]=u2(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+l/2,p="",h="";return"bottom"===s?(p=o?u:`${d}px`,h=`${-l}px`):"top"===s?(p=o?u:`${d}px`,h=`${r.floating.height+l}px`):"right"===s?(p=`${-l}px`,h=o?u:`${f}px`):"left"===s&&(p=`${r.floating.width+l}px`,h=o?u:`${f}px`),{data:{x:p,y:h}}}}),"transformOrigin");function u2(e){let[t,n="center"]=e.split("-");return[t,n]}function u4(e){let t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}uH(u2,"getSideAndAlignFromPlacement"),(0,Object.defineProperty)(u4,"name",{value:"usePrevious",configurable:!0});var u3=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),u5=Object.defineProperty,u6=(e,t)=>u5(e,"name",{value:t,configurable:!0}),u8=[" ","Enter","ArrowUp","ArrowDown"],u9=[" ","Enter"],u7="Select",[de,dt,dn]=ck(u7),[dr,da]=oh(u7,[dn,uV]),di=uV(),[dl,ds]=dr(u7),[dc,du]=dr(u7);function dd(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:o,value:i,defaultValue:l,onValueChange:s,dir:c,name:u,autoComplete:d,disabled:f,required:p,form:h,internal_do_not_use_render:m}=e,v=di(t),[b,x]=y.useState(null),[w,k]=y.useState(null),[j,S]=y.useState(!1),O=cR(c),[C,N]=oP({prop:r,defaultProp:a??!1,onChange:o,caller:u7}),[P,E]=oP({prop:i,defaultProp:l,onChange:s,caller:u7}),_=y.useRef(null),z=y.useRef(P);y.useEffect(()=>{let e=h?b?.ownerDocument.getElementById(h):b?.form;if(e instanceof HTMLFormElement){let t=u6(()=>E(z.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[h,b,E]);let T=!b||!!h||!!b.closest("form"),[A,R]=y.useState(new Set),L=ox(),I=Array.from(A).map(e=>e.props.value).join(";"),M=y.useCallback(e=>{R(t=>new Set(t).add(e))},[]),D=y.useCallback(e=>{R(t=>{let n=new Set(t);return n.delete(e),n})},[]),F={required:p,trigger:b,onTriggerChange:x,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:j,onValueNodeHasChildrenChange:S,contentId:L,value:P,onValueChange:E,open:C,onOpenChange:N,dir:O,triggerPointerDownPosRef:_,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:A,nativeSelectKey:I,isFormControl:T};return(0,g.jsx)(uZ,{...v,children:(0,g.jsx)(dl,{scope:t,...F,children:(0,g.jsx)(de.Provider,{scope:t,children:(0,g.jsx)(dc,{scope:t,onNativeOptionAdd:M,onNativeOptionRemove:D,children:dG(m)?m(F):n})})})})}u6(dd,"SelectProvider");var df=u6(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,g.jsx)(dd,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,g.jsxs)(g.Fragment,{children:[n,e?(0,g.jsx)(dZ,{__scopeSelect:t}):null]})})},"Select"),dp=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,disabled:r=!1,...a}=e,o=di(n),i=ds("SelectTrigger",n),l=i.disabled||r,s=aY(t,i.onTriggerChange),c=dt(n),u=y.useRef("touch"),[d,f,p]=dQ(e=>{let t=c().filter(e=>!e.disabled),n=t.find(e=>e.value===i.value),r=dY(t,e,n);void 0!==r&&i.onValueChange(r.value)}),h=u6(e=>{l||(i.onOpenChange(!0),p()),e&&(i.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},"handleOpen");return(0,g.jsx)(uG,{asChild:!0,...o,children:(0,g.jsx)(oR.button,{type:"button",role:"combobox","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":dJ(i.value)?"":void 0,...a,ref:s,onClick:oc(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==u.current&&h(e)}),onPointerDown:oc(a.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(h(e),e.preventDefault())}),onKeyDown:oc(a.onKeyDown,e=>{let t=""!==d.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||f(e.key),(!t||" "!==e.key)&&u8.includes(e.key)&&(h(),e.preventDefault())})})})},"SelectTrigger")),dh=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,className:r,style:a,children:o,placeholder:i="",...l}=e,s=ds("SelectValue",n),{onValueNodeHasChildrenChange:c}=s,u=void 0!==o,d=aY(t,s.onValueNodeChange);og(()=>{c(u)},[c,u]);let f=dJ(s.value);return(0,g.jsx)(oR.span,{...l,asChild:!f&&l.asChild,ref:d,style:{pointerEvents:"none"},children:(0,g.jsx)(y.Fragment,{children:f?i:o},f?"placeholder":"value")})},"SelectValue")),dm=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,children:r,...a}=e;return(0,g.jsx)(oR.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})},"SelectIcon")),[dg,dy]=dr("SelectPortal",{forceMount:void 0}),dv=u6(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,g.jsx)(dg,{scope:e.__scopeSelect,forceMount:n,children:(0,g.jsx)(ir,{asChild:!0,...r})})},"SelectPortal"),db="SelectContent",dx=y.forwardRef(u6(function(e,t){let n=dy(db,e.__scopeSelect),{forceMount:r=n.forceMount,...a}=e,o=ds(db,e.__scopeSelect),[i,l]=y.useState();return og(()=>{l(new DocumentFragment)},[]),(0,g.jsx)(il,{present:r||o.open,children:({present:e})=>e?(0,g.jsx)(dO,{...a,ref:t}):(0,g.jsx)(dw,{...a,fragment:i})})},"SelectContent")),dw=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,children:r,fragment:a}=e;return a?oT.createPortal((0,g.jsx)(dk,{scope:n,children:(0,g.jsx)(de.Slot,{scope:n,children:(0,g.jsx)("div",{ref:t,children:r})})}),a):null},"SelectContentFragment")),[dk,dj]=dr(db),dS=a1("SelectContent.RemoveScroll"),dO=y.forwardRef(u6(function(e,t){let{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:i,side:l,sideOffset:s,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:v,...b}=e,x=ds(db,n),[w,k]=y.useState(null),[j,S]=y.useState(null),O=aY(t,k),[C,N]=y.useState(null),[P,E]=y.useState(null),_=dt(n),[z,T]=y.useState(!1),A=y.useRef(!1);y.useEffect(()=>{if(w)return lt(w)},[w]),iv();let R=y.useCallback(e=>{let[t,...n]=_().map(e=>e.ref.current),[r]=n.slice(-1),a=document.activeElement;for(let n of e)if(n===a||(n?.scrollIntoView({block:"nearest"}),n===t&&j&&(j.scrollTop=0),n===r&&j&&(j.scrollTop=j.scrollHeight),n?.focus(),document.activeElement!==a))return},[_,j]),L=y.useCallback(()=>R([C,w]),[R,C,w]);y.useEffect(()=>{z&&L()},[z,L]);let{onOpenChange:I,triggerPointerDownPosRef:M}=x;y.useEffect(()=>{if(w){let e={x:0,y:0},t=u6(t=>{e={x:Math.abs(Math.round(t.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(M.current?.y??0))}},"handlePointerMove"),n=u6(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(w)||I(!1),document.removeEventListener("pointermove",t),M.current=null},"handlePointerUp");return null!==M.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[w,I,M]),y.useEffect(()=>{let e=u6(()=>I(!1),"close");return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[I]);let[D,F]=dQ(e=>{let t=_().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=dY(t,e,n);r&&setTimeout(()=>r.ref.current?.focus())}),$=y.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&(N(e),r&&(A.current=!0))},[x.value]),U=y.useCallback(()=>w?.focus(),[w]),H=y.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&E(e)},[x.value]),B="popper"===r?dN:dC;return(0,g.jsx)(dk,{scope:n,content:w,viewport:j,onViewportChange:S,itemRefCallback:$,selectedItem:C,onItemLeave:U,itemTextRefCallback:H,focusSelectedItem:L,selectedItemText:P,position:r,isPositioned:z,searchRef:D,children:(0,g.jsx)(i3,{as:dS,allowPinchZoom:!0,children:(0,g.jsx)(oX,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:oc(a,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,g.jsx)(oU,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,g.jsx)(B,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...B===dN?{side:l,sideOffset:s,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:v}:{},onPlaced:()=>T(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:oc(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||F(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=_().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>R(t)),e.preventDefault()}})})})})})})},"SelectContentImpl")),dC=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,onPlaced:r,...a}=e,o=ds(db,n),i=dj(db,n),[l,s]=y.useState(null),[c,u]=y.useState(null),d=aY(t,u),f=dt(n),p=y.useRef(!1),h=y.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=i,w=y.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&c&&m&&v&&b){let e=o.trigger.getBoundingClientRect(),t=c.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),a=b.getBoundingClientRect();if("rtl"!==o.dir){let r=a.left-t.left,o=n.left-r,i=e.left-o,s=e.width+i,c=Math.max(s,t.width),u=cb(o,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.left=u+"px"}else{let r=t.right-a.right,o=window.innerWidth-n.right-r,i=window.innerWidth-e.right-o,s=e.width+i,c=Math.max(s,t.width),u=cb(o,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.right=u+"px"}let i=f(),s=window.innerHeight-20,u=m.scrollHeight,d=window.getComputedStyle(c),h=parseInt(d.borderTopWidth,10),g=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),x=h+g+u+parseInt(d.paddingBottom,10)+y,w=Math.min(5*v.offsetHeight,x),k=window.getComputedStyle(m),j=parseInt(k.paddingTop,10),S=parseInt(k.paddingBottom,10),O=e.top+e.height/2-10,C=v.offsetHeight/2,N=h+g+(v.offsetTop+C);if(N<=O){let e=i.length>0&&v===i[i.length-1].ref.current;l.style.bottom="0px";let t=Math.max(s-O,C+(e?S:0)+(c.clientHeight-m.offsetTop-m.offsetHeight)+y);l.style.height=N+t+"px"}else{let e=i.length>0&&v===i[0].ref.current;l.style.top="0px";let t=Math.max(O,h+m.offsetTop+(e?j:0)+C);l.style.height=t+(x-N)+"px",m.scrollTop=N-O+m.offsetTop}l.style.margin="10px 0",l.style.minHeight=w+"px",l.style.maxHeight=s+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,o.trigger,o.valueNode,l,c,m,v,b,o.dir,r]);og(()=>w(),[w]);let[k,j]=y.useState();og(()=>{c&&j(window.getComputedStyle(c).zIndex)},[c]);let S=y.useCallback(e=>{e&&!0===h.current&&(w(),x?.(),h.current=!1)},[w,x]);return(0,g.jsx)(dP,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:(0,g.jsx)("div",{ref:s,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:(0,g.jsx)(oR.div,{...a,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})},"SelectItemAlignedPosition")),dN=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,align:r="start",collisionPadding:a=10,...o}=e,i=di(n);return(0,g.jsx)(uX,{...i,...o,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[dP,dE]=dr(db,{}),d_="SelectViewport",dz=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,nonce:r,...a}=e,o=dj(d_,n),i=dE(d_,n),l=aY(t,o.onViewportChange),s=y.useRef(0);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,g.jsx)(de.Slot,{scope:n,children:(0,g.jsx)(oR.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:oc(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=i;if(r?.current&&n){let e=Math.abs(s.current-t.scrollTop);if(e>0){let r=window.innerHeight-20,a=Math.max(parseFloat(n.style.minHeight),parseFloat(n.style.height));if(a<r){let o=a+e,i=Math.min(r,o),l=o-i;n.style.height=i+"px","0px"===n.style.bottom&&(t.scrollTop=l>0?l:0,n.style.justifyContent="flex-end")}}}s.current=t.scrollTop})})})]})},"SelectViewport")),[dT,dA]=dr("SelectGroup"),dR=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,...r}=e,a=dA("SelectLabel",n);return(0,g.jsx)(oR.div,{id:a.id,...r,ref:t})},"SelectLabel")),dL="SelectItem",[dI,dM]=dr(dL),dD=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...i}=e,l=ds(dL,n),s=dj(dL,n),c=l.value===r,[u,d]=y.useState(o??""),[f,p]=y.useState(!1),h=aY(t,oI(e=>s.itemRefCallback?.(e,r,a))),m=ox(),v=y.useRef("touch"),b=u6(()=>{a||(l.onValueChange(r),l.onOpenChange(!1))},"handleSelect");return(0,g.jsx)(dI,{scope:n,value:r,disabled:a,textId:m,isSelected:c,onItemTextChange:y.useCallback(e=>{d(t=>t||(e?.textContent??"").trim())},[]),children:(0,g.jsx)(de.ItemSlot,{scope:n,value:r,disabled:a,textValue:u,children:(0,g.jsx)(oR.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:h,onFocus:oc(i.onFocus,()=>p(!0)),onBlur:oc(i.onBlur,()=>p(!1)),onClick:oc(i.onClick,()=>{"mouse"!==v.current&&b()}),onPointerUp:oc(i.onPointerUp,()=>{"mouse"===v.current&&b()}),onPointerDown:oc(i.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:oc(i.onPointerMove,e=>{v.current=e.pointerType,a?s.onItemLeave?.():"mouse"===v.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:oc(i.onPointerLeave,e=>{e.currentTarget===document.activeElement&&s.onItemLeave?.()}),onKeyDown:oc(i.onKeyDown,e=>{a||e.target!==e.currentTarget||(s.searchRef?.current===""||" "!==e.key)&&(u9.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})},"SelectItem")),dF="SelectItemText",d$=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,className:r,style:a,...o}=e,i=ds(dF,n),l=dj(dF,n),s=dM(dF,n),c=du(dF,n),[u,d]=y.useState(null),f=oI(e=>l.itemTextRefCallback?.(e,s.value,s.disabled)),p=aY(t,d,s.onItemTextChange,f),h=u?.textContent,m=y.useMemo(()=>(0,g.jsx)("option",{value:s.value,disabled:s.disabled,children:h},s.value),[s.disabled,s.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=c;return og(()=>(v(m),()=>b(m)),[v,b,m]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(oR.span,{id:s.textId,...o,ref:p}),s.isSelected&&i.valueNode&&!i.valueNodeHasChildren&&!dJ(i.value)?oT.createPortal(o.children,i.valueNode):null]})},"SelectItemText")),dU=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,...r}=e;return dM("SelectItemIndicator",n).isSelected?(0,g.jsx)(oR.span,{"aria-hidden":!0,...r,ref:t}):null},"SelectItemIndicator")),dH="SelectScrollUpButton",dB=y.forwardRef(u6(function(e,t){let n=dj(dH,e.__scopeSelect),r=dE(dH,e.__scopeSelect),[a,o]=y.useState(!1),i=aY(t,r.onScrollButtonChange);return og(()=>{if(n.viewport&&n.isPositioned){let e=function(){o(t.scrollTop>0)};u6(e,"handleScroll");let t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),a?(0,g.jsx)(dq,{...e,ref:i,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null},"SelectScrollUpButton")),dK="SelectScrollDownButton",dV=y.forwardRef(u6(function(e,t){let n=dj(dK,e.__scopeSelect),r=dE(dK,e.__scopeSelect),[a,o]=y.useState(!1),i=aY(t,r.onScrollButtonChange);return og(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)};u6(e,"handleScroll");let t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),a?(0,g.jsx)(dq,{...e,ref:i,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null},"SelectScrollDownButton")),dq=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...a}=e,o=dj("SelectScrollButton",n),i=y.useRef(null),l=dt(n),s=y.useCallback(()=>{null!==i.current&&(window.clearInterval(i.current),i.current=null)},[]);return y.useEffect(()=>()=>s(),[s]),og(()=>{let e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),(0,g.jsx)(oR.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:oc(a.onPointerDown,()=>{null===i.current&&(i.current=window.setInterval(r,50))}),onPointerMove:oc(a.onPointerMove,()=>{o.onItemLeave?.(),null===i.current&&(i.current=window.setInterval(r,50))}),onPointerLeave:oc(a.onPointerLeave,()=>{s()})})},"SelectScrollButtonImpl")),dW=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,...r}=e;return(0,g.jsx)(oR.div,{"aria-hidden":!0,...r,ref:t})},"SelectSeparator")),dZ=y.forwardRef(u6(function({__scopeSelect:e,...t},n){let r=ds("SelectBubbleInput",e),{value:a,onValueChange:o,required:i,disabled:l,name:s,autoComplete:c,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=y.useRef(null),h=aY(n,p),m=a??"",v=u4(m),b=Array.from(d).some(e=>(e.props.value??"")==="");return y.useEffect(()=>{let e=p.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(v!==m&&t){let n=new Event("change",{bubbles:!0});t.call(e,m),e.dispatchEvent(n)}},[v,m]),(0,g.jsxs)(oR.select,{"aria-hidden":!0,required:i,tabIndex:-1,name:s,autoComplete:c,disabled:l,form:u,onChange:e=>o(e.target.value),...t,style:{...u3,...t.style},ref:h,defaultValue:m,children:[dJ(a)&&!b?(0,g.jsx)("option",{value:""}):null,Array.from(d)]},f)},"SelectBubbleInput"));function dG(e){return"function"==typeof e}function dJ(e){return""===e||void 0===e}function dQ(e){let t=oI(e),n=y.useRef(""),r=y.useRef(0),a=y.useCallback(e=>{t(n.current+e)},[t]),o=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function dY(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1,o=dX(e,Math.max(a,0));1===r.length&&(o=o.filter(e=>e!==n));let i=o.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return i!==n?i:void 0}function dX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}u6(dG,"isFunction"),u6(dJ,"shouldShowPlaceholder"),u6(dQ,"useTypeaheadSearch"),u6(dY,"findNextItem"),u6(dX,"wrapArray");let d0=O("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);function d1(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d2(e){if(Array.isArray(e))return e}function d4(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function d5(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function d6(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function d8(e,t){return d2(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||d7(e,t)||d4()}function d9(e){return d2(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d7(e)||d4()}function d7(e,t){if(e){if("string"==typeof e)return d1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d1(e,t)}}var fe=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=r.children,l=d6(r,["className","children"]),s=d8(a,1)[0];return(0,g.jsxs)(dp,d5(d3({ref:s,"data-slot":"select-trigger",className:aR("flex h-10 w-full cursor-pointer items-center justify-between gap-2 rounded-[10px] border border-input bg-card px-3 py-2 text-sm text-foreground shadow-[0_1px_2px_rgb(20_24_40/0.04)] outline-none transition-[border-color,box-shadow,background-color] hover:border-ring/35 focus-visible:border-ring/50 focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:focus-visible:border-destructive aria-invalid:focus-visible:ring-destructive/25 disabled:pointer-events-none disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:truncate",o)},l),{children:[i,(0,g.jsx)(dm,{asChild:!0,children:(0,g.jsx)(A,{className:"size-4 shrink-0 text-muted-foreground"})})]}))});fe.displayName=dp.displayName;var ft=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=d6(r,["className"]),l=d8(a,1)[0];return(0,g.jsx)(dB,d5(d3({ref:l,className:aR("flex cursor-default items-center justify-center py-1",o)},i),{children:(0,g.jsx)(d0,{className:"size-4"})}))});ft.displayName=dB.displayName;var fn=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=d6(r,["className"]),l=d8(a,1)[0];return(0,g.jsx)(dV,d5(d3({ref:l,className:aR("flex cursor-default items-center justify-center py-1",o)},i),{children:(0,g.jsx)(A,{className:"size-4"})}))});fn.displayName=dV.displayName;var fr=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=r.children,l=r.position,s=void 0===l?"popper":l,c=r.sideOffset,u=d6(r,["className","children","position","sideOffset"]),d=d8(a,1)[0];return(0,g.jsx)(dv,{children:(0,g.jsxs)(dx,d5(d3({ref:d,"data-slot":"select-content",position:s,sideOffset:void 0===c?6:c,className:aR("relative z-50 max-h-[min(20rem,var(--radix-select-content-available-height))] min-w-[8rem] overflow-hidden rounded-xl border border-border/80 bg-popover text-popover-foreground shadow-[0_18px_50px_rgb(22_27_45/0.14)] data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","popper"===s&&"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o)},u),{children:[(0,g.jsx)(ft,{}),(0,g.jsx)(dz,{className:aR("p-1.5","popper"===s&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:i}),(0,g.jsx)(fn,{})]}))})});fr.displayName=dx.displayName,y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=d6(r,["className"]),l=d8(a,1)[0];return(0,g.jsx)(dR,d3({ref:l,className:aR("px-2 py-1.5 text-xs font-semibold text-muted-foreground",o)},i))}).displayName=dR.displayName;var fa=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=r.children,l=d6(r,["className","children"]),s=d8(a,1)[0];return(0,g.jsxs)(dD,d5(d3({ref:s,"data-slot":"select-item",className:aR("relative flex w-full cursor-pointer select-none items-center rounded-lg py-2 pr-8 pl-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o)},l),{children:[(0,g.jsx)(d$,{children:i}),(0,g.jsx)("span",{className:"absolute right-2 flex size-4 items-center justify-center text-primary",children:(0,g.jsx)(dU,{children:(0,g.jsx)(s3,{className:"size-4",strokeWidth:2.5})})})]}))});function fo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fi(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function fl(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){fi(o,r,a,i,l,"next",e)}function l(e){fi(o,r,a,i,l,"throw",e)}i(void 0)})}}function fs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fo(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fc(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function fu(e){var t=e.open,n=e.onOpenChange,r=(0,x.Bd)().t,a=ss(function(e){return e.loadHarnesses}),o=ss(function(e){return e.setNotice}),i=fs((0,y.useState)(null),2),l=i[0],s=i[1],c=fs((0,y.useState)(!1),2),u=c[0],d=c[1],f=fs((0,y.useState)(null),2),p=f[0],h=f[1],m=fs((0,y.useState)(null),2),v=m[0],b=m[1],w=fs((0,y.useState)("device"),2),k=w[0],j=w[1],S=fs((0,y.useState)("push"),2),O=S[0],C=S[1],P=fs((0,y.useState)(null),2),E=P[0],z=P[1],T=fs((0,y.useState)(!1),2),A=T[0],R=T[1],M=fs((0,y.useState)(!1),2),D=M[0],$=M[1],U=fs((0,y.useState)(!1),2),H=U[0],B=U[1],K=fs((0,y.useState)(5),2),V=K[0],q=K[1],W=(0,y.useRef)(null),Z=fs((0,y.useState)(""),2),G=Z[0],J=Z[1],Q=fs((0,y.useState)(!1),2),Y=Q[0],X=Q[1],ee=fs((0,y.useState)(""),2),et=ee[0],en=ee[1],er=fs((0,y.useState)(!1),2),ea=er[0],eo=er[1],ei=fs((0,y.useState)(!1),2),el=ei[0],es=ei[1],ec=fs((0,y.useState)(""),2),eu=ec[0],ed=ec[1],ef=fs((0,y.useState)("skip"),2),ep=ef[0],eh=ef[1],em=fs((0,y.useState)(!0),2),eg=em[0],ey=em[1],ev=fs((0,y.useState)(!1),2),eb=ev[0],ex=ev[1],ew=fs((0,y.useState)(null),2),ek=ew[0],ej=ew[1],eS=fs((0,y.useState)(null),2),eO=eS[0],eC=eS[1],eN=fs((0,y.useState)(!1),2),eP=eN[0],eE=eN[1],e_=fs((0,y.useState)(!1),2),ez=e_[0],eT=e_[1];function eA(){return fl(function(){return fc(this,function(e){switch(e.label){case 0:d(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,lX("/api/github/status")];case 2:return s(e.sent()),[3,5];case 3:return h(l6(e.sent())),[3,5];case 4:return d(!1),[7];case 5:return[2]}})})()}function eR(){return fl(function(){var e;return fc(this,function(t){switch(t.label){case 0:h(null),b(null),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,lX("/api/github/device/code",{method:"POST",body:JSON.stringify({})})];case 2:return z(e=t.sent()),eI(e.deviceCode,e.interval),[3,4];case 3:return h(l6(t.sent())),[3,4];case 4:return[2]}})})()}function eL(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return fl(function(){var n,a,o;return fc(this,function(i){switch(i.label){case 0:if(!(n=e||(null==E?void 0:E.deviceCode)))return[2];t&&(B(!0),h(null),b(null)),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,lX("/api/github/device/poll",{method:"POST",body:JSON.stringify({deviceCode:n})})];case 2:return"authorized"===(a=i.sent()).status?(W.current&&clearInterval(W.current),$(!1),z(null),b("GitHub 授权成功!欢迎 ".concat(a.username||"")),eA()):"expired"===a.status?(W.current&&clearInterval(W.current),$(!1),h(l6(a.error||"授权已过期,请重新获取授权码"))):"error"===a.status?(W.current&&clearInterval(W.current),$(!1),h(l6(a.error||"授权失败,请重试"))):"pending"===a.status&&(a.interval&&a.interval>5&&(q(a.interval),eI(n,a.interval)),t&&b(r("githubSync.pendingAuth"))),[3,5];case 3:return o=i.sent(),t&&h(l6(o)),[3,5];case 4:return t&&B(!1),[7];case 5:return[2]}})})()}function eI(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;W.current&&clearInterval(W.current),$(!0),q(t),W.current=setInterval(function(){eL(e,!1)},1e3*Math.max(t,5))}return(0,y.useEffect)(function(){t?(h(null),b(null),eA()):(W.current&&(clearInterval(W.current),W.current=null),$(!1),z(null),ej(null))},[t]),(0,y.useEffect)(function(){return function(){W.current&&clearInterval(W.current)}},[]),(0,g.jsx)(lc,{open:t,onOpenChange:n,children:(0,g.jsxs)(lT,{className:"max-h-[90vh] overflow-y-auto sm:max-w-2xl",children:[(0,g.jsxs)(lA,{children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(_,{className:"size-5 text-primary"}),(0,g.jsx)(lL,{children:r("githubSync.title")})]}),(0,g.jsx)(lI,{children:r("githubSync.intro")})]}),p&&(0,g.jsx)("div",{className:"rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:l7(r,p)}),v&&(0,g.jsx)("div",{className:"rounded-lg border border-emerald-500/40 bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400",children:v}),(null==l?void 0:l.connected)?(0,g.jsxs)("div",{className:"space-y-6",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 rounded-xl border bg-muted/40 p-4",children:[(0,g.jsxs)("div",{className:"flex items-center gap-3",children:[l.avatarUrl?(0,g.jsx)("img",{src:l.avatarUrl,alt:l.username,className:"size-10 rounded-full border"}):(0,g.jsx)(sX,{className:"size-10 text-muted-foreground"}),(0,g.jsxs)("div",{children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("span",{className:"font-semibold",children:l.username}),(0,g.jsxs)(aI,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:[(0,g.jsx)(s0,{className:"mr-1 size-3"}),"已连接"]})]}),(0,g.jsxs)("p",{className:"text-xs text-muted-foreground",children:[r("githubSync.lastSynced")," ",l.lastSyncedAt?new Date(l.lastSyncedAt).toLocaleString():r("githubSync.neverSynced")]})]})]}),(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(oo,{variant:"outline",size:"sm",onClick:function(){eA()},disabled:u,children:(0,g.jsx)(N,{className:"size-4 ".concat(u?"animate-spin":"")})}),(0,g.jsxs)(oo,{variant:"ghost",size:"sm",onClick:function(){fl(function(){return fc(this,function(e){switch(e.label){case 0:h(null),b(null),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,lX("/api/github/disconnect",{method:"POST"})];case 2:return e.sent(),s({connected:!1}),ej(null),b("已断开与 GitHub 的连接"),[3,4];case 3:return h(l6(e.sent())),[3,4];case 4:return[2]}})})()},children:[(0,g.jsx)(I,{className:"mr-1 size-4"}),r("githubSync.disconnect")]})]})]}),(0,g.jsxs)("div",{className:"space-y-4",children:[(0,g.jsxs)("div",{className:"grid grid-cols-2 rounded-lg bg-muted p-1",children:[(0,g.jsxs)("button",{type:"button",className:aR("flex items-center justify-center gap-2 rounded-md py-1.5 text-sm font-medium transition-colors","push"===O?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),onClick:function(){return C("push")},children:[(0,g.jsx)(s1,{className:"size-4"}),r("githubSync.pushTitle")]}),(0,g.jsxs)("button",{type:"button",className:aR("flex items-center justify-center gap-2 rounded-md py-1.5 text-sm font-medium transition-colors","pull"===O?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),onClick:function(){return C("pull")},children:[(0,g.jsx)(s2,{className:"size-4"}),r("githubSync.pullTitle")]})]}),"push"===O&&(0,g.jsxs)("div",{className:"space-y-4 pt-1",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:r("githubSync.pushIntro")}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"push-passphrase",children:r("githubSync.passphrase")}),(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)(L,{className:"absolute left-3 top-2.5 size-4 text-muted-foreground"}),(0,g.jsx)(cm,{id:"push-passphrase",type:"password",className:"pl-9",placeholder:r("githubSync.passphrasePlaceholder"),value:et,onChange:function(e){return en(e.target.value)}})]})]}),(0,g.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,g.jsx)(ch,{id:"push-codex-cache",checked:ea,onCheckedChange:function(e){return eo(!!e)}}),(0,g.jsx)(cv,{htmlFor:"push-codex-cache",className:"text-sm font-normal",children:r("githubSync.includeCache")})]}),(0,g.jsxs)(oo,{className:"w-full",disabled:!et||el,onClick:function(){fl(function(){var e;return fc(this,function(t){switch(t.label){case 0:if(!et)return[2];es(!0),h(null),b(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,lX("/api/github/push",{method:"POST",body:JSON.stringify({passphrase:et,includeCodexLoginCache:ea})})];case 2:return b(r("githubSync.pushSuccess",{profiles:(e=t.sent()).exportedProfilesCount,vault:e.exportedVaultCount})),eA(),[3,5];case 3:return h(l6(t.sent())),[3,5];case 4:return es(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(s1,{className:"mr-2 size-4"}),el?r("githubSync.pushing"):r("githubSync.pushTitle")]})]}),"pull"===O&&(0,g.jsxs)("div",{className:"space-y-4 pt-1",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:r("githubSync.pullIntro")}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"pull-passphrase",children:r("githubSync.passphrase")}),(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)(L,{className:"absolute left-3 top-2.5 size-4 text-muted-foreground"}),(0,g.jsx)(cm,{id:"pull-passphrase",type:"password",className:"pl-9",placeholder:r("githubSync.pullPassphrasePlaceholder"),value:eu,onChange:function(e){ed(e.target.value),ej(null)}})]})]}),(0,g.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{children:r("transfer.conflictPolicy")}),(0,g.jsxs)(df,{value:ep,onValueChange:function(e){eh(e),ej(null)},children:[(0,g.jsx)(fe,{children:(0,g.jsx)(dh,{})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"skip",children:r("transfer.policySkip")}),(0,g.jsx)(fa,{value:"overwrite",children:r("transfer.policyOverwrite")})]})]})]})}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,g.jsx)(ch,{id:"pull-restore-active",checked:eg,onCheckedChange:function(e){ey(!!e),ej(null)}}),(0,g.jsx)(cv,{htmlFor:"pull-restore-active",className:"text-sm font-normal",children:r("transfer.restoreActive")})]}),(0,g.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,g.jsx)(ch,{id:"pull-migrate-cache",checked:eb,onCheckedChange:function(e){ex(!!e)}}),(0,g.jsx)(cv,{htmlFor:"pull-migrate-cache",className:"text-sm font-normal",children:r("transfer.migrateCache")})]})]}),ek?(0,g.jsxs)("div",{className:"space-y-4 rounded-xl border bg-muted/20 p-4",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b pb-3",children:[(0,g.jsx)("span",{className:"font-semibold text-sm",children:"云端备份检查结果"}),(0,g.jsxs)("span",{className:"text-xs text-muted-foreground",children:["备份时间: ",eO?new Date(eO).toLocaleString():""]})]}),(0,g.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm sm:grid-cols-4",children:[(0,g.jsxs)("div",{className:"rounded-lg border bg-background p-2 text-center",children:[(0,g.jsx)("div",{className:"font-bold text-lg",children:ek.profileCount}),(0,g.jsx)("div",{className:"text-xs text-muted-foreground",children:"配置数量"})]}),(0,g.jsxs)("div",{className:"rounded-lg border bg-background p-2 text-center",children:[(0,g.jsx)("div",{className:"font-bold text-lg",children:ek.providerCount}),(0,g.jsx)("div",{className:"text-xs text-muted-foreground",children:"凭据数量"})]}),(0,g.jsxs)("div",{className:"rounded-lg border bg-background p-2 text-center",children:[(0,g.jsx)("div",{className:"font-bold text-lg text-amber-500",children:ek.conflicts.length}),(0,g.jsx)("div",{className:"text-xs text-muted-foreground",children:"同名冲突"})]}),(0,g.jsxs)("div",{className:"rounded-lg border bg-background p-2 text-center",children:[(0,g.jsx)("div",{className:"font-bold text-lg",children:ek.activeCount}),(0,g.jsx)("div",{className:"text-xs text-muted-foreground",children:"激活状态"})]})]}),ek.conflicts.length>0&&(0,g.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-300",children:[(0,g.jsxs)("div",{className:"flex items-center gap-1 font-semibold",children:[(0,g.jsx)(s4,{className:"size-4"}),"发现同名配置:"]}),(0,g.jsx)("div",{className:"mt-1",children:ek.conflicts.map(function(e){return"".concat(F[e.harness]||e.harness,"/").concat(e.name)}).join("、")}),(0,g.jsxs)("div",{className:"mt-1",children:["当前策略:","skip"===ep?"保留本机,跳过导入":"覆盖本机同名配置"]})]}),(0,g.jsxs)(oo,{className:"w-full",disabled:ez,onClick:function(){fl(function(){var e;return fc(this,function(t){switch(t.label){case 0:if(!eu)return[2];eT(!0),h(null),b(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,lX("/api/github/pull",{method:"POST",body:JSON.stringify({passphrase:eu,conflictPolicy:ep,restoreActive:eg,migrateCodexLoginCache:eb})})];case 2:var n,i,l;return e=t.sent(),a(),n=e,i=r,l=[],n.imported>0&&l.push(i("transfer.importedCount",{count:n.imported})),n.overwritten>0&&l.push(i("transfer.overwrittenCount",{count:n.overwritten})),n.providersCopied>0&&l.push(i("transfer.providersCopiedCount",{count:n.providersCopied})),n.skipped>0&&l.push(i("transfer.skippedCount",{count:n.skipped})),n.activeRestored>0&&l.push(i("transfer.activeRestoredCount",{count:n.activeRestored})),b(r("githubSync.pullSuccess",{summary:l.join(",")||"无变动"})),o(e.warnings.length>0?e.warnings.map(l5):[{key:"transfer.imported"}]),ej(null),eA(),[3,5];case 3:return h(l6(t.sent())),[3,5];case 4:return eT(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(s2,{className:"mr-2 size-4"}),ez?r("githubSync.pulling"):r("githubSync.confirmPull")]})]}):(0,g.jsxs)(oo,{variant:"outline",className:"w-full",disabled:!eu||eP,onClick:function(){fl(function(){var e,t;return fc(this,function(n){switch(n.label){case 0:if(!eu)return[2];eE(!0),h(null),b(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,lX("/api/github/pull/preview",{method:"POST",body:JSON.stringify({passphrase:eu,conflictPolicy:ep,restoreActive:eg})})];case 2:return ej((e=n.sent()).preview),eC(e.gistUpdatedAt),[3,5];case 3:return t=n.sent(),ej(null),h(l6(t)),[3,5];case 4:return eE(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(N,{className:"mr-2 size-4 ".concat(eP?"animate-spin":"")}),eP?r("transfer.inspecting"):r("githubSync.inspect")]})]})]})]}):(0,g.jsxs)("div",{className:"space-y-4",children:[(0,g.jsxs)("div",{className:"grid grid-cols-2 rounded-lg bg-muted p-1",children:[(0,g.jsx)("button",{type:"button",className:aR("flex items-center justify-center gap-2 rounded-md py-1.5 text-sm font-medium transition-colors","device"===k?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),onClick:function(){return j("device")},children:r("githubSync.tabDevice")}),(0,g.jsx)("button",{type:"button",className:aR("flex items-center justify-center gap-2 rounded-md py-1.5 text-sm font-medium transition-colors","token"===k?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),onClick:function(){return j("token")},children:r("githubSync.tabToken")})]}),"device"===k&&(0,g.jsxs)("div",{className:"space-y-4 pt-1",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:r("githubSync.deviceIntro")}),E?(0,g.jsxs)("div",{className:"space-y-4 rounded-xl border bg-muted/30 p-4",children:[(0,g.jsxs)("div",{className:"space-y-1 text-center",children:[(0,g.jsx)("span",{className:"text-xs text-muted-foreground",children:r("githubSync.userCode")}),(0,g.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,g.jsx)("code",{className:"rounded-md bg-background px-3 py-1.5 font-mono text-2xl font-bold tracking-widest text-primary border",children:E.userCode}),(0,g.jsx)(oo,{variant:"outline",size:"icon",onClick:function(){(null==E?void 0:E.userCode)&&(navigator.clipboard.writeText(E.userCode),R(!0),setTimeout(function(){return R(!1)},2e3))},children:A?(0,g.jsx)(s3,{className:"size-4 text-emerald-500"}):(0,g.jsx)(s5,{className:"size-4"})})]})]}),(0,g.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,g.jsx)(oo,{className:"w-full",asChild:!0,children:(0,g.jsxs)("a",{href:E.verificationUri,target:"_blank",rel:"noopener noreferrer",children:[(0,g.jsx)(s6,{className:"mr-2 size-4"}),r("githubSync.openAuthPage")]})}),(0,g.jsxs)(oo,{type:"button",variant:"secondary",className:"w-full",disabled:H,onClick:function(){(null==E?void 0:E.deviceCode)&&eL(E.deviceCode,!0)},children:[(0,g.jsx)(N,{className:"mr-2 size-4 ".concat(H?"animate-spin":"")}),H?r("githubSync.checkingAuth"):r("githubSync.checkNow")]}),(0,g.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,g.jsx)(oo,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-foreground h-auto p-1",onClick:function(){eR()},children:r("githubSync.regenerateCode")}),D&&(0,g.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,g.jsx)(N,{className:"size-3 animate-spin"}),V>5?r("githubSync.waitingAuthInterval",{seconds:V}):r("githubSync.waitingAuth")]})]})]})]}):(0,g.jsxs)(oo,{className:"w-full",onClick:function(){eR()},children:[(0,g.jsx)(sX,{className:"mr-2 size-4"}),r("githubSync.getCode")]})]}),"token"===k&&(0,g.jsxs)("div",{className:"space-y-4 pt-1",children:[(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"github-pat",children:"Personal Access Token"}),(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)(s8,{className:"absolute left-3 top-2.5 size-4 text-muted-foreground"}),(0,g.jsx)(cm,{id:"github-pat",type:"password",className:"pl-9",placeholder:r("githubSync.tokenPlaceholder"),value:G,onChange:function(e){return J(e.target.value)}})]}),(0,g.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Token 需具备 ",(0,g.jsx)("code",{className:"text-primary font-mono",children:"gist"})," ","权限以读写加密配置文件。"]})]}),(0,g.jsxs)(oo,{className:"w-full",disabled:!G.trim()||Y,onClick:function(){fl(function(){var e;return fc(this,function(t){switch(t.label){case 0:if(!G.trim())return[2];X(!0),h(null),b(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,lX("/api/github/token",{method:"POST",body:JSON.stringify({token:G.trim()})})];case 2:return s(e=t.sent()),J(""),b("GitHub 连接成功!欢迎 ".concat(e.username||"")),[3,5];case 3:return h(l6(t.sent())),[3,5];case 4:return X(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(sX,{className:"mr-2 size-4"}),Y?"连接中…":r("githubSync.connectToken")]})]})]})]})})}fa.displayName=dD.displayName,y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=d6(r,["className"]),l=d8(a,1)[0];return(0,g.jsx)(dW,d3({ref:l,className:aR("-mx-1 my-1 h-px bg-border",o)},i))}).displayName=dW.displayName;let fd=O("circle-user-round",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),ff=O("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),fp=O("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),fh=O("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);function fm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fm(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fy(e){var t,n=e.harness,r=e.profile,a=e.open,o=e.onOpenChange,i=(0,x.Bd)().t,l=ss(function(e){return e.previewProfile}),s=ss(function(e){return e.activateProfile}),c=ss(function(e){return e.currentUser}),u=fg((0,y.useState)(null),2),d=u[0],f=u[1],p=fg((0,y.useState)(null),2),h=p[0],m=p[1];(0,y.useEffect)(function(){if(a){var e=!1;return f(null),m(null),l(n.id,r.name).then(function(t){e||f(t)}).catch(function(t){e||m(l6(t))}),function(){e=!0}}},[a,n.id,r.name,l]);var v=null!=(t=null==d?void 0:d.map(function(e){return{path:e.path,existed:null!==e.currentContent,content:e.content,currentContent:e.currentContent}}))?t:[],b=v.filter(function(e){return"same"!==aB(e)}).length;return(0,g.jsx)(sj,{open:a,onOpenChange:o,children:(0,g.jsxs)(sI,{className:"max-h-[85dvh] overflow-y-auto sm:max-w-4xl",children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:i("activate.title")}),(0,g.jsx)(s$,{children:i("activate.body",{harness:n.label,profile:r.name,changed:b>0?i("activate.changedFiles",{count:b}):"",user:c||i("notice.currentUser")})})]}),h?(0,g.jsx)("p",{className:"text-sm text-destructive",children:i("activate.loadFailed",{reason:l7(i,h)})}):null===d?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:i("activate.loading")}):(0,g.jsx)("div",{className:"max-h-[52dvh] overflow-y-auto rounded-xl border p-3",children:(0,g.jsx)(aK,{files:v})}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:i("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){s(n.id,r.name),o(!1)},children:i("activate.confirm")})]})]})})}function fv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function fb(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function fx(e){var t=e.className,n=fb(e,["className"]);return(0,g.jsx)("div",fv({"data-slot":"card",className:aR("rounded-2xl border bg-card text-card-foreground shadow-[0_12px_34px_-26px_rgb(36_39_70/0.38)]",t)},n))}function fw(e){var t=e.className,n=fb(e,["className"]);return(0,g.jsx)("div",fv({"data-slot":"card-title",className:aR("font-semibold leading-none tracking-tight",t)},n))}function fk(e){var t=e.className,n=fb(e,["className"]);return(0,g.jsx)("div",fv({"data-slot":"card-description",className:aR("text-sm text-muted-foreground",t)},n))}function fj(e){var t=e.className,n=fb(e,["className"]);return(0,g.jsx)("div",fv({"data-slot":"card-content",className:aR("p-5 pt-0",t)},n))}function fS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fS(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fC(e){var t,n,r,a,o,i,l,s,c,u=e.harness,d=e.onAdd,f=e.onEdit,p=e.extraActions,h=(0,x.Bd)().t,m=ss(function(e){return e.activateOfficial}),v=ss(function(e){return e.deleteProfile}),b=fO((0,y.useState)(null),2),w=b[0],k=b[1],j=fO((0,y.useState)(null),2),S=j[0],O=j[1],C=(null==(r=u.active)?void 0:r.official)?h("harness.official"):null!=(t=null==(a=u.active)?void 0:a.name)?t:null;return(0,g.jsxs)("div",{className:"space-y-6",children:[(0,g.jsx)(fx,{className:"overflow-hidden border-primary/10",children:(0,g.jsxs)(fj,{className:"p-5 sm:p-6",children:[(0,g.jsxs)("div",{className:"grid gap-5 sm:grid-cols-[minmax(0,1fr)_minmax(15rem,0.85fr)] sm:divide-x",children:[(0,g.jsxs)("div",{className:"min-w-0 sm:pr-5",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,g.jsx)("span",{className:"size-2 rounded-full bg-primary shadow-[0_0_0_4px_rgb(99_91_255/0.1)]"}),h("harness.activeConfig")]}),(0,g.jsx)(fw,{className:"mt-3 truncate text-xl",children:null===C?h("harness.inactive"):h("harness.activeNamed",{name:C})}),(0,g.jsx)(fk,{className:"mt-1",children:null===C?h("harness.currentInactive"):h("harness.current",{name:C})})]}),(0,g.jsxs)("div",{className:"min-w-0 sm:pl-5",children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:h("harness.writeTargets")}),(0,g.jsx)("p",{className:"mt-3 truncate font-mono text-sm",children:null!=(n=null==(o=u.targets[0])?void 0:o.path)?n:h("harness.noTargetFile")}),u.targets.length>1?(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:h("harness.moreFiles",{count:u.targets.length-1})}):null]})]}),(0,g.jsxs)("div",{className:"mt-5 flex items-start gap-3 border-t pt-4 text-sm text-muted-foreground",children:[(0,g.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/[0.08] text-primary",children:(0,g.jsx)(s0,{className:"size-4"})}),(0,g.jsx)("p",{className:"pt-1 leading-relaxed",children:h("harness.overwriteWarning")})]})]})}),(0,g.jsxs)("section",{children:[(0,g.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"text-sm font-semibold",children:h("harness.profiles")}),(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:h("harness.profileCount",{count:u.profiles.length})})]}),p]}),(0,g.jsxs)("div",{className:"space-y-3",children:[u.supportsOfficialAuth?(0,g.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-xl border bg-card px-4 py-4 shadow-[0_10px_28px_-26px_rgb(36_39_70/0.38)]",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,g.jsx)("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground",children:(0,g.jsx)(fd,{className:"size-4"})}),(0,g.jsxs)("div",{className:"min-w-0",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("p",{className:"font-medium",children:h("harness.official")}),(null==(i=u.active)?void 0:i.official)?(0,g.jsx)(aI,{variant:"secondary",children:h("harness.active")}):null]}),(0,g.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"claude"===u.id?h("harness.officialHintClaude"):h("harness.officialHintCodex")})]})]}),(0,g.jsx)(oo,{size:"sm",variant:(null==(l=u.active)?void 0:l.official)?"secondary":"outline",disabled:null==(s=u.active)?void 0:s.official,onClick:function(){m(u.id)},children:(null==(c=u.active)?void 0:c.official)?h("harness.officialActive"):h("harness.officialSwitch")})]}):null,0===u.profiles.length?(0,g.jsxs)("div",{className:"rounded-xl border border-dashed bg-card/60 px-5 py-8 text-center",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:h("harness.noProfiles")}),(0,g.jsxs)(oo,{className:"mt-4",size:"sm",onClick:d,children:[(0,g.jsx)(T,{}),h("harness.newProfile")]})]}):u.profiles.map(function(e){var t,n,r=(null==(t=u.active)?void 0:t.official)!==!0&&(null==(n=u.active)?void 0:n.name)===e.name;return(0,g.jsxs)("div",{className:aR("flex flex-col gap-4 rounded-xl border bg-card px-4 py-4 shadow-[0_10px_28px_-26px_rgb(36_39_70/0.38)] transition-[border-color,background-color,box-shadow] sm:flex-row sm:items-center sm:justify-between",r?"border-primary/20 bg-primary/[0.035] shadow-[0_12px_30px_-24px_rgb(99_91_255/0.35)]":"hover:border-primary/15 hover:bg-card/85"),children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,g.jsx)("span",{className:aR("mt-2 size-2 shrink-0 rounded-full",r?"bg-primary":"bg-muted-foreground/30")}),(0,g.jsxs)("div",{className:"min-w-0",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("p",{className:"font-medium",children:e.name}),r?(0,g.jsx)(aI,{children:h("harness.active")}):null,e.overriddenTargets.length>0?(0,g.jsx)(aI,{variant:"outline",children:h("harness.manualOverride")}):null]}),(0,g.jsx)("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",children:e.baseUrl}),e.model?(0,g.jsx)("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:e.model}):null]})]}),(0,g.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 self-end sm:self-auto",children:[(0,g.jsxs)(oo,{size:"sm",variant:r?"secondary":"outline",onClick:function(){return O(e)},children:[r?null:(0,g.jsx)(ff,{}),r?h("harness.active"):h("harness.activate")]}),(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":h("harness.edit",{name:e.name}),onClick:function(){return f(e)},children:(0,g.jsx)(fp,{})}),(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":h("harness.delete",{name:e.name}),disabled:r,title:r?h("harness.deleteBlocked"):void 0,onClick:function(){return k(e.name)},children:(0,g.jsx)(fh,{className:r?void 0:"text-destructive"})})]})]},e.name)})]})]}),S?(0,g.jsx)(fy,{harness:u,profile:S,open:!0,onOpenChange:function(e){return!e&&O(null)}}):null,(0,g.jsx)(sj,{open:null!==w,onOpenChange:function(e){return!e&&k(null)},children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:h("harness.deleteTitle")}),(0,g.jsx)(s$,{children:h("harness.deleteBody",{harness:u.label,profile:null!=w?w:"",extra:"additive"===u.mode?h("harness.deleteAdditiveExtra"):""})})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:h("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){w&&v(u.id,w)},children:h("common.delete")})]})]})})]})}function fN(e){return(fN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fP=["size","style"];function fE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f_(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fE(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=fN(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=fN(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==fN(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fE(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fz=(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fP);return(0,g.jsxs)("svg",f_(f_({height:n,style:f_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:"Claude Code"}),(0,g.jsx)("path",{clipRule:"evenodd",d:"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z",fill:"#D97757",fillRule:"evenodd"})]}))});let fT=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;var fA=function(e){var t=(0,y.useId)(),n="lobe-icons-".concat(Array.from(e.match(fT)??[]).map(e=>e.toLowerCase()).join("-"),"-").concat(t);return(0,y.useMemo)(function(){return{fill:"url(#".concat(n,")"),id:n}},[e])},fR="Codex";function fL(e){return(fL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fI=["size","style"];function fM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fM(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=fL(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=fL(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==fL(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fF=(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fI),o=fA(fR),i=o.id,l=o.fill;return(0,g.jsxs)("svg",fD(fD({height:n,style:fD({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:fR}),(0,g.jsx)("path",{d:"M19.503 0H4.496A4.496 4.496 0 000 4.496v15.007A4.496 4.496 0 004.496 24h15.007A4.496 4.496 0 0024 19.503V4.496A4.496 4.496 0 0019.503 0z",fill:"#fff"}),(0,g.jsx)("path",{d:"M9.064 3.344a4.578 4.578 0 012.285-.312c1 .115 1.891.54 2.673 1.275.01.01.024.017.037.021a.09.09 0 00.043 0 4.55 4.55 0 013.046.275l.047.022.116.057a4.581 4.581 0 012.188 2.399c.209.51.313 1.041.315 1.595a4.24 4.24 0 01-.134 1.223.123.123 0 00.03.115c.594.607.988 1.33 1.183 2.17.289 1.425-.007 2.71-.887 3.854l-.136.166a4.548 4.548 0 01-2.201 1.388.123.123 0 00-.081.076c-.191.551-.383 1.023-.74 1.494-.9 1.187-2.222 1.846-3.711 1.838-1.187-.006-2.239-.44-3.157-1.302a.107.107 0 00-.105-.024c-.388.125-.78.143-1.204.138a4.441 4.441 0 01-1.945-.466 4.544 4.544 0 01-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81 5.81 0 01-.37-.961 4.582 4.582 0 01-.014-2.298.124.124 0 00.006-.056.085.085 0 00-.027-.048 4.467 4.467 0 01-1.034-1.651 3.896 3.896 0 01-.251-1.192 5.189 5.189 0 01.141-1.6c.337-1.112.982-1.985 1.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098 0 00.065-.066 4.51 4.51 0 01.829-1.615 4.535 4.535 0 011.837-1.388zm3.482 10.565a.637.637 0 000 1.272h3.636a.637.637 0 100-1.272h-3.636zM8.462 9.23a.637.637 0 00-1.106.631l1.272 2.224-1.266 2.136a.636.636 0 101.095.649l1.454-2.455a.636.636 0 00.005-.64L8.462 9.23z",fill:l}),(0,g.jsx)("defs",{children:(0,g.jsxs)("linearGradient",{gradientUnits:"userSpaceOnUse",id:i,x1:"12",x2:"12",y1:"3",y2:"21",children:[(0,g.jsx)("stop",{stopColor:"#B1A7FF"}),(0,g.jsx)("stop",{offset:".5",stopColor:"#7A9DFF"}),(0,g.jsx)("stop",{offset:"1",stopColor:"#3941FF"})]})})]}))});function f$(e){return(f$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fU=["size","style"];function fH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fB(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fH(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=f$(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=f$(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==f$(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fK=(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fU);return(0,g.jsxs)("svg",fB(fB({height:n,style:fB({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:"DeepSeek"}),(0,g.jsx)("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z",fill:"#4D6BFE"})]}))});function fV(e){return(fV="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fq=["size","style"];function fW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fZ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fW(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=fV(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=fV(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==fV(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fW(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fG=(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fq);return(0,g.jsxs)("svg",fZ(fZ({fill:"currentColor",fillRule:"evenodd",height:n,style:fZ({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:"Kimi"}),(0,g.jsx)("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),(0,g.jsx)("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]}))});function fJ(e){return(fJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fQ=["size","style"];function fY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fY(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=fJ(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=fJ(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==fJ(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var f0={claude:fz,codex:fF,kimi:fG,pi:(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fQ);return(0,g.jsxs)("svg",fX(fX({fill:"currentColor",fillRule:"evenodd",height:n,style:fX({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:"Pi"}),(0,g.jsx)("path",{clipRule:"evenodd",d:"M1 1h16.5v11H12v5.5H6.5V23H1V1zm5.5 5.5V12H12V6.5H6.5z"}),(0,g.jsx)("path",{d:"M17.5 12H23v11h-5.5V12z"})]}))}),dsh:fK};function f1(e){var t=e.id,n=e.className,r=f0[t];return(0,g.jsx)(r,{"aria-hidden":!0,className:aR("size-5",n)})}let f2=O("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),f4=O("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);function f3(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f5(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function f6(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f8(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){f6(e,t,n[t])})}return e}function f9(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f3(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f7(e){var t=e.open,n=e.onOpenChange,r=(0,x.Bd)().t,a=ss(function(e){return e.scan}),o=ss(function(e){return e.scanLoading}),i=ss(function(e){return e.scanError}),l=ss(function(e){return e.loadScan}),s=ss(function(e){return e.importScan}),c=ss(function(e){return e.providers}),u=ss(function(e){return e.loadProviders}),d=f9((0,y.useState)({}),2),f=d[0],p=d[1],h=f9((0,y.useState)(!1),2),m=h[0],v=h[1],b=f9((0,y.useState)(null),2),w=b[0],k=b[1],j=f9((0,y.useState)(null),2),S=j[0],O=j[1];(0,y.useEffect)(function(){t&&(O(null),k(null),l(),u())},[t,l,u]),(0,y.useEffect)(function(){a&&p(function(e){var t={},n=!0,r=!1,o=void 0;try{for(var i,l=a[Symbol.iterator]();!(n=(i=l.next()).done);n=!0){var s=i.value,c=!0,u=!1,d=void 0;try{for(var f,p=s.candidates[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var h,m,g=f.value;t[g.id]=null!=(h=e[g.id])?h:{selected:!1,name:g.suggestedName,target:g.matchesProvider?"vault":"profile",providerId:null!=(m=g.matchesProvider)?m:"",apiKey:"",overwrite:!1}}}catch(e){u=!0,d=e}finally{try{c||null==p.return||p.return()}finally{if(u)throw d}}}}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}return t})},[a]);var C=(null!=a?a:[]).flatMap(function(e){return e.candidates}).filter(function(e){var t;return null==(t=f[e.id])?void 0:t.selected}),N=C.filter(function(e){var t=f[e.id],n=!e.apiKeyPresent&&!t.apiKey.trim(),r="vault"===t.target&&""!==t.providerId;return!t.name.trim()||n&&!r});return(0,g.jsx)(lc,{open:t,onOpenChange:n,children:(0,g.jsxs)(lT,{className:"flex max-h-[85vh] w-[min(56rem,calc(100vw-2rem))] max-w-3xl flex-col overflow-hidden",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:r("import.title")}),(0,g.jsx)(lI,{children:r("import.intro")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto pr-1",children:[o?(0,g.jsxs)("p",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[(0,g.jsx)(f2,{className:"size-4 animate-spin"}),r("import.scanning")]}):null,i?(0,g.jsx)("p",{className:"py-6 text-sm text-destructive",children:l7(r,i)}):null,S?(0,g.jsxs)("div",{className:"rounded-xl border border-emerald-500/40 bg-emerald-500/5 px-4 py-3 text-sm",children:[(0,g.jsxs)("p",{className:"flex items-center gap-2 font-medium",children:[(0,g.jsx)(f4,{className:"size-4 text-emerald-600"}),r("import.summary",{imported:S.imported,skipped:S.skipped,providersCreated:S.providersCreated})]}),S.warnings.map(function(e){return(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l7(r,e)},e.key+e.scope)})]}):null,(null!=a?a:[]).map(function(e){var t,n,a;return(0,g.jsxs)("section",{className:"rounded-2xl border bg-card px-4 py-3",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,g.jsx)("h3",{className:"text-sm font-semibold",children:e.label}),e.candidates.length>0?(0,g.jsx)(aI,{variant:"secondary",children:r("import.providerCount",{count:e.candidates.length})}):null]}),(0,g.jsx)("ul",{className:"mt-2 space-y-0.5",children:e.sources.map(function(e){return(0,g.jsxs)("li",{className:"truncate font-mono text-[11px] text-muted-foreground",children:[e.path," \xb7"," ",e.exists?e.parsable?r("import.sourceRead"):r("import.sourceUnparsable"):r("import.sourceMissing")]},e.key)})}),0===e.candidates.length?(0,g.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:(t=r,(n=e).note||n.noteCode?l7(t,{key:null!=(a=n.noteCode)?a:"scan.note.unknown",fallback:n.note}):"")}):(0,g.jsx)("ul",{className:"mt-3 space-y-3",children:e.candidates.map(function(e){return(0,g.jsx)(pe,{candidate:e,choice:f[e.id],providers:null!=c?c:[],onChange:function(t){var n;return n=e.id,void p(function(e){var r,a;return r=f8({},e),a=null!=(a=f6({},n,f8({},e[n],t)))?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(a,e))}),r})}},e.id)})})]},e.harness)})]}),w?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(r,w)}):null,(0,g.jsxs)(lR,{className:"items-center",children:[(0,g.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:C.length>0?r("import.selected",{count:C.length}):r("import.selectPrompt")}),(0,g.jsxs)(oo,{variant:"outline",onClick:function(){l()},disabled:o,children:[(0,g.jsx)(P,{}),r("import.rescan")]}),(0,g.jsxs)(oo,{disabled:0===C.length||N.length>0||m,onClick:function(){var e;(e=function(){var e;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:v(!0),k(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,s(C.map(function(e){var t=f[e.id];return f8({id:e.id,name:t.name.trim(),target:t.target},"vault"===t.target&&t.providerId?{providerId:t.providerId}:{},t.apiKey.trim()?{apiKey:t.apiKey.trim()}:{},t.overwrite?{overwrite:!0}:{})}))];case 2:return O({imported:(e=t.sent()).imported,skipped:e.skipped,providersCreated:e.providersCreated,warnings:e.warnings.map(l5)}),p({}),[3,5];case 3:return k(l8(t.sent(),"import.failed")),[3,5];case 4:return v(!1),[7];case 5:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){f5(o,r,a,i,l,"next",e)}function l(e){f5(o,r,a,i,l,"throw",e)}i(void 0)})})()},children:[m?(0,g.jsx)(f2,{className:"animate-spin"}):null,r("import.importSelected")]})]})]})})}function pe(e){var t=e.candidate,n=e.choice,r=e.providers,a=e.onChange,o=(0,x.Bd)().t;if(!n)return null;var i="vault"===n.target&&""!==n.providerId,l=!t.apiKeyPresent&&!i;return(0,g.jsx)("li",{className:"rounded-xl border bg-background px-3 py-3",children:(0,g.jsxs)("div",{className:"flex items-start gap-3",children:[(0,g.jsx)(ch,{className:"mt-1",checked:n.selected,onCheckedChange:function(e){return a({selected:!0===e})},"aria-label":o("import.select",{name:t.sourceKey})}),(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsx)("span",{className:"truncate font-mono text-sm",children:t.sourceKey}),t.active?(0,g.jsx)(aI,{children:o("import.inUse")}):null,t.conflictsWith?(0,g.jsx)(aI,{variant:"secondary",children:o("import.nameTaken")}):null,t.matchesProvider?(0,g.jsx)(aI,{variant:"secondary",children:o("import.matchesProvider",{name:t.matchesProvider})}):null]}),(0,g.jsxs)("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[t.baseUrl||o("import.noBaseUrl"),t.model?" \xb7 ".concat(t.model):"",t.apiKeyPresent?" \xb7 ".concat(t.apiKeyPreview):" \xb7 ".concat(o("import.keyOutsideConfig"))]}),n.selected?(0,g.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"name-".concat(t.id),children:o("import.profileName")}),(0,g.jsx)(cm,{id:"name-".concat(t.id),value:n.name,onChange:function(e){return a({name:e.target.value})}})]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"target-".concat(t.id),children:o("import.credentialTarget")}),(0,g.jsxs)(df,{value:"vault"===n.target?n.providerId||"new-vault":"profile",onValueChange:function(e){return a("profile"===e?{target:"profile",providerId:""}:"new-vault"===e?{target:"vault",providerId:""}:{target:"vault",providerId:e})},children:[(0,g.jsx)(fe,{id:"target-".concat(t.id),children:(0,g.jsx)(dh,{})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"profile",children:o("import.targetProfile")}),(0,g.jsx)(fa,{value:"new-vault",children:o("import.targetNewVault")}),r.map(function(e){return(0,g.jsx)(fa,{value:e.id,children:o("import.targetExisting",{name:e.name})},e.id)})]})]})]}),l?(0,g.jsxs)("div",{className:"space-y-1.5 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"key-".concat(t.id),children:"API key"}),(0,g.jsx)(cm,{id:"key-".concat(t.id),type:"password",value:n.apiKey,placeholder:o("import.apiKeyFromEnv"),onChange:function(e){return a({apiKey:e.target.value})}})]}):null,t.conflictsWith?(0,g.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground sm:col-span-2",children:[(0,g.jsx)(ch,{checked:n.overwrite,onCheckedChange:function(e){return a({overwrite:!0===e})}}),o("import.overwriteExisting")]}):null]}):null]})]})})}let pt=O("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);function pn(){var e=(0,x.Bd)().t,t=(0,x.s9)(),n=t.language,r=t.setLanguage,a="en"===n,o=e(a?"language.toChinese":"language.toEnglish");return(0,g.jsxs)(oo,{type:"button",size:"sm",variant:"outline","aria-label":o,title:o,onClick:function(){return r(a?"zh-CN":"en")},children:[(0,g.jsx)(pt,{}),(0,g.jsx)("span",{className:"hidden sm:inline",children:e("language.short")})]})}function pr(){var e=(0,x.Bd)().t,t=ss(function(e){return e.notice}),n=ss(function(e){return e.clearNotice});return((0,y.useEffect)(function(){if(t){var e=window.setTimeout(function(){return n()},8e3);return function(){return window.clearTimeout(e)}}},[t,n]),t)?(0,g.jsxs)("div",{role:"status",className:"fixed bottom-4 right-4 z-50 w-[min(28rem,calc(100vw-2rem))] rounded-2xl border bg-card p-4 shadow-[0_18px_50px_-24px_rgb(36_39_70/0.45)]",children:[(0,g.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,g.jsx)("p",{className:"text-sm font-medium",children:e("notice.title")}),(0,g.jsx)(oo,{size:"sm",variant:"ghost",onClick:n,children:e("notice.close")})]}),t.map(function(t){var n;return(0,g.jsx)("p",{className:"mt-2 text-sm leading-relaxed text-muted-foreground",children:l7(e,t)},"".concat(t.key,"-").concat(null!=(n=t.scope)?n:""))})]}):null}let pa=O("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function po(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pi(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function pl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return po(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return po(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ps(e){var t,n,r=e.harnessId,a=e.open,o=e.onOpenChange,i=(0,x.s9)().locale,l=(0,x.Bd)().t,s=ss(function(e){return e.operations}),c=ss(function(e){return e.operationsLoading}),u=ss(function(e){return e.operationsError}),d=ss(function(e){return e.loadOperations}),f=ss(function(e){return e.undoOperation}),p=pl((0,y.useState)(null),2),h=p[0],m=p[1],v=pl((0,y.useState)(!1),2),b=v[0],w=v[1],k=pl((0,y.useState)(null),2),j=k[0],S=k[1],O=null!=(t=null==s?void 0:s.filter(function(e){return e.harness===r}))?t:[],C=F[r];return(0,y.useEffect)(function(){a&&(S(null),d(r))},[a,r,d]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(lc,{open:a,onOpenChange:o,children:(0,g.jsxs)(lT,{className:"flex max-h-[85vh] w-[min(52rem,calc(100vw-2rem))] max-w-2xl flex-col gap-0 overflow-hidden p-0",children:[(0,g.jsxs)(lA,{className:"shrink-0 space-y-1.5 px-6 pb-4 pt-6 pr-12",children:[(0,g.jsx)(lL,{children:l("operations.titleFor",{harness:C})}),(0,g.jsx)(lI,{children:l("operations.intro")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-6",children:[c&&0===O.length?(0,g.jsxs)("p",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[(0,g.jsx)(f2,{className:"size-4 animate-spin"}),l("operations.loading")]}):null,u?(0,g.jsx)("p",{className:"py-6 text-sm text-destructive",children:l7(l,u)}):null,c||0!==O.length?null:(0,g.jsx)("p",{className:"py-10 text-center text-sm text-muted-foreground",children:l("operations.empty")}),O.length>0?(0,g.jsx)("ul",{className:"divide-y rounded-xl border",children:O.map(function(e){var t,n,r,a,o;return(0,g.jsxs)("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsxs)("span",{className:"truncate text-sm font-medium",children:[l("operations.kind.".concat(e.kind))," \xb7 ",e.profile]}),(0,g.jsx)(aI,{variant:"degraded"===(n=e.state)?"destructive":"committed"===n?"default":"secondary",children:l("operations.state.".concat(e.state))})]}),(0,g.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[(r=null!=(t=e.finishedAt)?t:e.startedAt,a=i,Number.isNaN((o=new Date(r)).getTime())?r:o.toLocaleString(a))," \xb7"," ",l("operations.user",{user:e.user})," \xb7"," ",l("operations.fileCount",{count:e.files.length})]}),e.note?(0,g.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:e.note}):null]}),(0,g.jsxs)(oo,{size:"sm",variant:"outline",className:"shrink-0",disabled:!e.undoable,onClick:function(){return m(e)},children:[(0,g.jsx)(pa,{}),l("operations.undo")]})]},e.id)})}):null]}),(0,g.jsx)(lR,{className:"shrink-0 px-6 py-4",children:(0,g.jsx)(oo,{onClick:function(){return o(!1)},children:l("operations.close")})})]})}),(0,g.jsx)(lc,{open:null!==h,onOpenChange:function(e){return!e&&m(null)},children:(0,g.jsxs)(lT,{className:"max-w-lg",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:l("operations.undoTitle")}),(0,g.jsx)(lI,{children:h?l("operations.undoBody",{harness:null!=(n=F[h.harness])?n:h.harness,count:h.files.length}):""})]}),j?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(l,j)}):null,(0,g.jsxs)(lR,{children:[(0,g.jsx)(oo,{variant:"outline",onClick:function(){return m(null)},children:l("common.cancel")}),(0,g.jsxs)(oo,{disabled:b,onClick:function(){var e;(e=function(){return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:if(!h)return[2];w(!0),S(null),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,f(h.id)];case 2:return e.sent(),m(null),[3,5];case 3:return S(l8(e.sent(),"operations.undoFailed")),[3,5];case 4:return w(!1),[7];case 5:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){pi(o,r,a,i,l,"next",e)}function l(e){pi(o,r,a,i,l,"throw",e)}i(void 0)})})()},children:[b?(0,g.jsx)(f2,{className:"animate-spin"}):null,l("operations.confirmUndo")]})]})]})})]})}function pc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pu(e){var t,n,r=e.harness,a=(0,x.Bd)().t,o=ss(function(e){return e.operations}),i=ss(function(e){return e.operationsLoading}),l=ss(function(e){return e.operationsError}),s=ss(function(e){return e.loadOperations}),c=function(e){if(Array.isArray(e))return e}(t=(0,y.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(t)||function(e){if(e){if("string"==typeof e)return pc(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return pc(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),u=c[0],d=c[1],f=null!=(n=null==o?void 0:o.filter(function(e){return e.harness===r.id}))?n:[];return(0,y.useEffect)(function(){s(r.id)},[r.id,s]),(0,g.jsxs)("section",{className:"rounded-2xl border bg-card p-5 shadow-[0_12px_34px_-28px_rgb(36_39_70/0.38)]",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(rE,{className:"size-4 text-primary"}),(0,g.jsx)("h3",{className:"font-semibold",children:a("operations.title")}),(0,g.jsx)("span",{className:"ml-auto",children:(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":a("operations.refresh"),onClick:function(){s(r.id)},children:(0,g.jsx)(sp,{className:i?"animate-spin":void 0})})})]}),(0,g.jsx)("div",{className:"mt-4",children:l?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(a,l)}):null===o||i?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:a("operations.loading")}):0===f.length?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:a("operations.empty")}):(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:a("operations.count",{count:f.length})})}),(0,g.jsx)(oo,{className:"mt-4 w-full",size:"sm",variant:"outline",disabled:null===o,onClick:function(){return d(!0)},children:a("operations.viewDetails")}),(0,g.jsx)(ps,{harnessId:r.id,open:u,onOpenChange:d})]})}let pd=O("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),pf=O("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),pp=O("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);function ph(e){var t=e.result,n=(0,x.Bd)().t;if(t.ok){var r,a,o,i,l=null!=(a=null==(i=t.models)?void 0:i.length)?a:0;return(0,g.jsxs)("span",{className:"flex items-center gap-1.5 text-sm text-emerald-600 dark:text-emerald-400",children:[(0,g.jsx)(f4,{className:"size-4 shrink-0","aria-hidden":!0}),n(l>0?"probe.ok":"probe.okNoCatalog",{latencyMs:null!=(o=t.latencyMs)?o:"?",count:l})]})}return(0,g.jsxs)("span",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[(0,g.jsx)(pp,{className:"size-4 shrink-0","aria-hidden":!0}),l7(n,l5({code:t.code,params:t.params,message:null!=(r=t.message)?r:""}))]})}function pm(e){var t=e.className,n=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className"]);return(0,g.jsx)("textarea",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"textarea",className:aR("flex min-h-[60px] w-full rounded-[10px] border border-input bg-card px-3 py-2 text-base shadow-[0_1px_2px_rgb(20_24_40/0.04)] transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:focus-visible:border-destructive aria-invalid:focus-visible:ring-destructive/25 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t)},n))}function pg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function py(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function pv(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function pb(e){return function(e){if(Array.isArray(e))return pg(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return pg(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return pg(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var px=[{id:"openrouter",baseUrl:"https://openrouter.ai/api/v1"},{id:"zai",baseUrl:"https://api.z.ai/api/paas/v4",model:"glm-4.6"},{id:"moonshot",baseUrl:"https://api.moonshot.cn/v1"},{id:"deepseek",baseUrl:"https://api.deepseek.com/v1"}],pw={id:"cliproxyResponses",baseUrl:"https://api.seavey.ai/cliproxy/v1",model:"gpt-5.6-sol"},pk={claude:[{id:"zaiAnthropic",baseUrl:"https://api.z.ai/api/anthropic",model:"glm-4.6"},{id:"moonshotAnthropic",baseUrl:"https://api.moonshot.cn/anthropic"},{id:"deepseekAnthropic",baseUrl:"https://api.deepseek.com/anthropic"}],codex:px,kimi:px,pi:[pv(py({},pw),{extras:{api:"openai-responses",reasoning:"true"}})].concat(pb(px)),dsh:[pv(py({},pw),{extras:{api:"openai-responses",reasoningEfforts:"low,medium,high,xhigh,max"}})].concat(pb(px))};function pj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pS(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function pO(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){pS(o,r,a,i,l,"next",e)}function l(e){pS(o,r,a,i,l,"throw",e)}i(void 0)})}}function pC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){pC(e,t,n[t])})}return e}function pP(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function pE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||p_(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p_(e,t){if(e){if("string"==typeof e)return pj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pj(e,t)}}function pz(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var pT=[{role:"Sonnet",modelKey:"sonnetModel",nameKey:"sonnetModelName",oneMKey:"sonnetModel1m"},{role:"Opus",modelKey:"opusModel",nameKey:"opusModelName",oneMKey:"opusModel1m"},{role:"Fable",modelKey:"fableModel",nameKey:"fableModelName",oneMKey:"fableModel1m"},{role:"Haiku",modelKey:"haikuModel",nameKey:"haikuModelName",oneMKey:null}],pA="subagentModel",pR="subagentModel1m",pL=new Set(((function(e){if(Array.isArray(e))return pj(e)})(u=pT.flatMap(function(e){var t=e.modelKey,n=e.nameKey,r=e.oneMKey;return r?[t,n,r]:[t,n]}))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(u)||p_(u)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([pA,pR]));function pI(e){var t,n,r,a,o,i,l,s,c,u=e.harness,d=e.profile,f=e.onOpenChange,p=(0,x.Bd)().t,h=ss(function(e){return e.createProfile}),m=ss(function(e){return e.updateProfile}),v=ss(function(e){return e.previewProfile}),b=ss(function(e){return e.providers}),w=ss(function(e){return e.loadProviders}),k=ss(function(e){return e.probeDraft}),j=ss(function(e){return e.probeProfile}),S=null!==d,O=pE((0,y.useState)(null!=(t=null==d?void 0:d.name)?t:""),2),C=O[0],N=O[1],P=pE((0,y.useState)(null!=(n=null==d?void 0:d.baseUrl)?n:""),2),E=P[0],_=P[1],z=pE((0,y.useState)(""),2),T=z[0],R=z[1],L=pE((0,y.useState)(null!=(r=null==d?void 0:d.model)?r:""),2),I=L[0],M=L[1],D=pE((0,y.useState)(null!=(a=null==d?void 0:d.notes)?a:""),2),F=D[0],$=D[1],U=pE((0,y.useState)(function(){return function(e,t){var n={},r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done);r=!0){var s,c,u=i.value;n[u.key]=null!=(s=null!=(c=null==t?void 0:t.extras[u.key])?c:u.defaultValue)?s:""}}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return n}(u.fields,d)}),2),H=U[0],B=U[1],K=pE((0,y.useState)({}),2),V=K[0],q=K[1],W=pE((0,y.useState)(null!=(o=null==d?void 0:d.providerId)?o:""),2),Z=W[0],G=W[1],J=pE((0,y.useState)(null!=(i=null==d?void 0:d.providerEndpoint)?i:""),2),Q=J[0],Y=J[1],X=pE((0,y.useState)(!1),2),ee=X[0],et=X[1],en=pE((0,y.useState)(null),2),er=en[0],ea=en[1],eo=pE((0,y.useState)(null),2),ei=eo[0],el=eo[1],es=pE((0,y.useState)(!1),2),ec=es[0],eu=es[1],ed=pE((0,y.useState)({}),2),ef=ed[0],ep=ed[1],eh=pE((0,y.useState)(!1),2),em=eh[0],eg=eh[1],ey=pE((0,y.useState)(null),2),ev=ey[0],eb=ey[1],ex=null!=b?b:[],ew=null!=(l=ex.find(function(e){return e.id===Z}))?l:null,ek=null==ew?void 0:ew.endpoints.find(function(e){return e.key===Q}),ej=(null==ev?void 0:ev.ok)&&null!=(s=ev.models)?s:[];(0,y.useEffect)(function(){eb(null)},[E,T,Z,Q]);var eS=null!==b&&""!==Z&&null===ew,eO=null!==ew&&""!==Q&&void 0===ek,eC="claude"===u.id?u.fields.filter(function(e){return!pL.has(e.key)}):u.fields,eN="claude"===u.id?eC.filter(function(e){return"authVar"===e.key}):eC,eP="claude"===u.id?eC.filter(function(e){return"authVar"!==e.key}):[];function eE(){return pO(function(){var e;return pz(this,function(t){switch(t.label){case 0:if(!d)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,v(u.id,d.name)];case 2:return ea(e=t.sent()),q(Object.fromEntries(e.filter(function(e){return e.overridden}).map(function(e){return[e.key,e.content]}))),[3,4];case 3:return el(l6(t.sent())),[3,4];case 4:return[2]}})})()}function e_(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];ep(function(e){if(!t.some(function(t){return e[t]}))return e;var n=pN({},e),r=!0,a=!1,o=void 0;try{for(var i,l=t[Symbol.iterator]();!(r=(i=l.next()).done);r=!0){var s=i.value;delete n[s]}}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return n})}function ez(){var e;return ew&&Q&&null!=(e=null==ek?void 0:ek.baseUrl)?e:E}return(0,y.useEffect)(function(){null===b&&w()},[b,w]),(0,g.jsx)(lc,{open:!0,onOpenChange:f,children:(0,g.jsx)(lT,{className:"max-h-[92vh] w-[calc(100vw-2rem)] overflow-hidden p-0 sm:max-w-[1120px]",children:(0,g.jsxs)("form",{onSubmit:function(e){return pO(function(){var t,n;return pz(this,function(r){switch(r.label){case 0:if(e.preventDefault(),!function(){var e={},t=C.trim();t?t.includes("/")||t.includes("\\")?e.name={key:"profile.error.nameSlash"}:t.length>120&&(e.name={key:"profile.error.nameTooLong",params:{max:120}}):e.name={key:"profile.error.nameRequired"},ez().trim()||(e.baseUrl={key:"profile.error.baseUrlRequired"}),S||null!==ew||T.trim()||(e.apiKey={key:"profile.error.apiKeyRequired"}),u.modelRequired&&!I.trim()&&(e.model={key:"profile.error.modelRequired"}),eS&&(e.providerId={key:"profile.error.providerGone"}),eO&&(e.providerEndpoint={key:"profile.error.endpointGone"});var n=!0,r=!1,a=void 0;try{for(var o,i=u.fields[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l,s=o.value;!s.required||(null==(l=H[s.key])?void 0:l.trim())||(e["extra:".concat(s.key)]={key:"profile.error.fieldRequired",params:{label:s.label}})}}catch(e){r=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw a}}return ep(e),!(Object.keys(e).length>0)||(el({key:"profile.error.checkFields"}),!1)}())return[2];eu(!0),el(null),r.label=1;case 1:if(r.trys.push([1,6,7,8]),n=pN({name:C,baseUrl:ew&&Q&&null!=(t=null==ek?void 0:ek.baseUrl)?t:E,model:I,notes:F,extras:H},Z?pN({providerId:Z},Q?{providerEndpoint:Q}:{}):S?{providerId:""}:{},ew?{}:{apiKey:T||void 0}),!S)return[3,3];return[4,m(u.id,d.name,pP(pN({},n),{overrides:V}))];case 2:return r.sent(),[3,5];case 3:return[4,h(u.id,n)];case 4:r.sent(),r.label=5;case 5:return f(!1),[3,8];case 6:return el(l6(r.sent())),[3,8];case 7:return eu(!1),[7];case 8:return[2]}})})()},noValidate:!0,className:"flex max-h-[92vh] min-h-0 flex-col",children:[(0,g.jsxs)(lA,{className:"shrink-0 border-b bg-card px-6 py-5 pr-12",children:[(0,g.jsx)(lL,{children:S?p("profile.editTitle",{harness:u.label,profile:d.name}):p("profile.createTitle",{harness:u.label})}),(0,g.jsxs)(lI,{children:[p("profile.intro",{targets:u.targets.map(function(e){return e.label}).join(p("common.listSeparator"))}),"additive"===u.mode?p("profile.additiveNote"):""]})]}),(0,g.jsxs)("div",{"data-slot":"profile-dialog-scroll",className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-5",children:[(0,g.jsxs)("div",{"data-slot":"provider-reference-fields",className:"space-y-3 rounded-xl border p-3",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-select",className:"font-medium",children:p("profile.useSharedProvider")}),ew?(0,g.jsx)(aI,{variant:"secondary",children:p("profile.keyFromVault")}):null]}),(0,g.jsxs)(df,{value:Z,onValueChange:function(e){G(e);var t,n,r=ex.find(function(t){return t.id===e});Y(null!=(t=null==r||null==(n=r.endpoints[0])?void 0:n.key)?t:""),e_("providerId","providerEndpoint","baseUrl","apiKey")},children:[(0,g.jsx)(fe,{id:"provider-select","aria-label":p("profile.useSharedProviderLabel"),"aria-invalid":!!ef.providerId||void 0,"aria-describedby":ef.providerId?"provider-select-error":void 0,children:(0,g.jsx)(dh,{placeholder:p("profile.providerNone")})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"",children:p("profile.providerNone")}),ex.map(function(e){return(0,g.jsx)(fa,{value:e.id,children:e.name},e.id)})]})]}),ef.providerId?(0,g.jsx)("p",{id:"provider-select-error",className:"text-xs text-destructive",children:l7(p,ef.providerId)}):null,0===ex.length?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.vaultEmpty")}):null,ew?(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-endpoint",children:p("profile.namedEndpoint")}),(0,g.jsxs)(df,{value:Q,onValueChange:function(e){Y(e),e_("providerEndpoint","baseUrl")},children:[(0,g.jsx)(fe,{id:"provider-endpoint","aria-label":p("profile.namedEndpointLabel"),"aria-invalid":!!ef.providerEndpoint||void 0,"aria-describedby":ef.providerEndpoint?"provider-endpoint-error":void 0,children:(0,g.jsx)(dh,{placeholder:p("profile.endpointNone")})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"",children:p("profile.endpointNone")}),ew.endpoints.map(function(e){return(0,g.jsx)(fa,{value:e.key,children:e.label?p("profile.endpointOption",{label:e.label,key:e.key}):e.key},e.key)})]})]}),ef.providerEndpoint?(0,g.jsx)("p",{id:"provider-endpoint-error",className:"text-xs text-destructive",children:l7(p,ef.providerEndpoint)}):null,0===ew.endpoints.length?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.noEndpoints")}):null]}):null]}),(0,g.jsx)(pD,{harnessId:u.id,onPick:function(e){_(e.baseUrl),e_("baseUrl"),e.model&&(M(e.model),e_("model")),e.extras&&B(function(t){return pN({},t,e.extras)})}}),(0,g.jsxs)("div",{className:"grid gap-x-4 gap-y-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"name",children:p("profile.name")}),(0,g.jsx)(cm,{id:"name",value:C,onChange:function(e){N(e.target.value),e_("name")},placeholder:p("profile.namePlaceholder"),"aria-invalid":!!ef.name||void 0,"aria-describedby":ef.name?"profile-name-error":void 0}),ef.name?(0,g.jsx)("p",{id:"profile-name-error",className:"text-xs text-destructive",children:l7(p,ef.name)}):null,S?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.renameHint")}):null]}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"baseUrl",children:p("profile.baseUrl")}),(0,g.jsx)(cm,{id:"baseUrl",value:ew&&Q&&null!=(c=null==ek?void 0:ek.baseUrl)?c:E,onChange:function(e){_(e.target.value),e_("baseUrl")},placeholder:p("profile.baseUrlPlaceholder"),disabled:null!==ew&&""!==Q,"aria-invalid":!!ef.baseUrl||void 0,"aria-describedby":ef.baseUrl?"profile-base-url-error":void 0}),ef.baseUrl?(0,g.jsx)("p",{id:"profile-base-url-error",className:"text-xs text-destructive",children:l7(p,ef.baseUrl)}):null,ew&&Q?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.baseUrlFromVault",{endpoint:Q})}):null]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"apiKey",children:p("profile.apiKey")}),(0,g.jsx)(cm,{id:"apiKey",type:"password",value:T,onChange:function(e){R(e.target.value),e_("apiKey")},placeholder:ew?p("profile.keyFromVault"):S?p("profile.apiKeyKeep"):p("profile.apiKeyRequiredPlaceholder"),disabled:null!==ew,"aria-invalid":!!ef.apiKey||void 0,"aria-describedby":ef.apiKey?"profile-api-key-error":void 0}),ef.apiKey?(0,g.jsx)("p",{id:"profile-api-key-error",className:"text-xs text-destructive",children:l7(p,ef.apiKey)}):null,ew?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.apiKeySharedHint")}):null]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"model",children:"claude"===u.id?p("profile.fallbackModel"):p("profile.model")}),(0,g.jsx)(cm,{id:"model",value:I,list:ej.length>0?"profile-model-options":void 0,onChange:function(e){M(e.target.value),e_("model")},placeholder:"claude"===u.id?p("profile.fallbackModelPlaceholder"):p("profile.modelPlaceholder"),"aria-invalid":!!ef.model||void 0,"aria-describedby":ef.model?"profile-model-error":void 0}),ej.length>0?(0,g.jsx)("datalist",{id:"profile-model-options",children:ej.map(function(e){return(0,g.jsx)("option",{value:e},e)})}):null,ef.model?(0,g.jsx)("p",{id:"profile-model-error",className:"text-xs text-destructive",children:l7(p,ef.model)}):null,"claude"===u.id?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.claudeModelHint")}):null]}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsxs)(oo,{type:"button",variant:"outline",size:"sm",onClick:function(){return pO(function(){var e,t;return pz(this,function(n){switch(n.label){case 0:if(!(e=ez().trim()))return ep(function(e){return pP(pN({},e),{baseUrl:{key:"profile.error.baseUrlRequired"}})}),[2];eg(!0),el(null),eb(null),n.label=1;case 1:if(n.trys.push([1,7,8,9]),!(ew||T.trim()))return[3,3];return[4,k(pN({baseUrl:e},ew?{providerId:Z}:{apiKey:T}))];case 2:case 4:return t=n.sent(),[3,6];case 3:if(!(S&&d))return[3,5];return[4,j(u.id,d.name)];case 5:return ep(function(e){return pP(pN({},e),{apiKey:{key:"profile.error.apiKeyRequired"}})}),[2];case 6:return eb(t),[3,9];case 7:return el(l6(n.sent())),[3,9];case 8:return eg(!1),[7];case 9:return[2]}})})()},disabled:em,children:[em?(0,g.jsx)(f2,{className:"animate-spin"}):null,em?p("probe.probing"):p("probe.action")]}),ev?(0,g.jsx)(ph,{result:ev}):null]}),(null==ev?void 0:ev.ok)&&ej.length>0?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("probe.catalogHint")}):null]}),eN.map(function(e){var t;return(0,g.jsx)(pF,{field:e,value:null!=(t=H[e.key])?t:"",error:ef["extra:".concat(e.key)],onChange:function(t){B(function(n){return pP(pN({},n),pC({},e.key,t))}),e_("extra:".concat(e.key))}},e.key)}),"claude"===u.id?(0,g.jsx)(pH,{fields:u.fields,values:H,errors:ef,onChange:function(e,t){B(function(n){return pP(pN({},n),pC({},e,t))}),e_("extra:".concat(e))}}):null,eP.map(function(e){var t;return(0,g.jsx)(pF,{field:e,value:null!=(t=H[e.key])?t:"",error:ef["extra:".concat(e.key)],onChange:function(t){B(function(n){return pP(pN({},n),pC({},e.key,t))}),e_("extra:".concat(e.key))}},e.key)}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"notes",children:p("profile.notes")}),(0,g.jsx)(pm,{id:"notes",rows:2,value:F,onChange:function(e){return $(e.target.value)}})]})]}),(0,g.jsxs)("div",{className:"rounded-xl border",children:[(0,g.jsxs)("button",{type:"button",onClick:function(){var e=!ee;et(e),e&&null===er&&eE()},className:"flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground active:bg-accent/80 ".concat(ee?"rounded-t-xl":"rounded-xl"),children:[ee?(0,g.jsx)(A,{className:"size-4"}):(0,g.jsx)(pd,{className:"size-4"}),p("profile.advanced"),d&&d.overriddenTargets.length>0?(0,g.jsx)(aI,{variant:"secondary",children:p("profile.overridden")}):null]}),ee?(0,g.jsx)("div",{className:"space-y-4 border-t px-3 py-3",children:S?(0,g.jsx)(pM,{targets:er,overrides:V,onEdit:function(e,t){return q(function(n){return pP(pN({},n),pC({},e,t))})},onReset:function(e){q(function(t){var n=pN({},t);return delete n[e],n}),eE()}}):(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:p("profile.saveFirst")})}):null]}),ei?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(p,ei)}):null]}),(0,g.jsxs)(lR,{className:"shrink-0 border-t bg-card px-6 py-4",children:[(0,g.jsx)(oo,{type:"button",variant:"outline",onClick:function(){return f(!1)},children:p("common.cancel")}),(0,g.jsx)(oo,{type:"submit",disabled:ec,children:ec?p("profile.saving"):p("profile.save")})]})]})})})}function pM(e){var t=e.targets,n=e.overrides,r=e.onEdit,a=e.onReset,o=(0,x.Bd)().t;return null===t?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:o("profile.rawLoading")}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:o("profile.rawIntro")}),t.map(function(e){var t,i=void 0!==n[e.key];return(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,g.jsx)(cv,{htmlFor:"raw-".concat(e.key),className:"font-mono text-xs",children:e.path}),i?(0,g.jsxs)(oo,{type:"button",size:"sm",variant:"ghost",onClick:function(){return a(e.key)},children:[(0,g.jsx)(pf,{}),o("profile.resetToGenerated")]}):null]}),(0,g.jsx)(pm,{id:"raw-".concat(e.key),rows:10,spellCheck:!1,className:"font-mono text-xs",value:null!=(t=n[e.key])?t:e.content,onChange:function(t){return r(e.key,t.target.value)}})]},e.key)})]})}function pD(e){var t,n=e.harnessId,r=e.onPick,a=(0,x.Bd)().t,o=null!=(t=pk[n])?t:[];return 0===o.length?null:(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsx)("span",{className:"text-xs text-muted-foreground",children:a("profile.quickFill")}),o.map(function(e){return(0,g.jsx)(oo,{type:"button",size:"sm",variant:"outline",onClick:function(){return r(e)},children:a("preset.".concat(e.id))},e.id)})]})}function pF(e){var t,n,r=e.field,a=e.value,o=e.error,i=e.onChange,l=(0,x.Bd)().t,s="extra-".concat(r.key);return(0,g.jsxs)("div",{className:"textarea"===r.kind||r.fullWidth?"space-y-2 sm:col-span-2":"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:s,children:r.label}),"select"===r.kind?(0,g.jsxs)(df,{value:a,onValueChange:i,children:[(0,g.jsx)(fe,{id:s,"aria-label":r.label,"aria-invalid":!!o||void 0,"aria-describedby":o?"".concat(s,"-error"):void 0,children:(0,g.jsx)(dh,{placeholder:null!=(t=r.placeholder)?t:l("profile.selectPlaceholder")})}),(0,g.jsx)(fr,{children:null==(n=r.options)?void 0:n.map(function(e){return(0,g.jsx)(fa,{value:e.value,children:e.label},e.value)})})]}):"textarea"===r.kind?(0,g.jsx)(pm,{id:s,rows:3,value:a,placeholder:r.placeholder,className:"font-mono text-xs","aria-invalid":!!o||void 0,"aria-describedby":o?"".concat(s,"-error"):void 0,onChange:function(e){return i(e.target.value)}}):(0,g.jsx)(cm,{id:s,type:"password"===r.kind?"password":"text",value:a,placeholder:r.placeholder,"aria-invalid":!!o||void 0,"aria-describedby":o?"".concat(s,"-error"):void 0,onChange:function(e){return i(e.target.value)}}),o?(0,g.jsx)("p",{id:"".concat(s,"-error"),className:"text-xs text-destructive",children:l7(l,o)}):null,r.help?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:r.help}):null]})}var p$="md:grid-cols-[6.5rem_minmax(0,1fr)_minmax(0,1fr)_8.5rem]",pU="grid gap-2 rounded-lg border bg-card/70 p-3 ".concat(p$," md:items-start md:gap-3 md:border-0 md:bg-transparent md:p-0");function pH(e){var t,n=e.fields,r=e.values,a=e.errors,o=e.onChange,i=(0,x.Bd)().t,l=new Map(n.map(function(e){return[e.key,e]})),s=l.get(pA);return(0,g.jsxs)("section",{"data-slot":"claude-model-mapping",className:"space-y-4 rounded-xl border bg-muted/15 p-4 sm:col-span-2 sm:p-5",children:[(0,g.jsxs)("div",{className:"space-y-1",children:[(0,g.jsx)("h3",{className:"text-base font-semibold",children:i("profile.mapping.title")}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:i("profile.mapping.intro")})]}),(0,g.jsxs)("div",{className:"hidden gap-3 px-1 text-xs font-medium text-muted-foreground md:grid ".concat(p$),children:[(0,g.jsx)("span",{children:i("profile.mapping.role")}),(0,g.jsx)("span",{children:i("profile.mapping.displayName")}),(0,g.jsx)("span",{children:i("profile.mapping.actualModel")}),(0,g.jsx)("span",{children:i("profile.mapping.oneM")})]}),(0,g.jsxs)("div",{className:"space-y-3",children:[pT.map(function(e){var t,n,s,c=e.role,u=e.modelKey,d=e.nameKey,f=e.oneMKey,p=l.get(u),h=l.get(d);if(!p||!h)return null;var m=a["extra:".concat(u)],y=a["extra:".concat(d)];return(0,g.jsxs)("div",{className:pU,children:[(0,g.jsxs)("div",{className:"flex h-10 items-center rounded-lg border bg-muted/45 px-3 text-sm font-medium",children:[c,p.required?(0,g.jsx)("span",{className:"ml-1 text-destructive",children:"*"}):null]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"extra-".concat(d),className:"text-xs md:sr-only",children:h.label}),(0,g.jsx)(cm,{id:"extra-".concat(d),value:null!=(t=r[d])?t:"",placeholder:(null==(s=r[u])?void 0:s.trim())?i("profile.mapping.defaultTo",{model:r[u].trim()}):h.placeholder,"aria-invalid":!!y||void 0,"aria-describedby":y?"extra-".concat(d,"-error"):void 0,onChange:function(e){return o(d,e.target.value)}}),y?(0,g.jsx)("p",{id:"extra-".concat(d,"-error"),className:"text-xs text-destructive",children:l7(i,y)}):null]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"extra-".concat(u),className:"text-xs md:sr-only",children:p.label}),(0,g.jsx)(cm,{id:"extra-".concat(u),value:null!=(n=r[u])?n:"",placeholder:p.placeholder,"aria-invalid":!!m||void 0,"aria-describedby":m?"extra-".concat(u,"-error"):void 0,onChange:function(e){return o(u,e.target.value)}}),m?(0,g.jsx)("p",{id:"extra-".concat(u,"-error"),className:"text-xs text-destructive",children:l7(i,m)}):null]}),(0,g.jsx)(pB,{role:c,field:f?l.get(f):void 0,value:f?r[f]:void 0,error:f?a["extra:".concat(f)]:void 0,onChange:o})]},c)}),s?(0,g.jsxs)("div",{className:pU,children:[(0,g.jsx)("div",{className:"flex h-10 items-center rounded-lg border bg-muted/45 px-3 text-sm font-medium",children:"Subagent"}),(0,g.jsx)("div",{className:"flex h-10 items-center rounded-lg border bg-muted/30 px-3 text-sm text-muted-foreground",children:i("profile.mapping.notInMenu")}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"extra-subagentModel",className:"text-xs md:sr-only",children:s.label}),(0,g.jsx)(cm,{id:"extra-subagentModel",value:null!=(t=r.subagentModel)?t:"",placeholder:s.placeholder,"aria-invalid":!!a["extra:subagentModel"]||void 0,"aria-describedby":a["extra:subagentModel"]?"extra-subagentModel-error":void 0,onChange:function(e){return o("subagentModel",e.target.value)}}),a["extra:subagentModel"]?(0,g.jsx)("p",{id:"extra-subagentModel-error",className:"text-xs text-destructive",children:l7(i,a["extra:subagentModel"])}):null]}),(0,g.jsx)(pB,{role:"Subagent",field:l.get(pR),value:r[pR],error:a["extra:".concat(pR)],onChange:o})]}):null]})]})}function pB(e){var t=e.role,n=e.field,r=e.value,a=e.error,o=e.onChange,i=(0,x.Bd)().t;if(!n)return(0,g.jsx)("div",{"data-slot":"one-m-unsupported",className:"flex h-10 items-center rounded-lg border border-dashed bg-muted/20 px-3 text-sm text-muted-foreground",children:i("profile.mapping.oneMUnsupported",{role:t})});var l="extra-".concat(n.key);return(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)("div",{className:"flex h-10 items-center",children:(0,g.jsxs)("label",{htmlFor:l,className:"flex cursor-pointer items-center gap-2 text-sm text-muted-foreground",children:[(0,g.jsx)(ch,{id:l,checked:"true"===r,"aria-label":n.label,"aria-invalid":!!a||void 0,"aria-describedby":a?"".concat(l,"-error"):void 0,onCheckedChange:function(e){return o(n.key,!0===e?"true":"false")}}),(0,g.jsx)("span",{className:"md:hidden",children:n.label}),(0,g.jsx)("span",{className:"hidden md:inline",children:i("profile.mapping.enable")})]})}),a?(0,g.jsx)("p",{id:"".concat(l,"-error"),className:"text-xs text-destructive",children:l7(i,a)}):null]})}let pK=O("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),pV=O("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function pq(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pW(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function pZ(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){pW(o,r,a,i,l,"next",e)}function l(e){pW(o,r,a,i,l,"throw",e)}i(void 0)})}}function pG(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){pG(e,t,n[t])})}return e}function pQ(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function pY(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||p0(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pX(e){return function(e){if(Array.isArray(e))return pq(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p0(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p0(e,t){if(e){if("string"==typeof e)return pq(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pq(e,t)}}function p1(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function p2(e){var t,n=e.open,r=e.onOpenChange,a=(0,x.s9)().locale,o=(0,x.Bd)().t,i=ss(function(e){return e.providers}),l=ss(function(e){return e.providersLoading}),s=ss(function(e){return e.providersError}),c=ss(function(e){return e.loadProviders}),u=ss(function(e){return e.deleteProvider}),d=pY((0,y.useState)({kind:"list"}),2),f=d[0],p=d[1],h=pY((0,y.useState)(null),2),m=h[0],v=h[1],b=pY((0,y.useState)(null),2),w=b[0],k=b[1],j=pY((0,y.useState)(null),2),S=j[0],O=j[1],C=pY((0,y.useState)(null),2),N=C[0],P=C[1],E=pY((0,y.useState)({}),2),_=E[0],z=E[1],A=ss(function(e){return e.revealProvider});(0,y.useEffect)(function(){n&&(p({kind:"list"}),v(null),k(null),P(null),null===i&&c())},[n,i,c]);var R=null!=i?i:[];return(0,g.jsxs)(lc,{open:n,onOpenChange:r,children:[(0,g.jsxs)(lT,{className:"max-h-[88vh] overflow-y-auto sm:max-w-2xl",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:"create"===f.kind?o("vault.createTitle"):"edit"===f.kind?o("vault.editTitle",{name:f.entry.name}):o("vault.title")}),(0,g.jsx)(lI,{children:"list"===f.kind?o("vault.intro"):o("vault.formIntro")})]}),l&&0===R.length?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:o("vault.loading")}):null,s?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,s)}):null,"create"===f.kind||"edit"===f.kind?(0,g.jsx)(p4,{entry:"edit"===f.kind?f.entry:null,onCancel:function(){p({kind:"list"}),k(null)},onSaved:function(e){p({kind:"list"}),v(e),k(null)}}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:o("vault.entryCount",{count:R.length})}),(0,g.jsxs)(oo,{size:"sm",onClick:function(){return p({kind:"create"})},children:[(0,g.jsx)(T,{}),o("vault.add")]})]}),m?(0,g.jsx)("div",{className:"rounded-xl bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400",children:m.map(function(e){return(0,g.jsx)("p",{children:l7(o,e)},e.key+e.scope)})}):null,w?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,w)}):null,0===R.length?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:o("vault.empty")}):(0,g.jsx)("ul",{className:"max-h-80 divide-y overflow-y-auto rounded-xl border",children:R.map(function(e){var t,n,r;return(0,g.jsxs)("li",{className:"px-4 py-3",children:[(0,g.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,g.jsxs)("div",{className:"min-w-0",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsx)("p",{className:"font-medium",children:e.name}),e.apiKeyConfigured?(0,g.jsx)(aI,{variant:"secondary",children:o("vault.keyConfigured")}):(0,g.jsx)(aI,{variant:"outline",children:o("vault.keyMissing")}),(0,g.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:(t=e.updatedAt,n=a,Number.isNaN((r=new Date(t)).getTime())?t:r.toLocaleString(n))})]}),e.notes?(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e.notes}):null,e.endpoints.length>0?(0,g.jsx)("ul",{className:"mt-2 space-y-1",children:e.endpoints.map(function(e){return(0,g.jsxs)("li",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,g.jsx)("code",{className:"font-mono text-xs",children:e.key}),(0,g.jsx)("span",{className:"break-all font-mono text-[11px] text-muted-foreground",children:e.baseUrl})]},e.key)})}):(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("vault.noEndpoints")})]}),(0,g.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":void 0!==_[e.id]?o("vault.hide",{name:e.name}):o("vault.reveal",{name:e.name}),onClick:function(){pZ(function(){var t;return p1(this,function(n){switch(n.label){case 0:if(void 0!==_[e.id])return z(function(t){var n=pJ({},t);return delete n[e.id],n}),[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,A(e.id)];case 2:return t=n.sent().apiKey,z(function(n){return pQ(pJ({},n),pG({},e.id,t))}),[3,4];case 3:return k(l8(n.sent(),"vault.revealFailed")),[3,4];case 4:return[2]}})})()},children:void 0!==_[e.id]?(0,g.jsx)(pK,{}):(0,g.jsx)(pV,{})}),(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":o("vault.edit",{name:e.name}),onClick:function(){p({kind:"edit",entry:e}),k(null)},children:(0,g.jsx)(fp,{})}),(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":o("vault.delete",{name:e.name}),onClick:function(){P(null),O(e)},children:(0,g.jsx)(fh,{className:"text-destructive"})})]})]}),void 0!==_[e.id]?(0,g.jsx)("p",{className:"mt-2 break-all rounded-lg bg-muted/60 px-3 py-2 font-mono text-xs",children:_[e.id]}):null]},e.id)})})]}),"list"===f.kind?(0,g.jsx)(lR,{children:(0,g.jsx)(oo,{variant:"outline",onClick:function(){return r(!1)},children:o("vault.close")})}):null]}),(0,g.jsx)(sj,{open:null!==S,onOpenChange:function(e){return!e&&O(null)},children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:o("vault.deleteTitle")}),(0,g.jsx)(s$,{children:o("vault.deleteBody",{name:null!=(t=null==S?void 0:S.name)?t:""})})]}),N?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,N)}):null,(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:o("common.cancel")}),(0,g.jsx)(sU,{onClick:function(e){e.preventDefault(),S&&pZ(function(){return p1(this,function(e){switch(e.label){case 0:P(null),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,u(S.id)];case 2:return e.sent(),O(null),v([{key:"vault.deleted"}]),[3,4];case 3:return P(l8(e.sent(),"vault.deleteFailed")),[3,4];case 4:return[2]}})})()},children:o("common.delete")})]})]})})]})}function p4(e){var t,n,r=e.entry,a=e.onCancel,o=e.onSaved,i=(0,x.Bd)().t,l=ss(function(e){return e.createProvider}),s=ss(function(e){return e.updateProvider}),c=ss(function(e){return e.probeDraft}),u=null!==r,d=pY((0,y.useState)(null!=(t=null==r?void 0:r.name)?t:""),2),f=d[0],p=d[1],h=pY((0,y.useState)(""),2),m=h[0],v=h[1],b=pY((0,y.useState)(null!=(n=null==r?void 0:r.notes)?n:""),2),w=b[0],k=b[1],j=pY((0,y.useState)(function(){var e;return(null!=(e=null==r?void 0:r.endpoints)?e:[]).map(function(e){return{key:e.key,baseUrl:e.baseUrl,label:e.label}})}),2),S=j[0],O=j[1],C=pY((0,y.useState)(!1),2),N=C[0],P=C[1],E=pY((0,y.useState)(null),2),_=E[0],z=E[1],A=pY((0,y.useState)({}),2),R=A[0],L=A[1],I=pY((0,y.useState)({}),2),M=I[0],D=I[1],F=pY((0,y.useState)(!1),2),$=F[0],U=F[1],H=pY((0,y.useState)(null),2),B=H[0],K=H[1],V=pY((0,y.useState)(null),2),q=V[0],W=V[1],Z=pY((0,y.useState)(0),2),G=Z[0],J=Z[1],Q=JSON.stringify(S);function Y(e,t){O(function(n){return n.map(function(n,r){return r===e?pJ({},n,t):n})}),D(function(n){if(!n[e])return n;var r=pJ({},n),a=pJ({},r[e]);return void 0!==t.key&&delete a.key,void 0!==t.baseUrl&&delete a.baseUrl,0===Object.keys(a).length?delete r[e]:r[e]=a,r})}return(0,y.useEffect)(function(){K(null),W(null)},[m,Q]),(0,g.jsxs)("form",{onSubmit:function(e){return pZ(function(){var t,n,a,i,c,d,p,h,g,y,v,b;return p1(this,function(x){switch(x.label){case 0:e.preventDefault(),t=S.map(function(e){return{key:e.key.trim(),label:e.label.trim(),baseUrl:e.baseUrl.trim()}}),n=pJ({},f.trim()?{}:{name:{key:"vault.error.nameRequired"}},u||m.trim()?{}:{apiKey:{key:"vault.error.apiKeyRequired"}}),a=new Map,i=!0,c=!1,d=void 0;try{for(p=t[Symbol.iterator]();!(i=(h=p.next()).done);i=!0)(g=h.value).key&&a.set(g.key,(null!=(y=a.get(g.key))?y:0)+1)}catch(e){c=!0,d=e}finally{try{i||null==p.return||p.return()}finally{if(c)throw d}}if(v=Object.fromEntries(t.flatMap(function(e,t){var n,r={};return e.key?e.key.includes("/")||e.key.includes("\\")||e.key.length>60?r.key={key:"vault.error.endpointKeyInvalid",params:{max:60}}:(null!=(n=a.get(e.key))?n:0)>1&&(r.key={key:"vault.error.endpointKeyDuplicate"}):r.key={key:"vault.error.endpointKeyRequired"},e.baseUrl||(r.baseUrl={key:"vault.error.endpointUrlRequired"}),Object.keys(r).length>0?[[t,r]]:[]})),L(n),D(v),Object.keys(n).length>0||Object.keys(v).length>0)return z({key:"vault.error.checkFields"}),[2];b={name:f.trim(),notes:w.trim()||void 0,endpoints:t},P(!0),z(null),x.label=1;case 1:if(x.trys.push([1,6,7,8]),!(u&&r))return[3,3];return[4,s(r.id,pJ({},b,m.trim()?{apiKey:m.trim()}:{}))];case 2:return o([{key:"vault.updated"}].concat(pX(x.sent().warnings.map(l5)))),[3,5];case 3:return[4,l(pQ(pJ({},b),{apiKey:m.trim()}))];case 4:x.sent(),o([{key:"vault.created"}]),x.label=5;case 5:return[3,8];case 6:return z(l8(x.sent(),"vault.saveFailed")),[3,8];case 7:return P(!1),[7];case 8:return[2]}})})()},noValidate:!0,className:"space-y-4",children:[(0,g.jsxs)("div",{className:"grid gap-x-4 gap-y-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-name",children:i("vault.name")}),(0,g.jsx)(cm,{id:"provider-name",value:f,onChange:function(e){p(e.target.value),L(function(e){return pQ(pJ({},e),{name:void 0})})},placeholder:i("vault.namePlaceholder"),"aria-invalid":!!R.name||void 0,"aria-describedby":R.name?"provider-name-error":void 0}),R.name?(0,g.jsx)("p",{id:"provider-name-error",className:"text-xs text-destructive",children:l7(i,R.name)}):null]}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-api-key",children:i("vault.apiKey")}),(0,g.jsx)(cm,{id:"provider-api-key",type:"password",value:m,onChange:function(e){v(e.target.value),L(function(e){return pQ(pJ({},e),{apiKey:void 0})})},placeholder:u?i("vault.apiKeyKeep"):i("vault.apiKeyRequiredPlaceholder"),"aria-invalid":!!R.apiKey||void 0,"aria-describedby":R.apiKey?"provider-api-key-error":void 0}),R.apiKey?(0,g.jsx)("p",{id:"provider-api-key-error",className:"text-xs text-destructive",children:l7(i,R.apiKey)}):null]}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-notes",children:i("vault.notes")}),(0,g.jsx)(pm,{id:"provider-notes",rows:2,value:w,onChange:function(e){return k(e.target.value)}})]})]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{children:i("vault.endpoints")}),(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:i("vault.endpointsHint")}),0===S.length?(0,g.jsx)("p",{className:"rounded-xl border border-dashed px-3 py-3 text-center text-xs text-muted-foreground",children:i("vault.noEndpointDrafts")}):(0,g.jsx)("div",{className:"space-y-2",children:S.map(function(e,t){var n,r,a,o,l,s;return(0,g.jsxs)("div",{className:"grid items-start gap-2 sm:grid-cols-[10rem_minmax(0,1fr)_minmax(0,1fr)_auto]",children:[(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cm,{"aria-label":i("vault.endpointKeyLabel",{index:t+1}),value:e.key,onChange:function(e){return Y(t,{key:e.target.value})},placeholder:i("vault.endpointKeyPlaceholder"),"aria-invalid":null!=(n=M[t])&&!!n.key||void 0,"aria-describedby":(null==(r=M[t])?void 0:r.key)?"endpoint-".concat(t,"-key-error"):void 0}),(null==(a=M[t])?void 0:a.key)?(0,g.jsx)("p",{id:"endpoint-".concat(t,"-key-error"),className:"text-xs text-destructive",children:l7(i,M[t].key)}):null]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cm,{"aria-label":i("vault.endpointUrlLabel",{index:t+1}),value:e.baseUrl,onChange:function(e){return Y(t,{baseUrl:e.target.value})},placeholder:i("vault.endpointUrlPlaceholder"),"aria-invalid":null!=(o=M[t])&&!!o.baseUrl||void 0,"aria-describedby":(null==(l=M[t])?void 0:l.baseUrl)?"endpoint-".concat(t,"-url-error"):void 0}),(null==(s=M[t])?void 0:s.baseUrl)?(0,g.jsx)("p",{id:"endpoint-".concat(t,"-url-error"),className:"text-xs text-destructive",children:l7(i,M[t].baseUrl)}):null]}),(0,g.jsx)(cm,{"aria-label":i("vault.endpointLabelLabel",{index:t+1}),value:e.label,onChange:function(e){return Y(t,{label:e.target.value})},placeholder:i("vault.endpointLabelPlaceholder")}),(0,g.jsx)(oo,{type:"button",size:"icon",variant:"ghost","aria-label":i("vault.removeEndpoint",{index:t+1}),onClick:function(){O(function(e){return e.filter(function(e,n){return n!==t})}),D({})},children:(0,g.jsx)(fh,{})})]},t)})}),(0,g.jsxs)(oo,{type:"button",size:"sm",variant:"outline",onClick:function(){return O(function(e){return pX(e).concat([{key:"",baseUrl:"",label:""}])})},children:[(0,g.jsx)(T,{}),i("vault.addEndpoint")]}),(0,g.jsx)(p3,{options:S.map(function(e,t){return{index:t,key:e.key,baseUrl:e.baseUrl}}).filter(function(e){return e.baseUrl.trim()}),targetIndex:G,onTargetChange:J,hasStoredKey:u,hasTypedKey:m.trim().length>0,onMissingKey:function(){return L(function(e){return pQ(pJ({},e),{apiKey:{key:"vault.error.apiKeyRequired"}})})},probing:$,result:B,probeError:q,onProbe:function(){return pZ(function(){var e,t,n,a;return p1(this,function(o){switch(o.label){case 0:if(!(n=null!=(e=(t=S.map(function(e,t){return{endpoint:e,index:t}}).filter(function(e){return""!==e.endpoint.baseUrl.trim()})).find(function(e){return e.index===G}))?e:t[0]))return K(null),W({key:"probe.missingBaseUrl"}),[2];if(!u&&!m.trim())return K(null),W(null),L(function(e){return pQ(pJ({},e),{apiKey:{key:"vault.error.apiKeyRequired"}})}),[2];U(!0),W(null),K(null),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,c(pJ({baseUrl:n.endpoint.baseUrl},m.trim()?{apiKey:m}:{providerId:null!=(a=null==r?void 0:r.id)?a:""}))];case 2:return K(o.sent()),[3,5];case 3:return W(l8(o.sent(),"vault.probeFailed")),[3,5];case 4:return U(!1),[7];case 5:return[2]}})})()}})]}),_?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(i,_)}):null,(0,g.jsxs)(lR,{className:"flex-row justify-end gap-2 space-x-0",children:[(0,g.jsx)(oo,{type:"button",variant:"outline",className:"min-w-24",onClick:a,children:i("common.cancel")}),(0,g.jsx)(oo,{type:"submit",className:"min-w-24",disabled:N,children:N?i("vault.saving"):u?i("vault.saveChanges"):i("vault.add")})]})]})}function p3(e){var t,n,r=e.options,a=e.targetIndex,o=e.onTargetChange,i=e.hasStoredKey,l=e.hasTypedKey,s=e.onMissingKey,c=e.probing,u=e.result,d=e.probeError,f=e.onProbe,p=(0,x.Bd)().t;if(0===r.length&&!i)return null;var h=null!=(t=r.find(function(e){return e.index===a}))?t:r[0];return(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-t pt-3",children:[(0,g.jsxs)(oo,{type:"button",variant:"outline",size:"sm",disabled:c||0===r.length&&!l,onClick:function(){l||i?f():s()},children:[c?(0,g.jsx)(f2,{className:"animate-spin"}):null,p(c?"probe.probing":"probe.action")]}),r.length>1?(0,g.jsxs)(df,{value:String(null!=(n=null==h?void 0:h.index)?n:""),onValueChange:function(e){return o(Number(e))},children:[(0,g.jsx)(fe,{className:"h-9 w-56","aria-label":p("vault.probeEndpointLabel"),children:(0,g.jsx)(dh,{})}),(0,g.jsx)(fr,{children:r.map(function(e){return(0,g.jsx)(fa,{value:String(e.index),children:e.key||e.baseUrl},e.index)})})]}):null,d?(0,g.jsxs)("span",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[(0,g.jsx)(pp,{className:"size-4 shrink-0","aria-hidden":!0}),l7(p,d)]}):u?(0,g.jsx)(ph,{result:u}):null]})}let p5=O("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),p6=O("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);var p8=d(2935);function p9(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p7(){var e,t=(0,x.Bd)().t,n=function(e){if(Array.isArray(e))return e}(e=(0,y.useState)("light"))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(e)||function(e){if(e){if("string"==typeof e)return p9(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p9(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),r=n[0],a=n[1];return(0,y.useEffect)(function(){var e=(0,p8.PY)();a(e),(0,p8.AZ)(e)},[]),(0,g.jsx)(oo,{type:"button",size:"icon",variant:"outline","aria-label":t("dark"===r?"theme.toLight":"theme.toDark"),onClick:function(){return a(function(e){return(0,p8.OD)(e)})},children:"dark"===r?(0,g.jsx)(p5,{}):(0,g.jsx)(p6,{})})}let he=O("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),ht=O("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),hn=O("file-lock-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v1",key:"jmtmu2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"5",x:"2",y:"13",rx:"1",key:"10y5wo"}],["path",{d:"M8 13v-2a2 2 0 1 0-4 0v2",key:"1pdxzg"}]]);function hr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ha(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function ho(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){ha(o,r,a,i,l,"next",e)}function l(e){ha(o,r,a,i,l,"throw",e)}i(void 0)})}}function hi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||hl(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hl(e,t){if(e){if("string"==typeof e)return hr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hr(e,t)}}function hs(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function hc(e){var t,n,r,a=e.open,o=e.onOpenChange,i=(0,x.Bd)().t,l=ss(function(e){return e.loadHarnesses}),s=ss(function(e){return e.setNotice}),c=(0,y.useRef)(null),u=hi((0,y.useState)(""),2),d=u[0],f=u[1],p=hi((0,y.useState)(""),2),h=p[0],m=p[1],v=hi((0,y.useState)(null),2),b=v[0],w=v[1],k=hi((0,y.useState)(!1),2),j=k[0],S=k[1],O=hi((0,y.useState)(null),2),C=O[0],N=O[1],P=hi((0,y.useState)(""),2),E=P[0],_=P[1],z=hi((0,y.useState)(""),2),T=z[0],A=z[1],R=hi((0,y.useState)(null),2),L=R[0],I=R[1],M=hi((0,y.useState)(!1),2),D=M[0],$=M[1],U=hi((0,y.useState)(!1),2),H=U[0],B=U[1],K=hi((0,y.useState)("skip"),2),V=K[0],q=K[1],W=hi((0,y.useState)(!0),2),Z=W[0],G=W[1],J=hi((0,y.useState)(!1),2),Q=J[0],Y=J[1],X=hi((0,y.useState)(null),2),ee=X[0],et=X[1],en=hi((0,y.useState)(null),2),er=en[0],ea=en[1],eo=hi((0,y.useState)(null),2),ei=eo[0],el=eo[1];(0,y.useEffect)(function(){if(!a){S(!1),B(!1),$(!1),Y(!1);return}var e=!1;return lX("/api/transfer/export/preview").then(function(t){e||(w(t),S(!0===t.codexLoginCacheAvailable))}).catch(function(){e||w(null)}),function(){e=!0}},[a]);var es=d.length>=8&&d===h&&null===ee,ec=null!==C&&T.length>=8&&null===ee,eu=(null==L?void 0:L.conflictPolicy)===V&&(null==L?void 0:L.restoreActive)===Z,ed=null!==L&&eu&&!D&&null===ee,ef=L&&eu&&!D?function(e,t){switch(t){case"openai-api-key":return e("transfer.authEffect.openai-api-key");case"auth-override":return e("transfer.authEffect.auth-override");case"official-cleanup":return e("transfer.authEffect.official-cleanup");case"none":return null}}(i,L.codexActivationAuthEffect):null;return(0,g.jsx)(lc,{open:a,onOpenChange:o,children:(0,g.jsxs)(lT,{className:"max-h-[90vh] overflow-x-hidden overflow-y-auto sm:max-w-2xl",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:i("transfer.title")}),(0,g.jsx)(lI,{children:i("transfer.intro")})]}),(0,g.jsxs)("section",{className:"space-y-4 rounded-2xl border bg-muted/25 p-4",children:[(0,g.jsxs)("div",{className:"flex items-start gap-3",children:[(0,g.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary",children:(0,g.jsx)(he,{className:"size-4"})}),(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"font-semibold",children:i("transfer.exportTitle")}),(0,g.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:i("transfer.exportIntro")})]})]}),(0,g.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"export-passphrase",children:i("transfer.passphrase")}),(0,g.jsx)(cm,{id:"export-passphrase",type:"password",autoComplete:"new-password",value:d,onChange:function(e){return f(e.target.value)},placeholder:i("transfer.passphrasePlaceholder",{min:8})})]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"export-passphrase-confirm",children:i("transfer.passphraseConfirm")}),(0,g.jsx)(cm,{id:"export-passphrase-confirm",type:"password",autoComplete:"new-password",value:h,onChange:function(e){return m(e.target.value)},placeholder:i("transfer.passphraseConfirmPlaceholder")})]})]}),h&&d!==h?(0,g.jsx)("p",{className:"text-xs text-destructive",children:i("transfer.passphraseMismatch")}):null,(null==b?void 0:b.codexLoginCacheAvailable)?(0,g.jsx)("label",{className:"block space-y-2 rounded-xl border border-amber-500/30 bg-amber-500/5 p-3 text-sm",children:(0,g.jsxs)("span",{className:"flex cursor-pointer items-start gap-3",children:[(0,g.jsx)(ch,{checked:j,onCheckedChange:function(e){return S(!0===e)},className:"mt-0.5"}),(0,g.jsxs)("span",{className:"min-w-0",children:[(0,g.jsx)("span",{className:"block font-medium",children:i("transfer.includeCache")}),(0,g.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-muted-foreground",children:i("transfer.includeCacheHint")})]})]})}):b?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:i("transfer.noCacheToExport")}):null,(0,g.jsxs)(oo,{type:"button",onClick:function(){ho(function(){return hs(this,function(e){switch(e.label){case 0:et("export"),el(null),ea(null),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,lX("/api/transfer/export",{method:"POST",body:JSON.stringify({passphrase:d,includeCodexLoginCache:j})})];case 2:var t,n,r,a,o;return t=e.sent(),n=new Date().toISOString().slice(0,10),r=new Blob(["".concat(JSON.stringify(t,null,2),"\n")],{type:"application/json"}),a=URL.createObjectURL(r),(o=document.createElement("a")).href=a,o.download="harness-switch-".concat(n,".hsw-backup"),o.click(),URL.revokeObjectURL(a),ea(j?i("transfer.exportedWithCache"):i("transfer.exportedWithoutCache")),[3,5];case 3:return el(l6(e.sent())),[3,5];case 4:return et(null),[7];case 5:return[2]}})})()},disabled:!es,children:[(0,g.jsx)(he,{}),"export"===ee?i("transfer.encrypting"):i("transfer.download")]})]}),(0,g.jsxs)("section",{className:"space-y-4 rounded-2xl border p-4",children:[(0,g.jsxs)("div",{className:"flex items-start gap-3",children:[(0,g.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary",children:(0,g.jsx)(ht,{className:"size-4"})}),(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"font-semibold",children:i("transfer.importTitle")}),(0,g.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:i("transfer.importIntro")})]})]}),(0,g.jsx)("input",{ref:c,type:"file",accept:".hsw-backup,application/json",className:"sr-only",onChange:function(e){var t,n;n=null==(t=e.target.files)?void 0:t[0],ho(function(){var e,t,r;return hs(this,function(a){switch(a.label){case 0:if(I(null),$(!1),Y(!1),B(!1),ea(null),el(null),!n)return N(null),_(""),[2];a.label=1;case 1:return a.trys.push([1,3,,4]),t=JSON.parse,[4,n.text()];case 2:if("harness-switch-encrypted-export"!==(e=t.apply(JSON,[a.sent()])).format||1!==e.version)return el({key:"transfer.notAnExport"}),N(null),_(""),[2];return N(e),_(n.name),[3,4];case 3:return r=a.sent(),N(null),_(""),el(l6(r)),[3,4];case 4:return[2]}})})()}}),(0,g.jsxs)("button",{type:"button",className:"flex w-full cursor-pointer items-center gap-3 rounded-xl border border-dashed bg-muted/20 px-4 py-4 text-left transition-colors hover:border-primary/40 hover:bg-primary/5",onClick:function(){var e;return null==(e=c.current)?void 0:e.click()},children:[(0,g.jsx)(hn,{className:"size-5 text-primary"}),(0,g.jsxs)("span",{className:"min-w-0",children:[(0,g.jsx)("span",{className:"block truncate text-sm font-medium",children:E||i("transfer.pickFile")}),(0,g.jsx)("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:i("transfer.pickFileHint")})]})]}),(0,g.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end",children:[(0,g.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"import-passphrase",children:i("transfer.passphrase")}),(0,g.jsx)(cm,{id:"import-passphrase",type:"password",value:T,onChange:function(e){A(e.target.value),I(null),$(!1),Y(!1),B(!1)},placeholder:i("transfer.importPassphrasePlaceholder")})]}),(0,g.jsx)(oo,{type:"button",variant:"outline",disabled:!ec,onClick:function(){ho(function(){var e,t,n;return hs(this,function(r){switch(r.label){case 0:if(!C)return[2];et("preview"),el(null),ea(null),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,lX("/api/transfer/preview",{method:"POST",body:JSON.stringify({envelope:C,passphrase:T,conflictPolicy:V,restoreActive:Z})})];case 2:return I(t=r.sent()),$(!1),Y(!1),B((null==(e=t.codexLoginCache)?void 0:e.available)===!0&&!0===t.codexLoginCache.migrationNeeded),[3,5];case 3:return n=r.sent(),I(null),el(l6(n)),[3,5];case 4:return et(null),[7];case 5:return[2]}})})()},children:"preview"===ee?i("transfer.inspecting"):i("transfer.inspect")})]}),L?(0,g.jsxs)("div",{className:"space-y-4 rounded-xl border bg-card p-4",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsx)(aI,{children:i("transfer.profileCount",{count:L.profileCount})}),(0,g.jsx)(aI,{variant:"secondary",children:i("transfer.providerCount",{count:L.providerCount})}),(0,g.jsx)(aI,{variant:L.conflicts.length>0?"outline":"secondary",children:i("transfer.conflictCount",{count:L.conflicts.length})}),(0,g.jsx)(aI,{variant:"secondary",children:i("transfer.activeCount",{count:L.activeCount})})]}),(0,g.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground",children:L.harnesses.map(function(e){return(0,g.jsx)("span",{children:i("transfer.harnessProfiles",{harness:F[e.harness],count:e.profiles})},e.harness)})}),L.conflicts.length>0?(0,g.jsx)("div",{className:"rounded-xl bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:i("transfer.conflictList",{items:L.conflicts.map(function(e){return"".concat(F[e.harness]," / ").concat(e.name)}).join(i("common.listSeparator"))})}):null,(null==(t=L.codexLoginCache)?void 0:t.available)&&L.codexLoginCache.migrationNeeded?(0,g.jsxs)("label",{className:"block space-y-2 rounded-xl border border-amber-500/30 bg-amber-500/5 p-3 text-sm",children:[(0,g.jsxs)("span",{className:"flex cursor-pointer items-start gap-3",children:[(0,g.jsx)(ch,{checked:H,onCheckedChange:function(e){return B(!0===e)},className:"mt-0.5"}),(0,g.jsxs)("span",{className:"min-w-0",children:[(0,g.jsx)("span",{className:"block font-medium",children:i("transfer.migrateCache")}),(0,g.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-muted-foreground",children:i("transfer.migrateCacheHint")})]})]}),(null==(n=L.codexLoginCache)?void 0:n.targetExists)?(0,g.jsx)("span",{className:"block text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:i("transfer.migrateCacheOverwrite")}):null]}):null,ef?(0,g.jsx)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:ef}):null,D?(0,g.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:i("transfer.previewStale")}):null,(0,g.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"conflict-policy",children:i("transfer.conflictPolicy")}),(0,g.jsxs)(df,{value:V,onValueChange:function(e){q(e),$(!0),Y(!1)},children:[(0,g.jsx)(fe,{id:"conflict-policy",children:(0,g.jsx)(dh,{})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"skip",children:i("transfer.policySkip")}),(0,g.jsx)(fa,{value:"overwrite",children:i("transfer.policyOverwrite")})]})]})]}),(0,g.jsxs)("label",{className:"flex cursor-pointer items-center gap-3 rounded-xl border px-3 py-2 text-sm",children:[(0,g.jsx)(ch,{checked:Z,onCheckedChange:function(e){G(!0===e),$(!0),Y(!1)}}),i("transfer.restoreActive")]})]}),(0,g.jsxs)(oo,{type:"button",disabled:!ed,onClick:function(){return Y(!0)},children:[(0,g.jsx)(ht,{}),D?i("transfer.recheckNeeded"):i("transfer.confirmImport")]}),(0,g.jsx)(sj,{open:Q,onOpenChange:Y,children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:ef?i("transfer.confirmAuthTitle"):i("transfer.confirmTitle")}),(0,g.jsxs)(s$,{children:[i("transfer.confirmBody",{count:L.profileCount}),"overwrite"===V&&L.conflicts.length>0?i("transfer.confirmOverwrite",{count:L.conflicts.length}):i("transfer.confirmKeep"),H?(null==(r=L.codexLoginCache)?void 0:r.targetExists)?i("transfer.confirmCacheOverwrite"):i("transfer.confirmCacheWrite"):i("transfer.confirmCacheSkip"),ef?" ".concat(ef):null]})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:i("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){ho(function(){var e;return hs(this,function(t){switch(t.label){case 0:if(!C||!L||D)return[2];Y(!1),et("import"),el(null),t.label=1;case 1:return t.trys.push([1,4,5,6]),[4,lX("/api/transfer/import",{method:"POST",body:JSON.stringify({envelope:C,passphrase:T,conflictPolicy:V,restoreActive:Z,migrateCodexLoginCache:H})})];case 2:return e=t.sent(),[4,l()];case 3:var n,r,a,c;return t.sent(),s((c=[(n=i)("transfer.importedCount",{count:(r=e).imported})],r.overwritten>0&&c.push(n("transfer.overwrittenCount",{count:r.overwritten})),r.providersCopied>0&&c.push(n("transfer.providersCopiedCount",{count:r.providersCopied})),r.skipped>0&&c.push(n("transfer.skippedCount",{count:r.skipped})),r.activeRestored>0&&c.push(n("transfer.activeRestoredCount",{count:r.activeRestored})),c.push(n(r.codexLoginCacheMigrated?"transfer.cacheMigrated":"transfer.cacheNotMigrated")),[{key:"transfer.importedSummary",params:{parts:c.join(n("common.listSeparator"))}}].concat(function(e){if(Array.isArray(e))return hr(e)}(a=r.warnings.map(function(e){return l5(e)}))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(a)||hl(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()))),I(null),$(!1),B(!1),o(!1),[3,6];case 4:return el(l6(t.sent())),[3,6];case 5:return et(null),[7];case 6:return[2]}})})()},children:ef?i("transfer.proceedAware"):"overwrite"===V?i("transfer.proceedOverwrite"):i("transfer.proceedSafe")})]})]})})]}):null]}),er?(0,g.jsx)("p",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:er}):null,ei?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(i,ei)}):null]})})}function hu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hd(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function hf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hu(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hp(){var e=(0,x.Bd)().t,t=hf((0,y.useState)(null),2),n=t[0],r=t[1],a=hf((0,y.useState)(null),2),o=a[0],i=a[1],l=hf((0,y.useState)("idle"),2),s=l[0],c=l[1];return((0,y.useEffect)(function(){var e=!1;return lX("/api/update/check").then(function(t){!e&&(r(t.current),t.updateAvailable&&t.latest&&i(t.latest))}).catch(function(){}),function(){e=!0}},[]),"updating"===s)?(0,g.jsxs)("span",{className:"flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md bg-muted/70 px-2 font-mono text-[11px] text-muted-foreground",children:[(0,g.jsx)(f2,{className:"size-3 shrink-0 animate-spin"}),e("update.updating")]}):"failed"===s?(0,g.jsx)("span",{title:e("update.failedHint"),className:"flex h-6 shrink-0 items-center whitespace-nowrap rounded-md bg-destructive/10 px-2 font-mono text-[11px] text-destructive",children:e("update.failed")}):o?(0,g.jsxs)(oo,{variant:"outline",size:"sm","aria-label":e("update.toVersion",{version:o}),className:"h-6 shrink-0 gap-1 whitespace-nowrap px-2 font-mono text-[11px]",onClick:function(){var e;(e=function(){var e;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:c("updating"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,lX("/api/update",{method:"POST"})];case 2:case 3:return t.sent(),[3,4];case 4:e=Date.now()+18e4,t.label=5;case 5:if(!(Date.now()<e))return[3,11];return[4,new Promise(function(e){return setTimeout(e,2500)})];case 6:t.sent(),t.label=7;case 7:return t.trys.push([7,9,,10]),[4,lX("/api/version")];case 8:if(t.sent().version!==n)return window.location.reload(),[2];return[3,10];case 9:return t.sent(),[3,10];case 10:return[3,5];case 11:return c("failed"),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){hd(o,r,a,i,l,"next",e)}function l(e){hd(o,r,a,i,l,"throw",e)}i(void 0)})})()},children:[(0,g.jsx)(sh,{className:"size-3 shrink-0"}),(0,g.jsx)("span",{className:"sm:hidden",children:e("update.short")}),(0,g.jsx)("span",{className:"hidden sm:inline",children:e("update.toVersion",{version:o})})]}):null}let hh=O("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);function hm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hg(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function hy(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){hg(o,r,a,i,l,"next",e)}function l(e){hg(o,r,a,i,l,"throw",e)}i(void 0)})}}function hv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||hx(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hb(e){return function(e){if(Array.isArray(e))return hm(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||hx(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hx(e,t){if(e){if("string"==typeof e)return hm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hm(e,t)}}function hw(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function hk(e){var t=e.open,n=e.onOpenChange,r=(0,x.Bd)().t,a=ss(function(e){return e.users}),o=ss(function(e){return e.currentUser}),i=ss(function(e){return e.loadHarnesses}),l=ss(function(e){return e.loadProviders}),s=ss(function(e){return e.setNotice}),c=(0,y.useMemo)(function(){return a.filter(function(e){return e.username!==o&&!1!==e.manageable})},[a,o]),u=hv((0,y.useState)(""),2),d=u[0],f=u[1],p=hv((0,y.useState)(null),2),h=p[0],m=p[1],v=hv((0,y.useState)([]),2),b=v[0],w=v[1],k=hv((0,y.useState)(!1),2),j=k[0],S=k[1],O=hv((0,y.useState)(!1),2),C=O[0],N=O[1],P=hv((0,y.useState)(!1),2),E=P[0],_=P[1],z=hv((0,y.useState)(null),2),T=z[0],A=z[1],R=(0,y.useMemo)(function(){return D.flatMap(function(e){var t,n=null!=(t=null==h?void 0:h.conflicts.filter(function(t){return t.harness===e}).length)?t:0;return n>0?[{harness:e,count:n}]:[]})},[h]),L=o||r("notice.currentUser");function I(){return hy(function(){var e;return hw(this,function(t){switch(t.label){case 0:if(!d||!h)return[2];_(!0),A(null),t.label=1;case 1:return t.trys.push([1,4,5,6]),[4,lX("/api/users/sync",{method:"POST",body:JSON.stringify({sourceUser:d,conflictPolicy:"skip",overwriteHarnesses:b,migrateCodexLoginCache:j})})];case 2:return e=t.sent(),[4,Promise.all([i(),l()])];case 3:return t.sent(),s([{key:"sync.done",params:{imported:e.imported,overwritten:e.overwritten,skipped:e.skipped,providersCopied:e.providersCopied}},{key:e.codexLoginCacheMigrated?"sync.cacheMigrated":"sync.cacheNotMigrated"}].concat(hb(e.warnings.map(function(e){return l5(e)})))),n(!1),[3,6];case 4:return A(l6(t.sent())),[3,6];case 5:return _(!1),[7];case 6:return[2]}})})()}return(0,y.useEffect)(function(){t&&(f(function(e){var t,n;return c.some(function(t){return t.username===e})?e:null!=(t=null==(n=c[0])?void 0:n.username)?t:""}),m(null),w([]),S(!1),N(!1),A(null))},[t,c]),(0,g.jsx)(lc,{open:t,onOpenChange:n,children:(0,g.jsxs)(lT,{className:"flex max-h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] max-w-xl flex-col gap-0 overflow-hidden p-0 sm:max-h-[90dvh] sm:w-full",children:[(0,g.jsxs)(lA,{className:"shrink-0 border-b px-5 py-4 pr-12 text-left sm:px-6",children:[(0,g.jsx)(lL,{children:r("sync.title")}),(0,g.jsx)(lI,{children:r("sync.intro",{user:L})})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-6",children:[c.length>0?(0,g.jsxs)("div",{className:"space-y-5",children:[(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"sync-source-user",children:r("sync.sourceUser")}),(0,g.jsxs)(df,{value:d,onValueChange:function(e){f(e),m(null),w([]),S(!1)},children:[(0,g.jsx)(fe,{id:"sync-source-user",children:(0,g.jsx)(dh,{placeholder:r("sync.selectUser")})}),(0,g.jsx)(fr,{children:c.map(function(e){return(0,g.jsxs)(fa,{value:e.username,children:[e.username," \xb7 ",e.homeDir]},e.username)})})]})]}),h?(0,g.jsxs)("div",{className:"space-y-4 rounded-2xl border bg-muted/25 p-4",children:[(0,g.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,g.jsx)(aI,{variant:"secondary",children:r("sync.profileCount",{count:h.profileCount})}),(0,g.jsx)(aI,{variant:"secondary",children:r("sync.providerCount",{count:h.providerCount})}),(0,g.jsx)(aI,{variant:h.conflicts.length>0?"destructive":"outline",children:r("sync.conflictCount",{count:h.conflicts.length})})]}),h.conflicts.length>0?(0,g.jsxs)("div",{className:"space-y-3",children:[(0,g.jsxs)("div",{className:"space-y-1",children:[(0,g.jsx)(cv,{children:r("sync.overwriteByHarness")}),(0,g.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:r("sync.overwriteHint")})]}),(0,g.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:R.map(function(e){var t=e.harness,n=e.count;return(0,g.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 rounded-xl border bg-background/70 p-3 text-sm",children:[(0,g.jsx)(ch,{checked:b.includes(t),onCheckedChange:function(e){return w(function(n){return!0===e?hb(n).concat([t]):n.filter(function(e){return e!==t})})},className:"mt-0.5"}),(0,g.jsxs)("span",{children:[(0,g.jsx)("span",{className:"block font-medium",children:r("sync.overwriteHarness",{harness:F[t]})}),(0,g.jsx)("span",{className:"mt-1 block text-xs text-muted-foreground",children:r("sync.conflictsInHarness",{count:n})})]})]},t)})})]}):null,h.codexLoginCache.available&&h.codexLoginCache.migrationNeeded?(0,g.jsxs)("label",{className:"block space-y-3 rounded-xl border bg-background/70 p-3 text-sm",children:[(0,g.jsxs)("span",{className:"flex cursor-pointer items-start gap-3",children:[(0,g.jsx)(ch,{checked:j,onCheckedChange:function(e){return S(!0===e)},className:"mt-0.5"}),(0,g.jsxs)("span",{children:[(0,g.jsx)("span",{className:"block font-medium",children:r("sync.migrateCache")}),(0,g.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-muted-foreground",children:r("sync.migrateCacheHint")})]})]}),h.codexLoginCache.targetExists?(0,g.jsx)("span",{className:"block rounded-lg bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:r("sync.migrateCacheOverwrite")}):null]}):null,(0,g.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:r("sync.storeOnlyHint")})]}):null]}):(0,g.jsxs)("div",{className:"flex items-start gap-3 rounded-2xl border bg-muted/25 p-4",children:[(0,g.jsx)(hh,{className:"mt-0.5 size-5 text-muted-foreground"}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:r("sync.noOtherUsers")})]}),T?(0,g.jsx)("p",{className:"mt-4 text-sm text-destructive",children:l7(r,T)}):null]}),(0,g.jsx)(lR,{className:"shrink-0 border-t bg-card px-4 py-3 pb-[max(.75rem,env(safe-area-inset-bottom))] sm:px-6 sm:py-4",children:h?j?(0,g.jsxs)(sj,{open:C,onOpenChange:N,children:[(0,g.jsxs)(oo,{className:"w-full sm:w-auto",disabled:E,onClick:function(){return N(!0)},children:[(0,g.jsx)(s5,{}),E?r("sync.syncing"):r("sync.syncTo",{user:L})]}),(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:r("sync.confirmCacheTitle")}),(0,g.jsx)(s$,{children:r("sync.confirmCacheBody",{source:d,target:L,extra:h.codexLoginCache.targetExists?r("sync.confirmCacheOverwrite"):r("sync.confirmCacheFresh")})})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:r("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){I()},children:r("sync.confirmCacheAction")})]})]})]}):(0,g.jsxs)(oo,{className:"w-full sm:w-auto",disabled:E,onClick:function(){I()},children:[(0,g.jsx)(s5,{}),E?r("sync.syncing"):r("sync.syncTo",{user:L})]}):(0,g.jsxs)(oo,{className:"w-full sm:w-auto",disabled:!d||E,onClick:function(){hy(function(){var e;return hw(this,function(t){switch(t.label){case 0:if(!d)return[2];_(!0),A(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,lX("/api/users/sync/preview",{method:"POST",body:JSON.stringify({sourceUser:d})})];case 2:return m(t.sent()),w([]),S(!1),N(!1),[3,5];case 3:return e=t.sent(),m(null),w([]),A(l6(e)),[3,5];case 4:return _(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(s5,{}),E?r("sync.inspecting"):r("sync.inspect")]})})]})})}function hj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hS(){var e,t=function(e){if(Array.isArray(e))return e}(e=(0,y.useState)(null))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(e)||function(e){if(e){if("string"==typeof e)return hj(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return hj(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),n=t[0],r=t[1];return((0,y.useEffect)(function(){var e=!1;return lX("/api/version").then(function(t){e||r(t.version)}).catch(function(){}),function(){e=!0}},[]),n)?(0,g.jsxs)("span",{className:"shrink-0 whitespace-nowrap rounded-md bg-muted/70 px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:["v",n]}):null}function hO(){return(0,x.Bd)().t,null}function hC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hN(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function hP(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){hN(o,r,a,i,l,"next",e)}function l(e){hN(o,r,a,i,l,"throw",e)}i(void 0)})}}function hE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hC(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h_(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function hz(){var e,t,n,r=(0,x.s9)().locale,a=(0,x.Bd)().t,o=ss(function(e){return e.harnesses}),i=ss(function(e){return e.envFile}),l=ss(function(e){return e.backups}),s=hE((0,y.useState)(null),2),c=s[0],u=s[1],d=hE((0,y.useState)(!1),2),f=d[0],p=d[1],h=hE((0,y.useState)(!1),2),m=h[0],v=h[1],b=hE((0,y.useState)(!1),2),w=b[0],k=b[1],j=hE((0,y.useState)(!1),2),S=j[0],O=j[1],R=hE((0,y.useState)(!1),2),L=R[0],I=R[1],M=hE((0,y.useState)("claude"),2),D=M[0],F=M[1],$=o.find(function(e){return e.id===(null==c?void 0:c.harnessId)}),U=null!=(e=o.find(function(e){return e.id===D}))?e:o[0];return(0,g.jsxs)("div",{className:"min-h-[100dvh] bg-background",children:[(0,g.jsx)("header",{className:"sticky top-0 z-20 border-b bg-card/90 backdrop-blur-xl",children:(0,g.jsxs)("div",{className:"flex min-h-20 flex-wrap items-center justify-between gap-x-4 gap-y-2 px-4 py-2 sm:px-6",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,g.jsx)("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl bg-primary text-primary-foreground shadow-[0_10px_24px_-12px_rgb(99_91_255/0.8)]",children:(0,g.jsx)(C,{className:"size-5"})}),(0,g.jsxs)("div",{className:"min-w-0",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,g.jsx)("h1",{className:"min-w-0 flex-1 truncate text-base font-semibold tracking-tight",children:"harness-switch"}),(0,g.jsx)(hS,{}),(0,g.jsx)(hO,{}),(0,g.jsx)(hp,{})]}),(0,g.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:a("app.tagline")})]})]}),(0,g.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return O(!0)},children:[(0,g.jsx)(N,{}),(0,g.jsx)("span",{className:"hidden lg:inline",children:a("nav.syncUserConfig")})]}),(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return I(!0)},children:[(0,g.jsx)(P,{}),(0,g.jsx)("span",{className:"hidden lg:inline",children:a("nav.importExisting")})]}),(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return p(!0)},children:[(0,g.jsx)(E,{}),(0,g.jsx)("span",{className:"hidden sm:inline",children:a("nav.transfer")})]}),(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return v(!0)},children:[(0,g.jsx)(_,{}),(0,g.jsx)("span",{className:"hidden sm:inline",children:a("nav.githubSync")})]}),(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return k(!0)},children:[(0,g.jsx)(z,{}),(0,g.jsx)("span",{className:"hidden sm:inline",children:a("nav.vault")})]}),(0,g.jsx)(pn,{}),(0,g.jsx)(p7,{}),(0,g.jsx)(hT,{})]})]})}),(0,g.jsxs)("div",{className:"grid xl:grid-cols-[17rem_minmax(0,1fr)_18rem]",children:[(0,g.jsx)(hA,{harnesses:o,value:null==U?void 0:U.id,onChange:F}),U?(0,g.jsxs)("main",{role:"tabpanel",id:"harness-panel-".concat(U.id),"aria-labelledby":"harness-tab-".concat(U.id),className:"min-w-0 space-y-6 p-4 sm:p-6 xl:p-8",children:[(0,g.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h2",{className:"text-2xl font-semibold tracking-tight",children:U.label}),(0,g.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a("harness.subtitle")})]}),(0,g.jsxs)(oo,{className:"self-start sm:self-auto",onClick:function(){return u({harnessId:U.id,profile:null})},children:[(0,g.jsx)(T,{}),a("harness.newProfile")]})]}),(0,g.jsx)(fC,{harness:U,onAdd:function(){return u({harnessId:U.id,profile:null})},onEdit:function(e){return u({harnessId:U.id,profile:e})}}),(0,g.jsxs)("details",{className:"group rounded-2xl border bg-card px-5 py-4 text-sm shadow-[0_12px_34px_-28px_rgb(36_39_70/0.35)]",children:[(0,g.jsxs)("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 font-medium",children:[(0,g.jsx)("span",{className:"font-mono text-[13px]",children:a("env.title")}),(0,g.jsx)(A,{className:"size-4 text-muted-foreground transition-transform group-open:rotate-180"})]}),(0,g.jsx)("p",{className:"mt-4 leading-relaxed text-muted-foreground",children:a("env.intro")}),(0,g.jsxs)("code",{className:"mt-3 block rounded-xl bg-muted/70 px-4 py-3 font-mono text-[13px]",children:["source ",i||"~/.harness-switch/env.sh"]}),(0,g.jsx)("p",{className:"mt-3 leading-relaxed text-muted-foreground",children:a("env.note")})]})]}):null,U?(0,g.jsx)(hR,{harness:U,latestBackup:l.find(function(e){return e.harness===U.id}),locale:r}):null]}),c&&$?(0,g.jsx)(pI,{harness:$,profile:c.profile,onOpenChange:function(e){return!e&&u(null)}},"".concat(c.harnessId,"-").concat(null!=(t=null==(n=c.profile)?void 0:n.name)?t:"new")):null,(0,g.jsx)(hc,{open:f,onOpenChange:p}),(0,g.jsx)(fu,{open:m,onOpenChange:v}),(0,g.jsx)(p2,{open:w,onOpenChange:k}),(0,g.jsx)(hk,{open:S,onOpenChange:O}),(0,g.jsx)(f7,{open:L,onOpenChange:I}),(0,g.jsx)(pr,{})]})}function hT(){var e=(0,x.Bd)().t,t=ss(function(e){return e.logout}),n=ss(function(e){return e.users}),r=ss(function(e){return e.currentUser}),a=ss(function(e){return e.usersLoading}),o=ss(function(e){return e.switchUser}),i=hE((0,y.useState)(!1),2),l=i[0],s=i[1],c=(0,y.useRef)(null);return(0,y.useEffect)(function(){var e=function(e){var t;(null==(t=c.current)?void 0:t.contains(e.target))||s(!1)};if(l)return window.addEventListener("pointerdown",e),function(){return window.removeEventListener("pointerdown",e)}},[l]),(0,g.jsxs)("div",{ref:c,className:"relative",children:[(0,g.jsxs)(oo,{variant:"outline",size:"sm","aria-label":e("nav.currentLocalUser"),"aria-expanded":l,"aria-haspopup":"menu",disabled:a,onClick:function(){return s(function(e){return!e})},children:[(0,g.jsx)(R,{}),(0,g.jsx)("span",{className:"max-w-28 truncate",children:r||e("nav.localUser")}),(0,g.jsx)(A,{className:aR("transition-transform",l&&"rotate-180")})]}),l?(0,g.jsxs)("div",{role:"menu","aria-label":e("nav.currentLocalUser"),className:"absolute right-0 top-full z-30 mt-2 w-52 rounded-xl border bg-popover p-1 text-popover-foreground shadow-lg",children:[(0,g.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:e("nav.currentLocalUser")}),n.map(function(t){var n,i=!1===t.manageable,l=i?l7(e,{key:t.blockCode?l3(t.blockCode):"error.user.notSwitchable",params:t.blockParams,fallback:t.blockReason}):"",c=a||t.username===r||i;return(0,g.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":t.username===r,disabled:c,title:i?null!=(n=t.blockReason)?n:l:void 0,onClick:function(){var e;e=t.username,hP(function(){return h_(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,o(e)];case 1:return t.sent(),s(!1),[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}})})()},className:aR("flex w-full flex-col items-start rounded-lg px-3 py-2 text-left text-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35",c?"cursor-default opacity-60":"cursor-pointer hover:bg-accent hover:text-accent-foreground"),children:[(0,g.jsxs)("span",{className:"flex w-full items-center gap-1.5",children:[i?(0,g.jsx)(L,{className:"size-3 shrink-0","aria-hidden":!0}):null,(0,g.jsx)("span",{className:"truncate",children:t.username})]}),i?(0,g.jsx)("span",{className:"mt-0.5 text-xs leading-snug text-muted-foreground",children:l}):null]},t.username)}),(0,g.jsx)("div",{className:"my-1 border-t"}),(0,g.jsxs)("button",{type:"button",role:"menuitem",disabled:a,onClick:function(){hP(function(){return h_(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,t()];case 1:return e.sent(),s(!1),[3,3];case 2:return e.sent(),[3,3];case 3:return[2]}})})()},className:aR("flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm text-destructive transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35",a?"cursor-default opacity-60":"cursor-pointer hover:bg-destructive/10"),children:[(0,g.jsx)(I,{className:"size-4"}),e("nav.signOut")]})]}):null]})}function hA(e){var t=e.harnesses,n=e.value,r=e.onChange,a=(0,x.Bd)().t;return(0,g.jsx)("div",{role:"tablist","aria-label":a("nav.switchHarness"),"aria-orientation":"vertical",className:"flex gap-2 overflow-x-auto border-b bg-card/45 p-3 xl:min-h-[calc(100dvh-80px)] xl:flex-col xl:overflow-x-visible xl:border-b-0 xl:border-r xl:p-4",children:t.map(function(e,o){var i,l,s,c=e.id===n,u=(null==(l=e.active)?void 0:l.official)?a("harness.official"):null!=(i=null==(s=e.active)?void 0:s.name)?i:null;return(0,g.jsxs)("button",{type:"button",role:"tab",id:"harness-tab-".concat(e.id),"aria-controls":"harness-panel-".concat(e.id),"aria-selected":c,tabIndex:c?0:-1,onClick:function(){return r(e.id)},onKeyDown:function(e){return function(e,n){var a="ArrowLeft"===e.key||"ArrowUp"===e.key,o="ArrowRight"===e.key||"ArrowDown"===e.key;if(a||o||"Home"===e.key||"End"===e.key){e.preventDefault();var i=n;i="Home"===e.key?0:"End"===e.key?t.length-1:(n+(o?1:-1)+t.length)%t.length;var l=t[i];if(l){r(l.id);var s,c,u=null==(s=e.currentTarget.parentElement)?void 0:s.querySelectorAll('[role="tab"]');null==u||null==(c=u[i])||c.focus()}}}(e,o)},className:aR("flex min-w-[12rem] shrink-0 cursor-pointer items-center gap-3 rounded-xl px-3 py-3 text-left transition-[color,background-color,box-shadow,transform] duration-150 active:translate-y-px xl:min-w-0 xl:w-full",c?"bg-primary/[0.09] text-primary shadow-[inset_0_0_0_1px_rgb(99_91_255/0.13)]":"text-muted-foreground hover:bg-card hover:text-foreground"),children:[(0,g.jsx)("span",{className:aR("flex size-10 shrink-0 items-center justify-center rounded-xl border bg-card shadow-[0_4px_12px_-8px_rgb(36_39_70/0.28)]",c?"border-primary/20":"border-border"),children:(0,g.jsx)(f1,{id:e.id})}),(0,g.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,g.jsx)("span",{className:"block truncate text-sm font-medium text-current",children:e.label}),(0,g.jsx)("span",{className:"mt-0.5 block truncate font-mono text-[11px] text-muted-foreground",children:null===u?a("harness.currentInactive"):a("harness.current",{name:u})})]}),(0,g.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:e.profiles.length})]},e.id)})})}function hR(e){var t=e.harness,n=e.latestBackup,r=e.locale,a=(0,x.Bd)().t;return(0,g.jsx)("aside",{className:"border-t bg-card/35 p-4 sm:p-6 xl:min-h-[calc(100dvh-80px)] xl:border-l xl:border-t-0 xl:p-5",children:(0,g.jsxs)("div",{className:"space-y-4 xl:sticky xl:top-[100px]",children:[(0,g.jsxs)("section",{className:"rounded-2xl border bg-card p-5 shadow-[0_12px_34px_-28px_rgb(36_39_70/0.38)]",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(M,{className:"size-4 text-primary"}),(0,g.jsx)("h3",{className:"font-semibold",children:a("harness.writeTargets")})]}),(0,g.jsxs)("div",{className:"mt-5 space-y-4",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:a("harness.application")}),(0,g.jsx)("p",{className:"mt-1 text-sm font-medium",children:t.label})]}),t.targets.map(function(e){return(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:e.label}),(0,g.jsx)("p",{className:"mt-1 break-all font-mono text-xs leading-relaxed",children:e.path})]},e.key)}),(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:a("harness.writeMode")}),(0,g.jsx)("p",{className:"mt-1 text-sm",children:a("replace"===t.mode?"harness.modeReplace":"harness.modeAdditive")})]})]})]}),(0,g.jsx)(sJ,{harness:t}),(0,g.jsx)(pu,{harness:t}),(0,g.jsxs)("section",{className:"rounded-2xl border bg-card p-5 shadow-[0_12px_34px_-28px_rgb(36_39_70/0.38)]",children:[(0,g.jsx)("h3",{className:"font-semibold",children:a("backup.latest")}),n?(0,g.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:a("backup.profile")}),(0,g.jsx)("p",{className:"mt-1 truncate text-sm font-medium",children:n.profile})]}),(0,g.jsxs)("p",{className:"font-mono text-[11px] leading-relaxed text-muted-foreground",children:[new Date(n.createdAt).toLocaleString(r)," \xb7"," ",a("backup.fileCount",{count:n.files.length})]})]}):(0,g.jsx)("p",{className:"mt-3 text-sm text-muted-foreground",children:a("backup.empty")}),(0,g.jsx)("div",{className:"mt-4 border-t pt-4",children:(0,g.jsx)(sd,{harnessId:t.id})})]})]})})}function hL(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hI(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function hM(){var e,t=(0,x.Bd)().t,n=ss(function(e){return e.login}),r=ss(function(e){return e.loading}),a=function(e){if(Array.isArray(e))return e}(e=(0,y.useState)(null))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(e)||function(e){if(e){if("string"==typeof e)return hL(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return hL(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=a[0],i=a[1];return(0,g.jsxs)("main",{className:"grid min-h-[100dvh] lg:grid-cols-2",children:[(0,g.jsxs)("section",{className:"hidden flex-col justify-between border-r bg-card p-10 lg:flex",children:[(0,g.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:t("app.brandMark")}),(0,g.jsxs)("div",{className:"max-w-sm space-y-3",children:[(0,g.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:t("login.title")}),(0,g.jsx)("p",{className:"text-sm leading-relaxed text-muted-foreground",children:t("login.intro")})]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)(pn,{}),(0,g.jsx)(p7,{})]})]}),(0,g.jsx)("section",{className:"flex items-center justify-center px-4 py-10",children:(0,g.jsxs)("form",{className:"w-full max-w-sm space-y-5",onSubmit:function(e){var t;return(t=function(){var t,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(a){switch(a.label){case 0:e.preventDefault(),t=new FormData(e.currentTarget),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n(String(null!=(r=t.get("password"))?r:""))];case 2:return a.sent(),[3,4];case 3:return i(l6(a.sent())),[3,4];case 4:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(e){hI(o,r,a,i,l,"next",e)}function l(e){hI(o,r,a,i,l,"throw",e)}i(void 0)})})()},children:[(0,g.jsxs)("div",{className:"flex items-start justify-between gap-3 lg:hidden",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:t("app.brandMark")}),(0,g.jsx)("h1",{className:"mt-2 text-2xl font-semibold tracking-tight",children:t("login.title")})]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)(pn,{}),(0,g.jsx)(p7,{})]})]}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:t("login.hint")}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"password",children:t("login.password")}),(0,g.jsx)(cm,{id:"password",name:"password",type:"password",autoFocus:!0,required:!0})]}),o?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(t,o)}):null,(0,g.jsx)(oo,{className:"w-full",type:"submit",disabled:r,children:t(r?"login.submitting":"login.submit")})]})})]})}(0,b.createRoot)(document.getElementById("root")).render((0,g.jsx)(y.StrictMode,{children:(0,g.jsx)(x.CY,{children:(0,g.jsx)(function(){var e=(0,x.Bd)().t,t=ss(function(e){return e.sessionChecked}),n=ss(function(e){return e.authenticated}),r=ss(function(e){return e.loadSession});return((0,y.useEffect)(function(){r()},[r]),t)?n?(0,g.jsx)(hz,{}):(0,g.jsx)(hM,{}):(0,g.jsx)("div",{className:"flex min-h-[100dvh] items-center justify-center text-sm text-muted-foreground",children:e("app.checkingSession")})},{})})}))})()})();
|
|
62
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&"ref"===e.reused){a(n);continue}}}function no(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=t=>{let n=e.seen.get(t);if(null===n.ref)return;let a=n.def??n.schema,o={...a},i=n.ref;if(n.ref=null,i){r(i);let n=e.seen.get(i),l=n.schema;if(l.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(a.allOf=a.allOf??[],a.allOf.push(l)):Object.assign(a,l),Object.assign(a,o),t._zod.parent===i)for(let e in a)"$ref"!==e&&"allOf"!==e&&(e in o||delete a[e]);if(l.$ref&&n.def)for(let e in a)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(a[e])===JSON.stringify(n.def[e])&&delete a[e]}let l=t._zod.parent;if(l&&l!==i){r(l);let t=e.seen.get(l);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(let e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");a.$id=e.external.uri(n)}Object.assign(a,n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;void 0!==o&&a.id===o&&delete a.id;let i=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?a.$defs=i:a.definitions=i);try{let n=JSON.parse(JSON.stringify(a));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:ni(t,"input",e.processors),output:ni(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw Error("Error converting schema to JSON.")}}let ni=(e,t,n={})=>r=>{let{libraryOptions:a,target:o}=r??{},i=nn({...a??{},target:o,io:t,processors:n});return nr(e,i),na(i,e),no(i,e)},nl={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ns=(e,t,n,r)=>{let a=e._zod.def;nr(a.innerType,t,r),t.seen.get(e).ref=a.innerType},nc=$("ZodISODateTime",(e,t)=>{tp.init(e,t),nT.init(e,t)}),nu=$("ZodISODate",(e,t)=>{th.init(e,t),nT.init(e,t)}),nd=$("ZodISOTime",(e,t)=>{tm.init(e,t),nT.init(e,t)}),nf=$("ZodISODuration",(e,t)=>{tg.init(e,t),nT.init(e,t)}),np=$("ZodError",(e,t)=>{e0.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let n={_errors:[]},r=(e,a=[])=>{for(let o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...a,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...a,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...a,...o.path]);else{let e=[...a,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,a=0;for(;a<e.length;){let n=e[a];a===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(o))):r[n]=r[n]||{_errors:[]},r=r[n],a++}}}};return r(e),n})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let n={},r=[];for(let a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ey,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ey,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),nh=e2(np),nm=e4(np),ng=e3(np),ny=e6(np),nv=(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return e2(np)(e,t,r)},nb=(e,t,n)=>e2(np)(e,t,n),nx=async(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return e4(np)(e,t,r)},nw=async(e,t,n)=>e4(np)(e,t,n),nk=(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return e3(np)(e,t,r)},nj=(e,t,n)=>e3(np)(e,t,n),nS=async(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return e6(np)(e,t,r)},nO=async(e,t,n)=>e6(np)(e,t,n),nC=new WeakMap;function nN(e,t,n){let r=Object.getPrototypeOf(e),a=nC.get(r);if(a||(a=new Set,nC.set(r,a)),!a.has(t))for(let e in a.add(t),n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let nP=$("ZodType",(e,t)=>(e7.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ni(e,"input"),output:ni(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{let r=nn({...n,processors:t});return nr(e,r),na(r,e),no(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>nh(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ng(e,t,n),e.parseAsync=async(t,n)=>nm(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ny(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>nv(e,t,n),e.decode=(t,n)=>nb(e,t,n),e.encodeAsync=async(t,n)=>nx(e,t,n),e.decodeAsync=async(t,n)=>nw(e,t,n),e.safeEncode=(t,n)=>nk(e,t,n),e.safeDecode=(t,n)=>nj(e,t,n),e.safeEncodeAsync=async(t,n)=>nS(e,t,n),e.safeDecodeAsync=async(t,n)=>nO(e,t,n),nN(e,"ZodType",{check(...e){let t=this.def;return this.clone(ej(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eT(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new rv({type:"custom",check:"custom",fn:e,...eA(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var n;let r,a;return n=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(eF(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(eF(e)))},e(t.value,t)),(a=new e$({check:"custom",...eA(t)}))._zod.check=n,r=a}(e,t))},overwrite(e){return this.check(nt(e))},optional(){return rl(this)},exactOptional(){var e;return e=this,new rs({type:"optional",innerType:e})},nullable(){return ru(this)},nullish(){return rl(ru(this))},nonoptional(e){var t;return t=this,new rp({type:"nonoptional",innerType:t,...eA(e)})},array(){return n3(this)},or(e){return new n8({type:"union",options:[this,e],...eA(void 0)})},and(e){var t;return t=this,new n9({type:"intersection",left:t,right:e})},transform(e){return rg(this,new ro({type:"transform",transform:e}))},default(e){var t,n;return t=this,n=e,new rd({type:"default",innerType:t,get defaultValue(){return"function"==typeof n?n():eE(n)}})},prefault(e){var t,n;return t=this,n=e,new rf({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof n?n():eE(n)}})},catch(e){var t,n;return t=this,new rh({type:"catch",innerType:t,catchValue:"function"==typeof(n=e)?n:()=>n})},pipe(e){return rg(this,e)},readonly(){var e;return e=this,new ry({type:"readonly",innerType:e})},describe(e){let t=this.clone();return t6.add(t,{description:e}),t},meta(...e){if(0===e.length)return t6.get(this);let t=this.clone();return t6.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>t6.get(e)?.description,configurable:!0}),e)),nE=$("_ZodString",(e,t)=>{te.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{n.type="string";let{minimum:a,maximum:o,format:i,patterns:l,contentEncoding:s}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),i&&(n.format=nl[i]??i,""===n.format&&delete n.format,"time"===i&&delete n.format),s&&(n.contentEncoding=s),l&&l.size>0){let e=[...l];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n,0);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,nN(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new eV({check:"string_format",format:"regex",...eA(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new eZ({check:"string_format",format:"includes",...eA(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new eG({check:"string_format",format:"starts_with",...eA(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new eJ({check:"string_format",format:"ends_with",...eA(t),suffix:e})}(...e))},min(...e){return this.check(t7(...e))},max(...e){return this.check(t9(...e))},length(...e){return this.check(ne(...e))},nonempty(...e){return this.check(t7(1,...e))},lowercase(e){return this.check(new eq({check:"string_format",format:"lowercase",...eA(e)}))},uppercase(e){return this.check(new eW({check:"string_format",format:"uppercase",...eA(e)}))},trim(){return this.check(nt(e=>e.trim()))},normalize(...e){return this.check(function(e){return nt(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(nt(e=>e.toLowerCase()))},toUpperCase(){return this.check(nt(e=>e.toUpperCase()))},slugify(){return this.check(nt(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),n_=$("ZodString",(e,t)=>{te.init(e,t),nE.init(e,t),e.email=t=>e.check(new nA({type:"string",format:"email",check:"string_format",abort:!1,...eA(t)})),e.url=t=>e.check(new nI({type:"string",format:"url",check:"string_format",abort:!1,...eA(t)})),e.jwt=t=>e.check(new nQ({type:"string",format:"jwt",check:"string_format",abort:!1,...eA(t)})),e.emoji=t=>e.check(new nM({type:"string",format:"emoji",check:"string_format",abort:!1,...eA(t)})),e.guid=t=>e.check(t8(nR,t)),e.uuid=t=>e.check(new nL({type:"string",format:"uuid",check:"string_format",abort:!1,...eA(t)})),e.uuidv4=t=>e.check(new nL({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eA(t)})),e.uuidv6=t=>e.check(new nL({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eA(t)})),e.uuidv7=t=>e.check(new nL({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eA(t)})),e.nanoid=t=>e.check(new nD({type:"string",format:"nanoid",check:"string_format",abort:!1,...eA(t)})),e.guid=t=>e.check(t8(nR,t)),e.cuid=t=>e.check(new nF({type:"string",format:"cuid",check:"string_format",abort:!1,...eA(t)})),e.cuid2=t=>e.check(new n$({type:"string",format:"cuid2",check:"string_format",abort:!1,...eA(t)})),e.ulid=t=>e.check(new nU({type:"string",format:"ulid",check:"string_format",abort:!1,...eA(t)})),e.base64=t=>e.check(new nZ({type:"string",format:"base64",check:"string_format",abort:!1,...eA(t)})),e.base64url=t=>e.check(new nG({type:"string",format:"base64url",check:"string_format",abort:!1,...eA(t)})),e.xid=t=>e.check(new nH({type:"string",format:"xid",check:"string_format",abort:!1,...eA(t)})),e.ksuid=t=>e.check(new nB({type:"string",format:"ksuid",check:"string_format",abort:!1,...eA(t)})),e.ipv4=t=>e.check(new nK({type:"string",format:"ipv4",check:"string_format",abort:!1,...eA(t)})),e.ipv6=t=>e.check(new nV({type:"string",format:"ipv6",check:"string_format",abort:!1,...eA(t)})),e.cidrv4=t=>e.check(new nq({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eA(t)})),e.cidrv6=t=>e.check(new nW({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eA(t)})),e.e164=t=>e.check(new nJ({type:"string",format:"e164",check:"string_format",abort:!1,...eA(t)})),e.datetime=t=>e.check(new nc({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eA(t)})),e.date=t=>e.check(new nu({type:"string",format:"date",check:"string_format",...eA(t)})),e.time=t=>e.check(new nd({type:"string",format:"time",check:"string_format",precision:null,...eA(t)})),e.duration=t=>e.check(new nf({type:"string",format:"duration",check:"string_format",...eA(t)}))});function nz(e){return new n_({type:"string",...eA(e)})}let nT=$("ZodStringFormat",(e,t)=>{tt.init(e,t),nE.init(e,t)}),nA=$("ZodEmail",(e,t)=>{ta.init(e,t),nT.init(e,t)}),nR=$("ZodGUID",(e,t)=>{tn.init(e,t),nT.init(e,t)}),nL=$("ZodUUID",(e,t)=>{tr.init(e,t),nT.init(e,t)}),nI=$("ZodURL",(e,t)=>{to.init(e,t),nT.init(e,t)}),nM=$("ZodEmoji",(e,t)=>{ti.init(e,t),nT.init(e,t)}),nD=$("ZodNanoID",(e,t)=>{tl.init(e,t),nT.init(e,t)}),nF=$("ZodCUID",(e,t)=>{ts.init(e,t),nT.init(e,t)}),n$=$("ZodCUID2",(e,t)=>{tc.init(e,t),nT.init(e,t)}),nU=$("ZodULID",(e,t)=>{tu.init(e,t),nT.init(e,t)}),nH=$("ZodXID",(e,t)=>{td.init(e,t),nT.init(e,t)}),nB=$("ZodKSUID",(e,t)=>{tf.init(e,t),nT.init(e,t)}),nK=$("ZodIPv4",(e,t)=>{ty.init(e,t),nT.init(e,t)}),nV=$("ZodIPv6",(e,t)=>{tv.init(e,t),nT.init(e,t)}),nq=$("ZodCIDRv4",(e,t)=>{tb.init(e,t),nT.init(e,t)}),nW=$("ZodCIDRv6",(e,t)=>{tx.init(e,t),nT.init(e,t)}),nZ=$("ZodBase64",(e,t)=>{tk.init(e,t),nT.init(e,t)}),nG=$("ZodBase64URL",(e,t)=>{tj.init(e,t),nT.init(e,t)}),nJ=$("ZodE164",(e,t)=>{tS.init(e,t),nT.init(e,t)}),nQ=$("ZodJWT",(e,t)=>{tO.init(e,t),nT.init(e,t)}),nY=$("ZodBoolean",(e,t)=>{tC.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.type="boolean"}});function nX(e){return new nY({type:"boolean",...eA(e)})}let n0=$("ZodUnknown",(e,t)=>{tN.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function n1(){return new n0({type:"unknown"})}let n2=$("ZodNever",(e,t)=>{tP.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.not={}}}),n4=$("ZodArray",(e,t)=>{t_.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a=e._zod.def,{minimum:o,maximum:i}=e._zod.bag;"number"==typeof o&&(n.minItems=o),"number"==typeof i&&(n.maxItems=i),n.type="array",n.items=nr(a.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,nN(e,"ZodArray",{min(e,t){return this.check(t7(e,t))},nonempty(e){return this.check(t7(1,e))},max(e,t){return this.check(t9(e,t))},length(e,t){return this.check(ne(e,t))},unwrap(){return this.element}})});function n3(e,t){return new n4({type:"array",element:e,...eA(t)})}let n5=$("ZodObject",(e,t)=>{tL.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a=e._zod.def;n.type="object",n.properties={};let o=a.shape;for(let e in o)n.properties[e]=nr(o[e],t,{...r,path:[...r.path,"properties",e]});let i=new Set([...new Set(Object.keys(o))].filter(e=>{let n=a.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));i.size>0&&(n.required=Array.from(i)),a.catchall?._zod.def.type==="never"?n.additionalProperties=!1:a.catchall?a.catchall&&(n.additionalProperties=nr(a.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(n.additionalProperties=!1)})(e,t,n,r),ew(e,"shape",()=>t.shape),nN(e,"ZodObject",{keyof(){return rn(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:n1()})},loose(){return this.clone({...this._zod.def,catchall:n1()})},strict(){return this.clone({...this._zod.def,catchall:new n2({type:"never",...eA(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!eP(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=ej(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ek(this,"shape",n),n}});return eT(e,r)}(this,e)},safeExtend(e){var t=this;if(!eP(e))throw Error("Invalid input to safeExtend: expected a plain object");let n=ej(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return ek(this,"shape",n),n}});return eT(t,n)},merge(e){var t=this;if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=ej(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return ek(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return eT(t,n)},pick(e){return function(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let a=ej(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ek(this,"shape",e),e},checks:[]});return eT(e,a)}(this,e)},omit(e){return function(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let a=ej(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ek(this,"shape",r),r},checks:[]});return eT(e,a)}(this,e)},partial(...e){return function(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let a=ej(t._zod.def,{get shape(){let r=t._zod.def.shape,a={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(a[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(let t in r)a[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return ek(this,"shape",a),a},checks:[]});return eT(t,a)}(ri,this,e[0])},required(...e){var t,n;let r;return t=this,n=e[0],r=ej(t._zod.def,{get shape(){let e=t._zod.def.shape,r={...e};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=new rp({type:"nonoptional",innerType:e[t]}))}else for(let t in e)r[t]=new rp({type:"nonoptional",innerType:e[t]});return ek(this,"shape",r),r}}),eT(t,r)}})});function n6(e,t){return new n5({type:"object",shape:e??{},...eA(t)})}let n8=$("ZodUnion",(e,t)=>{tM.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a,o,i;return o=!1===(a=e._zod.def).inclusive,i=a.options.map((e,n)=>nr(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]})),void(o?n.oneOf=i:n.anyOf=i)},e.options=t.options}),n9=$("ZodIntersection",(e,t)=>{tD.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a,o,i,l;return o=nr((a=e._zod.def).left,t,{...r,path:[...r.path,"allOf",0]}),i=nr(a.right,t,{...r,path:[...r.path,"allOf",1]}),void(n.allOf=[...(l=e=>"allOf"in e&&1===Object.keys(e).length)(o)?o.allOf:[o],...l(i)?i.allOf:[i]])}}),n7=$("ZodRecord",(e,t)=>{t$.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a=e._zod.def;n.type="object";let o=a.keyType,i=o._zod.bag,l=i?.patterns;if("loose"===a.mode&&l&&l.size>0){let e=nr(a.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});for(let t of(n.patternProperties={},l))n.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(n.propertyNames=nr(a.keyType,t,{...r,path:[...r.path,"propertyNames"]})),n.additionalProperties=nr(a.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let s=o._zod.values;if(s){let e=[...s].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(n.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function re(e,t,n){return new n7(t&&t._zod?{type:"record",keyType:e,valueType:t,...eA(n)}:{type:"record",keyType:nz(),valueType:e,...eA(t)})}let rt=$("ZodEnum",(e,t)=>{tU.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;(a=eg(e._zod.def.entries)).every(e=>"number"==typeof e)&&(n.type="number"),a.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=a},e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let a={};for(let r of e)if(n.has(r))a[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new rt({...t,checks:[],...eA(r),entries:a})},e.exclude=(e,r)=>{let a={...t.entries};for(let t of e)if(n.has(t))delete a[t];else throw Error(`Key ${t} not found in enum`);return new rt({...t,checks:[],...eA(r),entries:a})}});function rn(e,t){return new rt({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...eA(t)})}let rr=$("ZodLiteral",(e,t)=>{tH.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a=e._zod.def,o=[];for(let e of a.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else o.push(Number(e));else o.push(e);if(0===o.length);else if(1===o.length){let e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n,0),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ra(e,t){return new rr({type:"literal",values:Array.isArray(e)?e:[e],...eA(t)})}let ro=$("ZodTransform",(e,t)=>{tB.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,e,0,0),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new H(e.constructor.name);n.addIssue=r=>{"string"==typeof r?n.issues.push(eF(r,n.value,t)):(r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=e),n.issues.push(eF(r)))};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}}),ri=$("ZodOptional",(e,t)=>{tV.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rl(e){return new ri({type:"optional",innerType:e})}let rs=$("ZodExactOptional",(e,t)=>{tq.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),rc=$("ZodNullable",(e,t)=>{tW.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a,o,i;return o=nr((a=e._zod.def).innerType,t,r),i=t.seen.get(e),void("openapi-3.0"===t.target?(i.ref=a.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function ru(e){return new rc({type:"nullable",innerType:e})}let rd=$("ZodDefault",(e,t)=>{tZ.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;nr((a=e._zod.def).innerType,t,r),t.seen.get(e).ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),rf=$("ZodPrefault",(e,t)=>{tJ.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;nr((a=e._zod.def).innerType,t,r),t.seen.get(e).ref=a.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},e.unwrap=()=>e._zod.def.innerType}),rp=$("ZodNonOptional",(e,t)=>{tQ.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;nr((a=e._zod.def).innerType,t,r),t.seen.get(e).ref=a.innerType},e.unwrap=()=>e._zod.def.innerType}),rh=$("ZodCatch",(e,t)=>{tX.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let a,o=e._zod.def;nr(o.innerType,t,r),t.seen.get(e).ref=o.innerType;try{a=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}n.default=a})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),rm=$("ZodPipe",(e,t)=>{t0.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a,o,i;return o=(a=e._zod.def).in._zod.traits.has("$ZodTransform"),void(nr(i="input"===t.io?o?a.out:a.in:a.out,t,r),t.seen.get(e).ref=i)},e.in=t.in,e.out=t.out});function rg(e,t){return new rm({type:"pipe",in:e,out:t})}let ry=$("ZodReadonly",(e,t)=>{t2.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let a;nr((a=e._zod.def).innerType,t,r),t.seen.get(e).ref=a.innerType,n.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),rv=$("ZodCustom",(e,t)=>{t3.init(e,t),nP.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,e,0,0)});var rb=nz().trim().min(1,"名称不能为空").max(120,"名称不能超过 ".concat(120," 个字符")).refine(function(e){return!e.includes("/")&&!e.includes("\\")},"名称不能包含斜杠"),rx=function(e){return nz().max(e)},rw=nz().min(1).max(120),rk=rn(D),rj=re(rw,rx(4096)),rS=re(rw,rx(1048576)),rO=rn(["skip","overwrite"]);n6({password:rx(4096)}),n6({name:rb,baseUrl:rx(2048).optional(),apiKey:rx(4096).optional(),model:rx(120).optional(),notes:rx(4096).optional(),extras:rj.optional(),overrides:rS.optional(),providerId:rx(120).optional(),providerEndpoint:rx(120).optional()}).partial();var rC=n3(n6({key:nz().trim().min(1,"endpoint key 不能为空").max(60,"endpoint key 过长").refine(function(e){return!e.includes("/")&&!e.includes("\\")},"endpoint key 不能包含斜杠"),label:rx(120).optional(),baseUrl:nz().trim().min(1,"endpoint 需要 baseUrl").max(2048)})).max(50).refine(function(e){return new Set(e.map(function(e){return e.key})).size===e.length},"endpoint key 不能重复");n6({name:rb,apiKey:nz().min(1,"apiKey 不能为空").max(4096),endpoints:rC.optional(),notes:rx(4096).optional()}),n6({name:rb.optional(),apiKey:rx(4096).optional(),endpoints:rC.optional(),notes:rx(4096).optional()}),n6({sourceUser:nz().trim().min(1,"来源用户不能为空").max(120),conflictPolicy:rO.optional(),overwriteHarnesses:n3(rk).optional(),migrateCodexLoginCache:nX().optional()});var rN=n6({format:ra("harness-switch-encrypted-export"),version:ra(1),kdf:n6({name:ra("scrypt"),salt:nz().min(1)}),cipher:n6({name:ra("aes-256-gcm"),iv:nz().min(1),tag:nz().min(1),data:nz().min(1)})});n6({passphrase:rx(4096),includeCodexLoginCache:nX().optional()}),n6({envelope:rN,passphrase:rx(4096),conflictPolicy:rO.optional(),restoreActive:nX().optional(),migrateCodexLoginCache:nX().optional()});var rP=n6({id:nz().min(1).max(240),name:rb,target:rn(["profile","vault"]),apiKey:rx(4096).optional(),providerId:rx(120).optional(),providerName:rb.optional(),overwrite:nX().optional()});n6({selections:n3(rP).min(1,"请至少选择一条配置").max(200)}),n6({baseUrl:nz().trim().min(1,"baseUrl 不能为空").max(2048),apiKey:rx(4096).optional(),providerId:rx(120).optional()}),n6({endpoint:rx(120).optional()}),n6({clientId:rx(100).optional()}),n6({deviceCode:nz().min(1).max(200),clientId:rx(100).optional()}),n6({token:nz().trim().min(1,"Token 不能为空").max(500)}),n6({passphrase:rx(4096),includeCodexLoginCache:nX().optional()}),n6({passphrase:rx(4096),conflictPolicy:rO.optional(),restoreActive:nX().optional()}),n6({passphrase:rx(4096),conflictPolicy:rO.optional(),restoreActive:nX().optional(),migrateCodexLoginCache:nX().optional()}),n6({});let rE=O("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);function r_(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=function e(t){var n,r,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(r=e(t[n]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}(e))&&(r&&(r+=" "),r+=t);return r}let rz=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,rT=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return r_(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{let t=null==n?void 0:n[e],r=null==o?void 0:o[e];if(null===t)return null;let i=rz(t)||rz(r);return a[e][i]}),l=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return r_(e,i,null==t||null==(r=t.compoundVariants)?void 0:r.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...l}[t]):({...o,...l})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)},rA=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rR=[],rL=(e,t,n)=>{if(0==e.length-t)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let n=rL(e,t+1,a);if(n)return n}let o=n.validators;if(null===o)return;let i=0===t?e.join("-"):e.slice(t).join("-"),l=o.length;for(let e=0;e<l;e++){let t=o[e];if(t.validator(i))return t.classGroupId}},rI=(e,t)=>{let n=rA();for(let r in e)rM(e[r],n,r,t);return n},rM=(e,t,n,r)=>{let a=e.length;for(let o=0;o<a;o++)rD(e[o],t,n,r)},rD=(e,t,n,r)=>{"string"==typeof e?rF(e,t,n):"function"==typeof e?r$(e,t,n,r):rU(e,t,n,r)},rF=(e,t,n)=>{(""===e?t:rH(t,e)).classGroupId=n},r$=(e,t,n,r)=>{rB(e)?rM(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:n,validator:e}))},rU=(e,t,n,r)=>{let a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){let[o,i]=a[e];rM(i,rH(t,o),n,r)}},rH=(e,t)=>{let n=e,r=t.split("-"),a=r.length;for(let e=0;e<a;e++){let t=r[e],a=n.nextPart.get(t);a||(a=rA(),n.nextPart.set(t,a)),n=a}return n},rB=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,rK=[],rV=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),rq=/\s+/,rW=e=>{let t;if("string"==typeof e)return e;let n="";for(let r=0;r<e.length;r++)e[r]&&(t=rW(e[r]))&&(n&&(n+=" "),n+=t);return n},rZ=[],rG=e=>{let t=t=>t[e]||rZ;return t.isThemeGetter=!0,t},rJ=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rQ=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rY=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,rX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r0=/\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$/,r1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,r2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,r3=e=>rY.test(e),r5=e=>!!e&&!Number.isNaN(Number(e)),r6=e=>!!e&&Number.isInteger(Number(e)),r8=e=>e.endsWith("%")&&r5(e.slice(0,-1)),r9=e=>rX.test(e),r7=()=>!0,ae=e=>r0.test(e)&&!r1.test(e),at=()=>!1,an=e=>r2.test(e),ar=e=>r4.test(e),aa=e=>!al(e)&&!am(e),ao=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),ai=e=>aj(e,aN,at),al=e=>rJ.test(e),as=e=>aj(e,aP,ae),ac=e=>aj(e,aE,r5),au=e=>aj(e,az,r7),ad=e=>aj(e,a_,at),af=e=>aj(e,aO,at),ap=e=>aj(e,aC,ar),ah=e=>aj(e,aT,an),am=e=>rQ.test(e),ag=e=>aS(e,aP),ay=e=>aS(e,a_),av=e=>aS(e,aO),ab=e=>aS(e,aN),ax=e=>aS(e,aC),aw=e=>aS(e,aT,!0),ak=e=>aS(e,az,!0),aj=(e,t,n)=>{let r=rJ.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},aS=(e,t,n=!1)=>{let r=rQ.exec(e);return!!r&&(r[1]?t(r[1]):n)},aO=e=>"position"===e||"percentage"===e,aC=e=>"image"===e||"url"===e,aN=e=>"length"===e||"size"===e||"bg-size"===e,aP=e=>"length"===e,aE=e=>"number"===e,a_=e=>"family-name"===e,az=e=>"number"===e||"weight"===e,aT=e=>"shadow"===e,aA=((e,...t)=>{let n,r,a,o,i=e=>{let t=r(e);if(t)return t;let o=((e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o,postfixLookupClassGroupIds:i}=t,l=[],s=e.trim().split(rq),c="";for(let e=s.length-1;e>=0;e-=1){let t,u=s[e],{isExternal:d,modifiers:f,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:m}=n(u);if(d){c=u+(c.length>0?" "+c:c);continue}let g=!!m;if(g){let e=(t=r(h.substring(0,m)))&&i[t]?r(h):void 0;e&&e!==t&&(t=e,g=!1)}else t=r(h);if(!t){if(!g||!(t=r(h))){c=u+(c.length>0?" "+c:c);continue}g=!1}let y=0===f.length?"":1===f.length?f[0]:o(f).join(":"),v=p?y+"!":y,b=v+t;if(l.indexOf(b)>-1)continue;l.push(b);let x=a(t,g);for(let e=0;e<x.length;++e){let t=x[e];l.push(v+t)}c=u+(c.length>0?" "+c:c)}return c})(e,n);return a(e,o),o};return o=l=>{var s;let c;return r=(n={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),a=(a,o)=>{n[a]=o,++t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(a(e,t),t):void 0},set(e,t){e in n?n[e]=t:a(e,t)}}})((s=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t,n=[],r=0,a=0,o=0,i=e.length;for(let l=0;l<i;l++){let i=e[l];if(0===r&&0===a){if(":"===i){n.push(e.slice(o,l)),o=l+1;continue}if("/"===i){t=l;continue}}"["===i?r++:"]"===i?r--:"("===i?a++:")"===i&&a--}let l=0===n.length?e:e.slice(o),s=l,c=!1;return l.endsWith("!")?(s=l.slice(0,-1),c=!0):l.startsWith("!")&&(s=l.slice(1),c=!0),rV(n,c,s,t&&t>o?t-o:void 0)};if(t){let e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):rV(rK,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r})(s),sortModifiers:(c=new Map,s.orderSensitiveModifiers.forEach((e,t)=>{c.set(e,1e6+t)}),e=>{let t=[],n=[];for(let r=0;r<e.length;r++){let a=e[r],o="["===a[0],i=c.has(a);o||i?(n.length>0&&(n.sort(),t.push(...n),n=[]),t.push(a)):n.push(a)}return n.length>0&&(n.sort(),t.push(...n)),t}),postfixLookupClassGroupIds:(e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t})(s),...(e=>{let t=(e=>{let{theme:t,classGroups:n}=e;return rI(n,t)})(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var n;let t,r,a;return -1===(n=e).slice(1,-1).indexOf(":")?void 0:(r=(t=n.slice(1,-1)).indexOf(":"),(a=t.slice(0,r))?"arbitrary.."+a:void 0)}let r=e.split("-"),a=+(""===r[0]&&r.length>1);return rL(r,a,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],a=n[e];if(t){if(a){let e=Array(a.length+t.length);for(let t=0;t<a.length;t++)e[t]=a[t];for(let n=0;n<t.length;n++)e[a.length+n]=t[n];return e}return t}return a||rR}return n[e]||rR}}})(s)}).cache.get,a=n.cache.set,o=i,i(l)},(...e)=>o(((...e)=>{let t,n,r=0,a="";for(;r<e.length;)(t=e[r++])&&(n=rW(t))&&(a&&(a+=" "),a+=n);return a})(...e))})(()=>{let e=rG("color"),t=rG("font"),n=rG("text"),r=rG("font-weight"),a=rG("tracking"),o=rG("leading"),i=rG("breakpoint"),l=rG("container"),s=rG("spacing"),c=rG("radius"),u=rG("shadow"),d=rG("inset-shadow"),f=rG("text-shadow"),p=rG("drop-shadow"),h=rG("blur"),m=rG("perspective"),g=rG("aspect"),y=rG("ease"),v=rG("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...x(),am,al],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],S=()=>[am,al,s],O=()=>[r3,"full","auto",...S()],C=()=>[r6,"none","subgrid",am,al],N=()=>["auto",{span:["full",r6,am,al]},r6,am,al],P=()=>[r6,"auto",am,al],E=()=>["auto","min","max","fr",am,al],_=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...S()],A=()=>[r3,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],R=()=>[r3,"screen","full","dvw","lvw","svw","min","max","fit",...S()],L=()=>[r3,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],I=()=>[e,am,al],M=()=>[...x(),av,af,{position:[am,al]}],D=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",ab,ai,{size:[am,al]}],$=()=>[r8,ag,as],U=()=>["","none","full",c,am,al],H=()=>["",r5,ag,as],B=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[r5,r8,av,af],q=()=>["","none",h,am,al],W=()=>["none",r5,am,al],Z=()=>["none",r5,am,al],G=()=>[r5,am,al],J=()=>[r3,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[r9],breakpoint:[r9],color:[r7],container:[r9],"drop-shadow":[r9],ease:["in","out","in-out"],font:[aa],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[r9],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[r9],shadow:[r9],spacing:["px",r5],text:[r9],"text-shadow":[r9],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",r3,al,am,g]}],container:["container"],"container-type":[{"@container":["","normal","size",am,al]}],"container-named":[ao],columns:[{columns:[r5,al,am,l]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:w()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{"inset-s":O(),start:O()}],end:[{"inset-e":O(),end:O()}],"inset-bs":[{"inset-bs":O()}],"inset-be":[{"inset-be":O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[r6,"auto",am,al]}],basis:[{basis:[r3,"full","auto",l,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[r5,r3,"auto","initial","none",al]}],grow:[{grow:["",r5,am,al]}],shrink:[{shrink:["",r5,am,al]}],order:[{order:[r6,"first","last","none",am,al]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[..._(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",..._()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":_()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mbs:[{mbs:T()}],mbe:[{mbe:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",...L()]}],"min-block-size":[{"min-block":["auto",...L()]}],"max-block-size":[{"max-block":["none",...L()]}],w:[{w:[l,"screen",...A()]}],"min-w":[{"min-w":[l,"screen","none",...A()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",n,ag,as]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ak,au]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",r8,al]}],"font-family":[{font:[ay,ad,t]}],"font-features":[{"font-features":[al]}],"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:[a,am,al]}],"line-clamp":[{"line-clamp":[r5,"none",am,ac]}],leading:[{leading:[o,...S()]}],"list-image":[{"list-image":["none",am,al]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",am,al]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:[r5,"from-font","auto",am,as]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[r5,"auto",am,al]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[r6,am,al]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",am,al]}],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",am,al]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:D()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},r6,am,al],radial:["",am,al],conic:[r6,am,al]},ax,ap]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...B(),"hidden","none"]}],"divide-style":[{divide:[...B(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...B(),"none","hidden"]}],"outline-offset":[{"outline-offset":[r5,am,al]}],"outline-w":[{outline:["",r5,ag,as]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",u,aw,ah]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",d,aw,ah]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[r5,as]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",f,aw,ah]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[r5,am,al]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"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":[r5]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[am,al]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":x()}],"mask-image-conic-pos":[{"mask-conic":[r5]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:D()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",am,al]}],filter:[{filter:["","none",am,al]}],blur:[{blur:q()}],brightness:[{brightness:[r5,am,al]}],contrast:[{contrast:[r5,am,al]}],"drop-shadow":[{"drop-shadow":["","none",p,aw,ah]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",r5,am,al]}],"hue-rotate":[{"hue-rotate":[r5,am,al]}],invert:[{invert:["",r5,am,al]}],saturate:[{saturate:[r5,am,al]}],sepia:[{sepia:["",r5,am,al]}],"backdrop-filter":[{"backdrop-filter":["","none",am,al]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[r5,am,al]}],"backdrop-contrast":[{"backdrop-contrast":[r5,am,al]}],"backdrop-grayscale":[{"backdrop-grayscale":["",r5,am,al]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[r5,am,al]}],"backdrop-invert":[{"backdrop-invert":["",r5,am,al]}],"backdrop-opacity":[{"backdrop-opacity":[r5,am,al]}],"backdrop-saturate":[{"backdrop-saturate":[r5,am,al]}],"backdrop-sepia":[{"backdrop-sepia":["",r5,am,al]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",am,al]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[r5,"initial",am,al]}],ease:[{ease:["linear","initial",y,am,al]}],delay:[{delay:[r5,am,al]}],animate:[{animate:["none",v,am,al]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,am,al]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:W()}],"rotate-x":[{"rotate-x":W()}],"rotate-y":[{"rotate-y":W()}],"rotate-z":[{"rotate-z":W()}],scale:[{scale:Z()}],"scale-x":[{"scale-x":Z()}],"scale-y":[{"scale-y":Z()}],"scale-z":[{"scale-z":Z()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[am,al,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:J()}],"translate-x":[{"translate-x":J()}],"translate-y":[{"translate-y":J()}],"translate-z":[{"translate-z":J()}],"translate-none":["translate-none"],zoom:[{zoom:[r6,am,al]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",am,al]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"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",am,al]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[r5,ag,as,ac]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-bs","border-w-be","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-bs","border-color-be","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-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function aR(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return aA(r_(t))}var aL=rT("inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function aI(e){var t=e.className,n=e.variant,r=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className","variant"]);return(0,g.jsx)("div",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"badge",className:aR(aL({variant:n}),t)},r))}function aM(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function aD(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function aF(e){return(aF=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a$(e,t){return(a$=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function aU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(aU=function(){return!!e})()}var aH=(0,y.lazy)(function(){var e;return(e=function(){return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:return[4,Promise.all([d.e("6150"),d.e("4952")]).then(d.bind(d,1419))];case 1:return[2,{default:e.sent().PierreFileDiff}]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){aM(o,r,a,i,l,"next",e)}function l(e){aM(o,r,a,i,l,"throw",e)}i(void 0)})})()});function aB(e){return null===e.content&&null===e.currentContent?"same":null===e.content?"delete":null===e.currentContent?"create":e.content===e.currentContent?"same":"replace"}function aK(e){var t=e.files;return(0,g.jsx)("div",{className:"space-y-3",children:t.map(function(e){return(0,g.jsx)(aV,{file:e},e.path)})})}function aV(e){var t=e.file,n=(0,x.Bd)().t,r=aB(t);return(0,g.jsxs)("div",{className:"overflow-hidden rounded-xl border",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b bg-muted/40 px-3 py-2",children:[(0,g.jsx)("p",{className:"min-w-0 truncate font-mono text-xs",title:t.path,children:t.path}),(0,g.jsx)(aI,{variant:"secondary",children:n("diff.".concat(r))})]}),(0,g.jsx)(aW,{fallback:(0,g.jsx)(aq,{file:t}),children:(0,g.jsx)(y.Suspense,{fallback:(0,g.jsx)("p",{className:"px-3 py-4 text-sm text-muted-foreground",children:n("diff.rendering")}),children:(0,g.jsx)(aH,{file:t})})})]})}function aq(e){var t,n,r=e.file,a=(0,x.Bd)().t;return(0,g.jsxs)("div",{className:"grid gap-2 p-3 font-mono text-xs",children:[(0,g.jsx)("pre",{className:"whitespace-pre-wrap text-red-400/90",children:null!=(t=r.currentContent)?t:a("diff.absent")}),(0,g.jsx)("p",{className:"font-sans text-muted-foreground",children:a("diff.afterRestore")}),(0,g.jsx)("pre",{className:"whitespace-pre-wrap text-emerald-400/90",children:null!=(n=r.content)?n:a("diff.deletedAfterRestore")})]})}var aW=function(e){var t,n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n,a,o;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=aF(t),e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,aU()?Reflect.construct(t,n||[],aF(this).constructor):t.apply(this,n)),o={failed:!1},(a="state")in e?Object.defineProperty(e,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[a]=o,e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&a$(r,e),n=[{key:"getDerivedStateFromError",value:function(){return{failed:!0}}}],t=[{key:"render",value:function(){return this.state.failed?this.props.fallback:this.props.children}}],aD(r.prototype,t),n&&aD(r,n),r}(y.Component),aZ=Object.defineProperty,aG=(e,t)=>aZ(e,"name",{value:t,configurable:!0});function aJ(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function aQ(...e){return t=>{let n=!1,r=e.map(e=>{let r=aJ(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():aJ(e[t],null)}}}}function aY(...e){return y.useCallback(aQ(...e),e)}aG(aJ,"setRef"),aG(aQ,"composeRefs"),aG(aY,"useComposedRefs");var aX=Object.defineProperty,a0=(e,t)=>aX(e,"name",{value:t,configurable:!0});function a1(e){let t=y.forwardRef((t,n)=>{let{children:r,...a}=t,o=null,i=!1,l=[];a7(r)&&"function"==typeof or&&(r=or(r._payload)),y.Children.forEach(r,e=>{if(a8(e)){i=!0;let t="child"in e.props?e.props.child:e.props.children;a7(t)&&"function"==typeof or&&(t=or(t._payload)),o=a3(e,t),l.push(o?.props?.children)}else l.push(e)}),o?o=y.cloneElement(o,void 0,l):!i&&1===y.Children.count(r)&&y.isValidElement(r)&&(o=r);let s=o?a6(o):void 0,c=aY(n,s);if(!o){if(r||0===r)throw Error(i?on(e):ot(e));return r}let u=a5(a,o.props??{});return o.type!==y.Fragment&&(u.ref=n?c:s),y.cloneElement(o,u)});return t.displayName=`${e}.Slot`,t}a0(a1,"createSlot");var a2=a1("Slot"),a4=Symbol.for("radix.slottable");a0(function(e){let t=a0(e=>"child"in e?e.children(e.child):e.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=a4,t},"createSlottable");var a3=a0((e,t)=>{if("child"in e.props){let t=e.props.child;return y.isValidElement(t)?y.cloneElement(t,void 0,e.props.children(t.props.children)):null}return y.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function a5(e,t){let n={...t};for(let r in t){let a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...e)=>{let t=o(...e);return a(...e),t}:a&&(n[r]=a):"style"===r?n[r]={...a,...o}:"className"===r&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function a6(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(n=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}function a8(e){return y.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===a4}a0(a5,"mergeProps"),a0(a6,"getElementRef"),a0(a8,"isSlottable");var a9=Symbol.for("react.lazy");function a7(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===a9&&"_payload"in e&&oe(e._payload)}function oe(e){return"object"==typeof e&&null!==e&&"then"in e}a0(a7,"isLazyComponent"),a0(oe,"isPromiseLike");var ot=a0(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),on=a0(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),or=v[" use ".trim().toString()],oa=rT("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[10px] text-sm font-medium transition-[color,background-color,border-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-background active:translate-y-px disabled:pointer-events-none disabled:opacity-50 disabled:active:translate-y-0 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-[0_8px_20px_-10px_color-mix(in_srgb,var(--primary)_65%,transparent)] hover:bg-primary/90 hover:shadow-[0_10px_24px_-10px_color-mix(in_srgb,var(--primary)_80%,transparent)]",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/88",outline:"border border-input bg-card shadow-[0_1px_2px_rgb(20_24_40/0.04)] hover:border-ring/35 hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent/75 hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3 text-xs",lg:"h-11 px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}});function oo(e){var t=e.className,n=e.variant,r=e.size,a=e.asChild,o=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className","variant","size","asChild"]);return(0,g.jsx)(void 0!==a&&a?a2:"button",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"button",className:aR(oa({variant:n,size:r,className:t}))},o))}var oi=Object.defineProperty,ol=(e,t)=>oi(e,"name",{value:t,configurable:!0}),os=!!("u">typeof window&&window.document&&window.document.createElement);function oc(e,t,{checkForDefaultPrevented:n=!0}={}){return ol(function(r){if(e?.(r),!1===n||!r||!r.defaultPrevented)return t?.(r)},"handleEvent")}function ou(e){if(!os)throw Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}function od(e){return"IFRAME"===e.tagName}ol(oc,"composeEventHandlers"),ol(function(e){if(!os)throw Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window},"getOwnerWindow"),ol(ou,"getOwnerDocument"),ol(function e(t,n=!1){let{activeElement:r}=ou(t);if(!r?.nodeName)return null;if(od(r)&&r.contentDocument)return e(r.contentDocument.body,n);if(n){let e=r.getAttribute("aria-activedescendant");if(e){let t=ou(r).getElementById(e);if(t)return t}}return r},"getActiveElement"),ol(od,"isFrame");var of=Object.defineProperty,op=(e,t)=>of(e,"name",{value:t,configurable:!0});function oh(e,t=[]){let n=[];function r(t,r){let a=y.createContext(r);a.displayName=t+"Context";let o=n.length;n=[...n,r];let i=op(t=>{let{scope:n,children:r,...i}=t,l=n?.[e]?.[o]||a,s=y.useMemo(()=>i,Object.values(i));return(0,g.jsx)(l.Provider,{value:s,children:r})},"Provider");function l(n,i,s={}){let{optional:c=!1}=s,u=i?.[e]?.[o]||a,d=y.useContext(u);if(d)return d;if(void 0!==r)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return i.displayName=t+"Provider",op(l,"useContext"),[i,l]}op(r,"createContext");let a=op(()=>{let t=n.map(e=>y.createContext(e));return op(function(n){let r=n?.[e]||t;return y.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},"useScope")},"createScope");return a.scopeName=e,[r,om(a,...t)]}function om(...e){let t=e[0];if(1===e.length)return t;let n=op(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return op(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let a=n(e)[`__scope${r}`];return{...t,...a}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}op(function(e,t){let n=y.createContext(t);n.displayName=e+"Context";let r=op(e=>{let{children:t,...r}=e,a=y.useMemo(()=>r,Object.values(r));return(0,g.jsx)(n.Provider,{value:a,children:t})},"Provider");function a(r,o={}){let{optional:i=!1}=o,l=y.useContext(n);if(l)return l;if(void 0!==t)return t;if(!i)throw Error(`\`${r}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",op(a,"useContext"),[r,a]},"createContext"),op(oh,"createContextScope"),op(om,"composeContextScopes");var og=globalThis?.document?y.useLayoutEffect:()=>{},oy=Object.defineProperty,ov=v[" useId ".trim().toString()]||(()=>void 0),ob=0;function ox(e){let[t,n]=y.useState(ov());return og(()=>{e||n(e=>e??String(ob++))},[e]),e||(t?`radix-${t}`:"")}oy(ox,"name",{value:"useId",configurable:!0});var ow=Object.defineProperty,ok=v[" useEffectEvent ".trim().toString()],oj=v[" useInsertionEffect ".trim().toString()];function oS(e){if("function"==typeof ok)return ok(e);let t=y.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});return"function"==typeof oj?oj(()=>{t.current=e}):og(()=>{t.current=e}),y.useMemo(()=>(...e)=>t.current?.(...e),[])}ow(oS,"name",{value:"useEffectEvent",configurable:!0});var oO=Object.defineProperty,oC=(e,t)=>oO(e,"name",{value:t,configurable:!0}),oN=v[" useInsertionEffect ".trim().toString()]||og;function oP({prop:e,defaultProp:t,onChange:n=oC(()=>{},"onChange"),caller:r}){let[a,o,i]=oE({defaultProp:t,onChange:n}),l=void 0!==e,s=l?e:a;return[s,y.useCallback(t=>{if(l){let n=o_(t)?t(e):t;n!==e&&i.current?.(n)}else o(t)},[l,e,o,i])]}function oE({defaultProp:e,onChange:t}){let[n,r]=y.useState(e),a=y.useRef(n),o=y.useRef(t);return oN(()=>{o.current=t},[t]),y.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,r,o]}function o_(e){return"function"==typeof e}oC(oP,"useControllableState"),oC(oE,"useUncontrolledState"),oC(o_,"isFunction");var oz=Symbol("RADIX:SYNC_STATE");oC(function(e,t,n,r){let{prop:a,defaultProp:o,onChange:i,caller:l}=t,s=void 0!==a,c=oS(i),u=[{...n,state:o}];r&&u.push(r);let[d,f]=y.useReducer((t,n)=>{if(n.type===oz)return{...t,state:n.state};let r=e(t,n);return s&&!Object.is(r.state,t.state)&&c(r.state),r},...u),p=d.state,h=y.useRef(p);y.useEffect(()=>{h.current!==p&&(h.current=p,s||c(p))},[p,h,s]);let m=y.useMemo(()=>void 0!==a?{...d,state:a}:d,[d,a]);return y.useEffect(()=>{s&&!Object.is(a,d.state)&&f({type:oz,state:a})},[a,d.state,s]),[m,f]},"useControllableStateReducer");var oT=d(3144),oA=Object.defineProperty,oR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=a1(`Primitive.${t}`),r=y.forwardRef((e,r)=>{let{asChild:a,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,g.jsx)(a?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function oL(e,t){e&&oT.flushSync(()=>e.dispatchEvent(t))}function oI(e){let t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...e)=>t.current?.(...e),[])}oA(oL,"name",{value:"dispatchDiscreteCustomEvent",configurable:!0}),(0,Object.defineProperty)(oI,"name",{value:"useCallbackRef",configurable:!0});var oM=Object.defineProperty,oD=(e,t)=>oM(e,"name",{value:t,configurable:!0}),oF="dismissableLayer.update",o$=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),oU=y.forwardRef(oD(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:l,onDismiss:s,...c}=e,u=y.useContext(o$),[d,f]=y.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=y.useState({}),v=aY(t,f),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=x?b.indexOf(x):-1,k=d?b.indexOf(d):-1,j=u.layersWithOutsidePointerEventsDisabled.size>0,S=k>=w,O=y.useRef(!1),C=oK(e=>{o?.(e),l?.(e),e.defaultPrevented||s?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:O,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:y.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return S&&!t},[u.branches,S])}),N=oV(e=>{if(r&&O.current)return;let t=e.target;![...u.branches].some(e=>e.contains(t))&&(i?.(e),l?.(e),e.defaultPrevented||s?.())},p),P=!!d&&k===b.length-1,E=oI(e=>{"Escape"===e.key&&(a?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))});return y.useEffect(()=>{if(P)return p.addEventListener("keydown",E,{capture:!0}),()=>p.removeEventListener("keydown",E,{capture:!0})},[p,P,E]),y.useEffect(()=>{if(d)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(h=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),oq(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),0===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=h))}},[d,p,n,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),oq())},[d,u]),y.useEffect(()=>{let e=oD(()=>m({}),"handleUpdate");return document.addEventListener(oF,e),()=>document.removeEventListener(oF,e)},[]),(0,g.jsx)(oR.div,{...c,ref:v,style:{pointerEvents:j?S?"auto":"none":void 0,...e.style},onFocusCapture:oc(e.onFocusCapture,N.onFocusCapture),onBlurCapture:oc(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:oc(e.onPointerDownCapture,C.onPointerDownCapture)})},"DismissableLayer"));function oH(){let e=y.useContext(o$),[t,n]=y.useState(null);return y.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}oD(oH,"useDismissableLayerSurface");var oB=oD(()=>!0,"IS_TRUE");function oK(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=oB}=t,l=oI(e),s=y.useRef(!1),c=y.useRef(!1),u=y.useRef(new Map),d=y.useRef(()=>{});return y.useEffect(()=>{function e(){c.current=!1,a.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...o].some(e=>e.contains(t))||u.current.set(e.type,!0),"click"===e.type&&window.setTimeout(()=>{c.current&&d.current()},0)}function p(e){c.current&&u.current.set(e.type,!1)}oD(e,"resetOutsideInteraction"),oD(t,"isOutsideInteractionIntercepted"),oD(f,"handleInteractionCapture"),oD(p,"handleInteractionBubble");let h=oD(o=>{if(o.target&&!s.current){let f=function(){n.removeEventListener("click",d.current);let r=t();e(),r||oW("dismissableLayer.pointerDownOutside",l,p,{discrete:!0})};if(oD(f,"handleAndDispatchPointerDownOutsideEvent"),!i(o.target)){n.removeEventListener("click",d.current),e(),s.current=!1;return}let p={originalEvent:o};c.current=!0,a.current=r&&0===o.button,u.current.clear(),r&&0===o.button?(n.removeEventListener("click",d.current),d.current=f,n.addEventListener("click",d.current,{once:!0})):f()}else n.removeEventListener("click",d.current),e();s.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let e of m)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener("pointerdown",h)},0);return()=>{for(let e of(window.clearTimeout(g),n.removeEventListener("pointerdown",h),n.removeEventListener("click",d.current),m))n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,l,r,a,o,i]),{onPointerDownCapture:oD(()=>s.current=!0,"onPointerDownCapture")}}function oV(e,t=globalThis?.document){let n=oI(e),r=y.useRef(!1);return y.useEffect(()=>{let e=oD(e=>{e.target&&!r.current&&oW("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:oD(()=>r.current=!0,"onFocusCapture"),onBlurCapture:oD(()=>r.current=!1,"onBlurCapture")}}function oq(){let e=new CustomEvent(oF);document.dispatchEvent(e)}function oW(e,t,n,{discrete:r}){let a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?oL(a,o):a.dispatchEvent(o)}oD(oK,"usePointerDownOutside"),oD(oV,"useFocusOutside"),oD(oq,"dispatchUpdate"),oD(oW,"handleAndDispatchCustomEvent");var oZ=Object.defineProperty,oG=(e,t)=>oZ(e,"name",{value:t,configurable:!0}),oJ="focusScope.autoFocusOnMount",oQ="focusScope.autoFocusOnUnmount",oY={bubbles:!1,cancelable:!0},oX=y.forwardRef(oG(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[l,s]=y.useState(null),c=oI(a),u=oI(o),d=y.useRef(null),f=aY(t,s),p=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let e=function(e){if(p.paused||!l)return;let t=e.target;l.contains(t)?d.current=t:o6(d.current,{select:!0})},t=function(e){if(p.paused||!l)return;let t=e.relatedTarget;null!==t&&(l.contains(t)||o6(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&o6(l)};oG(e,"handleFocusIn"),oG(t,"handleFocusOut"),oG(n,"handleMutations"),document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[r,l,p.paused]),y.useEffect(()=>{if(l){o8.add(p);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(oJ,oY);l.addEventListener(oJ,c),l.dispatchEvent(t),t.defaultPrevented||(o0(ie(o2(l)),{select:!0}),document.activeElement===e&&o6(l))}return()=>{l.removeEventListener(oJ,c),setTimeout(()=>{let t=new CustomEvent(oQ,oY);l.addEventListener(oQ,u),l.dispatchEvent(t),t.defaultPrevented||o6(e??document.body,{select:!0}),l.removeEventListener(oQ,u),o8.remove(p)},0)}}},[l,c,u,p]);let h=y.useCallback(e=>{if(!n&&!r||p.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){let t=e.currentTarget,[r,o]=o1(t);r&&o?e.shiftKey||a!==o?e.shiftKey&&a===r&&(e.preventDefault(),n&&o6(o,{select:!0})):(e.preventDefault(),n&&o6(r,{select:!0})):a===t&&e.preventDefault()}},[n,r,p.paused]);return(0,g.jsx)(oR.div,{tabIndex:-1,...i,ref:f,onKeyDown:h})},"FocusScope"));function o0(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(o6(r,{select:t}),document.activeElement!==n)return}function o1(e){let t=o2(e);return[o4(t,e),o4(t.reverse(),e)]}function o2(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:oG(e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}function o4(e,t){let n="function"==typeof t.checkVisibility&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):o3(r,{upTo:t})))return r}function o3(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function o5(e){return e instanceof HTMLInputElement&&"select"in e}function o6(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&o5(e)&&t&&e.select()}}oG(o0,"focusFirst"),oG(o1,"getTabbableEdges"),oG(o2,"getTabbableCandidates"),oG(o4,"findVisible"),oG(o3,"isHidden"),oG(o5,"isSelectableInput"),oG(o6,"focus");var o8=o9();function o9(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),(e=o7(e,t)).unshift(t)},remove(t){e=o7(e,t),e[0]?.resume()}}}function o7(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}function ie(e){return e.filter(e=>"A"!==e.tagName)}oG(o9,"createFocusScopesStack"),oG(o7,"arrayRemove"),oG(ie,"removeLinks");var it=Object.defineProperty,ir=y.forwardRef(it(function(e,t){let{container:n,...r}=e,[a,o]=y.useState(!1);og(()=>o(!0),[]);let i=n||a&&globalThis?.document?.body;return i?oT.createPortal((0,g.jsx)(oR.div,{...r,ref:t}),i):null},"name",{value:"Portal",configurable:!0})),ia=Object.defineProperty,io=(e,t)=>ia(e,"name",{value:t,configurable:!0});function ii(e,t){return y.useReducer((e,n)=>t[e][n]??e,e)}io(ii,"useStateMachine");var il=io(e=>{let{present:t,children:n}=e,r=is(t),a="function"==typeof n?n({present:r.isPresent}):y.Children.only(n),o=iu(r.ref,ip(a));return"function"==typeof n||r.isPresent?y.cloneElement(a,{ref:o}):null},"Presence");function is(e){let[t,n]=y.useState(),r=y.useRef(null),a=y.useRef(e),o=y.useRef("none"),i=y.useRef(void 0),[l,s]=ii(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{"mounted"===l?(o.current=i.current??id(r.current),i.current=void 0):o.current="none"},[l]),og(()=>{let t=r.current,n=a.current;if(n!==e){let r=o.current,l=id(t);e?(i.current=l,s("MOUNT")):"none"===l||t?.display==="none"?s("UNMOUNT"):n&&r!==l?s("ANIMATION_OUT"):s("UNMOUNT"),a.current=e}},[e,s]),og(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,i=io(o=>{let i=id(r.current).includes(CSS.escape(o.animationName));if(o.target===t&&i&&(s("ANIMATION_END"),!a.current)){let r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},"handleAnimationEnd"),l=io(e=>{e.target===t&&(o.current=id(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",l),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",l),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}s("ANIMATION_END")},[t,s]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,i.current=id(t)}else r.current=null;n(e)},[])}}function ic(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function iu(...e){let t=y.useRef(e);return t.current=e,y.useCallback(e=>{let n=t.current,r=!1,a=n.map(t=>{let n=ic(t,e);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let e=0;e<a.length;e++){let t=a[e];"function"==typeof t?t():ic(n[e],null)}}},[])}function id(e){return e?.animationName||"none"}function ip(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(n=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}io(is,"usePresence"),io(ic,"setRef"),io(iu,"useStableComposedRefs"),io(id,"getAnimationName"),io(ip,"getElementRef");var ih=Object.defineProperty,im=(e,t)=>ih(e,"name",{value:t,configurable:!0}),ig=0,iy=null;function iv(){y.useEffect(()=>{iy||(iy={start:ib(),end:ib()});let{start:e,end:t}=iy;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),ig++,()=>{1===ig&&(iy?.start.remove(),iy?.end.remove(),iy=null),ig=Math.max(0,ig-1)}},[])}function ib(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}im(function(e){return iv(),e.children},"FocusGuards"),im(iv,"useFocusGuards"),im(ib,"createFocusGuard");var ix=function(){return(ix=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function iw(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)0>t.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}var ik="right-scroll-bar-position",ij="width-before-scroll-bar";function iS(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var iO="u">typeof window?y.useLayoutEffect:y.useEffect,iC=new WeakMap,iN=(void 0===a&&(a={}),(void 0===o&&(o=function(e){return e}),i=[],l=!1,s={read:function(){if(l)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:null},useMedium:function(e){var t=o(e,l);return i.push(t),function(){i=i.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(l=!0;i.length;){var t=i;i=[],t.forEach(e)}i={push:function(t){return e(t)},filter:function(){return i}}},assignMedium:function(e){l=!0;var t=[];if(i.length){var n=i;i=[],n.forEach(e),t=i}var r=function(){var n=t;t=[],n.forEach(e)},a=function(){return Promise.resolve().then(r)};a(),i={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),i}}}}).options=ix({async:!0,ssr:!1},a),s),iP=function(){},iE=y.forwardRef(function(e,t){var n,r,a,o,i=y.useRef(null),l=y.useState({onScrollCapture:iP,onWheelCapture:iP,onTouchMoveCapture:iP}),s=l[0],c=l[1],u=e.forwardProps,d=e.children,f=e.className,p=e.removeScrollBar,h=e.enabled,m=e.shards,g=e.sideCar,v=e.noRelative,b=e.noIsolation,x=e.inert,w=e.allowPinchZoom,k=e.as,j=e.gapMode,S=iw(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=(n=[i,t],r=function(e){return n.forEach(function(t){return iS(t,e)})},(a=(0,y.useState)(function(){return{value:null,callback:r,facade:{get current(){return a.value},set current(value){var e=a.value;e!==value&&(a.value=value,a.callback(value,e))}}}})[0]).callback=r,o=a.facade,iO(function(){var e=iC.get(o);if(e){var t=new Set(e),r=new Set(n),a=o.current;t.forEach(function(e){r.has(e)||iS(e,null)}),r.forEach(function(e){t.has(e)||iS(e,a)})}iC.set(o,n)},[n]),o),C=ix(ix({},S),s);return y.createElement(y.Fragment,null,h&&y.createElement(g,{sideCar:iN,removeScrollBar:p,shards:m,noRelative:v,noIsolation:b,inert:x,setCallbacks:c,allowPinchZoom:!!w,lockRef:i,gapMode:j}),u?y.cloneElement(y.Children.only(d),ix(ix({},C),{ref:O})):y.createElement(void 0===k?"div":k,ix({},C,{className:f,ref:O}),d))});iE.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},iE.classNames={fullWidth:ij,zeroRight:ik};var i_=function(e){var t=e.sideCar,n=iw(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return y.createElement(r,ix({},n))};i_.isSideCarExport=!0;var iz=function(){var e=0,t=null;return{add:function(n){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=m||d.nc;return t&&e.setAttribute("nonce",t),e}())){var r,a;(r=t).styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n)),a=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(a)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},iT=function(){var e=iz();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},iA=function(){var e=iT();return function(t){return e(t.styles,t.dynamic),null}},iR={left:0,top:0,right:0,gap:0},iL=function(e){return parseInt(e||"",10)||0},iI=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[iL(n),iL(r),iL(a)]},iM=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return iR;var t=iI(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},iD=iA(),iF="data-scroll-locked",i$=function(e,t,n,r){var a=e.left,o=e.top,i=e.right,l=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(l,"px ").concat(r,";\n }\n body[").concat(iF,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(l,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(ik," {\n right: ").concat(l,"px ").concat(r,";\n }\n \n .").concat(ij," {\n margin-right: ").concat(l,"px ").concat(r,";\n }\n \n .").concat(ik," .").concat(ik," {\n right: 0 ").concat(r,";\n }\n \n .").concat(ij," .").concat(ij," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(iF,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(l,"px;\n }\n")},iU=function(){var e=parseInt(document.body.getAttribute(iF)||"0",10);return isFinite(e)?e:0},iH=function(){y.useEffect(function(){return document.body.setAttribute(iF,(iU()+1).toString()),function(){var e=iU()-1;e<=0?document.body.removeAttribute(iF):document.body.setAttribute(iF,e.toString())}},[])},iB=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=void 0===r?"margin":r;iH();var o=y.useMemo(function(){return iM(a)},[a]);return y.createElement(iD,{styles:i$(o,!t,a,n?"":"!important")})},iK=!1;if("u">typeof window)try{var iV=Object.defineProperty({},"passive",{get:function(){return iK=!0,!0}});window.addEventListener("test",iV,iV),window.removeEventListener("test",iV,iV)}catch(e){iK=!1}var iq=!!iK&&{passive:!1},iW=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&(n.overflowY!==n.overflowX||"TEXTAREA"===e.tagName||"visible"!==n[t])},iZ=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),iG(e,r)){var a=iJ(e,r);if(a[1]>a[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},iG=function(e,t){return"v"===e?iW(t,"overflowY"):iW(t,"overflowX")},iJ=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},iQ=function(e,t,n,r,a){var o,i=(o=window.getComputedStyle(t).direction,"h"===e&&"rtl"===o?-1:1),l=i*r,s=n.target,c=t.contains(s),u=!1,d=l>0,f=0,p=0;do{if(!s)break;var h=iJ(e,s),m=h[0],g=h[1]-h[2]-i*m;(m||g)&&iG(e,s)&&(f+=g,p+=m);var y=s.parentNode;s=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return d&&(a&&1>Math.abs(f)||!a&&l>f)?u=!0:!d&&(a&&1>Math.abs(p)||!a&&-l>p)&&(u=!0),u},iY=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},iX=function(e){return[e.deltaX,e.deltaY]},i0=function(e){return e&&"current"in e?e.current:e},i1=0,i2=[];let i4=(c=function(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(i1++)[0],o=y.useState(iA)[0],i=y.useRef(e);y.useEffect(function(){i.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=(function(e,t,n){if(n||2==arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(i0),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=y.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,o=iY(e),l=n.current,s="deltaX"in e?e.deltaX:l[0]-o[0],c="deltaY"in e?e.deltaY:l[1]-o[1],u=e.target,d=Math.abs(s)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var h=iZ(d,u);if(!h)return!0;if(h?a=d:(a="v"===d?"h":"v",h=iZ(d,u)),!h)return!1;if(!r.current&&"changedTouches"in e&&(s||c)&&(r.current=a),!a)return!0;var m=r.current||a;return iQ(m,t,e,"h"===m?s:c,!0)},[]),s=y.useCallback(function(e){if(i2.length&&i2[i2.length-1]===o){var n="deltaY"in e?iX(e):iY(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===n[0]&&r[1]===n[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var a=(i.current.shards||[]).map(i0).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?l(e,a[0]):!i.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=y.useCallback(function(e,n,r,a){var o={name:e,delta:n,target:r,should:a,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=y.useCallback(function(e){n.current=iY(e),r.current=void 0},[]),d=y.useCallback(function(t){c(t.type,iX(t),t.target,l(t,e.lockRef.current))},[]),f=y.useCallback(function(t){c(t.type,iY(t),t.target,l(t,e.lockRef.current))},[]);y.useEffect(function(){return i2.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",s,iq),document.addEventListener("touchmove",s,iq),document.addEventListener("touchstart",u,iq),function(){i2=i2.filter(function(e){return e!==o}),document.removeEventListener("wheel",s,iq),document.removeEventListener("touchmove",s,iq),document.removeEventListener("touchstart",u,iq)}},[]);var p=e.removeScrollBar,h=e.inert;return y.createElement(y.Fragment,null,h?y.createElement(o,{styles:"\n .block-interactivity-".concat(a," {pointer-events: none;}\n .allow-interactivity-").concat(a," {pointer-events: all;}\n")}):null,p?y.createElement(iB,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},iN.useMedium(c),i_);var i3=y.forwardRef(function(e,t){return y.createElement(iE,ix({},e,{ref:t,sideCar:i4}))});i3.classNames=iE.classNames;var i5=new WeakMap,i6=new WeakMap,i8={},i9=0,i7=function(e){return e&&(e.host||i7(e.parentNode))},le=function(e,t,n,r){var a=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var n=i7(e);return n&&t.contains(n)?n:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});i8[n]||(i8[n]=new WeakMap);var o=i8[n],i=[],l=new Set,s=new Set(a),c=function(e){!e||l.has(e)||(l.add(e),c(e.parentNode))};a.forEach(c);var u=function(e){!e||s.has(e)||Array.prototype.forEach.call(e.children,function(e){if(l.has(e))u(e);else try{var t=e.getAttribute(r),a=null!==t&&"false"!==t,s=(i5.get(e)||0)+1,c=(o.get(e)||0)+1;i5.set(e,s),o.set(e,c),i.push(e),1===s&&a&&i6.set(e,!0),1===c&&e.setAttribute(n,"true"),a||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return u(t),l.clear(),i9++,function(){i.forEach(function(e){var t=i5.get(e)-1,a=o.get(e)-1;i5.set(e,t),o.set(e,a),t||(i6.has(e)||e.removeAttribute(r),i6.delete(e)),a||e.removeAttribute(n)}),--i9||(i5=new WeakMap,i5=new WeakMap,i6=new WeakMap,i8={})}},lt=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),le(r,a,n,"aria-hidden")):function(){return null}},ln=Object.defineProperty,lr=(e,t)=>ln(e,"name",{value:t,configurable:!0}),la="Dialog",[lo,li]=oh(la),[ll,ls]=lo(la),lc=lr(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:i=!0}=e,l=y.useRef(null),s=y.useRef(null),[c,u]=oP({prop:r,defaultProp:a??!1,onChange:o,caller:la}),[d,f]=y.useState(0),[p,h]=y.useState(0);return(0,g.jsx)(ll,{scope:t,triggerRef:l,contentRef:s,contentId:ox(),titleId:ox(),descriptionId:ox(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:h,open:c,onOpenChange:u,onOpenToggle:y.useCallback(()=>u(e=>!e),[u]),modal:i,children:n})},"Dialog"),lu=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls("DialogTrigger",n),o=aY(t,a.triggerRef);return(0,g.jsx)(oR.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":lN(a.open),...r,ref:o,onClick:oc(e.onClick,a.onOpenToggle)})},"DialogTrigger")),ld="DialogPortal",[lf,lp]=lo(ld,{forceMount:void 0}),lh=lr(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=ls(ld,t);return(0,g.jsx)(lf,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,g.jsx)(il,{present:n||o.open,children:(0,g.jsx)(ir,{asChild:!0,container:a,children:e})}))})},"DialogPortal"),lm="DialogOverlay",lg=y.forwardRef(lr(function(e,t){let n=lp(lm,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=ls(lm,e.__scopeDialog);return o.modal?(0,g.jsx)(il,{present:r||o.open,children:(0,g.jsx)(lv,{...a,ref:t})}):null},"DialogOverlay")),ly=a1("DialogOverlay.RemoveScroll"),lv=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls(lm,n),o=aY(t,oH());return(0,g.jsx)(i3,{as:ly,allowPinchZoom:!0,shards:[a.contentRef],children:(0,g.jsx)(oR.div,{"data-state":lN(a.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})},"DialogOverlayImpl")),lb="DialogContent",lx=y.forwardRef(lr(function(e,t){let n=lp(lb,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=ls(lb,e.__scopeDialog);return(0,g.jsx)(il,{present:r||o.open,children:o.modal?(0,g.jsx)(lw,{...a,ref:t}):(0,g.jsx)(lk,{...a,ref:t})})},"DialogContent")),lw=y.forwardRef(lr(function(e,t){let n=ls(lb,e.__scopeDialog),r=y.useRef(null),a=aY(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return lt(e)},[]),(0,g.jsx)(lj,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:oc(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:oc(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:oc(e.onFocusOutside,e=>e.preventDefault())})},"DialogContentModal")),lk=y.forwardRef(lr(function(e,t){let n=ls(lb,e.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return(0,g.jsx)(lj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));let o=t.target;n.triggerRef.current?.contains(o)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})},"DialogContentNonModal")),lj=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,l=ls(lb,n);return iv(),(0,g.jsx)(g.Fragment,{children:(0,g.jsx)(oX,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,g.jsx)(oU,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionPresent?l.descriptionId:void 0,"aria-labelledby":l.titlePresent?l.titleId:void 0,"data-state":lN(l.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})},"DialogContentImpl")),lS=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls("DialogTitle",n),{setTitleCount:o}=a;return og(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,g.jsx)(oR.h2,{id:a.titleId,...r,ref:t})},"DialogTitle")),lO=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls("DialogDescription",n),{setDescriptionCount:o}=a;return og(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,g.jsx)(oR.p,{id:a.descriptionId,...r,ref:t})},"DialogDescription")),lC=y.forwardRef(lr(function(e,t){let{__scopeDialog:n,...r}=e,a=ls("DialogClose",n);return(0,g.jsx)(oR.button,{type:"button",...r,ref:t,onClick:oc(e.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function lN(e){return e?"open":"closed"}lr(lN,"getState");let lP=O("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function lE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function l_(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function lz(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)(lg,lE({"data-slot":"dialog-overlay",className:aR("fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t)},n))}function lT(e){var t,n,r=e.className,a=e.children,o=l_(e,["className","children"]);return(0,g.jsxs)(lh,{children:[(0,g.jsx)(lz,{}),(0,g.jsxs)(lx,(t=lE({"data-slot":"dialog-content",className:aR("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-card p-6 shadow-2xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-2xl",r)},o),n=n={children:[a,(0,g.jsxs)(lC,{className:"absolute right-4 top-4 cursor-pointer rounded-sm opacity-70 ring-offset-background transition-[opacity,background-color] hover:bg-accent hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 active:bg-accent/80 disabled:pointer-events-none",children:[(0,g.jsx)(lP,{className:"size-4"}),(0,g.jsx)("span",{className:"sr-only",children:"Close"})]})]},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))]})}function lA(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)("div",lE({"data-slot":"dialog-header",className:aR("flex flex-col space-y-1.5 text-center sm:text-left",t)},n))}function lR(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)("div",lE({"data-slot":"dialog-footer",className:aR("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t)},n))}function lL(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)(lS,lE({"data-slot":"dialog-title",className:aR("text-lg font-semibold leading-none tracking-tight",t)},n))}function lI(e){var t=e.className,n=l_(e,["className"]);return(0,g.jsx)(lO,lE({"data-slot":"dialog-description",className:aR("text-sm text-muted-foreground",t)},n))}function lM(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function lD(e,t,n){return(lD=lB()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&lU(a,n.prototype),a}).apply(null,arguments)}function lF(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l$(e){return(l$=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function lU(e,t){return(lU=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function lH(e){var t="function"==typeof Map?new Map:void 0;return(lH=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return lD(e,arguments,l$(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),lU(n,e)})(e)}function lB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(lB=function(){return!!e})()}var lK=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(e,n){var r,a,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return r=t,a=[n],r=l$(r),lF(o=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,lB()?Reflect.construct(r,a||[],l$(this).constructor):r.apply(this,a)),"status",void 0),lF(o,"code",void 0),lF(o,"params",void 0),o.status=e,o.name="ApiError",o.code=i.code,o.params=i.params,o}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&lU(t,e),t}(lH(Error));function lV(e){return"/api/harnesses/".concat(e,"/profiles")}function lq(e,t){return"".concat(lV(e),"/").concat(encodeURIComponent(t))}function lW(e){return e?"/api/backups/".concat(encodeURIComponent(e)):"/api/backups"}function lZ(){return"/api/providers"}function lG(e){return"".concat(lZ(),"/").concat(encodeURIComponent(e))}function lJ(e){return e?"/api/drift/".concat(encodeURIComponent(e)):"/api/drift"}function lQ(){return"/api/scan"}function lY(e){return e?"/api/operations?harness=".concat(encodeURIComponent(e)):"/api/operations"}function lX(e){var t;return(t=function(e){var t,n,r,a,o,i=arguments;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:var s,c;return n=new Headers((t=i.length>1&&void 0!==i[1]?i[1]:{}).headers),t.body&&!n.has("Content-Type")&&n.set("Content-Type","application/json"),[4,fetch(e,(s=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){lF(e,t,n[t])})}return e}({credentials:"include"},t),c=c={headers:n},Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(c)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(c)).forEach(function(e){Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(c,e))}),s))];case 1:return[4,(r=l.sent()).json().catch(function(){return{}})];case 2:if(a=l.sent(),!r.ok)throw new lK(r.status,null!=(o=a.error)?o:"",{code:a.code,params:a.params});return[2,a]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(e){lM(o,r,a,i,l,"next",e)}function l(e){lM(o,r,a,i,l,"throw",e)}i(void 0)})}).apply(this,arguments)}function l0(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l1(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function l2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function l4(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function l3(e){return e.startsWith("warning.")||e.startsWith("error.")?e:"error.".concat(e)}function l5(e){return e.code?{key:l3(e.code),params:e.params,scope:e.scope,fallback:e.message}:{key:"error.unknown",fallback:e.message,scope:e.scope}}function l6(e){return l1(e,lK)?l5({message:e.message,code:e.code,params:e.params}):{key:"error.unknown",fallback:l1(e,Error)?e.message:String(e)}}function l8(e,t){var n=l6(e);return"error.unknown"===n.key?l4(l2({},n),{key:t}):n}var l9=new Set(["drift.adoptFailed","drift.reapplyFailed","vault.deleteFailed","vault.saveFailed","vault.revealFailed","operations.undoFailed","import.failed","activate.loadFailed","backup.loadFailed","backup.diffFailed"]);function l7(e,t){if(t.fallback&&("error.unknown"===t.key||l9.has(t.key))){var n,r,a,o=null!=(a=t.fallback)?a:t.key;return t.scope?"".concat(t.scope,": ").concat(o):o}var i=Object.fromEntries(Object.entries(null!=(n=t.paramKeys)?n:{}).map(function(t){var n=function(e){if(Array.isArray(e))return e}(t)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(t)||function(e){if(e){if("string"==typeof e)return l0(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l0(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();return[n[0],e(n[1])]})),l=e(t.key,l4(l2({},t.params,i),{defaultValue:null!=(r=t.fallback)?r:t.key}));return t.scope?"".concat(t.scope,": ").concat(l):l}let se=e=>{let t,n=new Set,r=(e,r)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=r?r:"object"!=typeof a||null===a)?a:Object.assign({},t,a),n.forEach(n=>n(t,e))}},a=()=>t,o={setState:r,getState:a,getInitialState:()=>i,subscribe:e=>(n.add(e),()=>n.delete(e))},i=t=e(r,a,o);return o};function st(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sn(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function sr(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){sn(o,r,a,i,l,"next",e)}function l(e){sn(o,r,a,i,l,"throw",e)}i(void 0)})}}function sa(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function so(e){return function(e){if(Array.isArray(e))return st(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return st(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return st(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function si(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function sl(e,t,n){var r,a;return t?{key:e,params:(r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},n),a=a={user:t},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(a,e))}),r)}:{key:e,params:n,paramKeys:{user:"notice.currentUser"}}}var ss=(t=(r=function(e,t){return{sessionChecked:!1,authenticated:!1,currentUser:"",users:[],usersLoading:!1,loading:!1,error:null,envFile:"",harnesses:[],backups:[],notice:null,providers:null,providersLoading:!1,providersError:null,doctor:null,doctorUpdatedAvailable:!1,doctorLoading:!1,doctorError:null,drift:null,driftLoading:!1,driftError:null,scan:null,scanLoading:!1,scanError:null,operations:null,operationsLoading:!1,operationsError:null,loadSession:function(){return sr(function(){var n;return si(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),[4,lX("/api/auth/session")];case 1:return e({authenticated:!0,sessionChecked:!0,currentUser:r.sent().currentUser,error:null}),[4,t().loadUsers()];case 2:return r.sent(),[4,Promise.all([t().loadHarnesses(),t().loadBackups()])];case 3:return r.sent(),[4,t().loadDrift()];case 4:return r.sent(),[3,6];case 5:return e({authenticated:!1,sessionChecked:!0,error:sa(n=r.sent(),lK)&&401===n.status?null:l6(n)}),[3,6];case 6:return[2]}})})()},login:function(n){return sr(function(){var r;return si(this,function(a){switch(a.label){case 0:e({loading:!0,error:null}),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,lX("/api/auth/login",{method:"POST",body:JSON.stringify({password:n})})];case 2:return e({authenticated:!0,loading:!1,currentUser:a.sent().currentUser}),[4,t().loadUsers()];case 3:return a.sent(),[4,t().loadHarnesses()];case 4:return a.sent(),[3,6];case 5:throw e({loading:!1,error:l6(r=a.sent())}),r;case 6:return[2]}})})()},logout:function(){return sr(function(){return si(this,function(t){switch(t.label){case 0:return[4,lX("/api/auth/logout",{method:"POST"})];case 1:return t.sent(),e({authenticated:!1,currentUser:"",users:[],harnesses:[],backups:[],envFile:"",providers:null,doctor:null,doctorUpdatedAvailable:!1,drift:null}),[2]}})})()},loadUsers:function(){return sr(function(){var t;return si(this,function(n){switch(n.label){case 0:e({usersLoading:!0}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,lX("/api/users")];case 2:return e({users:(t=n.sent()).items,currentUser:t.currentUser,usersLoading:!1}),[3,4];case 3:return e({usersLoading:!1,error:l6(n.sent())}),[3,4];case 4:return[2]}})})()},switchUser:function(n){return sr(function(){var r;return si(this,function(a){switch(a.label){case 0:if(!n||n===t().currentUser)return[2];e({usersLoading:!0,loading:!0,error:null}),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,lX("/api/users/".concat(encodeURIComponent(n),"/select"),{method:"POST"})];case 2:return a.sent(),e({currentUser:n,harnesses:[],backups:[],envFile:"",providers:null,doctor:null,doctorUpdatedAvailable:!1,drift:null}),[4,t().loadUsers()];case 3:return a.sent(),[4,Promise.all([t().loadHarnesses(),t().loadBackups()])];case 4:return a.sent(),e({usersLoading:!1,loading:!1}),[3,6];case 5:throw e({usersLoading:!1,loading:!1,error:l6(r=a.sent())}),r;case 6:return[2]}})})()},loadHarnesses:function(){return sr(function(){var n,r;return si(this,function(a){switch(a.label){case 0:e({loading:!0,error:null}),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,lX("/api/harnesses")];case 2:return e({harnesses:(n=a.sent()).items,envFile:n.envFile,loading:!1}),[4,t().loadDrift()];case 3:return a.sent(),[3,5];case 4:if(sa(r=a.sent(),lK)&&401===r.status)return e({authenticated:!1,loading:!1,harnesses:[]}),[2];return e({loading:!1,error:l6(r)}),[3,5];case 5:return[2]}})})()},createProfile:function(e,n){return sr(function(){return si(this,function(r){switch(r.label){case 0:return[4,lX(lV(e),{method:"POST",body:JSON.stringify(n)})];case 1:return r.sent(),[4,t().loadHarnesses()];case 2:return r.sent(),[2]}})})()},updateProfile:function(e,n,r){return sr(function(){return si(this,function(a){switch(a.label){case 0:return[4,lX(lq(e,n),{method:"PATCH",body:JSON.stringify(r)})];case 1:return a.sent(),[4,t().loadHarnesses()];case 2:return a.sent(),[2]}})})()},deleteProfile:function(e,n){return sr(function(){return si(this,function(r){switch(r.label){case 0:return[4,lX(lq(e,n),{method:"DELETE"})];case 1:return r.sent(),[4,t().loadHarnesses()];case 2:return r.sent(),[2]}})})()},activateProfile:function(n,r){return sr(function(){var a,o,i,l;return si(this,function(s){switch(s.label){case 0:return[4,lX("".concat(lq(n,r),"/activate"),{method:"POST"})];case 1:return i=s.sent(),l=null!=(a=null==(o=t().harnesses.find(function(e){return e.id===n}))?void 0:o.label)?a:n,e({notice:[sl("notice.activated",t().currentUser,{harness:l,profile:r}),{key:"notice.activatedHint"}].concat(so(i.warnings.map(l5)))}),[4,t().loadHarnesses()];case 2:return s.sent(),[2]}})})()},activateOfficial:function(n){return sr(function(){var r,a,o,i;return si(this,function(l){switch(l.label){case 0:return[4,lX("/api/harnesses/".concat(n,"/official/activate"),{method:"POST"})];case 1:return o=l.sent(),i=null!=(r=null==(a=t().harnesses.find(function(e){return e.id===n}))?void 0:a.label)?r:n,e({notice:[sl("notice.officialRestored",t().currentUser,{harness:i}),{key:"notice.officialHint"}].concat(so(o.warnings.map(l5)))}),[4,t().loadHarnesses()];case 2:return l.sent(),[2]}})})()},previewProfile:function(e,t){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX("".concat(lq(e,t),"/preview"))];case 1:return[2,n.sent().targets]}})})()},loadBackups:function(){return sr(function(){var t;return si(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,lX(lW())];case 1:return e({backups:n.sent().items}),[3,3];case 2:return sa(t=n.sent(),lK)&&401===t.status||e({error:l6(t)}),[3,3];case 3:return[2]}})})()},loadBackupDetail:function(e){return sr(function(){return si(this,function(t){return[2,lX(lW(e))]})})()},restoreBackup:function(n){return sr(function(){return si(this,function(r){switch(r.label){case 0:return[4,lX("".concat(lW(n),"/restore"),{method:"POST"})];case 1:return r.sent(),e({notice:[{key:"backup.written"}]}),[4,Promise.all([t().loadHarnesses(),t().loadBackups()])];case 2:return r.sent(),[2]}})})()},loadProviders:function(){return sr(function(){var t;return si(this,function(n){switch(n.label){case 0:e({providersLoading:!0,providersError:null}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,lX(lZ())];case 2:return e({providers:n.sent().items,providersLoading:!1}),[3,4];case 3:if(sa(t=n.sent(),lK)&&401===t.status)return e({authenticated:!1,providersLoading:!1,providers:[]}),[2];return e({providersLoading:!1,providersError:l6(t)}),[3,4];case 4:return[2]}})})()},createProvider:function(e){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX(lZ(),{method:"POST",body:JSON.stringify(e)})];case 1:return n.sent(),[4,t().loadProviders()];case 2:return n.sent(),[2]}})})()},updateProvider:function(e,n){return sr(function(){var r;return si(this,function(a){switch(a.label){case 0:return[4,lX(lG(e),{method:"PATCH",body:JSON.stringify(n)})];case 1:return r=a.sent(),[4,t().loadProviders()];case 2:return a.sent(),[4,t().loadHarnesses()];case 3:return a.sent(),[4,t().loadDrift()];case 4:return a.sent(),[2,r]}})})()},deleteProvider:function(e){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX(lG(e),{method:"DELETE"})];case 1:return n.sent(),[4,t().loadProviders()];case 2:return n.sent(),[2]}})})()},revealProvider:function(e){return sr(function(){return si(this,function(t){return[2,lX("".concat(lG(e),"/reveal"))]})})()},probeDraft:function(e){return sr(function(){return si(this,function(t){switch(t.label){case 0:return[4,lX("/api/probe",{method:"POST",body:JSON.stringify(e)})];case 1:return[2,t.sent().result]}})})()},probeProfile:function(e,t){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX("".concat(lq(e,t),"/probe"),{method:"POST",body:JSON.stringify({})})];case 1:return[2,n.sent().result]}})})()},probeVaultEntry:function(e,t){return sr(function(){return si(this,function(n){switch(n.label){case 0:return[4,lX("".concat(lG(e),"/probe"),{method:"POST",body:JSON.stringify(t?{endpoint:t}:{})})];case 1:return[2,n.sent().result]}})})()},loadDoctor:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:e({doctorLoading:!0,doctorError:null}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,lX(n?"/api/doctor?harness=".concat(encodeURIComponent(n)):"/api/doctor")];case 2:return a=i.sent(),e({doctor:so((null!=(r=t().doctor)?r:[]).filter(function(e){return e.harness!==n})).concat(so(a.items.filter(function(e){return e.harness===n}))),doctorUpdatedAvailable:a.updatedAvailable,doctorLoading:!1}),[3,4];case 3:if(sa(o=i.sent(),lK)&&401===o.status)return e({authenticated:!1,doctorLoading:!1,doctor:[]}),[2];return e({doctorLoading:!1,doctorError:l6(o)}),[3,4];case 4:return[2]}})})()},loadDrift:function(){return sr(function(){var t,n;return si(this,function(r){switch(r.label){case 0:e({driftLoading:!0,driftError:null}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,lX(lJ())];case 2:return e({drift:null!=(t=r.sent().items)?t:[],driftLoading:!1}),[3,4];case 3:if(sa(n=r.sent(),lK)&&401===n.status)return e({authenticated:!1,driftLoading:!1,drift:[]}),[2];return e({driftLoading:!1,driftError:l6(n)}),[3,4];case 4:return[2]}})})()},reapplyDrift:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:return[4,lX("".concat(lJ(n),"/reapply"),{method:"POST"})];case 1:return o=i.sent(),e({notice:[{key:"drift.reapplied",params:{harness:null!=(r=null==(a=t().harnesses.find(function(e){return e.id===n}))?void 0:a.label)?r:n}}]}),[4,t().loadDrift()];case 2:return i.sent(),[2,o.files]}})})()},adoptDrift:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:return[4,lX("".concat(lJ(n),"/adopt"),{method:"POST"})];case 1:return o=i.sent(),e({notice:[{key:"drift.adopted",params:{harness:null!=(r=null==(a=t().harnesses.find(function(e){return e.id===n}))?void 0:a.label)?r:n}}]}),[4,t().loadHarnesses()];case 2:return i.sent(),[2,o]}})})()},loadScan:function(){return sr(function(){var t;return si(this,function(n){switch(n.label){case 0:e({scanLoading:!0,scanError:null}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,lX(lQ())];case 2:return e({scan:n.sent().items,scanLoading:!1}),[3,4];case 3:if(sa(t=n.sent(),lK)&&401===t.status)return e({authenticated:!1,scanLoading:!1,scan:[]}),[2];return e({scanLoading:!1,scanError:l6(t)}),[3,4];case 4:return[2]}})})()},importScan:function(e){return sr(function(){var n;return si(this,function(r){switch(r.label){case 0:return[4,lX("".concat(lQ(),"/import"),{method:"POST",body:JSON.stringify({selections:e})})];case 1:return n=r.sent(),[4,Promise.all([t().loadHarnesses(),t().loadProviders(),t().loadScan()])];case 2:return r.sent(),[2,n]}})})()},loadOperations:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:e({operationsLoading:!0,operationsError:null}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,lX(lY(n))];case 2:return a=i.sent(),e({operations:so((null!=(r=t().operations)?r:[]).filter(function(e){return e.harness!==n})).concat(so(a.items.filter(function(e){return e.harness===n}))),operationsLoading:!1}),[3,4];case 3:if(sa(o=i.sent(),lK)&&401===o.status)return e({authenticated:!1,operationsLoading:!1,operations:[]}),[2];return e({operationsLoading:!1,operationsError:l6(o)}),[3,4];case 4:return[2]}})})()},undoOperation:function(n){return sr(function(){var r,a,o;return si(this,function(i){switch(i.label){case 0:return[4,lX("".concat(lY(),"/").concat(encodeURIComponent(n),"/undo"),{method:"POST"})];case 1:return o=i.sent().receipt,e({notice:[{key:"operations.undone",params:{harness:null!=(r=null==(a=t().harnesses.find(function(e){return e.id===o.harness}))?void 0:a.label)?r:o.harness}}]}),[4,Promise.all([t().loadHarnesses(),t().loadBackups(),t().loadOperations(o.harness)])];case 2:return i.sent(),[2]}})})()},setNotice:function(t){return e({notice:t})},clearNotice:function(){return e({notice:null})}}},se(r)),Object.assign(n=e=>(function(e,t=e=>e){let n=y.useSyncExternalStore(e.subscribe,y.useCallback(()=>t(e.getState()),[e,t]),y.useCallback(()=>t(e.getInitialState()),[e,t]));return y.useDebugValue(n),n})(t,e),t),n);function sc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function su(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sc(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sd(e){var t,n=e.harnessId,r=(0,x.s9)().locale,a=(0,x.Bd)().t,o=ss(function(e){return e.backups}),i=ss(function(e){return e.loadBackups}),l=ss(function(e){return e.loadBackupDetail}),s=ss(function(e){return e.restoreBackup}),c=su((0,y.useState)(!1),2),u=c[0],d=c[1],f=su((0,y.useState)(null),2),p=f[0],h=f[1],m=su((0,y.useState)(null),2),v=m[0],b=m[1],w=su((0,y.useState)(null),2),k=w[0],j=w[1],S=su((0,y.useState)(!1),2),O=S[0],C=S[1],N=o.filter(function(e){return e.harness===n}),P=null!=(t=o.find(function(e){return e.id===p}))?t:null,E=F[n];return(0,y.useEffect)(function(){i()},[i]),(0,y.useEffect)(function(){d(!1),h(null)},[n]),(0,y.useEffect)(function(){if(!p){b(null),j(null),C(!1);return}var e=!1;return b(null),j(null),C(!0),l(p).then(function(t){e||b(t)}).catch(function(t){e||j(l8(t,"backup.diffFailed"))}).finally(function(){e||C(!1)}),function(){e=!0}},[p,l]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(oo,{className:"w-full justify-between",size:"sm",variant:"outline",onClick:function(){return d(!0)},children:[(0,g.jsx)(rE,{}),a("backup.history"),N.length>0?(0,g.jsx)(aI,{variant:"secondary",children:N.length}):null]}),(0,g.jsx)(lc,{open:u,onOpenChange:d,children:(0,g.jsxs)(lT,{className:"max-w-xl",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:a("backup.historyTitle",{harness:E})}),(0,g.jsx)(lI,{children:a("backup.historyIntro")})]}),0===N.length?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:a("backup.empty")}):(0,g.jsx)("ul",{className:"max-h-80 divide-y overflow-y-auto rounded-xl border",children:N.map(function(e){var t,n,o;return(0,g.jsxs)("li",{className:"flex items-center gap-3 px-3 py-2.5 hover:bg-muted/30",children:[(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,g.jsx)("p",{className:"truncate text-sm font-medium",children:e.profile}),e.current?(0,g.jsx)(aI,{children:a("backup.currentBadge")}):null]}),(0,g.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[(t=e.createdAt,n=r,Number.isNaN((o=new Date(t)).getTime())?t:o.toLocaleString(n))," \xb7"," ",a("backup.fileCount",{count:e.files.length}),e.files.some(function(e){return!e.existed})?" \xb7 ".concat(a("backup.withDeletions")):""]})]}),e.current?null:(0,g.jsx)(oo,{size:"sm",variant:"outline",className:"shrink-0",onClick:function(){return h(e.id)},children:a("backup.restore")})]},e.id)})})]})}),(0,g.jsx)(lc,{open:null!==P,onOpenChange:function(e){return!e&&h(null)},children:(0,g.jsxs)(lT,{className:"flex max-h-[85vh] w-[min(64rem,calc(100vw-2rem))] max-w-5xl flex-col overflow-hidden",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:a("backup.restoreHistoryTitle")}),(0,g.jsx)(lI,{children:a("backup.restoreHistoryBody")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[O?(0,g.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:a("backup.comparing")}):null,k?(0,g.jsx)("p",{className:"py-8 text-center text-sm text-destructive",children:l7(a,k)}):null,v?(0,g.jsx)(aK,{files:v.files}):null]}),(0,g.jsxs)(lR,{children:[(0,g.jsx)(oo,{variant:"outline",onClick:function(){return h(null)},children:a("common.cancel")}),(0,g.jsx)(oo,{disabled:O||null!==k||null===v,onClick:function(){p&&s(p).then(function(){h(null),d(!1)})},children:a("backup.confirmRestore")})]})]})})]})}let sf=O("stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]),sp=O("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),sh=O("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);var sm={ok:"bg-emerald-500",warn:"bg-amber-500",error:"bg-red-500",unknown:"bg-slate-400"};function sg(e){var t,n=e.harnessId,r=e.open,a=e.onOpenChange,o=(0,x.Bd)().t,i=ss(function(e){return e.doctor}),l=ss(function(e){return e.doctorLoading}),s=ss(function(e){return e.doctorError}),c=ss(function(e){return e.doctorUpdatedAvailable}),u=ss(function(e){return e.loadDoctor}),d=null!=(t=null==i?void 0:i.find(function(e){return e.harness===n}))?t:null;(0,y.useEffect)(function(){r&&null===d&&u(n)},[r,d,n,u]);var f=function(e){var t={ok:0,warn:0,error:0,unknown:0};if(!e)return t;var n=!0,r=!1,a=void 0;try{for(var o,i=e.checks[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l=o.value;t[l.status]++}}catch(e){r=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw a}}return t}(d),p=F[n];return(0,g.jsx)(lc,{open:r,onOpenChange:a,children:(0,g.jsxs)(lT,{className:"flex max-h-[88vh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl",children:[(0,g.jsxs)(lA,{className:"shrink-0 space-y-1.5 px-6 pb-4 pt-6 pr-12",children:[(0,g.jsx)(lL,{children:o("doctor.titleFor",{harness:p})}),(0,g.jsx)(lI,{children:o("doctor.intro")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-6",children:[l&&null===d?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:o("doctor.checking")}):null,s?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,s)}):null,d?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[f.ok>0?(0,g.jsx)(aI,{variant:"secondary",children:o("doctor.countOk",{count:f.ok})}):null,f.warn>0?(0,g.jsx)(aI,{variant:"outline",className:"border-amber-500/30 text-amber-700 dark:text-amber-300",children:o("doctor.countWarn",{count:f.warn})}):null,f.error>0?(0,g.jsx)(aI,{variant:"destructive",children:o("doctor.countError",{count:f.error})}):null,f.unknown>0?(0,g.jsx)(aI,{variant:"outline",children:o("doctor.countUnknown",{count:f.unknown})}):null,c?(0,g.jsxs)("span",{className:"ml-auto flex items-center gap-1 text-xs text-emerald-600 dark:text-emerald-400",children:[(0,g.jsx)(sh,{className:"size-3.5"}),o("doctor.updateAvailable")]}):null]}),(0,g.jsx)(sy,{checks:d.checks})]}):null,null!==d||l||s?null:(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:o("doctor.notRun")})]}),(0,g.jsxs)(lR,{className:"shrink-0 px-6 py-4",children:[(0,g.jsxs)(oo,{variant:"outline",disabled:l,onClick:function(){u(n)},children:[(0,g.jsx)(sp,{className:l?"animate-spin":void 0}),o("doctor.rerun")]}),(0,g.jsx)(oo,{onClick:function(){return a(!1)},children:o("doctor.close")})]})]})})}function sy(e){var t=e.checks,n=(0,x.Bd)().t;return 0===t.length?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:n("doctor.noChecks")}):(0,g.jsx)("ul",{className:"divide-y rounded-xl border",children:t.map(function(e){var t;return(0,g.jsxs)("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[(0,g.jsx)("span",{className:aR("mt-1.5 size-2 shrink-0 rounded-full",sm[e.status]),"aria-hidden":!0}),(0,g.jsx)("div",{className:"min-w-0 flex-1",children:(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,g.jsx)("p",{className:"text-sm leading-relaxed",children:l7(n,{key:null!=(t=e.code)?t:"doctor.unknownCheck",params:e.params,fallback:e.label})}),(0,g.jsx)("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:n("doctor.status.".concat(e.status))})]})})]},e.id)})})}var sv=Object.defineProperty,sb=(e,t)=>sv(e,"name",{value:t,configurable:!0}),[sx,sw]=oh("AlertDialog",[li]),sk=li(),sj=sb(e=>{let{__scopeAlertDialog:t,...n}=e,r=sk(t);return(0,g.jsx)(lc,{...r,...n,modal:!0})},"AlertDialog");y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lu,{...a,...r,ref:t})},"AlertDialogTrigger"));var sS=sb(e=>{let{__scopeAlertDialog:t,...n}=e,r=sk(t);return(0,g.jsx)(lh,{...r,...n})},"AlertDialogPortal"),sO=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lg,{...a,...r,ref:t})},"AlertDialogOverlay")),[sC,sN]=sx("AlertDialogContent"),sP=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,children:r,...a}=e,o=sk(n),i=aY(t,y.useRef(null)),l=y.useRef(null);return(0,g.jsx)(sC,{scope:n,cancelRef:l,children:(0,g.jsx)(lx,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:oc(a.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},"AlertDialogContent")),sE=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lS,{...a,...r,ref:t})},"AlertDialogTitle")),s_=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lO,{...a,...r,ref:t})},"AlertDialogDescription")),sz=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,a=sk(n);return(0,g.jsx)(lC,{...a,...r,ref:t})},"AlertDialogAction")),sT=y.forwardRef(sb(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=sN("AlertDialogCancel",n),o=sk(n),i=aY(t,a);return(0,g.jsx)(lC,{...o,...r,ref:i})},"AlertDialogCancel"));function sA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function sR(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function sL(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(sO,sA({"data-slot":"alert-dialog-overlay",className:aR("fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t)},n))}function sI(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsxs)(sS,{children:[(0,g.jsx)(sL,{}),(0,g.jsx)(sP,sA({"data-slot":"alert-dialog-content",className:aR("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-card p-6 shadow-2xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-2xl",t)},n))]})}function sM(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)("div",sA({className:aR("flex flex-col space-y-2 text-center sm:text-left",t)},n))}function sD(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)("div",sA({className:aR("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t)},n))}function sF(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(sE,sA({className:aR("text-lg font-semibold",t)},n))}function s$(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(s_,sA({className:aR("text-sm text-muted-foreground",t)},n))}function sU(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(sz,sA({className:aR(oa(),t)},n))}function sH(e){var t=e.className,n=sR(e,["className"]);return(0,g.jsx)(sT,sA({className:aR(oa({variant:"outline"}),"mt-2 sm:mt-0",t)},n))}function sB(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sK(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sB(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sB(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sV(e){switch(e){case"in-sync":return"border-transparent bg-emerald-500/15 text-emerald-600 dark:text-emerald-400";case"drifted":return"border-amber-500/30 text-amber-700 dark:text-amber-300";case"missing":case"invalid":return"border-transparent bg-destructive/15 text-destructive";default:return""}}function sq(e){var t,n=e.harness,r=e.open,a=e.onOpenChange,o=(0,x.Bd)().t,i=ss(function(e){return e.drift}),l=ss(function(e){return e.driftLoading}),s=ss(function(e){return e.reapplyDrift}),c=ss(function(e){return e.adoptDrift}),u=sK((0,y.useState)(null),2),d=u[0],f=u[1],p=sK((0,y.useState)(null),2),h=p[0],m=p[1],v=(0,y.useMemo)(function(){var e;return null!=(e=null==i?void 0:i.find(function(e){return e.harness===n.id}))?e:null},[i,n.id]),b=null!=(t=null==v?void 0:v.files.filter(function(e){return"in-sync"!==e.status}))?t:[],w=(null==v?void 0:v.active)===!0;return(0,g.jsxs)(lc,{open:r,onOpenChange:a,children:[(0,g.jsxs)(lT,{className:"flex max-h-[85vh] w-[min(64rem,calc(100vw-2rem))] max-w-5xl flex-col overflow-hidden",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:o("drift.dialogTitle",{harness:n.label})}),(0,g.jsx)(lI,{children:o(w?"drift.legend":"drift.noActiveProfile")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[l&&null===v?(0,g.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:o("drift.checking")}):null,null!==v||l?null:(0,g.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:o("drift.noData")}),v&&!w?(0,g.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:o("drift.nothingToCompare")}):null,v&&w?(0,g.jsx)("div",{className:"space-y-3",children:0===b.length?(0,g.jsx)("p",{className:"py-4 text-center text-sm text-muted-foreground",children:o("drift.allInSync")}):b.map(function(e){return(0,g.jsx)(sW,{file:e},e.key)})}):null]}),h?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,h)}):null,(0,g.jsxs)(lR,{children:[(0,g.jsx)(oo,{variant:"outline",disabled:null===v||!w,onClick:function(){return f("adopt")},children:o("drift.adopt")}),(0,g.jsx)(oo,{disabled:null===v||!w,onClick:function(){return f("reapply")},children:o("drift.reapply")})]})]}),(0,g.jsx)(sj,{open:"reapply"===d,onOpenChange:function(e){return!e&&f(null)},children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:o("drift.reapplyTitle")}),(0,g.jsx)(s$,{children:o("drift.reapplyBody",{harness:n.label})})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:o("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){f(null),m(null),s(n.id).then(function(){return a(!1)}).catch(function(e){m(l8(e,"drift.reapplyFailed"))})},children:o("drift.confirmReapply")})]})]})}),(0,g.jsx)(sj,{open:"adopt"===d,onOpenChange:function(e){return!e&&f(null)},children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:o("drift.adoptTitle")}),(0,g.jsx)(s$,{children:o("drift.adoptBody")})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:o("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){f(null),m(null),c(n.id).then(function(){return a(!1)}).catch(function(e){m(l8(e,"drift.adoptFailed"))})},children:o("drift.confirmAdopt")})]})]})})]})}function sW(e){var t=e.file,n=(0,x.Bd)().t;return(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,g.jsx)(aI,{className:sV(t.status),children:n("drift.status.".concat(t.status))}),(0,g.jsx)("p",{className:"min-w-0 truncate font-mono text-xs text-muted-foreground",title:t.path,children:t.path})]}),(0,g.jsx)(aK,{files:[{path:t.path,existed:null!==t.currentContent,content:t.expectedContent,currentContent:t.currentContent}]})]})}function sZ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sG(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sZ(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sJ(e){var t,n,r,a=e.harness,o=(0,x.Bd)().t,i=ss(function(e){return e.doctor}),l=ss(function(e){return e.doctorLoading}),s=ss(function(e){return e.doctorError}),c=ss(function(e){return e.loadDoctor}),u=ss(function(e){return e.drift}),d=ss(function(e){return e.driftLoading}),f=ss(function(e){return e.driftError}),p=ss(function(e){return e.loadDrift}),h=sG((0,y.useState)(!1),2),m=h[0],v=h[1],b=sG((0,y.useState)(!1),2),w=b[0],k=b[1],j=null!=(t=null==i?void 0:i.find(function(e){return e.harness===a.id}))?t:null,S=null!=(n=null==u?void 0:u.find(function(e){return e.harness===a.id}))?n:null,O=null!=(r=null==S?void 0:S.files.filter(function(e){return"in-sync"!==e.status}))?r:[],C=null!==S&&S.active&&O.length>0&&"in-sync"!==S.status;return(0,y.useEffect)(function(){c(a.id)},[a.id,c]),(0,y.useEffect)(function(){null===u&&p()},[u,p]),(0,g.jsxs)("section",{className:"rounded-2xl border bg-card p-5 shadow-[0_12px_34px_-28px_rgb(36_39_70/0.38)]",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(sf,{className:"size-4 text-primary"}),(0,g.jsx)("h3",{className:"font-semibold",children:o("doctor.title")}),(0,g.jsx)("span",{className:"ml-auto",children:(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":o("doctor.rerun"),onClick:function(){c(a.id),p()},children:(0,g.jsx)(sp,{className:l||d?"animate-spin":void 0})})})]}),(0,g.jsxs)("div",{className:"mt-4 space-y-3",children:[s?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,s)}):null===j?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:o("doctor.checking")}):(0,g.jsx)(sQ,{report:j}),f?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,f)}):null===S?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:o("drift.checking")}):(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(sY,{report:S}),O.length>0?(0,g.jsxs)("ul",{className:"space-y-1",children:[O.slice(0,3).map(function(e){return(0,g.jsxs)("li",{className:"flex items-center gap-2 text-xs",children:[(0,g.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-destructive/70"}),(0,g.jsx)("span",{className:"truncate font-mono text-muted-foreground",children:e.path.split("/").pop()}),(0,g.jsx)("span",{className:"ml-auto shrink-0 font-mono text-[11px] text-muted-foreground",children:o("drift.status.".concat(e.status))})]},e.key)}),O.length>3?(0,g.jsx)("li",{className:"pl-3.5 text-xs text-muted-foreground",children:o("drift.moreFiles",{count:O.length-3})}):null]}):null]})]}),(0,g.jsxs)("div",{className:"mt-4 grid gap-2 ".concat(C?"grid-cols-2":"grid-cols-1"),children:[(0,g.jsx)(oo,{size:"sm",variant:"outline",disabled:null===j,onClick:function(){return v(!0)},children:o("doctor.viewDetails")}),C?(0,g.jsx)(oo,{size:"sm",variant:"outline",onClick:function(){return k(!0)},children:o("drift.viewDiff")}):null]}),(0,g.jsx)(sg,{harnessId:a.id,open:m,onOpenChange:v}),(0,g.jsx)(sq,{harness:a,open:w,onOpenChange:k})]})}function sQ(e){var t=e.report,n=(0,x.Bd)().t,r=function(e){var t={ok:0,warn:0,error:0,unknown:0},n=!0,r=!1,a=void 0;try{for(var o,i=e.checks[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l=o.value;t[l.status]++}}catch(e){r=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw a}}return t}(t),a=["error","warn","ok","unknown"].filter(function(e){return r[e]>0});return 0===a.length?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:n("doctor.noChecks")}):(0,g.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(function(e){var t,a;return(0,g.jsx)(aI,{variant:"error"===(t=e)?"destructive":"ok"===t?"secondary":"outline",className:"warn"===e?"border-amber-500/30 text-amber-700 dark:text-amber-300":void 0,children:n("doctor.count".concat((a=e,"".concat(a[0].toUpperCase()).concat(a.slice(1)))),{count:r[e]})},e)})})}function sY(e){var t=e.report,n=(0,x.Bd)().t;if(!t.active)return(0,g.jsx)(aI,{variant:"secondary",children:n("harness.inactive")});if("in-sync"===t.status)return(0,g.jsx)(aI,{variant:"secondary",children:n("drift.none")});if("drifted"===t.status){var r=t.files.filter(function(e){return"in-sync"!==e.status}).length;return(0,g.jsx)(aI,{variant:"outline",className:"border-amber-500/30 text-amber-700 dark:text-amber-300",children:n("drift.mismatch",{count:r})})}return(0,g.jsx)(aI,{className:sV(t.status),children:n("drift.status.".concat(t.status))})}let sX=O("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),s0=O("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),s1=O("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),s2=O("cloud-upload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]),s4=O("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),s3=O("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),s5=O("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),s6=O("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),s8=O("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);function s9(e){let[t,n]=y.useState(void 0);return og(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,a;if(!Array.isArray(t)||!t.length)return;let o=t[0];if("borderBoxSize"in o){let e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,a=t.blockSize}else r=e.offsetWidth,a=e.offsetHeight;n({width:r,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(0,Object.defineProperty)(s9,"name",{value:"useSize",configurable:!0});var s7=Object.defineProperty,ce=(e,t)=>s7(e,"name",{value:t,configurable:!0}),ct="Checkbox",[cn,cr]=oh(ct),[ca,co]=cn(ct);function ci(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:a,disabled:o,form:i,name:l,onCheckedChange:s,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,p]=oP({prop:n,defaultProp:a??!1,onChange:s,caller:ct}),[h,m]=y.useState(null),[v,b]=y.useState(null),x=y.useRef(!1),[w,k]=y.useReducer(e=>e+1,0),j=!h||!!i||!!h.closest("form"),S={checked:f,disabled:o,setChecked:p,control:h,setControl:m,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:k,required:c,defaultChecked:!cf(a)&&a,isFormControl:j,bubbleInput:v,setBubbleInput:b};return(0,g.jsx)(ca,{scope:t,...S,children:cd(d)?d(S):r})}ce(ci,"CheckboxProvider");var cl=y.forwardRef(ce(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},a){let{control:o,value:i,disabled:l,checked:s,required:c,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:h,bubbleInput:m}=co("CheckboxTrigger",e),v=aY(a,u),b=y.useRef(s);return y.useEffect(()=>{let e=o?.form;if(e){let t=ce(()=>d(b.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[o,d]),(0,g.jsx)(oR.button,{type:"button",role:"checkbox","aria-checked":cf(s)?"mixed":s,"aria-required":c,"data-state":cp(s),"data-disabled":l?"":void 0,disabled:l,value:i,...r,ref:v,onKeyDown:oc(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:oc(n,e=>{p(),d(e=>!!cf(e)||!e),m&&h&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},"CheckboxTrigger")),cs=y.forwardRef(ce(function(e,t){let{__scopeCheckbox:n,name:r,checked:a,defaultChecked:o,required:i,disabled:l,value:s,onCheckedChange:c,form:u,...d}=e;return(0,g.jsx)(ci,{__scopeCheckbox:n,checked:a,defaultChecked:o,disabled:l,required:i,onCheckedChange:c,name:r,form:u,value:s,internal_do_not_use_render:({isFormControl:e})=>(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(cl,{...d,ref:t,__scopeCheckbox:n}),e&&(0,g.jsx)(cu,{__scopeCheckbox:n})]})})},"Checkbox")),cc=y.forwardRef(ce(function(e,t){let{__scopeCheckbox:n,forceMount:r,...a}=e,o=co("CheckboxIndicator",n);return(0,g.jsx)(il,{present:r||cf(o.checked)||!0===o.checked,children:(0,g.jsx)(oR.span,{"data-state":cp(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),cu=y.forwardRef(ce(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:a,hasConsumerStoppedPropagationRef:o,userInteractionCount:i,checked:l,defaultChecked:s,required:c,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:m}=co("CheckboxBubbleInput",e),v=aY(r,m),b=s9(a),x=y.useRef(!1),w=y.useRef(l),k=y.useRef(i);y.useEffect(()=>{if(!h)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,t=i!==k.current;k.current=i;let n=w.current!==l;w.current=l;let r=!(t&&o.current);if(n&&e){x.current=!t;let n=new Event("click",{bubbles:r});h.indeterminate=cf(l),e.call(h,!cf(l)&&l),h.dispatchEvent(n),x.current=!1}},[h,l,o,i]);let j=y.useRef(!cf(l)&&l);return(0,g.jsx)(oR.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??j.current,required:c,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:v,onClick:oc(t,e=>{x.current&&e.stopPropagation()}),style:{...n.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function cd(e){return"function"==typeof e}function cf(e){return"indeterminate"===e}function cp(e){return cf(e)?"indeterminate":e?"checked":"unchecked"}function ch(e){var t,n,r=e.className,a=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className"]);return(0,g.jsx)(cs,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"checkbox",className:aR("peer size-4 shrink-0 cursor-pointer rounded-[5px] border border-input bg-card shadow-[0_1px_2px_rgb(20_24_40/0.04)] outline-none transition-[border-color,box-shadow,background-color] hover:border-ring/35 focus-visible:border-ring/50 focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:focus-visible:border-destructive aria-invalid:focus-visible:ring-destructive/25 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",r)},a),n=n={children:(0,g.jsx)(cc,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:(0,g.jsx)(s5,{className:"size-3",strokeWidth:3.5})})},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function cm(e){var t=e.className,n=e.type,r=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className","type"]);return(0,g.jsx)("input",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({type:n,"data-slot":"input",className:aR("flex h-10 w-full rounded-[10px] border border-input bg-card px-3 py-1 text-base shadow-[0_1px_2px_rgb(20_24_40/0.04)] transition-[border-color,box-shadow] file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:focus-visible:border-destructive aria-invalid:focus-visible:ring-destructive/25 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t)},r))}ce(cd,"isFunction"),ce(cf,"isIndeterminate"),ce(cp,"getState");var cg=Object.defineProperty,cy=y.forwardRef(cg(function(e,t){return(0,g.jsx)(oR.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},"name",{value:"Label",configurable:!0}));function cv(e){var t=e.className,n=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className"]);return(0,g.jsx)(cy,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"label",className:aR("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t)},n))}function cb(e,[t,n]){return Math.min(n,Math.max(t,e))}(0,Object.defineProperty)(cb,"name",{value:"clamp",configurable:!0});var cx=Object.defineProperty,cw=(e,t)=>cx(e,"name",{value:t,configurable:!0});function ck(e){let t=e+"CollectionProvider",[n,r]=oh(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=cw(e=>{let{scope:t,children:n}=e,r=y.useRef(null),o=y.useRef(new Map).current;return(0,g.jsx)(a,{scope:t,itemMap:o,collectionRef:r,children:n})},"CollectionProvider");i.displayName=t;let l=e+"CollectionSlot",s=a1(l),c=y.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=aY(t,o(l,n).collectionRef);return(0,g.jsx)(s,{ref:a,children:r})});c.displayName=l;let u=e+"CollectionItemSlot",d="data-radix-collection-item",f=a1(u),p=y.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,i=y.useRef(null),l=aY(t,i),s=o(u,n);return y.useEffect(()=>(s.itemMap.set(i,{ref:i,...a}),()=>void s.itemMap.delete(i))),(0,g.jsx)(f,{...{[d]:""},ref:l,children:r})});function h(t){let n=o(e+"CollectionConsumer",t);return y.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return p.displayName=u,cw(h,"useCollection"),[{Provider:i,Slot:c,ItemSlot:p},h,r]}cw(ck,"createCollection");var cj=new WeakMap,cS=class e extends Map{static{cw(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],cj.set(this,!0)}set(e,t){return cj.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r,a=this.has(t),o=this.#e.length,i=cN(e),l=i>=0?i:o+i,s=l<0||l>=o?-1:l;if(s===this.size||a&&s===this.size-1||-1===s)return this.set(t,n),this;let c=this.size+ +!a;i<0&&l++;let u=[...this.#e],d=!1;for(let e=l;e<c;e++)if(l===e){let o=u[e];u[e]===t&&(o=u[e+1]),a&&this.delete(t),r=this.get(o),this.set(t,n)}else{d||u[e-1]!==t||(d=!0);let n=u[d?e:e-1],a=r;r=this.get(n),this.delete(n),this.set(n,a)}return this}with(t,n,r){let a=new e(this);return a.insert(t,n,r),a}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=cO(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=cO(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return cO(this.#e,e)}from(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return -1}filter(t,n){let r=[],a=0;for(let e of this)Reflect.apply(t,n,[e,a,this])&&r.push(e),a++;return new e(r)}map(t,n){let r=[],a=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,a,this])]),a++;return new e(r)}reduce(...e){let[t,n]=e,r=0,a=n??this.at(0);for(let n of this)a=0===r&&1===e.length?n:Reflect.apply(t,this,[a,n,r,this]),r++;return a}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let a=this.at(n);r=n===this.size-1&&1===e.length?a:Reflect.apply(t,this,[r,a,n,this])}return r}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,a=this.size-1;if(void 0===t)return r;t<0&&(t+=this.size),void 0!==n&&n>0&&(a=n-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function cO(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let n=cC(e,t);return -1===n?void 0:e[n]}function cC(e,t){let n=e.length,r=cN(t),a=r>=0?r:n+r;return a<0||a>=n?-1:a}function cN(e){return e!=e||0===e?0:Math.trunc(e)}function cP(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null==e||null==t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}function cE(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function c_(e,t){return e[1].element&&t[1].element?cE(e[1].element,t[1].element)?-1:1:0}function cz(e){return new MutationObserver(t=>{for(let n of t)if("childList"===n.type)return void e()})}cw(cO,"at"),cw(cC,"toSafeIndex"),cw(cN,"toSafeInteger"),cw(function(e){let t=e+"CollectionProvider",[n,r]=oh(t),[a,o]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new cS,setItemMap:cw(()=>void 0,"setItemMap")}),i=cw(({state:e,...t})=>e?(0,g.jsx)(s,{...t,state:e}):(0,g.jsx)(l,{...t}),"CollectionProvider");i.displayName=t;let l=cw(e=>{let t=m();return(0,g.jsx)(s,{...e,state:t})},"CollectionInit");l.displayName=t+"Init";let s=cw(e=>{let{scope:t,children:n,state:r}=e,o=y.useRef(null),[i,l]=y.useState(null),s=aY(o,l),[c,u]=r;return y.useEffect(()=>{if(!i)return;let e=cz(()=>{});return e.observe(i,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[i]),(0,g.jsx)(a,{scope:t,itemMap:c,setItemMap:u,collectionRef:s,collectionRefObject:o,collectionElement:i,children:n})},"CollectionProviderImpl");s.displayName=t+"Impl";let c=e+"CollectionSlot",u=a1(c),d=y.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=aY(t,o(c,n).collectionRef);return(0,g.jsx)(u,{ref:a,children:r})});d.displayName=c;let f=e+"CollectionItemSlot",p=a1(f),h=y.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,i=y.useRef(null),[l,s]=y.useState(null),c=aY(t,i,s),{setItemMap:u}=o(f,n),d=y.useRef(a);cP(d.current,a)||(d.current=a);let h=d.current;return y.useEffect(()=>(u(e=>l?e.has(l)?e.set(l,{...h,element:l}).toSorted(c_):(e.set(l,{...h,element:l}),e.toSorted(c_)):e),()=>{u(e=>l&&e.has(l)?(e.delete(l),new cS(e)):e)}),[l,h,u]),(0,g.jsx)(p,{"data-radix-collection-item":"",ref:c,children:r})});function m(){return y.useState(new cS)}function v(t){let{itemMap:n}=o(e+"CollectionConsumer",t);return n}return h.displayName=f,cw(m,"useInitCollection"),cw(v,"useCollection"),[{Provider:i,Slot:d,ItemSlot:h},{createCollectionScope:r,useCollection:v,useInitCollection:m}]},"createCollection"),cw(cP,"shallowEqual"),cw(cE,"isElementPreceding"),cw(c_,"sortByDocumentPosition"),cw(cz,"getChildListObserver");var cT=Object.defineProperty,cA=y.createContext(void 0);function cR(e){let t=y.useContext(cA);return e||t||"ltr"}cT(cR,"name",{value:"useDirection",configurable:!0});let cL=["top","right","bottom","left"],cI=Math.min,cM=Math.max,cD=Math.round,cF=Math.floor,c$=e=>({x:e,y:e}),cU={left:"right",right:"left",bottom:"top",top:"bottom"};function cH(e,t){return"function"==typeof e?e(t):e}function cB(e){return e.split("-")[0]}function cK(e){return e.split("-")[1]}function cV(e){return"x"===e?"y":"x"}function cq(e){return"y"===e?"height":"width"}function cW(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function cZ(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let cG=["left","right"],cJ=["right","left"],cQ=["top","bottom"],cY=["bottom","top"];function cX(e){let t=cB(e);return cU[t]+e.slice(t.length)}function c0(e){var t,n,r,a;return"number"!=typeof e?{top:null!=(t=e.top)?t:0,right:null!=(n=e.right)?n:0,bottom:null!=(r=e.bottom)?r:0,left:null!=(a=e.left)?a:0}:{top:e,right:e,bottom:e,left:e}}function c1(e){let{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function c2(e,t,n){let r,{reference:a,floating:o}=e,i=cW(t),l=cV(cW(t)),s=cq(l),c=cB(t),u=a.x+a.width/2-o.width/2,d=a.y+a.height/2-o.height/2,f=a[s]/2-o[s]/2;switch(c){case"top":r={x:u,y:a.y-o.height};break;case"bottom":r={x:u,y:a.y+a.height};break;case"right":r={x:a.x+a.width,y:d};break;case"left":r={x:a.x-o.width,y:d};break;default:r={x:a.x,y:a.y}}let p=cK(t);return p&&(r[l]+=f*("end"===p?1:-1)*(n&&"y"===i?-1:1)),r}async function c4(e,t){var n;void 0===t&&(t={});let{x:r,y:a,platform:o,rects:i,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=cH(t,e),h=c0(p),m=l[f?"floating"===d?"reference":"floating":d],g=c1(await o.getClippingRect({element:null==(n=await (null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await (null==o.getDocumentElement?void 0:o.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:s})),y="floating"===d?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,v=await (null==o.getOffsetParent?void 0:o.getOffsetParent(l.floating)),b=await (null==o.isElement?void 0:o.isElement(v))&&await (null==o.getScale?void 0:o.getScale(v))||{x:1,y:1},x=c1(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:s}):y);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}let c3=async(e,t,n)=>{let{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:c4},s=await (null==i.isRTL?void 0:i.isRTL(t)),c=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:d}=c2(c,r,s),f=r,p=0,h={};for(let n=0;n<o.length;n++){let m=o[n];if(!m)continue;let{name:g,fn:y}=m,{x:v,y:b,data:x,reset:w}=await y({x:u,y:d,initialPlacement:r,placement:f,strategy:a,middlewareData:h,rects:c,platform:l,elements:{reference:e,floating:t}});u=null!=v?v:u,d=null!=b?b:d,h[g]={...h[g],...x},w&&p<50&&(p++,"object"==typeof w&&(w.placement&&(f=w.placement),w.rects&&(c=!0===w.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):w.rects),{x:u,y:d}=c2(c,f,s)),n=-1)}return{x:u,y:d,placement:f,strategy:a,middlewareData:h}};function c5(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function c6(e){return cL.some(t=>e[t]>=0)}let c8=new Set(["left","top"]);async function c9(e,t){let{placement:n,platform:r,elements:a}=e,o=await (null==r.isRTL?void 0:r.isRTL(a.floating)),i=cB(n),l=cK(n),s="y"===cW(n),c=c8.has(i)?-1:1,u=o&&s?-1:1,d=cH(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&"number"==typeof h&&(p="end"===l?-1*h:h),s?{x:p*u,y:f*c}:{x:f*c,y:p*u}}function c7(){return"u">typeof window}function ue(e){return ur(e)?(e.nodeName||"").toLowerCase():"#document"}function ut(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function un(e){var t;return null==(t=(ur(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ur(e){return!!c7()&&(e instanceof Node||e instanceof ut(e).Node)}function ua(e){return!!c7()&&(e instanceof Element||e instanceof ut(e).Element)}function uo(e){return!!c7()&&(e instanceof HTMLElement||e instanceof ut(e).HTMLElement)}function ui(e){return!(!c7()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ut(e).ShadowRoot)}function ul(e){let{overflow:t,overflowX:n,overflowY:r,display:a}=um(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==a&&"contents"!==a}function us(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let uc=/transform|translate|scale|rotate|perspective|filter/,uu=/paint|layout|strict|content/,ud=e=>!!e&&"none"!==e;function uf(e){let t=ua(e)?um(e):e;return ud(t.transform)||ud(t.translate)||ud(t.scale)||ud(t.rotate)||ud(t.perspective)||!up()&&(ud(t.backdropFilter)||ud(t.filter))||uc.test(t.willChange||"")||uu.test(t.contain||"")}function up(){return null==e&&(e="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),e}function uh(e){return/^(html|body|#document)$/.test(ue(e))}function um(e){return ut(e).getComputedStyle(e)}function ug(e){return ua(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uy(e){if("html"===ue(e))return e;let t=e.assignedSlot||e.parentNode||ui(e)&&e.host||un(e);return ui(t)?t.host:t}function uv(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let a=function e(t){let n=uy(t);return uh(n)?(t.ownerDocument||t).body:uo(n)&&ul(n)?n:e(n)}(e),o=a===(null==(r=e.ownerDocument)?void 0:r.body),i=ut(a);if(!o)return t.concat(a,uv(a,[],n));{let e=ub(i);return t.concat(i,i.visualViewport||[],ul(a)?a:[],e&&n?uv(e):[])}}function ub(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ux(e){let t=um(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,a=uo(e),o=a?e.offsetWidth:n,i=a?e.offsetHeight:r,l=cD(n)!==o||cD(r)!==i;return l&&(n=o,r=i),{width:n,height:r,$:l}}function uw(e){return ua(e)?e:e.contextElement}function uk(e){let t=uw(e);if(!uo(t))return c$(1);let n=t.getBoundingClientRect(),{width:r,height:a,$:o}=ux(t),i=(o?cD(n.width):n.width)/r,l=(o?cD(n.height):n.height)/a;return i&&Number.isFinite(i)||(i=1),l&&Number.isFinite(l)||(l=1),{x:i,y:l}}let uj=c$(0);function uS(e){let t=ut(e);return up()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:uj}function uO(e,t,n,r){var a;void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),i=uw(e),l=c$(1);t&&(r?ua(r)&&(l=uk(r)):l=uk(e));let s=(void 0===(a=n)&&(a=!1),r&&a&&r===ut(i))?uS(i):c$(0),c=(o.left+s.x)/l.x,u=(o.top+s.y)/l.y,d=o.width/l.x,f=o.height/l.y;if(i&&r){let e=ut(i),t=ua(r)?ut(r):r,n=e,a=ub(n);for(;a&&t!==n;){let e=uk(a),t=a.getBoundingClientRect(),r=um(a),o=t.left+(a.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,u*=e.y,d*=e.x,f*=e.y,c+=o,u+=i,a=ub(n=ut(a))}}return c1({width:d,height:f,x:c,y:u})}function uC(e,t){let n=ug(e).scrollLeft;return t?t.left+n:uO(un(e)).left+n}function uN(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-uC(e,n),y:n.top+t.scrollTop}}function uP(e,t,n){var r;let a;if("viewport"===t||"layoutViewport"===t)a=function(e,t,n){void 0===n&&(n="viewport");let r="layoutViewport"===n,a=ut(e),o=un(e),i=a.visualViewport,l=o.clientWidth,s=o.clientHeight,c=0,u=0;if(i){let e=!up()||"fixed"===t;r?e||(c=-i.offsetLeft,u=-i.offsetTop):(l=i.width,s=i.height,e&&(c=i.offsetLeft,u=i.offsetTop))}if(0>=uC(o)){let e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(o.clientWidth-t.clientWidth-r),i="stable both-edges"===getComputedStyle(o).scrollbarGutter?a/2:a;i<=25&&(l-=i)}return{width:l,height:s,x:c,y:u}}(e,n,t);else if("document"===t){let t,n,o,i,l,s;t=ug(r=un(e)),n=r.ownerDocument.body,o=cM(r.scrollWidth,r.clientWidth,n.scrollWidth,n.clientWidth),i=cM(r.scrollHeight,r.clientHeight,n.scrollHeight,n.clientHeight),l=-t.scrollLeft+uC(r),s=-t.scrollTop,"rtl"===um(n).direction&&(l+=cM(r.clientWidth,n.clientWidth)-o),a={width:o,height:i,x:l,y:s}}else if(ua(t)){let e,r,o,i,l,s;r=(e=uO(t,!0,"fixed"===n)).top+t.clientTop,o=e.left+t.clientLeft,i=uk(t),l=t.clientWidth*i.x,s=t.clientHeight*i.y,a={width:l,height:s,x:o*i.x,y:r*i.y}}else{let n=uS(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return c1(a)}function uE(e){return"static"===um(e).position}function u_(e,t){if(!uo(e)||"fixed"===um(e).position)return null;if(t)return t(e);let n=e.offsetParent;return un(e)===n&&(n=n.ownerDocument.body),n}function uz(e,t){var n;let r=ut(e);if(us(e))return r;if(!uo(e)){let t=uy(e);for(;t&&!uh(t);){if(ua(t)&&!uE(t))return t;t=uy(t)}return r}let a=u_(e,t);for(;a&&(n=a,/^(table|td|th)$/.test(ue(n)))&&uE(a);)a=u_(a,t);return a&&uh(a)&&uE(a)&&!uf(a)?r:a||function(e){let t=uy(e);for(;uo(t)&&!uh(t);){if(uf(t))return t;if(us(t))break;t=uy(t)}return null}(e)||r}let uT=async function(e){let t=this.getOffsetParent||uz,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=uo(t),a=un(t),o="fixed"===n,i=uO(e,!0,o,t),l={scrollLeft:0,scrollTop:0},s=c$(0);if((r||!o)&&(("body"!==ue(t)||ul(a))&&(l=ug(t)),r)){let e=uO(t,!0,o,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}!r&&a&&(s.x=uC(a));let c=!a||r||o?c$(0):uN(a,l);return{x:i.left+l.scrollLeft-s.x-c.x,y:i.top+l.scrollTop-s.y-c.y,width:i.width,height:i.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},uA={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e,o="fixed"===a,i=un(r),l=!!t&&us(t.floating);if(r===i||l&&o)return n;let s={scrollLeft:0,scrollTop:0},c=c$(1),u=c$(0),d=uo(r);if((d||!o)&&(("body"!==ue(r)||ul(i))&&(s=ug(r)),d)){let e=uO(r);c=uk(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=!i||d||o?c$(0):uN(i,s);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-s.scrollTop*c.y+u.y+f.y}},getDocumentElement:un,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e,o=[..."clippingAncestors"===n?us(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=uv(e,[],!1).filter(e=>ua(e)&&"body"!==ue(e)),a=null,o="fixed"===um(e).position,i=o?uy(e):e;for(;ua(i)&&!uh(i);){let e=um(i),t=uf(i),n=a?a.position:o?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?a=e:r=r.filter(e=>e!==i),i=uy(i)}return t.set(e,r),r}(t,this._c):[].concat(n),r],i=uP(t,o[0],a),l=i.top,s=i.right,c=i.bottom,u=i.left;for(let e=1;e<o.length;e++){let n=uP(t,o[e],a);l=cM(n.top,l),s=cI(n.right,s),c=cI(n.bottom,c),u=cM(n.left,u)}return{width:s-u,height:c-l,x:u,y:l}},getOffsetParent:uz,getElementRects:uT,getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){let{width:t,height:n}=ux(e);return{width:t,height:n}},getScale:uk,isElement:ua,isRTL:function(e){return"rtl"===um(e).direction}};function uR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let uL=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:a,rects:o,platform:i,elements:l,middlewareData:s}=t,{element:c,padding:u=0}=cH(e,t)||{};if(null==c)return{};let d=c0(u),f={x:n,y:r},p=cV(cW(a)),h=cq(p),m=await i.getDimensions(c),g="y"===p,y=g?"clientHeight":"clientWidth",v=o.reference[h]+o.reference[p]-f[p]-o.floating[h],b=f[p]-o.reference[p],x=await (null==i.getOffsetParent?void 0:i.getOffsetParent(c)),w=x?x[y]:0;w&&await (null==i.isElement?void 0:i.isElement(x))||(w=l.floating[y]||o.floating[h]);let k=w/2-m[h]/2-1,j=cI(d[g?"top":"left"],k),S=cI(d[g?"bottom":"right"],k),O=w-m[h]-S,C=w/2-m[h]/2+(v/2-b/2),N=cM(j,cI(C,O)),P=!s.arrow&&null!=cK(a)&&C!==N&&o.reference[h]/2-(C<j?j:S)-m[h]/2<0,E=P?C<j?C-j:C-O:0;return{[p]:f[p]+E,data:{[p]:N,centerOffset:C-N-E,...P&&{alignmentOffset:E}},reset:P}}});var uI="u">typeof document?y.useLayoutEffect:function(){};function uM(e,t){let n,r,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!uM(e[r],t[r]))return!1;return!0}if((n=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!=r--;){let n=a[r];if(("_owner"!==n||!e.$$typeof)&&!uM(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function uD(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function uF(e,t){let n=uD(e);return Math.round(t*n)/n}function u$(e){let t=y.useRef(e);return uI(()=>{t.current=e}),t}var uU=Object.defineProperty,uH=(e,t)=>uU(e,"name",{value:t,configurable:!0}),uB="Popper",[uK,uV]=oh(uB),[uq,uW]=uK(uB),uZ=uH(e=>{let{__scopePopper:t,children:n}=e,[r,a]=y.useState(null),[o,i]=y.useState(void 0);return(0,g.jsx)(uq,{scope:t,anchor:r,onAnchorChange:a,placementState:o,setPlacementState:i,children:n})},"Popper"),uG=y.forwardRef(uH(function(e,t){let{__scopePopper:n,virtualRef:r,...a}=e,o=uW("PopperAnchor",n),i=y.useRef(null),l=o.onAnchorChange,s=aY(t,y.useCallback(e=>{i.current=e,e&&l(e)},[l])),c=y.useRef(null);y.useEffect(()=>{if(!r)return;let e=c.current;c.current=r.current,e!==c.current&&l(c.current)});let u=o.placementState&&u2(o.placementState),d=u?.[0],f=u?.[1];return r?null:(0,g.jsx)(oR.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...a,ref:s})},"PopperAnchor")),uJ="PopperContent",[uQ,uY]=uK(uJ),uX=y.forwardRef(uH(function(e,t){var n,r,a,o,i,l,s,c,u,d,f,p,h,m,v,b,x,w,k,j,S;let O,C,N,P,E,_,{__scopePopper:z,side:T="bottom",sideOffset:A=0,align:R="center",alignOffset:L=0,arrowPadding:I=0,avoidCollisions:M=!0,collisionBoundary:D=[],collisionPadding:F=0,sticky:$="partial",hideWhenDetached:U=!1,updatePositionStrategy:H="optimized",onPlaced:B,...K}=e,V=uW(uJ,z),[q,W]=y.useState(null),Z=aY(t,W),[G,J]=y.useState(null),Q=s9(G),Y=Q?.width??0,X=Q?.height??0,ee="number"==typeof F?F:{top:0,right:0,bottom:0,left:0,...F},et=Array.isArray(D)?D:[D],en=et.length>0,er={padding:ee,boundary:et.filter(u0),altBoundary:en},{refs:ea,floatingStyles:eo,placement:ei,isPositioned:el,middlewareData:es}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:i}={},transform:l=!0,whileElementsMounted:s,open:c}=e,[u,d]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=y.useState(r);uM(f,r)||p(r);let[h,m]=y.useState(null),[g,v]=y.useState(null),b=y.useCallback(e=>{e!==j.current&&(j.current=e,m(e))},[]),x=y.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),w=o||h,k=i||g,j=y.useRef(null),S=y.useRef(null),O=y.useRef(u),C=null!=s,N=u$(s),P=u$(a),E=u$(c),_=y.useCallback(()=>{var e,r;let a,o,i;if(!j.current||!S.current)return;let l={placement:t,strategy:n,middleware:f};P.current&&(l.platform=P.current),(e=j.current,r=S.current,a=new Map,o=null!=l?l:{},i={...uA,...o.platform,_c:a},c3(e,r,{...o,platform:i})).then(e=>{let t={...e,isPositioned:!1!==E.current};z.current&&!uM(O.current,t)&&(O.current=t,oT.flushSync(()=>{d(t)}))})},[f,t,n,P,E]);uI(()=>{!1===c&&O.current.isPositioned&&(O.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[c]);let z=y.useRef(!1);uI(()=>(z.current=!0,()=>{z.current=!1}),[]),uI(()=>{if(w&&(j.current=w),k&&(S.current=k),w&&k){if(N.current)return N.current(w,k,_);_()}},[w,k,_,N,C]);let T=y.useMemo(()=>({reference:j,floating:S,setReference:b,setFloating:x}),[b,x]),A=y.useMemo(()=>({reference:w,floating:k}),[w,k]),R=y.useMemo(()=>{let e={position:n,left:0,top:0};if(!A.floating)return e;let t=uF(A.floating,u.x),r=uF(A.floating,u.y);return l?{...e,transform:"translate("+t+"px, "+r+"px)",...uD(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,l,A.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:_,refs:T,elements:A,floatingStyles:R}),[u,_,T,A,R])}({strategy:"fixed",placement:T+("center"!==R?"-"+R:""),whileElementsMounted:uH((...e)=>(function(e,t,n,r){let a;void 0===r&&(r={});let{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,u=uw(e),d=o||i?[...u?uv(u):[],...t?uv(t):[]]:[];d.forEach(e=>{o&&e.addEventListener("scroll",n),i&&e.addEventListener("resize",n)});let f=u&&s?function(e,t,n){let r,a=null,o=un(e);function i(){var e;clearTimeout(r),null==(e=a)||e.disconnect(),a=null}function l(n,s){void 0===n&&(n=!1),void 0===s&&(s=1),i();let c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(n||t(),!f||!p)return;let h={rootMargin:-cF(d)+"px "+-cF(o.clientWidth-(u+f))+"px "+-cF(o.clientHeight-(d+p))+"px "+-cF(u)+"px",threshold:cM(0,cI(1,s))||1},m=!0;function g(t){let n=t[0].intersectionRatio;if(!uR(c,e.getBoundingClientRect()))return l();if(n!==s){if(!m)return l();n?l(!1,n):r=setTimeout(()=>{l(!1,1e-7)},1e3)}m=!1}try{a=new IntersectionObserver(g,{...h,root:o.ownerDocument})}catch(e){a=new IntersectionObserver(g,h)}a.observe(e)}let s=ut(e),c=()=>l(n);return s.addEventListener("resize",c),l(!0),()=>{s.removeEventListener("resize",c),i()}}(u,n,i):null,p=-1,h=null;l&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let m=c?uO(e):null;return c&&function t(){let r=uO(e);m&&!uR(m,r)&&n(),m=r,a=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==f||f(),null==(e=h)||e.disconnect(),h=null,c&&cancelAnimationFrame(a)}})(...e,{animationFrame:"always"===H}),"whileElementsMounted"),elements:{reference:V.anchor},middleware:[{name:(O={name:"offset",options:a=n={mainAxis:A+X,alignmentAxis:L},async fn(e){var t,n;let{x:r,y:o,placement:i,middlewareData:l}=e,s=await c9(e,a);return i===(null==(t=l.offset)?void 0:t.placement)&&null!=(n=l.arrow)&&n.alignmentOffset?{}:{x:r+s.x,y:o+s.y,data:{...s,placement:i}}}}).name,fn:O.fn,options:[n,r]},M&&{name:(C={name:"shift",options:u=s={mainAxis:!0,crossAxis:!1,limiter:"partial"===$?{fn:(void 0===(l=o)&&(l={}),{options:l,fn(e){var t,n,r,a;let{x:o,y:i,placement:s,rects:c,middlewareData:u}=e,{offset:d=0,mainAxis:f=!0,crossAxis:p=!0}=cH(l,e),h={x:o,y:i},m=cW(s),g=cV(m),y=h[g],v=h[m],b=cH(d,e),x="number"==typeof b?{mainAxis:b,crossAxis:0}:{mainAxis:null!=(t=b.mainAxis)?t:0,crossAxis:null!=(n=b.crossAxis)?n:0};if(f){let e="y"===g?"height":"width",t=c.reference[g]-c.floating[e]+x.mainAxis,n=c.reference[g]+c.reference[e]-x.mainAxis;y<t?y=t:y>n&&(y=n)}if(p){let e="y"===g?"width":"height",t=c8.has(cB(s)),n=c.reference[m]-c.floating[e]+(t&&(null==(r=u.offset)?void 0:r[m])||0)+(t?0:x.crossAxis),o=c.reference[m]+c.reference[e]+(t?0:(null==(a=u.offset)?void 0:a[m])||0)-(t?x.crossAxis:0);v<n?v=n:v>o&&(v=o)}return{[g]:y,[m]:v}}}).fn,options:[o,i]}:void 0,...er},async fn(e){let{x:t,y:n,placement:r,platform:a}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=cH(u,e),c={x:t,y:n},d=await a.detectOverflow(e,s),f=cW(r),p=cV(f),h=c[p],m=c[f],g=(e,t)=>cM(t+d["y"===e?"top":"left"],cI(t,t-d["y"===e?"bottom":"right"]));o&&(h=g(p,h)),i&&(m=g(f,m));let y=l.fn({...e,[p]:h,[f]:m});return{...y,data:{x:y.x-t,y:y.y-n,enabled:{[p]:o,[f]:i}}}}}).name,fn:C.fn,options:[s,c]},M&&{name:(N={name:"flip",options:p=d={...er},async fn(e){var t,n,r,a,o,i,l,s;let c,u,d,{placement:f,middlewareData:h,rects:m,initialPlacement:g,platform:y,elements:v}=e,{mainAxis:b=!0,crossAxis:x=!0,fallbackPlacements:w,fallbackStrategy:k="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:S=!0,...O}=cH(p,e);if(null!=(t=h.arrow)&&t.alignmentOffset)return{};let C=cB(f),N=cW(g),P=cB(g)===g,E=await (null==y.isRTL?void 0:y.isRTL(v.floating)),_=w||(P||!S?[cX(g)]:(c=cX(g),[cZ(g),c,cZ(c)])),z="none"!==j;!w&&z&&_.push(...(u=cK(g),d=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?cJ:cG;return t?cG:cJ;case"left":case"right":return t?cQ:cY;default:return[]}}(cB(g),"start"===j,E),u&&(d=d.map(e=>e+"-"+u),S&&(d=d.concat(d.map(cZ)))),d));let T=[g,..._],A=await y.detectOverflow(e,O),R=[],L=(null==(n=h.flip)?void 0:n.overflows)||[];if(b&&R.push(A[C]),x){let e,t,n,r,a=(i=f,l=m,void 0===(s=E)&&(s=!1),e=cK(i),n=cq(t=cV(cW(i))),r="x"===t?e===(s?"end":"start")?"right":"left":"start"===e?"bottom":"top",l.reference[n]>l.floating[n]&&(r=cX(r)),[r,cX(r)]);R.push(A[a[0]],A[a[1]])}if(L=[...L,{placement:f,overflows:R}],!R.every(e=>e<=0)){let e=((null==(r=h.flip)?void 0:r.index)||0)+1,t=T[e];if(t&&("alignment"!==x||N===cW(t)||L.every(e=>cW(e.placement)!==N||e.overflows[0]>0)))return{data:{index:e,overflows:L},reset:{placement:t}};let n=null==(a=L.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!n)switch(k){case"bestFit":{let e=null==(o=L.filter(e=>{if(z){let t=cW(e.placement);return t===N||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(n=e);break}case"initialPlacement":n=g}if(f!==n)return{reset:{placement:n}}}return{}}}).name,fn:N.fn,options:[d,f]},{name:(P={name:"size",options:v=h={...er,apply:uH(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${n}px`),i.setProperty("--radix-popper-available-height",`${r}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)},"apply")},async fn(e){let t,n,{placement:r,rects:a,platform:o,elements:i}=e,{apply:l=()=>{},...s}=cH(v,e),c=await o.detectOverflow(e,s),u=cB(r),d=cK(r),f="y"===cW(r),{width:p,height:h}=a.floating;"top"===u||"bottom"===u?(t=u,n=d===(await (null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(n=u,t="end"===d?"top":"bottom");let m=h-c.top-c.bottom,g=p-c.left-c.right,y=cI(h-c[t],m),b=cI(p-c[n],g),x=e.middlewareData.shift,w=!x,k=y,j=b;null!=x&&x.enabled.x&&(j=g),null!=x&&x.enabled.y&&(k=m),w&&!d&&(f?j=p-2*cM(c.left,c.right):k=h-2*cM(c.top,c.bottom)),await l({...e,availableWidth:j,availableHeight:k});let S=await o.getDimensions(i.floating);return p!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}).name,fn:P.fn,options:[h,m]},G&&{name:(E={name:"arrow",options:w=b={element:G,padding:I},fn(e){let{element:t,padding:n}="function"==typeof w?w(e):w;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?uL({element:t.current,padding:n}).fn(e):{}:t?uL({element:t,padding:n}).fn(e):{}}}).name,fn:E.fn,options:[b,x]},u1({arrowWidth:Y,arrowHeight:X}),U&&{name:(_={name:"hide",options:S=k={strategy:"referenceHidden",...er,boundary:en?er.boundary:void 0},async fn(e){let{rects:t,platform:n}=e,{strategy:r="referenceHidden",...a}=cH(S,e);switch(r){case"referenceHidden":{let r=c5(await n.detectOverflow(e,{...a,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:r,referenceHidden:c6(r)}}}case"escaped":{let r=c5(await n.detectOverflow(e,{...a,altBoundary:!0}),t.floating);return{data:{escapedOffsets:r,escaped:c6(r)}}}default:return{}}}}).name,fn:_.fn,options:[k,j]}]}),ec=V.setPlacementState;og(()=>(ec(ei),()=>{ec(void 0)}),[ei,ec]);let[eu,ed]=u2(ei),ef=oI(B);og(()=>{el&&ef?.()},[el,ef]);let ep=es.arrow?.x,eh=es.arrow?.y,em=es.arrow?.centerOffset!==0,[eg,ey]=y.useState();return og(()=>{q&&ey(window.getComputedStyle(q).zIndex)},[q]),(0,g.jsx)("div",{ref:ea.setFloating,"data-radix-popper-content-wrapper":"",style:{...eo,transform:el?eo.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eg,"--radix-popper-transform-origin":[es.transformOrigin?.x,es.transformOrigin?.y].join(" "),...es.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,g.jsx)(uQ,{scope:z,placedSide:eu,placedAlign:ed,onArrowChange:J,arrowX:ep,arrowY:eh,shouldHideArrow:em,children:(0,g.jsx)(oR.div,{"data-side":eu,"data-align":ed,...K,ref:Z,style:{...K.style,animation:el?K.style?.animation:"none"}})})})},"PopperContent"));function u0(e){return null!==e}uH(u0,"isNotNull");var u1=uH(e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:a}=t,o=a.arrow?.centerOffset!==0,i=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[s,c]=u2(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+l/2,p="",h="";return"bottom"===s?(p=o?u:`${d}px`,h=`${-l}px`):"top"===s?(p=o?u:`${d}px`,h=`${r.floating.height+l}px`):"right"===s?(p=`${-l}px`,h=o?u:`${f}px`):"left"===s&&(p=`${r.floating.width+l}px`,h=o?u:`${f}px`),{data:{x:p,y:h}}}}),"transformOrigin");function u2(e){let[t,n="center"]=e.split("-");return[t,n]}function u4(e){let t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}uH(u2,"getSideAndAlignFromPlacement"),(0,Object.defineProperty)(u4,"name",{value:"usePrevious",configurable:!0});var u3=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),u5=Object.defineProperty,u6=(e,t)=>u5(e,"name",{value:t,configurable:!0}),u8=[" ","Enter","ArrowUp","ArrowDown"],u9=[" ","Enter"],u7="Select",[de,dt,dn]=ck(u7),[dr,da]=oh(u7,[dn,uV]),di=uV(),[dl,ds]=dr(u7),[dc,du]=dr(u7);function dd(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:o,value:i,defaultValue:l,onValueChange:s,dir:c,name:u,autoComplete:d,disabled:f,required:p,form:h,internal_do_not_use_render:m}=e,v=di(t),[b,x]=y.useState(null),[w,k]=y.useState(null),[j,S]=y.useState(!1),O=cR(c),[C,N]=oP({prop:r,defaultProp:a??!1,onChange:o,caller:u7}),[P,E]=oP({prop:i,defaultProp:l,onChange:s,caller:u7}),_=y.useRef(null),z=y.useRef(P);y.useEffect(()=>{let e=h?b?.ownerDocument.getElementById(h):b?.form;if(e instanceof HTMLFormElement){let t=u6(()=>E(z.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[h,b,E]);let T=!b||!!h||!!b.closest("form"),[A,R]=y.useState(new Set),L=ox(),I=Array.from(A).map(e=>e.props.value).join(";"),M=y.useCallback(e=>{R(t=>new Set(t).add(e))},[]),D=y.useCallback(e=>{R(t=>{let n=new Set(t);return n.delete(e),n})},[]),F={required:p,trigger:b,onTriggerChange:x,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:j,onValueNodeHasChildrenChange:S,contentId:L,value:P,onValueChange:E,open:C,onOpenChange:N,dir:O,triggerPointerDownPosRef:_,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:A,nativeSelectKey:I,isFormControl:T};return(0,g.jsx)(uZ,{...v,children:(0,g.jsx)(dl,{scope:t,...F,children:(0,g.jsx)(de.Provider,{scope:t,children:(0,g.jsx)(dc,{scope:t,onNativeOptionAdd:M,onNativeOptionRemove:D,children:dG(m)?m(F):n})})})})}u6(dd,"SelectProvider");var df=u6(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,g.jsx)(dd,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,g.jsxs)(g.Fragment,{children:[n,e?(0,g.jsx)(dZ,{__scopeSelect:t}):null]})})},"Select"),dp=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,disabled:r=!1,...a}=e,o=di(n),i=ds("SelectTrigger",n),l=i.disabled||r,s=aY(t,i.onTriggerChange),c=dt(n),u=y.useRef("touch"),[d,f,p]=dQ(e=>{let t=c().filter(e=>!e.disabled),n=t.find(e=>e.value===i.value),r=dY(t,e,n);void 0!==r&&i.onValueChange(r.value)}),h=u6(e=>{l||(i.onOpenChange(!0),p()),e&&(i.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},"handleOpen");return(0,g.jsx)(uG,{asChild:!0,...o,children:(0,g.jsx)(oR.button,{type:"button",role:"combobox","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":dJ(i.value)?"":void 0,...a,ref:s,onClick:oc(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==u.current&&h(e)}),onPointerDown:oc(a.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(h(e),e.preventDefault())}),onKeyDown:oc(a.onKeyDown,e=>{let t=""!==d.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||f(e.key),(!t||" "!==e.key)&&u8.includes(e.key)&&(h(),e.preventDefault())})})})},"SelectTrigger")),dh=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,className:r,style:a,children:o,placeholder:i="",...l}=e,s=ds("SelectValue",n),{onValueNodeHasChildrenChange:c}=s,u=void 0!==o,d=aY(t,s.onValueNodeChange);og(()=>{c(u)},[c,u]);let f=dJ(s.value);return(0,g.jsx)(oR.span,{...l,asChild:!f&&l.asChild,ref:d,style:{pointerEvents:"none"},children:(0,g.jsx)(y.Fragment,{children:f?i:o},f?"placeholder":"value")})},"SelectValue")),dm=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,children:r,...a}=e;return(0,g.jsx)(oR.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})},"SelectIcon")),[dg,dy]=dr("SelectPortal",{forceMount:void 0}),dv=u6(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,g.jsx)(dg,{scope:e.__scopeSelect,forceMount:n,children:(0,g.jsx)(ir,{asChild:!0,...r})})},"SelectPortal"),db="SelectContent",dx=y.forwardRef(u6(function(e,t){let n=dy(db,e.__scopeSelect),{forceMount:r=n.forceMount,...a}=e,o=ds(db,e.__scopeSelect),[i,l]=y.useState();return og(()=>{l(new DocumentFragment)},[]),(0,g.jsx)(il,{present:r||o.open,children:({present:e})=>e?(0,g.jsx)(dO,{...a,ref:t}):(0,g.jsx)(dw,{...a,fragment:i})})},"SelectContent")),dw=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,children:r,fragment:a}=e;return a?oT.createPortal((0,g.jsx)(dk,{scope:n,children:(0,g.jsx)(de.Slot,{scope:n,children:(0,g.jsx)("div",{ref:t,children:r})})}),a):null},"SelectContentFragment")),[dk,dj]=dr(db),dS=a1("SelectContent.RemoveScroll"),dO=y.forwardRef(u6(function(e,t){let{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:i,side:l,sideOffset:s,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:v,...b}=e,x=ds(db,n),[w,k]=y.useState(null),[j,S]=y.useState(null),O=aY(t,k),[C,N]=y.useState(null),[P,E]=y.useState(null),_=dt(n),[z,T]=y.useState(!1),A=y.useRef(!1);y.useEffect(()=>{if(w)return lt(w)},[w]),iv();let R=y.useCallback(e=>{let[t,...n]=_().map(e=>e.ref.current),[r]=n.slice(-1),a=document.activeElement;for(let n of e)if(n===a||(n?.scrollIntoView({block:"nearest"}),n===t&&j&&(j.scrollTop=0),n===r&&j&&(j.scrollTop=j.scrollHeight),n?.focus(),document.activeElement!==a))return},[_,j]),L=y.useCallback(()=>R([C,w]),[R,C,w]);y.useEffect(()=>{z&&L()},[z,L]);let{onOpenChange:I,triggerPointerDownPosRef:M}=x;y.useEffect(()=>{if(w){let e={x:0,y:0},t=u6(t=>{e={x:Math.abs(Math.round(t.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(M.current?.y??0))}},"handlePointerMove"),n=u6(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(w)||I(!1),document.removeEventListener("pointermove",t),M.current=null},"handlePointerUp");return null!==M.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[w,I,M]),y.useEffect(()=>{let e=u6(()=>I(!1),"close");return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[I]);let[D,F]=dQ(e=>{let t=_().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=dY(t,e,n);r&&setTimeout(()=>r.ref.current?.focus())}),$=y.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&(N(e),r&&(A.current=!0))},[x.value]),U=y.useCallback(()=>w?.focus(),[w]),H=y.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&E(e)},[x.value]),B="popper"===r?dN:dC;return(0,g.jsx)(dk,{scope:n,content:w,viewport:j,onViewportChange:S,itemRefCallback:$,selectedItem:C,onItemLeave:U,itemTextRefCallback:H,focusSelectedItem:L,selectedItemText:P,position:r,isPositioned:z,searchRef:D,children:(0,g.jsx)(i3,{as:dS,allowPinchZoom:!0,children:(0,g.jsx)(oX,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:oc(a,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,g.jsx)(oU,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,g.jsx)(B,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...B===dN?{side:l,sideOffset:s,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:v}:{},onPlaced:()=>T(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:oc(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||F(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=_().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>R(t)),e.preventDefault()}})})})})})})},"SelectContentImpl")),dC=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,onPlaced:r,...a}=e,o=ds(db,n),i=dj(db,n),[l,s]=y.useState(null),[c,u]=y.useState(null),d=aY(t,u),f=dt(n),p=y.useRef(!1),h=y.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=i,w=y.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&c&&m&&v&&b){let e=o.trigger.getBoundingClientRect(),t=c.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),a=b.getBoundingClientRect();if("rtl"!==o.dir){let r=a.left-t.left,o=n.left-r,i=e.left-o,s=e.width+i,c=Math.max(s,t.width),u=cb(o,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.left=u+"px"}else{let r=t.right-a.right,o=window.innerWidth-n.right-r,i=window.innerWidth-e.right-o,s=e.width+i,c=Math.max(s,t.width),u=cb(o,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.right=u+"px"}let i=f(),s=window.innerHeight-20,u=m.scrollHeight,d=window.getComputedStyle(c),h=parseInt(d.borderTopWidth,10),g=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),x=h+g+u+parseInt(d.paddingBottom,10)+y,w=Math.min(5*v.offsetHeight,x),k=window.getComputedStyle(m),j=parseInt(k.paddingTop,10),S=parseInt(k.paddingBottom,10),O=e.top+e.height/2-10,C=v.offsetHeight/2,N=h+g+(v.offsetTop+C);if(N<=O){let e=i.length>0&&v===i[i.length-1].ref.current;l.style.bottom="0px";let t=Math.max(s-O,C+(e?S:0)+(c.clientHeight-m.offsetTop-m.offsetHeight)+y);l.style.height=N+t+"px"}else{let e=i.length>0&&v===i[0].ref.current;l.style.top="0px";let t=Math.max(O,h+m.offsetTop+(e?j:0)+C);l.style.height=t+(x-N)+"px",m.scrollTop=N-O+m.offsetTop}l.style.margin="10px 0",l.style.minHeight=w+"px",l.style.maxHeight=s+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,o.trigger,o.valueNode,l,c,m,v,b,o.dir,r]);og(()=>w(),[w]);let[k,j]=y.useState();og(()=>{c&&j(window.getComputedStyle(c).zIndex)},[c]);let S=y.useCallback(e=>{e&&!0===h.current&&(w(),x?.(),h.current=!1)},[w,x]);return(0,g.jsx)(dP,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:(0,g.jsx)("div",{ref:s,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:(0,g.jsx)(oR.div,{...a,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})},"SelectItemAlignedPosition")),dN=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,align:r="start",collisionPadding:a=10,...o}=e,i=di(n);return(0,g.jsx)(uX,{...i,...o,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[dP,dE]=dr(db,{}),d_="SelectViewport",dz=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,nonce:r,...a}=e,o=dj(d_,n),i=dE(d_,n),l=aY(t,o.onViewportChange),s=y.useRef(0);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,g.jsx)(de.Slot,{scope:n,children:(0,g.jsx)(oR.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:oc(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=i;if(r?.current&&n){let e=Math.abs(s.current-t.scrollTop);if(e>0){let r=window.innerHeight-20,a=Math.max(parseFloat(n.style.minHeight),parseFloat(n.style.height));if(a<r){let o=a+e,i=Math.min(r,o),l=o-i;n.style.height=i+"px","0px"===n.style.bottom&&(t.scrollTop=l>0?l:0,n.style.justifyContent="flex-end")}}}s.current=t.scrollTop})})})]})},"SelectViewport")),[dT,dA]=dr("SelectGroup"),dR=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,...r}=e,a=dA("SelectLabel",n);return(0,g.jsx)(oR.div,{id:a.id,...r,ref:t})},"SelectLabel")),dL="SelectItem",[dI,dM]=dr(dL),dD=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...i}=e,l=ds(dL,n),s=dj(dL,n),c=l.value===r,[u,d]=y.useState(o??""),[f,p]=y.useState(!1),h=aY(t,oI(e=>s.itemRefCallback?.(e,r,a))),m=ox(),v=y.useRef("touch"),b=u6(()=>{a||(l.onValueChange(r),l.onOpenChange(!1))},"handleSelect");return(0,g.jsx)(dI,{scope:n,value:r,disabled:a,textId:m,isSelected:c,onItemTextChange:y.useCallback(e=>{d(t=>t||(e?.textContent??"").trim())},[]),children:(0,g.jsx)(de.ItemSlot,{scope:n,value:r,disabled:a,textValue:u,children:(0,g.jsx)(oR.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:h,onFocus:oc(i.onFocus,()=>p(!0)),onBlur:oc(i.onBlur,()=>p(!1)),onClick:oc(i.onClick,()=>{"mouse"!==v.current&&b()}),onPointerUp:oc(i.onPointerUp,()=>{"mouse"===v.current&&b()}),onPointerDown:oc(i.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:oc(i.onPointerMove,e=>{v.current=e.pointerType,a?s.onItemLeave?.():"mouse"===v.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:oc(i.onPointerLeave,e=>{e.currentTarget===document.activeElement&&s.onItemLeave?.()}),onKeyDown:oc(i.onKeyDown,e=>{a||e.target!==e.currentTarget||(s.searchRef?.current===""||" "!==e.key)&&(u9.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})},"SelectItem")),dF="SelectItemText",d$=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,className:r,style:a,...o}=e,i=ds(dF,n),l=dj(dF,n),s=dM(dF,n),c=du(dF,n),[u,d]=y.useState(null),f=oI(e=>l.itemTextRefCallback?.(e,s.value,s.disabled)),p=aY(t,d,s.onItemTextChange,f),h=u?.textContent,m=y.useMemo(()=>(0,g.jsx)("option",{value:s.value,disabled:s.disabled,children:h},s.value),[s.disabled,s.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=c;return og(()=>(v(m),()=>b(m)),[v,b,m]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(oR.span,{id:s.textId,...o,ref:p}),s.isSelected&&i.valueNode&&!i.valueNodeHasChildren&&!dJ(i.value)?oT.createPortal(o.children,i.valueNode):null]})},"SelectItemText")),dU=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,...r}=e;return dM("SelectItemIndicator",n).isSelected?(0,g.jsx)(oR.span,{"aria-hidden":!0,...r,ref:t}):null},"SelectItemIndicator")),dH="SelectScrollUpButton",dB=y.forwardRef(u6(function(e,t){let n=dj(dH,e.__scopeSelect),r=dE(dH,e.__scopeSelect),[a,o]=y.useState(!1),i=aY(t,r.onScrollButtonChange);return og(()=>{if(n.viewport&&n.isPositioned){let e=function(){o(t.scrollTop>0)};u6(e,"handleScroll");let t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),a?(0,g.jsx)(dq,{...e,ref:i,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null},"SelectScrollUpButton")),dK="SelectScrollDownButton",dV=y.forwardRef(u6(function(e,t){let n=dj(dK,e.__scopeSelect),r=dE(dK,e.__scopeSelect),[a,o]=y.useState(!1),i=aY(t,r.onScrollButtonChange);return og(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)};u6(e,"handleScroll");let t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),a?(0,g.jsx)(dq,{...e,ref:i,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null},"SelectScrollDownButton")),dq=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...a}=e,o=dj("SelectScrollButton",n),i=y.useRef(null),l=dt(n),s=y.useCallback(()=>{null!==i.current&&(window.clearInterval(i.current),i.current=null)},[]);return y.useEffect(()=>()=>s(),[s]),og(()=>{let e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),(0,g.jsx)(oR.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:oc(a.onPointerDown,()=>{null===i.current&&(i.current=window.setInterval(r,50))}),onPointerMove:oc(a.onPointerMove,()=>{o.onItemLeave?.(),null===i.current&&(i.current=window.setInterval(r,50))}),onPointerLeave:oc(a.onPointerLeave,()=>{s()})})},"SelectScrollButtonImpl")),dW=y.forwardRef(u6(function(e,t){let{__scopeSelect:n,...r}=e;return(0,g.jsx)(oR.div,{"aria-hidden":!0,...r,ref:t})},"SelectSeparator")),dZ=y.forwardRef(u6(function({__scopeSelect:e,...t},n){let r=ds("SelectBubbleInput",e),{value:a,onValueChange:o,required:i,disabled:l,name:s,autoComplete:c,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=y.useRef(null),h=aY(n,p),m=a??"",v=u4(m),b=Array.from(d).some(e=>(e.props.value??"")==="");return y.useEffect(()=>{let e=p.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(v!==m&&t){let n=new Event("change",{bubbles:!0});t.call(e,m),e.dispatchEvent(n)}},[v,m]),(0,g.jsxs)(oR.select,{"aria-hidden":!0,required:i,tabIndex:-1,name:s,autoComplete:c,disabled:l,form:u,onChange:e=>o(e.target.value),...t,style:{...u3,...t.style},ref:h,defaultValue:m,children:[dJ(a)&&!b?(0,g.jsx)("option",{value:""}):null,Array.from(d)]},f)},"SelectBubbleInput"));function dG(e){return"function"==typeof e}function dJ(e){return""===e||void 0===e}function dQ(e){let t=oI(e),n=y.useRef(""),r=y.useRef(0),a=y.useCallback(e=>{t(n.current+e)},[t]),o=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function dY(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1,o=dX(e,Math.max(a,0));1===r.length&&(o=o.filter(e=>e!==n));let i=o.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return i!==n?i:void 0}function dX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}u6(dG,"isFunction"),u6(dJ,"shouldShowPlaceholder"),u6(dQ,"useTypeaheadSearch"),u6(dY,"findNextItem"),u6(dX,"wrapArray");let d0=O("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);function d1(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d2(e){if(Array.isArray(e))return e}function d4(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function d5(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function d6(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function d8(e,t){return d2(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||d7(e,t)||d4()}function d9(e){return d2(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d7(e)||d4()}function d7(e,t){if(e){if("string"==typeof e)return d1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d1(e,t)}}var fe=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=r.children,l=d6(r,["className","children"]),s=d8(a,1)[0];return(0,g.jsxs)(dp,d5(d3({ref:s,"data-slot":"select-trigger",className:aR("flex h-10 w-full cursor-pointer items-center justify-between gap-2 rounded-[10px] border border-input bg-card px-3 py-2 text-sm text-foreground shadow-[0_1px_2px_rgb(20_24_40/0.04)] outline-none transition-[border-color,box-shadow,background-color] hover:border-ring/35 focus-visible:border-ring/50 focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:focus-visible:border-destructive aria-invalid:focus-visible:ring-destructive/25 disabled:pointer-events-none disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:truncate",o)},l),{children:[i,(0,g.jsx)(dm,{asChild:!0,children:(0,g.jsx)(A,{className:"size-4 shrink-0 text-muted-foreground"})})]}))});fe.displayName=dp.displayName;var ft=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=d6(r,["className"]),l=d8(a,1)[0];return(0,g.jsx)(dB,d5(d3({ref:l,className:aR("flex cursor-default items-center justify-center py-1",o)},i),{children:(0,g.jsx)(d0,{className:"size-4"})}))});ft.displayName=dB.displayName;var fn=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=d6(r,["className"]),l=d8(a,1)[0];return(0,g.jsx)(dV,d5(d3({ref:l,className:aR("flex cursor-default items-center justify-center py-1",o)},i),{children:(0,g.jsx)(A,{className:"size-4"})}))});fn.displayName=dV.displayName;var fr=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=r.children,l=r.position,s=void 0===l?"popper":l,c=r.sideOffset,u=d6(r,["className","children","position","sideOffset"]),d=d8(a,1)[0];return(0,g.jsx)(dv,{children:(0,g.jsxs)(dx,d5(d3({ref:d,"data-slot":"select-content",position:s,sideOffset:void 0===c?6:c,className:aR("relative z-50 max-h-[min(20rem,var(--radix-select-content-available-height))] min-w-[8rem] overflow-hidden rounded-xl border border-border/80 bg-popover text-popover-foreground shadow-[0_18px_50px_rgb(22_27_45/0.14)] data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","popper"===s&&"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o)},u),{children:[(0,g.jsx)(ft,{}),(0,g.jsx)(dz,{className:aR("p-1.5","popper"===s&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:i}),(0,g.jsx)(fn,{})]}))})});fr.displayName=dx.displayName,y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=d6(r,["className"]),l=d8(a,1)[0];return(0,g.jsx)(dR,d3({ref:l,className:aR("px-2 py-1.5 text-xs font-semibold text-muted-foreground",o)},i))}).displayName=dR.displayName;var fa=y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=r.children,l=d6(r,["className","children"]),s=d8(a,1)[0];return(0,g.jsxs)(dD,d5(d3({ref:s,"data-slot":"select-item",className:aR("relative flex w-full cursor-pointer select-none items-center rounded-lg py-2 pr-8 pl-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o)},l),{children:[(0,g.jsx)(d$,{children:i}),(0,g.jsx)("span",{className:"absolute right-2 flex size-4 items-center justify-center text-primary",children:(0,g.jsx)(dU,{children:(0,g.jsx)(s5,{className:"size-4",strokeWidth:2.5})})})]}))});function fo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fi(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function fl(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){fi(o,r,a,i,l,"next",e)}function l(e){fi(o,r,a,i,l,"throw",e)}i(void 0)})}}function fs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fo(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fc(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function fu(e){var t=e.open,n=e.onOpenChange,r=(0,x.Bd)().t,a=ss(function(e){return e.loadHarnesses}),o=ss(function(e){return e.setNotice}),i=fs((0,y.useState)(null),2),l=i[0],s=i[1],c=fs((0,y.useState)(!1),2),u=c[0],d=c[1],f=fs((0,y.useState)(null),2),p=f[0],h=f[1],m=fs((0,y.useState)(null),2),v=m[0],b=m[1],w=fs((0,y.useState)("device"),2),k=w[0],j=w[1],S=fs((0,y.useState)("push"),2),O=S[0],C=S[1],P=fs((0,y.useState)(null),2),E=P[0],z=P[1],T=fs((0,y.useState)(!1),2),A=T[0],R=T[1],M=fs((0,y.useState)(!1),2),D=M[0],$=M[1],U=fs((0,y.useState)(!1),2),H=U[0],B=U[1],K=fs((0,y.useState)(5),2),V=K[0],q=K[1],W=(0,y.useRef)(null),Z=fs((0,y.useState)(""),2),G=Z[0],J=Z[1],Q=fs((0,y.useState)(!1),2),Y=Q[0],X=Q[1],ee=fs((0,y.useState)(""),2),et=ee[0],en=ee[1],er=fs((0,y.useState)(!1),2),ea=er[0],eo=er[1],ei=fs((0,y.useState)(!1),2),el=ei[0],es=ei[1],ec=fs((0,y.useState)(""),2),eu=ec[0],ed=ec[1],ef=fs((0,y.useState)("skip"),2),ep=ef[0],eh=ef[1],em=fs((0,y.useState)(!0),2),eg=em[0],ey=em[1],ev=fs((0,y.useState)(!1),2),eb=ev[0],ex=ev[1],ew=fs((0,y.useState)(null),2),ek=ew[0],ej=ew[1],eS=fs((0,y.useState)(null),2),eO=eS[0],eC=eS[1],eN=fs((0,y.useState)(!1),2),eP=eN[0],eE=eN[1],e_=fs((0,y.useState)(!1),2),ez=e_[0],eT=e_[1];function eA(){return fl(function(){return fc(this,function(e){switch(e.label){case 0:d(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,lX("/api/github/status")];case 2:return s(e.sent()),[3,5];case 3:return h(l6(e.sent())),[3,5];case 4:return d(!1),[7];case 5:return[2]}})})()}function eR(){return fl(function(){var e;return fc(this,function(t){switch(t.label){case 0:h(null),b(null),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,lX("/api/github/device/code",{method:"POST",body:JSON.stringify({})})];case 2:return z(e=t.sent()),eI(e.deviceCode,e.interval),[3,4];case 3:return h(l6(t.sent())),[3,4];case 4:return[2]}})})()}function eL(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return fl(function(){var n,a,o;return fc(this,function(i){switch(i.label){case 0:if(!(n=e||(null==E?void 0:E.deviceCode)))return[2];t&&(B(!0),h(null),b(null)),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,lX("/api/github/device/poll",{method:"POST",body:JSON.stringify({deviceCode:n})})];case 2:return"authorized"===(a=i.sent()).status?(W.current&&clearInterval(W.current),$(!1),z(null),b("GitHub 授权成功!欢迎 ".concat(a.username||"")),eA()):"expired"===a.status?(W.current&&clearInterval(W.current),$(!1),h(l6(a.error||"授权已过期,请重新获取授权码"))):"error"===a.status?(W.current&&clearInterval(W.current),$(!1),h(l6(a.error||"授权失败,请重试"))):"pending"===a.status&&(a.interval&&a.interval>5&&(q(a.interval),eI(n,a.interval)),t&&b(r("githubSync.pendingAuth"))),[3,5];case 3:return o=i.sent(),t&&h(l6(o)),[3,5];case 4:return t&&B(!1),[7];case 5:return[2]}})})()}function eI(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;W.current&&clearInterval(W.current),$(!0),q(t),W.current=setInterval(function(){eL(e,!1)},1e3*Math.max(t,5))}return(0,y.useEffect)(function(){t?(h(null),b(null),eA()):(W.current&&(clearInterval(W.current),W.current=null),$(!1),z(null),ej(null))},[t]),(0,y.useEffect)(function(){return function(){W.current&&clearInterval(W.current)}},[]),(0,g.jsx)(lc,{open:t,onOpenChange:n,children:(0,g.jsxs)(lT,{className:"max-h-[90vh] overflow-y-auto sm:max-w-2xl",children:[(0,g.jsxs)(lA,{children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(_,{className:"size-5 text-primary"}),(0,g.jsx)(lL,{children:r("githubSync.title")})]}),(0,g.jsx)(lI,{children:r("githubSync.intro")})]}),p&&(0,g.jsx)("div",{className:"rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:l7(r,p)}),v&&(0,g.jsx)("div",{className:"rounded-lg border border-emerald-500/40 bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400",children:v}),(null==l?void 0:l.connected)?(0,g.jsxs)("div",{className:"space-y-6",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 rounded-xl border bg-muted/40 p-4",children:[(0,g.jsxs)("div",{className:"flex items-center gap-3",children:[l.avatarUrl?(0,g.jsx)("img",{src:l.avatarUrl,alt:l.username,className:"size-10 rounded-full border"}):(0,g.jsx)(sX,{className:"size-10 text-muted-foreground"}),(0,g.jsxs)("div",{children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("span",{className:"font-semibold",children:l.username}),(0,g.jsxs)(aI,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:[(0,g.jsx)(s0,{className:"mr-1 size-3"}),"已连接"]})]}),(0,g.jsxs)("p",{className:"text-xs text-muted-foreground",children:[r("githubSync.lastSynced")," ",l.lastSyncedAt?new Date(l.lastSyncedAt).toLocaleString():r("githubSync.neverSynced")]}),l.gistId&&(0,g.jsxs)("div",{className:"mt-1 flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,g.jsx)("span",{children:r("githubSync.cloudGist")}),(0,g.jsxs)("a",{href:"https://gist.github.com/".concat(l.username?"".concat(l.username,"/"):"").concat(l.gistId),target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-primary hover:underline font-mono",children:[l.gistId.slice(0,8),"…",(0,g.jsx)(s1,{className:"size-3"})]})]})]})]}),(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(oo,{variant:"outline",size:"sm",onClick:function(){eA()},disabled:u,children:(0,g.jsx)(N,{className:"size-4 ".concat(u?"animate-spin":"")})}),(0,g.jsxs)(oo,{variant:"ghost",size:"sm",onClick:function(){fl(function(){return fc(this,function(e){switch(e.label){case 0:h(null),b(null),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,lX("/api/github/disconnect",{method:"POST"})];case 2:return e.sent(),s({connected:!1}),ej(null),b("已断开与 GitHub 的连接"),[3,4];case 3:return h(l6(e.sent())),[3,4];case 4:return[2]}})})()},children:[(0,g.jsx)(I,{className:"mr-1 size-4"}),r("githubSync.disconnect")]})]})]}),(0,g.jsxs)("div",{className:"space-y-4",children:[(0,g.jsxs)("div",{className:"grid grid-cols-2 rounded-lg bg-muted p-1",children:[(0,g.jsxs)("button",{type:"button",className:aR("flex items-center justify-center gap-2 rounded-md py-1.5 text-sm font-medium transition-colors","push"===O?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),onClick:function(){return C("push")},children:[(0,g.jsx)(s2,{className:"size-4"}),r("githubSync.pushTitle")]}),(0,g.jsxs)("button",{type:"button",className:aR("flex items-center justify-center gap-2 rounded-md py-1.5 text-sm font-medium transition-colors","pull"===O?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),onClick:function(){return C("pull")},children:[(0,g.jsx)(s4,{className:"size-4"}),r("githubSync.pullTitle")]})]}),"push"===O&&(0,g.jsxs)("div",{className:"space-y-4 pt-1",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:r("githubSync.pushIntro")}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"push-passphrase",children:r("githubSync.passphrase")}),(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)(L,{className:"absolute left-3 top-2.5 size-4 text-muted-foreground"}),(0,g.jsx)(cm,{id:"push-passphrase",type:"password",className:"pl-9",placeholder:r("githubSync.passphrasePlaceholder"),value:et,onChange:function(e){return en(e.target.value)}})]})]}),(0,g.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,g.jsx)(ch,{id:"push-codex-cache",checked:ea,onCheckedChange:function(e){return eo(!!e)}}),(0,g.jsx)(cv,{htmlFor:"push-codex-cache",className:"text-sm font-normal",children:r("githubSync.includeCache")})]}),(0,g.jsxs)(oo,{className:"w-full",disabled:!et||el,onClick:function(){fl(function(){var e;return fc(this,function(t){switch(t.label){case 0:if(!et)return[2];es(!0),h(null),b(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,lX("/api/github/push",{method:"POST",body:JSON.stringify({passphrase:et,includeCodexLoginCache:ea})})];case 2:return b(r("githubSync.pushSuccess",{profiles:(e=t.sent()).exportedProfilesCount,vault:e.exportedVaultCount})),eA(),[3,5];case 3:return h(l6(t.sent())),[3,5];case 4:return es(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(s2,{className:"mr-2 size-4"}),el?r("githubSync.pushing"):r("githubSync.pushTitle")]})]}),"pull"===O&&(0,g.jsxs)("div",{className:"space-y-4 pt-1",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:r("githubSync.pullIntro")}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"pull-passphrase",children:r("githubSync.passphrase")}),(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)(L,{className:"absolute left-3 top-2.5 size-4 text-muted-foreground"}),(0,g.jsx)(cm,{id:"pull-passphrase",type:"password",className:"pl-9",placeholder:r("githubSync.pullPassphrasePlaceholder"),value:eu,onChange:function(e){ed(e.target.value),ej(null)}})]})]}),(0,g.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{children:r("transfer.conflictPolicy")}),(0,g.jsxs)(df,{value:ep,onValueChange:function(e){eh(e),ej(null)},children:[(0,g.jsx)(fe,{children:(0,g.jsx)(dh,{})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"skip",children:r("transfer.policySkip")}),(0,g.jsx)(fa,{value:"overwrite",children:r("transfer.policyOverwrite")})]})]})]})}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,g.jsx)(ch,{id:"pull-restore-active",checked:eg,onCheckedChange:function(e){ey(!!e),ej(null)}}),(0,g.jsx)(cv,{htmlFor:"pull-restore-active",className:"text-sm font-normal",children:r("transfer.restoreActive")})]}),(0,g.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,g.jsx)(ch,{id:"pull-migrate-cache",checked:eb,onCheckedChange:function(e){ex(!!e)}}),(0,g.jsx)(cv,{htmlFor:"pull-migrate-cache",className:"text-sm font-normal",children:r("transfer.migrateCache")})]})]}),ek?(0,g.jsxs)("div",{className:"space-y-4 rounded-xl border bg-muted/20 p-4",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b pb-3",children:[(0,g.jsx)("span",{className:"font-semibold text-sm",children:"云端备份检查结果"}),(0,g.jsxs)("span",{className:"text-xs text-muted-foreground",children:["备份时间: ",eO?new Date(eO).toLocaleString():""]})]}),(0,g.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm sm:grid-cols-4",children:[(0,g.jsxs)("div",{className:"rounded-lg border bg-background p-2 text-center",children:[(0,g.jsx)("div",{className:"font-bold text-lg",children:ek.profileCount}),(0,g.jsx)("div",{className:"text-xs text-muted-foreground",children:"配置数量"})]}),(0,g.jsxs)("div",{className:"rounded-lg border bg-background p-2 text-center",children:[(0,g.jsx)("div",{className:"font-bold text-lg",children:ek.providerCount}),(0,g.jsx)("div",{className:"text-xs text-muted-foreground",children:"凭据数量"})]}),(0,g.jsxs)("div",{className:"rounded-lg border bg-background p-2 text-center",children:[(0,g.jsx)("div",{className:"font-bold text-lg text-amber-500",children:ek.conflicts.length}),(0,g.jsx)("div",{className:"text-xs text-muted-foreground",children:"同名冲突"})]}),(0,g.jsxs)("div",{className:"rounded-lg border bg-background p-2 text-center",children:[(0,g.jsx)("div",{className:"font-bold text-lg",children:ek.activeCount}),(0,g.jsx)("div",{className:"text-xs text-muted-foreground",children:"激活状态"})]})]}),ek.conflicts.length>0&&(0,g.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-300",children:[(0,g.jsxs)("div",{className:"flex items-center gap-1 font-semibold",children:[(0,g.jsx)(s3,{className:"size-4"}),"发现同名配置:"]}),(0,g.jsx)("div",{className:"mt-1",children:ek.conflicts.map(function(e){return"".concat(F[e.harness]||e.harness,"/").concat(e.name)}).join("、")}),(0,g.jsxs)("div",{className:"mt-1",children:["当前策略:","skip"===ep?"保留本机,跳过导入":"覆盖本机同名配置"]})]}),(0,g.jsxs)(oo,{className:"w-full",disabled:ez,onClick:function(){fl(function(){var e;return fc(this,function(t){switch(t.label){case 0:if(!eu)return[2];eT(!0),h(null),b(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,lX("/api/github/pull",{method:"POST",body:JSON.stringify({passphrase:eu,conflictPolicy:ep,restoreActive:eg,migrateCodexLoginCache:eb})})];case 2:var n,i,l;return e=t.sent(),a(),n=e,i=r,l=[],n.imported>0&&l.push(i("transfer.importedCount",{count:n.imported})),n.overwritten>0&&l.push(i("transfer.overwrittenCount",{count:n.overwritten})),n.providersCopied>0&&l.push(i("transfer.providersCopiedCount",{count:n.providersCopied})),n.skipped>0&&l.push(i("transfer.skippedCount",{count:n.skipped})),n.activeRestored>0&&l.push(i("transfer.activeRestoredCount",{count:n.activeRestored})),b(r("githubSync.pullSuccess",{summary:l.join(",")||"无变动"})),o(e.warnings.length>0?e.warnings.map(l5):[{key:"transfer.imported"}]),ej(null),eA(),[3,5];case 3:return h(l6(t.sent())),[3,5];case 4:return eT(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(s4,{className:"mr-2 size-4"}),ez?r("githubSync.pulling"):r("githubSync.confirmPull")]})]}):(0,g.jsxs)(oo,{variant:"outline",className:"w-full",disabled:!eu||eP,onClick:function(){fl(function(){var e,t;return fc(this,function(n){switch(n.label){case 0:if(!eu)return[2];eE(!0),h(null),b(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,lX("/api/github/pull/preview",{method:"POST",body:JSON.stringify({passphrase:eu,conflictPolicy:ep,restoreActive:eg})})];case 2:return ej((e=n.sent()).preview),eC(e.gistUpdatedAt),[3,5];case 3:return t=n.sent(),ej(null),h(l6(t)),[3,5];case 4:return eE(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(N,{className:"mr-2 size-4 ".concat(eP?"animate-spin":"")}),eP?r("transfer.inspecting"):r("githubSync.inspect")]})]})]})]}):(0,g.jsxs)("div",{className:"space-y-4",children:[(0,g.jsxs)("div",{className:"grid grid-cols-2 rounded-lg bg-muted p-1",children:[(0,g.jsx)("button",{type:"button",className:aR("flex items-center justify-center gap-2 rounded-md py-1.5 text-sm font-medium transition-colors","device"===k?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),onClick:function(){return j("device")},children:r("githubSync.tabDevice")}),(0,g.jsx)("button",{type:"button",className:aR("flex items-center justify-center gap-2 rounded-md py-1.5 text-sm font-medium transition-colors","token"===k?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),onClick:function(){return j("token")},children:r("githubSync.tabToken")})]}),"device"===k&&(0,g.jsxs)("div",{className:"space-y-4 pt-1",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:r("githubSync.deviceIntro")}),E?(0,g.jsxs)("div",{className:"space-y-4 rounded-xl border bg-muted/30 p-4",children:[(0,g.jsxs)("div",{className:"space-y-1 text-center",children:[(0,g.jsx)("span",{className:"text-xs text-muted-foreground",children:r("githubSync.userCode")}),(0,g.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,g.jsx)("code",{className:"rounded-md bg-background px-3 py-1.5 font-mono text-2xl font-bold tracking-widest text-primary border",children:E.userCode}),(0,g.jsx)(oo,{variant:"outline",size:"icon",onClick:function(){(null==E?void 0:E.userCode)&&(navigator.clipboard.writeText(E.userCode),R(!0),setTimeout(function(){return R(!1)},2e3))},children:A?(0,g.jsx)(s5,{className:"size-4 text-emerald-500"}):(0,g.jsx)(s6,{className:"size-4"})})]})]}),(0,g.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,g.jsx)(oo,{className:"w-full",asChild:!0,children:(0,g.jsxs)("a",{href:E.verificationUri,target:"_blank",rel:"noopener noreferrer",children:[(0,g.jsx)(s1,{className:"mr-2 size-4"}),r("githubSync.openAuthPage")]})}),(0,g.jsxs)(oo,{type:"button",variant:"secondary",className:"w-full",disabled:H,onClick:function(){(null==E?void 0:E.deviceCode)&&eL(E.deviceCode,!0)},children:[(0,g.jsx)(N,{className:"mr-2 size-4 ".concat(H?"animate-spin":"")}),H?r("githubSync.checkingAuth"):r("githubSync.checkNow")]}),(0,g.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,g.jsx)(oo,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-foreground h-auto p-1",onClick:function(){eR()},children:r("githubSync.regenerateCode")}),D&&(0,g.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,g.jsx)(N,{className:"size-3 animate-spin"}),V>5?r("githubSync.waitingAuthInterval",{seconds:V}):r("githubSync.waitingAuth")]})]})]})]}):(0,g.jsxs)(oo,{className:"w-full",onClick:function(){eR()},children:[(0,g.jsx)(sX,{className:"mr-2 size-4"}),r("githubSync.getCode")]})]}),"token"===k&&(0,g.jsxs)("div",{className:"space-y-4 pt-1",children:[(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"github-pat",children:"Personal Access Token"}),(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)(s8,{className:"absolute left-3 top-2.5 size-4 text-muted-foreground"}),(0,g.jsx)(cm,{id:"github-pat",type:"password",className:"pl-9",placeholder:r("githubSync.tokenPlaceholder"),value:G,onChange:function(e){return J(e.target.value)}})]}),(0,g.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Token 需具备 ",(0,g.jsx)("code",{className:"text-primary font-mono",children:"gist"})," ","权限以读写加密配置文件。"]})]}),(0,g.jsxs)(oo,{className:"w-full",disabled:!G.trim()||Y,onClick:function(){fl(function(){var e;return fc(this,function(t){switch(t.label){case 0:if(!G.trim())return[2];X(!0),h(null),b(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,lX("/api/github/token",{method:"POST",body:JSON.stringify({token:G.trim()})})];case 2:return s(e=t.sent()),J(""),b("GitHub 连接成功!欢迎 ".concat(e.username||"")),[3,5];case 3:return h(l6(t.sent())),[3,5];case 4:return X(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(sX,{className:"mr-2 size-4"}),Y?"连接中…":r("githubSync.connectToken")]})]})]})]})})}fa.displayName=dD.displayName,y.forwardRef(function(e,t){var n=d9([e,t]),r=n[0],a=n.slice(1),o=r.className,i=d6(r,["className"]),l=d8(a,1)[0];return(0,g.jsx)(dW,d3({ref:l,className:aR("-mx-1 my-1 h-px bg-border",o)},i))}).displayName=dW.displayName;let fd=O("circle-user-round",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),ff=O("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),fp=O("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),fh=O("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);function fm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fm(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fy(e){var t,n=e.harness,r=e.profile,a=e.open,o=e.onOpenChange,i=(0,x.Bd)().t,l=ss(function(e){return e.previewProfile}),s=ss(function(e){return e.activateProfile}),c=ss(function(e){return e.currentUser}),u=fg((0,y.useState)(null),2),d=u[0],f=u[1],p=fg((0,y.useState)(null),2),h=p[0],m=p[1];(0,y.useEffect)(function(){if(a){var e=!1;return f(null),m(null),l(n.id,r.name).then(function(t){e||f(t)}).catch(function(t){e||m(l6(t))}),function(){e=!0}}},[a,n.id,r.name,l]);var v=null!=(t=null==d?void 0:d.map(function(e){return{path:e.path,existed:null!==e.currentContent,content:e.content,currentContent:e.currentContent}}))?t:[],b=v.filter(function(e){return"same"!==aB(e)}).length;return(0,g.jsx)(sj,{open:a,onOpenChange:o,children:(0,g.jsxs)(sI,{className:"max-h-[85dvh] overflow-y-auto sm:max-w-4xl",children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:i("activate.title")}),(0,g.jsx)(s$,{children:i("activate.body",{harness:n.label,profile:r.name,changed:b>0?i("activate.changedFiles",{count:b}):"",user:c||i("notice.currentUser")})})]}),h?(0,g.jsx)("p",{className:"text-sm text-destructive",children:i("activate.loadFailed",{reason:l7(i,h)})}):null===d?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:i("activate.loading")}):(0,g.jsx)("div",{className:"max-h-[52dvh] overflow-y-auto rounded-xl border p-3",children:(0,g.jsx)(aK,{files:v})}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:i("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){s(n.id,r.name),o(!1)},children:i("activate.confirm")})]})]})})}function fv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function fb(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function fx(e){var t=e.className,n=fb(e,["className"]);return(0,g.jsx)("div",fv({"data-slot":"card",className:aR("rounded-2xl border bg-card text-card-foreground shadow-[0_12px_34px_-26px_rgb(36_39_70/0.38)]",t)},n))}function fw(e){var t=e.className,n=fb(e,["className"]);return(0,g.jsx)("div",fv({"data-slot":"card-title",className:aR("font-semibold leading-none tracking-tight",t)},n))}function fk(e){var t=e.className,n=fb(e,["className"]);return(0,g.jsx)("div",fv({"data-slot":"card-description",className:aR("text-sm text-muted-foreground",t)},n))}function fj(e){var t=e.className,n=fb(e,["className"]);return(0,g.jsx)("div",fv({"data-slot":"card-content",className:aR("p-5 pt-0",t)},n))}function fS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fS(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fC(e){var t,n,r,a,o,i,l,s,c,u=e.harness,d=e.onAdd,f=e.onEdit,p=e.extraActions,h=(0,x.Bd)().t,m=ss(function(e){return e.activateOfficial}),v=ss(function(e){return e.deleteProfile}),b=fO((0,y.useState)(null),2),w=b[0],k=b[1],j=fO((0,y.useState)(null),2),S=j[0],O=j[1],C=(null==(r=u.active)?void 0:r.official)?h("harness.official"):null!=(t=null==(a=u.active)?void 0:a.name)?t:null;return(0,g.jsxs)("div",{className:"space-y-6",children:[(0,g.jsx)(fx,{className:"overflow-hidden border-primary/10",children:(0,g.jsxs)(fj,{className:"p-5 sm:p-6",children:[(0,g.jsxs)("div",{className:"grid gap-5 sm:grid-cols-[minmax(0,1fr)_minmax(15rem,0.85fr)] sm:divide-x",children:[(0,g.jsxs)("div",{className:"min-w-0 sm:pr-5",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,g.jsx)("span",{className:"size-2 rounded-full bg-primary shadow-[0_0_0_4px_rgb(99_91_255/0.1)]"}),h("harness.activeConfig")]}),(0,g.jsx)(fw,{className:"mt-3 truncate text-xl",children:null===C?h("harness.inactive"):h("harness.activeNamed",{name:C})}),(0,g.jsx)(fk,{className:"mt-1",children:null===C?h("harness.currentInactive"):h("harness.current",{name:C})})]}),(0,g.jsxs)("div",{className:"min-w-0 sm:pl-5",children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:h("harness.writeTargets")}),(0,g.jsx)("p",{className:"mt-3 truncate font-mono text-sm",children:null!=(n=null==(o=u.targets[0])?void 0:o.path)?n:h("harness.noTargetFile")}),u.targets.length>1?(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:h("harness.moreFiles",{count:u.targets.length-1})}):null]})]}),(0,g.jsxs)("div",{className:"mt-5 flex items-start gap-3 border-t pt-4 text-sm text-muted-foreground",children:[(0,g.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/[0.08] text-primary",children:(0,g.jsx)(s0,{className:"size-4"})}),(0,g.jsx)("p",{className:"pt-1 leading-relaxed",children:h("harness.overwriteWarning")})]})]})}),(0,g.jsxs)("section",{children:[(0,g.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"text-sm font-semibold",children:h("harness.profiles")}),(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:h("harness.profileCount",{count:u.profiles.length})})]}),p]}),(0,g.jsxs)("div",{className:"space-y-3",children:[u.supportsOfficialAuth?(0,g.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-xl border bg-card px-4 py-4 shadow-[0_10px_28px_-26px_rgb(36_39_70/0.38)]",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,g.jsx)("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground",children:(0,g.jsx)(fd,{className:"size-4"})}),(0,g.jsxs)("div",{className:"min-w-0",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("p",{className:"font-medium",children:h("harness.official")}),(null==(i=u.active)?void 0:i.official)?(0,g.jsx)(aI,{variant:"secondary",children:h("harness.active")}):null]}),(0,g.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"claude"===u.id?h("harness.officialHintClaude"):h("harness.officialHintCodex")})]})]}),(0,g.jsx)(oo,{size:"sm",variant:(null==(l=u.active)?void 0:l.official)?"secondary":"outline",disabled:null==(s=u.active)?void 0:s.official,onClick:function(){m(u.id)},children:(null==(c=u.active)?void 0:c.official)?h("harness.officialActive"):h("harness.officialSwitch")})]}):null,0===u.profiles.length?(0,g.jsxs)("div",{className:"rounded-xl border border-dashed bg-card/60 px-5 py-8 text-center",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:h("harness.noProfiles")}),(0,g.jsxs)(oo,{className:"mt-4",size:"sm",onClick:d,children:[(0,g.jsx)(T,{}),h("harness.newProfile")]})]}):u.profiles.map(function(e){var t,n,r=(null==(t=u.active)?void 0:t.official)!==!0&&(null==(n=u.active)?void 0:n.name)===e.name;return(0,g.jsxs)("div",{className:aR("flex flex-col gap-4 rounded-xl border bg-card px-4 py-4 shadow-[0_10px_28px_-26px_rgb(36_39_70/0.38)] transition-[border-color,background-color,box-shadow] sm:flex-row sm:items-center sm:justify-between",r?"border-primary/20 bg-primary/[0.035] shadow-[0_12px_30px_-24px_rgb(99_91_255/0.35)]":"hover:border-primary/15 hover:bg-card/85"),children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,g.jsx)("span",{className:aR("mt-2 size-2 shrink-0 rounded-full",r?"bg-primary":"bg-muted-foreground/30")}),(0,g.jsxs)("div",{className:"min-w-0",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("p",{className:"font-medium",children:e.name}),r?(0,g.jsx)(aI,{children:h("harness.active")}):null,e.overriddenTargets.length>0?(0,g.jsx)(aI,{variant:"outline",children:h("harness.manualOverride")}):null]}),(0,g.jsx)("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",children:e.baseUrl}),e.model?(0,g.jsx)("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:e.model}):null]})]}),(0,g.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 self-end sm:self-auto",children:[(0,g.jsxs)(oo,{size:"sm",variant:r?"secondary":"outline",onClick:function(){return O(e)},children:[r?null:(0,g.jsx)(ff,{}),r?h("harness.active"):h("harness.activate")]}),(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":h("harness.edit",{name:e.name}),onClick:function(){return f(e)},children:(0,g.jsx)(fp,{})}),(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":h("harness.delete",{name:e.name}),disabled:r,title:r?h("harness.deleteBlocked"):void 0,onClick:function(){return k(e.name)},children:(0,g.jsx)(fh,{className:r?void 0:"text-destructive"})})]})]},e.name)})]})]}),S?(0,g.jsx)(fy,{harness:u,profile:S,open:!0,onOpenChange:function(e){return!e&&O(null)}}):null,(0,g.jsx)(sj,{open:null!==w,onOpenChange:function(e){return!e&&k(null)},children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:h("harness.deleteTitle")}),(0,g.jsx)(s$,{children:h("harness.deleteBody",{harness:u.label,profile:null!=w?w:"",extra:"additive"===u.mode?h("harness.deleteAdditiveExtra"):""})})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:h("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){w&&v(u.id,w)},children:h("common.delete")})]})]})})]})}function fN(e){return(fN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fP=["size","style"];function fE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f_(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fE(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=fN(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=fN(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==fN(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fE(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fz=(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fP);return(0,g.jsxs)("svg",f_(f_({height:n,style:f_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:"Claude Code"}),(0,g.jsx)("path",{clipRule:"evenodd",d:"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z",fill:"#D97757",fillRule:"evenodd"})]}))});let fT=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;var fA=function(e){var t=(0,y.useId)(),n="lobe-icons-".concat(Array.from(e.match(fT)??[]).map(e=>e.toLowerCase()).join("-"),"-").concat(t);return(0,y.useMemo)(function(){return{fill:"url(#".concat(n,")"),id:n}},[e])},fR="Codex";function fL(e){return(fL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fI=["size","style"];function fM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fM(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=fL(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=fL(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==fL(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fF=(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fI),o=fA(fR),i=o.id,l=o.fill;return(0,g.jsxs)("svg",fD(fD({height:n,style:fD({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:fR}),(0,g.jsx)("path",{d:"M19.503 0H4.496A4.496 4.496 0 000 4.496v15.007A4.496 4.496 0 004.496 24h15.007A4.496 4.496 0 0024 19.503V4.496A4.496 4.496 0 0019.503 0z",fill:"#fff"}),(0,g.jsx)("path",{d:"M9.064 3.344a4.578 4.578 0 012.285-.312c1 .115 1.891.54 2.673 1.275.01.01.024.017.037.021a.09.09 0 00.043 0 4.55 4.55 0 013.046.275l.047.022.116.057a4.581 4.581 0 012.188 2.399c.209.51.313 1.041.315 1.595a4.24 4.24 0 01-.134 1.223.123.123 0 00.03.115c.594.607.988 1.33 1.183 2.17.289 1.425-.007 2.71-.887 3.854l-.136.166a4.548 4.548 0 01-2.201 1.388.123.123 0 00-.081.076c-.191.551-.383 1.023-.74 1.494-.9 1.187-2.222 1.846-3.711 1.838-1.187-.006-2.239-.44-3.157-1.302a.107.107 0 00-.105-.024c-.388.125-.78.143-1.204.138a4.441 4.441 0 01-1.945-.466 4.544 4.544 0 01-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81 5.81 0 01-.37-.961 4.582 4.582 0 01-.014-2.298.124.124 0 00.006-.056.085.085 0 00-.027-.048 4.467 4.467 0 01-1.034-1.651 3.896 3.896 0 01-.251-1.192 5.189 5.189 0 01.141-1.6c.337-1.112.982-1.985 1.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098 0 00.065-.066 4.51 4.51 0 01.829-1.615 4.535 4.535 0 011.837-1.388zm3.482 10.565a.637.637 0 000 1.272h3.636a.637.637 0 100-1.272h-3.636zM8.462 9.23a.637.637 0 00-1.106.631l1.272 2.224-1.266 2.136a.636.636 0 101.095.649l1.454-2.455a.636.636 0 00.005-.64L8.462 9.23z",fill:l}),(0,g.jsx)("defs",{children:(0,g.jsxs)("linearGradient",{gradientUnits:"userSpaceOnUse",id:i,x1:"12",x2:"12",y1:"3",y2:"21",children:[(0,g.jsx)("stop",{stopColor:"#B1A7FF"}),(0,g.jsx)("stop",{offset:".5",stopColor:"#7A9DFF"}),(0,g.jsx)("stop",{offset:"1",stopColor:"#3941FF"})]})})]}))});function f$(e){return(f$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fU=["size","style"];function fH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fB(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fH(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=f$(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=f$(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==f$(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fK=(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fU);return(0,g.jsxs)("svg",fB(fB({height:n,style:fB({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:"DeepSeek"}),(0,g.jsx)("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z",fill:"#4D6BFE"})]}))});function fV(e){return(fV="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fq=["size","style"];function fW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fZ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fW(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=fV(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=fV(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==fV(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fW(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fG=(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fq);return(0,g.jsxs)("svg",fZ(fZ({fill:"currentColor",fillRule:"evenodd",height:n,style:fZ({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:"Kimi"}),(0,g.jsx)("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),(0,g.jsx)("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]}))});function fJ(e){return(fJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var fQ=["size","style"];function fY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fY(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=fJ(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=fJ(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==fJ(t)?t:String(t)}(a))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var f0={claude:fz,codex:fF,kimi:fG,pi:(0,y.memo)(function(e){var t=e.size,n=void 0===t?"1em":t,r=e.style,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,fQ);return(0,g.jsxs)("svg",fX(fX({fill:"currentColor",fillRule:"evenodd",height:n,style:fX({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},a),{},{children:[(0,g.jsx)("title",{children:"Pi"}),(0,g.jsx)("path",{clipRule:"evenodd",d:"M1 1h16.5v11H12v5.5H6.5V23H1V1zm5.5 5.5V12H12V6.5H6.5z"}),(0,g.jsx)("path",{d:"M17.5 12H23v11h-5.5V12z"})]}))}),dsh:fK};function f1(e){var t=e.id,n=e.className,r=f0[t];return(0,g.jsx)(r,{"aria-hidden":!0,className:aR("size-5",n)})}let f2=O("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),f4=O("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);function f3(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f5(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function f6(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f8(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){f6(e,t,n[t])})}return e}function f9(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f3(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f7(e){var t=e.open,n=e.onOpenChange,r=(0,x.Bd)().t,a=ss(function(e){return e.scan}),o=ss(function(e){return e.scanLoading}),i=ss(function(e){return e.scanError}),l=ss(function(e){return e.loadScan}),s=ss(function(e){return e.importScan}),c=ss(function(e){return e.providers}),u=ss(function(e){return e.loadProviders}),d=f9((0,y.useState)({}),2),f=d[0],p=d[1],h=f9((0,y.useState)(!1),2),m=h[0],v=h[1],b=f9((0,y.useState)(null),2),w=b[0],k=b[1],j=f9((0,y.useState)(null),2),S=j[0],O=j[1];(0,y.useEffect)(function(){t&&(O(null),k(null),l(),u())},[t,l,u]),(0,y.useEffect)(function(){a&&p(function(e){var t={},n=!0,r=!1,o=void 0;try{for(var i,l=a[Symbol.iterator]();!(n=(i=l.next()).done);n=!0){var s=i.value,c=!0,u=!1,d=void 0;try{for(var f,p=s.candidates[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var h,m,g=f.value;t[g.id]=null!=(h=e[g.id])?h:{selected:!1,name:g.suggestedName,target:g.matchesProvider?"vault":"profile",providerId:null!=(m=g.matchesProvider)?m:"",apiKey:"",overwrite:!1}}}catch(e){u=!0,d=e}finally{try{c||null==p.return||p.return()}finally{if(u)throw d}}}}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}return t})},[a]);var C=(null!=a?a:[]).flatMap(function(e){return e.candidates}).filter(function(e){var t;return null==(t=f[e.id])?void 0:t.selected}),N=C.filter(function(e){var t=f[e.id],n=!e.apiKeyPresent&&!t.apiKey.trim(),r="vault"===t.target&&""!==t.providerId;return!t.name.trim()||n&&!r});return(0,g.jsx)(lc,{open:t,onOpenChange:n,children:(0,g.jsxs)(lT,{className:"flex max-h-[85vh] w-[min(56rem,calc(100vw-2rem))] max-w-3xl flex-col overflow-hidden",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:r("import.title")}),(0,g.jsx)(lI,{children:r("import.intro")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto pr-1",children:[o?(0,g.jsxs)("p",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[(0,g.jsx)(f2,{className:"size-4 animate-spin"}),r("import.scanning")]}):null,i?(0,g.jsx)("p",{className:"py-6 text-sm text-destructive",children:l7(r,i)}):null,S?(0,g.jsxs)("div",{className:"rounded-xl border border-emerald-500/40 bg-emerald-500/5 px-4 py-3 text-sm",children:[(0,g.jsxs)("p",{className:"flex items-center gap-2 font-medium",children:[(0,g.jsx)(f4,{className:"size-4 text-emerald-600"}),r("import.summary",{imported:S.imported,skipped:S.skipped,providersCreated:S.providersCreated})]}),S.warnings.map(function(e){return(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l7(r,e)},e.key+e.scope)})]}):null,(null!=a?a:[]).map(function(e){var t,n,a;return(0,g.jsxs)("section",{className:"rounded-2xl border bg-card px-4 py-3",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,g.jsx)("h3",{className:"text-sm font-semibold",children:e.label}),e.candidates.length>0?(0,g.jsx)(aI,{variant:"secondary",children:r("import.providerCount",{count:e.candidates.length})}):null]}),(0,g.jsx)("ul",{className:"mt-2 space-y-0.5",children:e.sources.map(function(e){return(0,g.jsxs)("li",{className:"truncate font-mono text-[11px] text-muted-foreground",children:[e.path," \xb7"," ",e.exists?e.parsable?r("import.sourceRead"):r("import.sourceUnparsable"):r("import.sourceMissing")]},e.key)})}),0===e.candidates.length?(0,g.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:(t=r,(n=e).note||n.noteCode?l7(t,{key:null!=(a=n.noteCode)?a:"scan.note.unknown",fallback:n.note}):"")}):(0,g.jsx)("ul",{className:"mt-3 space-y-3",children:e.candidates.map(function(e){return(0,g.jsx)(pe,{candidate:e,choice:f[e.id],providers:null!=c?c:[],onChange:function(t){var n;return n=e.id,void p(function(e){var r,a;return r=f8({},e),a=null!=(a=f6({},n,f8({},e[n],t)))?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(a,e))}),r})}},e.id)})})]},e.harness)})]}),w?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(r,w)}):null,(0,g.jsxs)(lR,{className:"items-center",children:[(0,g.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:C.length>0?r("import.selected",{count:C.length}):r("import.selectPrompt")}),(0,g.jsxs)(oo,{variant:"outline",onClick:function(){l()},disabled:o,children:[(0,g.jsx)(P,{}),r("import.rescan")]}),(0,g.jsxs)(oo,{disabled:0===C.length||N.length>0||m,onClick:function(){var e;(e=function(){var e;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:v(!0),k(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,s(C.map(function(e){var t=f[e.id];return f8({id:e.id,name:t.name.trim(),target:t.target},"vault"===t.target&&t.providerId?{providerId:t.providerId}:{},t.apiKey.trim()?{apiKey:t.apiKey.trim()}:{},t.overwrite?{overwrite:!0}:{})}))];case 2:return O({imported:(e=t.sent()).imported,skipped:e.skipped,providersCreated:e.providersCreated,warnings:e.warnings.map(l5)}),p({}),[3,5];case 3:return k(l8(t.sent(),"import.failed")),[3,5];case 4:return v(!1),[7];case 5:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){f5(o,r,a,i,l,"next",e)}function l(e){f5(o,r,a,i,l,"throw",e)}i(void 0)})})()},children:[m?(0,g.jsx)(f2,{className:"animate-spin"}):null,r("import.importSelected")]})]})]})})}function pe(e){var t=e.candidate,n=e.choice,r=e.providers,a=e.onChange,o=(0,x.Bd)().t;if(!n)return null;var i="vault"===n.target&&""!==n.providerId,l=!t.apiKeyPresent&&!i;return(0,g.jsx)("li",{className:"rounded-xl border bg-background px-3 py-3",children:(0,g.jsxs)("div",{className:"flex items-start gap-3",children:[(0,g.jsx)(ch,{className:"mt-1",checked:n.selected,onCheckedChange:function(e){return a({selected:!0===e})},"aria-label":o("import.select",{name:t.sourceKey})}),(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsx)("span",{className:"truncate font-mono text-sm",children:t.sourceKey}),t.active?(0,g.jsx)(aI,{children:o("import.inUse")}):null,t.conflictsWith?(0,g.jsx)(aI,{variant:"secondary",children:o("import.nameTaken")}):null,t.matchesProvider?(0,g.jsx)(aI,{variant:"secondary",children:o("import.matchesProvider",{name:t.matchesProvider})}):null]}),(0,g.jsxs)("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[t.baseUrl||o("import.noBaseUrl"),t.model?" \xb7 ".concat(t.model):"",t.apiKeyPresent?" \xb7 ".concat(t.apiKeyPreview):" \xb7 ".concat(o("import.keyOutsideConfig"))]}),n.selected?(0,g.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"name-".concat(t.id),children:o("import.profileName")}),(0,g.jsx)(cm,{id:"name-".concat(t.id),value:n.name,onChange:function(e){return a({name:e.target.value})}})]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"target-".concat(t.id),children:o("import.credentialTarget")}),(0,g.jsxs)(df,{value:"vault"===n.target?n.providerId||"new-vault":"profile",onValueChange:function(e){return a("profile"===e?{target:"profile",providerId:""}:"new-vault"===e?{target:"vault",providerId:""}:{target:"vault",providerId:e})},children:[(0,g.jsx)(fe,{id:"target-".concat(t.id),children:(0,g.jsx)(dh,{})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"profile",children:o("import.targetProfile")}),(0,g.jsx)(fa,{value:"new-vault",children:o("import.targetNewVault")}),r.map(function(e){return(0,g.jsx)(fa,{value:e.id,children:o("import.targetExisting",{name:e.name})},e.id)})]})]})]}),l?(0,g.jsxs)("div",{className:"space-y-1.5 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"key-".concat(t.id),children:"API key"}),(0,g.jsx)(cm,{id:"key-".concat(t.id),type:"password",value:n.apiKey,placeholder:o("import.apiKeyFromEnv"),onChange:function(e){return a({apiKey:e.target.value})}})]}):null,t.conflictsWith?(0,g.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground sm:col-span-2",children:[(0,g.jsx)(ch,{checked:n.overwrite,onCheckedChange:function(e){return a({overwrite:!0===e})}}),o("import.overwriteExisting")]}):null]}):null]})]})})}let pt=O("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);function pn(){var e=(0,x.Bd)().t,t=(0,x.s9)(),n=t.language,r=t.setLanguage,a="en"===n,o=e(a?"language.toChinese":"language.toEnglish");return(0,g.jsxs)(oo,{type:"button",size:"sm",variant:"outline","aria-label":o,title:o,onClick:function(){return r(a?"zh-CN":"en")},children:[(0,g.jsx)(pt,{}),(0,g.jsx)("span",{className:"hidden sm:inline",children:e("language.short")})]})}function pr(){var e=(0,x.Bd)().t,t=ss(function(e){return e.notice}),n=ss(function(e){return e.clearNotice});return((0,y.useEffect)(function(){if(t){var e=window.setTimeout(function(){return n()},8e3);return function(){return window.clearTimeout(e)}}},[t,n]),t)?(0,g.jsxs)("div",{role:"status",className:"fixed bottom-4 right-4 z-50 w-[min(28rem,calc(100vw-2rem))] rounded-2xl border bg-card p-4 shadow-[0_18px_50px_-24px_rgb(36_39_70/0.45)]",children:[(0,g.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,g.jsx)("p",{className:"text-sm font-medium",children:e("notice.title")}),(0,g.jsx)(oo,{size:"sm",variant:"ghost",onClick:n,children:e("notice.close")})]}),t.map(function(t){var n;return(0,g.jsx)("p",{className:"mt-2 text-sm leading-relaxed text-muted-foreground",children:l7(e,t)},"".concat(t.key,"-").concat(null!=(n=t.scope)?n:""))})]}):null}let pa=O("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function po(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pi(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function pl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return po(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return po(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ps(e){var t,n,r=e.harnessId,a=e.open,o=e.onOpenChange,i=(0,x.s9)().locale,l=(0,x.Bd)().t,s=ss(function(e){return e.operations}),c=ss(function(e){return e.operationsLoading}),u=ss(function(e){return e.operationsError}),d=ss(function(e){return e.loadOperations}),f=ss(function(e){return e.undoOperation}),p=pl((0,y.useState)(null),2),h=p[0],m=p[1],v=pl((0,y.useState)(!1),2),b=v[0],w=v[1],k=pl((0,y.useState)(null),2),j=k[0],S=k[1],O=null!=(t=null==s?void 0:s.filter(function(e){return e.harness===r}))?t:[],C=F[r];return(0,y.useEffect)(function(){a&&(S(null),d(r))},[a,r,d]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(lc,{open:a,onOpenChange:o,children:(0,g.jsxs)(lT,{className:"flex max-h-[85vh] w-[min(52rem,calc(100vw-2rem))] max-w-2xl flex-col gap-0 overflow-hidden p-0",children:[(0,g.jsxs)(lA,{className:"shrink-0 space-y-1.5 px-6 pb-4 pt-6 pr-12",children:[(0,g.jsx)(lL,{children:l("operations.titleFor",{harness:C})}),(0,g.jsx)(lI,{children:l("operations.intro")})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-6",children:[c&&0===O.length?(0,g.jsxs)("p",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[(0,g.jsx)(f2,{className:"size-4 animate-spin"}),l("operations.loading")]}):null,u?(0,g.jsx)("p",{className:"py-6 text-sm text-destructive",children:l7(l,u)}):null,c||0!==O.length?null:(0,g.jsx)("p",{className:"py-10 text-center text-sm text-muted-foreground",children:l("operations.empty")}),O.length>0?(0,g.jsx)("ul",{className:"divide-y rounded-xl border",children:O.map(function(e){var t,n,r,a,o;return(0,g.jsxs)("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsxs)("span",{className:"truncate text-sm font-medium",children:[l("operations.kind.".concat(e.kind))," \xb7 ",e.profile]}),(0,g.jsx)(aI,{variant:"degraded"===(n=e.state)?"destructive":"committed"===n?"default":"secondary",children:l("operations.state.".concat(e.state))})]}),(0,g.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[(r=null!=(t=e.finishedAt)?t:e.startedAt,a=i,Number.isNaN((o=new Date(r)).getTime())?r:o.toLocaleString(a))," \xb7"," ",l("operations.user",{user:e.user})," \xb7"," ",l("operations.fileCount",{count:e.files.length})]}),e.note?(0,g.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:e.note}):null]}),(0,g.jsxs)(oo,{size:"sm",variant:"outline",className:"shrink-0",disabled:!e.undoable,onClick:function(){return m(e)},children:[(0,g.jsx)(pa,{}),l("operations.undo")]})]},e.id)})}):null]}),(0,g.jsx)(lR,{className:"shrink-0 px-6 py-4",children:(0,g.jsx)(oo,{onClick:function(){return o(!1)},children:l("operations.close")})})]})}),(0,g.jsx)(lc,{open:null!==h,onOpenChange:function(e){return!e&&m(null)},children:(0,g.jsxs)(lT,{className:"max-w-lg",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:l("operations.undoTitle")}),(0,g.jsx)(lI,{children:h?l("operations.undoBody",{harness:null!=(n=F[h.harness])?n:h.harness,count:h.files.length}):""})]}),j?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(l,j)}):null,(0,g.jsxs)(lR,{children:[(0,g.jsx)(oo,{variant:"outline",onClick:function(){return m(null)},children:l("common.cancel")}),(0,g.jsxs)(oo,{disabled:b,onClick:function(){var e;(e=function(){return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:if(!h)return[2];w(!0),S(null),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,f(h.id)];case 2:return e.sent(),m(null),[3,5];case 3:return S(l8(e.sent(),"operations.undoFailed")),[3,5];case 4:return w(!1),[7];case 5:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){pi(o,r,a,i,l,"next",e)}function l(e){pi(o,r,a,i,l,"throw",e)}i(void 0)})})()},children:[b?(0,g.jsx)(f2,{className:"animate-spin"}):null,l("operations.confirmUndo")]})]})]})})]})}function pc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pu(e){var t,n,r=e.harness,a=(0,x.Bd)().t,o=ss(function(e){return e.operations}),i=ss(function(e){return e.operationsLoading}),l=ss(function(e){return e.operationsError}),s=ss(function(e){return e.loadOperations}),c=function(e){if(Array.isArray(e))return e}(t=(0,y.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(t)||function(e){if(e){if("string"==typeof e)return pc(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return pc(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),u=c[0],d=c[1],f=null!=(n=null==o?void 0:o.filter(function(e){return e.harness===r.id}))?n:[];return(0,y.useEffect)(function(){s(r.id)},[r.id,s]),(0,g.jsxs)("section",{className:"rounded-2xl border bg-card p-5 shadow-[0_12px_34px_-28px_rgb(36_39_70/0.38)]",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(rE,{className:"size-4 text-primary"}),(0,g.jsx)("h3",{className:"font-semibold",children:a("operations.title")}),(0,g.jsx)("span",{className:"ml-auto",children:(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":a("operations.refresh"),onClick:function(){s(r.id)},children:(0,g.jsx)(sp,{className:i?"animate-spin":void 0})})})]}),(0,g.jsx)("div",{className:"mt-4",children:l?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(a,l)}):null===o||i?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:a("operations.loading")}):0===f.length?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:a("operations.empty")}):(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:a("operations.count",{count:f.length})})}),(0,g.jsx)(oo,{className:"mt-4 w-full",size:"sm",variant:"outline",disabled:null===o,onClick:function(){return d(!0)},children:a("operations.viewDetails")}),(0,g.jsx)(ps,{harnessId:r.id,open:u,onOpenChange:d})]})}let pd=O("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),pf=O("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),pp=O("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);function ph(e){var t=e.result,n=(0,x.Bd)().t;if(t.ok){var r,a,o,i,l=null!=(a=null==(i=t.models)?void 0:i.length)?a:0;return(0,g.jsxs)("span",{className:"flex items-center gap-1.5 text-sm text-emerald-600 dark:text-emerald-400",children:[(0,g.jsx)(f4,{className:"size-4 shrink-0","aria-hidden":!0}),n(l>0?"probe.ok":"probe.okNoCatalog",{latencyMs:null!=(o=t.latencyMs)?o:"?",count:l})]})}return(0,g.jsxs)("span",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[(0,g.jsx)(pp,{className:"size-4 shrink-0","aria-hidden":!0}),l7(n,l5({code:t.code,params:t.params,message:null!=(r=t.message)?r:""}))]})}function pm(e){var t=e.className,n=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["className"]);return(0,g.jsx)("textarea",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"data-slot":"textarea",className:aR("flex min-h-[60px] w-full rounded-[10px] border border-input bg-card px-3 py-2 text-base shadow-[0_1px_2px_rgb(20_24_40/0.04)] transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:focus-visible:border-destructive aria-invalid:focus-visible:ring-destructive/25 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t)},n))}function pg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function py(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function pv(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function pb(e){return function(e){if(Array.isArray(e))return pg(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return pg(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return pg(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var px=[{id:"openrouter",baseUrl:"https://openrouter.ai/api/v1"},{id:"zai",baseUrl:"https://api.z.ai/api/paas/v4",model:"glm-4.6"},{id:"moonshot",baseUrl:"https://api.moonshot.cn/v1"},{id:"deepseek",baseUrl:"https://api.deepseek.com/v1"}],pw={id:"cliproxyResponses",baseUrl:"https://api.seavey.ai/cliproxy/v1",model:"gpt-5.6-sol"},pk={claude:[{id:"zaiAnthropic",baseUrl:"https://api.z.ai/api/anthropic",model:"glm-4.6"},{id:"moonshotAnthropic",baseUrl:"https://api.moonshot.cn/anthropic"},{id:"deepseekAnthropic",baseUrl:"https://api.deepseek.com/anthropic"}],codex:px,kimi:px,pi:[pv(py({},pw),{extras:{api:"openai-responses",reasoning:"true"}})].concat(pb(px)),dsh:[pv(py({},pw),{extras:{api:"openai-responses",reasoningEfforts:"low,medium,high,xhigh,max"}})].concat(pb(px))};function pj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pS(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function pO(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){pS(o,r,a,i,l,"next",e)}function l(e){pS(o,r,a,i,l,"throw",e)}i(void 0)})}}function pC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){pC(e,t,n[t])})}return e}function pP(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function pE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||p_(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p_(e,t){if(e){if("string"==typeof e)return pj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pj(e,t)}}function pz(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var pT=[{role:"Sonnet",modelKey:"sonnetModel",nameKey:"sonnetModelName",oneMKey:"sonnetModel1m"},{role:"Opus",modelKey:"opusModel",nameKey:"opusModelName",oneMKey:"opusModel1m"},{role:"Fable",modelKey:"fableModel",nameKey:"fableModelName",oneMKey:"fableModel1m"},{role:"Haiku",modelKey:"haikuModel",nameKey:"haikuModelName",oneMKey:null}],pA="subagentModel",pR="subagentModel1m",pL=new Set(((function(e){if(Array.isArray(e))return pj(e)})(u=pT.flatMap(function(e){var t=e.modelKey,n=e.nameKey,r=e.oneMKey;return r?[t,n,r]:[t,n]}))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(u)||p_(u)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([pA,pR]));function pI(e){var t,n,r,a,o,i,l,s,c,u=e.harness,d=e.profile,f=e.onOpenChange,p=(0,x.Bd)().t,h=ss(function(e){return e.createProfile}),m=ss(function(e){return e.updateProfile}),v=ss(function(e){return e.previewProfile}),b=ss(function(e){return e.providers}),w=ss(function(e){return e.loadProviders}),k=ss(function(e){return e.probeDraft}),j=ss(function(e){return e.probeProfile}),S=null!==d,O=pE((0,y.useState)(null!=(t=null==d?void 0:d.name)?t:""),2),C=O[0],N=O[1],P=pE((0,y.useState)(null!=(n=null==d?void 0:d.baseUrl)?n:""),2),E=P[0],_=P[1],z=pE((0,y.useState)(""),2),T=z[0],R=z[1],L=pE((0,y.useState)(null!=(r=null==d?void 0:d.model)?r:""),2),I=L[0],M=L[1],D=pE((0,y.useState)(null!=(a=null==d?void 0:d.notes)?a:""),2),F=D[0],$=D[1],U=pE((0,y.useState)(function(){return function(e,t){var n={},r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done);r=!0){var s,c,u=i.value;n[u.key]=null!=(s=null!=(c=null==t?void 0:t.extras[u.key])?c:u.defaultValue)?s:""}}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return n}(u.fields,d)}),2),H=U[0],B=U[1],K=pE((0,y.useState)({}),2),V=K[0],q=K[1],W=pE((0,y.useState)(null!=(o=null==d?void 0:d.providerId)?o:""),2),Z=W[0],G=W[1],J=pE((0,y.useState)(null!=(i=null==d?void 0:d.providerEndpoint)?i:""),2),Q=J[0],Y=J[1],X=pE((0,y.useState)(!1),2),ee=X[0],et=X[1],en=pE((0,y.useState)(null),2),er=en[0],ea=en[1],eo=pE((0,y.useState)(null),2),ei=eo[0],el=eo[1],es=pE((0,y.useState)(!1),2),ec=es[0],eu=es[1],ed=pE((0,y.useState)({}),2),ef=ed[0],ep=ed[1],eh=pE((0,y.useState)(!1),2),em=eh[0],eg=eh[1],ey=pE((0,y.useState)(null),2),ev=ey[0],eb=ey[1],ex=null!=b?b:[],ew=null!=(l=ex.find(function(e){return e.id===Z}))?l:null,ek=null==ew?void 0:ew.endpoints.find(function(e){return e.key===Q}),ej=(null==ev?void 0:ev.ok)&&null!=(s=ev.models)?s:[];(0,y.useEffect)(function(){eb(null)},[E,T,Z,Q]);var eS=null!==b&&""!==Z&&null===ew,eO=null!==ew&&""!==Q&&void 0===ek,eC="claude"===u.id?u.fields.filter(function(e){return!pL.has(e.key)}):u.fields,eN="claude"===u.id?eC.filter(function(e){return"authVar"===e.key}):eC,eP="claude"===u.id?eC.filter(function(e){return"authVar"!==e.key}):[];function eE(){return pO(function(){var e;return pz(this,function(t){switch(t.label){case 0:if(!d)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,v(u.id,d.name)];case 2:return ea(e=t.sent()),q(Object.fromEntries(e.filter(function(e){return e.overridden}).map(function(e){return[e.key,e.content]}))),[3,4];case 3:return el(l6(t.sent())),[3,4];case 4:return[2]}})})()}function e_(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];ep(function(e){if(!t.some(function(t){return e[t]}))return e;var n=pN({},e),r=!0,a=!1,o=void 0;try{for(var i,l=t[Symbol.iterator]();!(r=(i=l.next()).done);r=!0){var s=i.value;delete n[s]}}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return n})}function ez(){var e;return ew&&Q&&null!=(e=null==ek?void 0:ek.baseUrl)?e:E}return(0,y.useEffect)(function(){null===b&&w()},[b,w]),(0,g.jsx)(lc,{open:!0,onOpenChange:f,children:(0,g.jsx)(lT,{className:"max-h-[92vh] w-[calc(100vw-2rem)] overflow-hidden p-0 sm:max-w-[1120px]",children:(0,g.jsxs)("form",{onSubmit:function(e){return pO(function(){var t,n;return pz(this,function(r){switch(r.label){case 0:if(e.preventDefault(),!function(){var e={},t=C.trim();t?t.includes("/")||t.includes("\\")?e.name={key:"profile.error.nameSlash"}:t.length>120&&(e.name={key:"profile.error.nameTooLong",params:{max:120}}):e.name={key:"profile.error.nameRequired"},ez().trim()||(e.baseUrl={key:"profile.error.baseUrlRequired"}),S||null!==ew||T.trim()||(e.apiKey={key:"profile.error.apiKeyRequired"}),u.modelRequired&&!I.trim()&&(e.model={key:"profile.error.modelRequired"}),eS&&(e.providerId={key:"profile.error.providerGone"}),eO&&(e.providerEndpoint={key:"profile.error.endpointGone"});var n=!0,r=!1,a=void 0;try{for(var o,i=u.fields[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l,s=o.value;!s.required||(null==(l=H[s.key])?void 0:l.trim())||(e["extra:".concat(s.key)]={key:"profile.error.fieldRequired",params:{label:s.label}})}}catch(e){r=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw a}}return ep(e),!(Object.keys(e).length>0)||(el({key:"profile.error.checkFields"}),!1)}())return[2];eu(!0),el(null),r.label=1;case 1:if(r.trys.push([1,6,7,8]),n=pN({name:C,baseUrl:ew&&Q&&null!=(t=null==ek?void 0:ek.baseUrl)?t:E,model:I,notes:F,extras:H},Z?pN({providerId:Z},Q?{providerEndpoint:Q}:{}):S?{providerId:""}:{},ew?{}:{apiKey:T||void 0}),!S)return[3,3];return[4,m(u.id,d.name,pP(pN({},n),{overrides:V}))];case 2:return r.sent(),[3,5];case 3:return[4,h(u.id,n)];case 4:r.sent(),r.label=5;case 5:return f(!1),[3,8];case 6:return el(l6(r.sent())),[3,8];case 7:return eu(!1),[7];case 8:return[2]}})})()},noValidate:!0,className:"flex max-h-[92vh] min-h-0 flex-col",children:[(0,g.jsxs)(lA,{className:"shrink-0 border-b bg-card px-6 py-5 pr-12",children:[(0,g.jsx)(lL,{children:S?p("profile.editTitle",{harness:u.label,profile:d.name}):p("profile.createTitle",{harness:u.label})}),(0,g.jsxs)(lI,{children:[p("profile.intro",{targets:u.targets.map(function(e){return e.label}).join(p("common.listSeparator"))}),"additive"===u.mode?p("profile.additiveNote"):""]})]}),(0,g.jsxs)("div",{"data-slot":"profile-dialog-scroll",className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-5",children:[(0,g.jsxs)("div",{"data-slot":"provider-reference-fields",className:"space-y-3 rounded-xl border p-3",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-select",className:"font-medium",children:p("profile.useSharedProvider")}),ew?(0,g.jsx)(aI,{variant:"secondary",children:p("profile.keyFromVault")}):null]}),(0,g.jsxs)(df,{value:Z,onValueChange:function(e){G(e);var t,n,r=ex.find(function(t){return t.id===e});Y(null!=(t=null==r||null==(n=r.endpoints[0])?void 0:n.key)?t:""),e_("providerId","providerEndpoint","baseUrl","apiKey")},children:[(0,g.jsx)(fe,{id:"provider-select","aria-label":p("profile.useSharedProviderLabel"),"aria-invalid":!!ef.providerId||void 0,"aria-describedby":ef.providerId?"provider-select-error":void 0,children:(0,g.jsx)(dh,{placeholder:p("profile.providerNone")})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"",children:p("profile.providerNone")}),ex.map(function(e){return(0,g.jsx)(fa,{value:e.id,children:e.name},e.id)})]})]}),ef.providerId?(0,g.jsx)("p",{id:"provider-select-error",className:"text-xs text-destructive",children:l7(p,ef.providerId)}):null,0===ex.length?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.vaultEmpty")}):null,ew?(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-endpoint",children:p("profile.namedEndpoint")}),(0,g.jsxs)(df,{value:Q,onValueChange:function(e){Y(e),e_("providerEndpoint","baseUrl")},children:[(0,g.jsx)(fe,{id:"provider-endpoint","aria-label":p("profile.namedEndpointLabel"),"aria-invalid":!!ef.providerEndpoint||void 0,"aria-describedby":ef.providerEndpoint?"provider-endpoint-error":void 0,children:(0,g.jsx)(dh,{placeholder:p("profile.endpointNone")})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"",children:p("profile.endpointNone")}),ew.endpoints.map(function(e){return(0,g.jsx)(fa,{value:e.key,children:e.label?p("profile.endpointOption",{label:e.label,key:e.key}):e.key},e.key)})]})]}),ef.providerEndpoint?(0,g.jsx)("p",{id:"provider-endpoint-error",className:"text-xs text-destructive",children:l7(p,ef.providerEndpoint)}):null,0===ew.endpoints.length?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.noEndpoints")}):null]}):null]}),(0,g.jsx)(pD,{harnessId:u.id,onPick:function(e){_(e.baseUrl),e_("baseUrl"),e.model&&(M(e.model),e_("model")),e.extras&&B(function(t){return pN({},t,e.extras)})}}),(0,g.jsxs)("div",{className:"grid gap-x-4 gap-y-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"name",children:p("profile.name")}),(0,g.jsx)(cm,{id:"name",value:C,onChange:function(e){N(e.target.value),e_("name")},placeholder:p("profile.namePlaceholder"),"aria-invalid":!!ef.name||void 0,"aria-describedby":ef.name?"profile-name-error":void 0}),ef.name?(0,g.jsx)("p",{id:"profile-name-error",className:"text-xs text-destructive",children:l7(p,ef.name)}):null,S?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.renameHint")}):null]}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"baseUrl",children:p("profile.baseUrl")}),(0,g.jsx)(cm,{id:"baseUrl",value:ew&&Q&&null!=(c=null==ek?void 0:ek.baseUrl)?c:E,onChange:function(e){_(e.target.value),e_("baseUrl")},placeholder:p("profile.baseUrlPlaceholder"),disabled:null!==ew&&""!==Q,"aria-invalid":!!ef.baseUrl||void 0,"aria-describedby":ef.baseUrl?"profile-base-url-error":void 0}),ef.baseUrl?(0,g.jsx)("p",{id:"profile-base-url-error",className:"text-xs text-destructive",children:l7(p,ef.baseUrl)}):null,ew&&Q?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.baseUrlFromVault",{endpoint:Q})}):null]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"apiKey",children:p("profile.apiKey")}),(0,g.jsx)(cm,{id:"apiKey",type:"password",value:T,onChange:function(e){R(e.target.value),e_("apiKey")},placeholder:ew?p("profile.keyFromVault"):S?p("profile.apiKeyKeep"):p("profile.apiKeyRequiredPlaceholder"),disabled:null!==ew,"aria-invalid":!!ef.apiKey||void 0,"aria-describedby":ef.apiKey?"profile-api-key-error":void 0}),ef.apiKey?(0,g.jsx)("p",{id:"profile-api-key-error",className:"text-xs text-destructive",children:l7(p,ef.apiKey)}):null,ew?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.apiKeySharedHint")}):null]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"model",children:"claude"===u.id?p("profile.fallbackModel"):p("profile.model")}),(0,g.jsx)(cm,{id:"model",value:I,list:ej.length>0?"profile-model-options":void 0,onChange:function(e){M(e.target.value),e_("model")},placeholder:"claude"===u.id?p("profile.fallbackModelPlaceholder"):p("profile.modelPlaceholder"),"aria-invalid":!!ef.model||void 0,"aria-describedby":ef.model?"profile-model-error":void 0}),ej.length>0?(0,g.jsx)("datalist",{id:"profile-model-options",children:ej.map(function(e){return(0,g.jsx)("option",{value:e},e)})}):null,ef.model?(0,g.jsx)("p",{id:"profile-model-error",className:"text-xs text-destructive",children:l7(p,ef.model)}):null,"claude"===u.id?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("profile.claudeModelHint")}):null]}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsxs)(oo,{type:"button",variant:"outline",size:"sm",onClick:function(){return pO(function(){var e,t;return pz(this,function(n){switch(n.label){case 0:if(!(e=ez().trim()))return ep(function(e){return pP(pN({},e),{baseUrl:{key:"profile.error.baseUrlRequired"}})}),[2];eg(!0),el(null),eb(null),n.label=1;case 1:if(n.trys.push([1,7,8,9]),!(ew||T.trim()))return[3,3];return[4,k(pN({baseUrl:e},ew?{providerId:Z}:{apiKey:T}))];case 2:case 4:return t=n.sent(),[3,6];case 3:if(!(S&&d))return[3,5];return[4,j(u.id,d.name)];case 5:return ep(function(e){return pP(pN({},e),{apiKey:{key:"profile.error.apiKeyRequired"}})}),[2];case 6:return eb(t),[3,9];case 7:return el(l6(n.sent())),[3,9];case 8:return eg(!1),[7];case 9:return[2]}})})()},disabled:em,children:[em?(0,g.jsx)(f2,{className:"animate-spin"}):null,em?p("probe.probing"):p("probe.action")]}),ev?(0,g.jsx)(ph,{result:ev}):null]}),(null==ev?void 0:ev.ok)&&ej.length>0?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:p("probe.catalogHint")}):null]}),eN.map(function(e){var t;return(0,g.jsx)(pF,{field:e,value:null!=(t=H[e.key])?t:"",error:ef["extra:".concat(e.key)],onChange:function(t){B(function(n){return pP(pN({},n),pC({},e.key,t))}),e_("extra:".concat(e.key))}},e.key)}),"claude"===u.id?(0,g.jsx)(pH,{fields:u.fields,values:H,errors:ef,onChange:function(e,t){B(function(n){return pP(pN({},n),pC({},e,t))}),e_("extra:".concat(e))}}):null,eP.map(function(e){var t;return(0,g.jsx)(pF,{field:e,value:null!=(t=H[e.key])?t:"",error:ef["extra:".concat(e.key)],onChange:function(t){B(function(n){return pP(pN({},n),pC({},e.key,t))}),e_("extra:".concat(e.key))}},e.key)}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"notes",children:p("profile.notes")}),(0,g.jsx)(pm,{id:"notes",rows:2,value:F,onChange:function(e){return $(e.target.value)}})]})]}),(0,g.jsxs)("div",{className:"rounded-xl border",children:[(0,g.jsxs)("button",{type:"button",onClick:function(){var e=!ee;et(e),e&&null===er&&eE()},className:"flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground active:bg-accent/80 ".concat(ee?"rounded-t-xl":"rounded-xl"),children:[ee?(0,g.jsx)(A,{className:"size-4"}):(0,g.jsx)(pd,{className:"size-4"}),p("profile.advanced"),d&&d.overriddenTargets.length>0?(0,g.jsx)(aI,{variant:"secondary",children:p("profile.overridden")}):null]}),ee?(0,g.jsx)("div",{className:"space-y-4 border-t px-3 py-3",children:S?(0,g.jsx)(pM,{targets:er,overrides:V,onEdit:function(e,t){return q(function(n){return pP(pN({},n),pC({},e,t))})},onReset:function(e){q(function(t){var n=pN({},t);return delete n[e],n}),eE()}}):(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:p("profile.saveFirst")})}):null]}),ei?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(p,ei)}):null]}),(0,g.jsxs)(lR,{className:"shrink-0 border-t bg-card px-6 py-4",children:[(0,g.jsx)(oo,{type:"button",variant:"outline",onClick:function(){return f(!1)},children:p("common.cancel")}),(0,g.jsx)(oo,{type:"submit",disabled:ec,children:ec?p("profile.saving"):p("profile.save")})]})]})})})}function pM(e){var t=e.targets,n=e.overrides,r=e.onEdit,a=e.onReset,o=(0,x.Bd)().t;return null===t?(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:o("profile.rawLoading")}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:o("profile.rawIntro")}),t.map(function(e){var t,i=void 0!==n[e.key];return(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,g.jsx)(cv,{htmlFor:"raw-".concat(e.key),className:"font-mono text-xs",children:e.path}),i?(0,g.jsxs)(oo,{type:"button",size:"sm",variant:"ghost",onClick:function(){return a(e.key)},children:[(0,g.jsx)(pf,{}),o("profile.resetToGenerated")]}):null]}),(0,g.jsx)(pm,{id:"raw-".concat(e.key),rows:10,spellCheck:!1,className:"font-mono text-xs",value:null!=(t=n[e.key])?t:e.content,onChange:function(t){return r(e.key,t.target.value)}})]},e.key)})]})}function pD(e){var t,n=e.harnessId,r=e.onPick,a=(0,x.Bd)().t,o=null!=(t=pk[n])?t:[];return 0===o.length?null:(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsx)("span",{className:"text-xs text-muted-foreground",children:a("profile.quickFill")}),o.map(function(e){return(0,g.jsx)(oo,{type:"button",size:"sm",variant:"outline",onClick:function(){return r(e)},children:a("preset.".concat(e.id))},e.id)})]})}function pF(e){var t,n,r=e.field,a=e.value,o=e.error,i=e.onChange,l=(0,x.Bd)().t,s="extra-".concat(r.key);return(0,g.jsxs)("div",{className:"textarea"===r.kind||r.fullWidth?"space-y-2 sm:col-span-2":"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:s,children:r.label}),"select"===r.kind?(0,g.jsxs)(df,{value:a,onValueChange:i,children:[(0,g.jsx)(fe,{id:s,"aria-label":r.label,"aria-invalid":!!o||void 0,"aria-describedby":o?"".concat(s,"-error"):void 0,children:(0,g.jsx)(dh,{placeholder:null!=(t=r.placeholder)?t:l("profile.selectPlaceholder")})}),(0,g.jsx)(fr,{children:null==(n=r.options)?void 0:n.map(function(e){return(0,g.jsx)(fa,{value:e.value,children:e.label},e.value)})})]}):"textarea"===r.kind?(0,g.jsx)(pm,{id:s,rows:3,value:a,placeholder:r.placeholder,className:"font-mono text-xs","aria-invalid":!!o||void 0,"aria-describedby":o?"".concat(s,"-error"):void 0,onChange:function(e){return i(e.target.value)}}):(0,g.jsx)(cm,{id:s,type:"password"===r.kind?"password":"text",value:a,placeholder:r.placeholder,"aria-invalid":!!o||void 0,"aria-describedby":o?"".concat(s,"-error"):void 0,onChange:function(e){return i(e.target.value)}}),o?(0,g.jsx)("p",{id:"".concat(s,"-error"),className:"text-xs text-destructive",children:l7(l,o)}):null,r.help?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:r.help}):null]})}var p$="md:grid-cols-[6.5rem_minmax(0,1fr)_minmax(0,1fr)_8.5rem]",pU="grid gap-2 rounded-lg border bg-card/70 p-3 ".concat(p$," md:items-start md:gap-3 md:border-0 md:bg-transparent md:p-0");function pH(e){var t,n=e.fields,r=e.values,a=e.errors,o=e.onChange,i=(0,x.Bd)().t,l=new Map(n.map(function(e){return[e.key,e]})),s=l.get(pA);return(0,g.jsxs)("section",{"data-slot":"claude-model-mapping",className:"space-y-4 rounded-xl border bg-muted/15 p-4 sm:col-span-2 sm:p-5",children:[(0,g.jsxs)("div",{className:"space-y-1",children:[(0,g.jsx)("h3",{className:"text-base font-semibold",children:i("profile.mapping.title")}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:i("profile.mapping.intro")})]}),(0,g.jsxs)("div",{className:"hidden gap-3 px-1 text-xs font-medium text-muted-foreground md:grid ".concat(p$),children:[(0,g.jsx)("span",{children:i("profile.mapping.role")}),(0,g.jsx)("span",{children:i("profile.mapping.displayName")}),(0,g.jsx)("span",{children:i("profile.mapping.actualModel")}),(0,g.jsx)("span",{children:i("profile.mapping.oneM")})]}),(0,g.jsxs)("div",{className:"space-y-3",children:[pT.map(function(e){var t,n,s,c=e.role,u=e.modelKey,d=e.nameKey,f=e.oneMKey,p=l.get(u),h=l.get(d);if(!p||!h)return null;var m=a["extra:".concat(u)],y=a["extra:".concat(d)];return(0,g.jsxs)("div",{className:pU,children:[(0,g.jsxs)("div",{className:"flex h-10 items-center rounded-lg border bg-muted/45 px-3 text-sm font-medium",children:[c,p.required?(0,g.jsx)("span",{className:"ml-1 text-destructive",children:"*"}):null]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"extra-".concat(d),className:"text-xs md:sr-only",children:h.label}),(0,g.jsx)(cm,{id:"extra-".concat(d),value:null!=(t=r[d])?t:"",placeholder:(null==(s=r[u])?void 0:s.trim())?i("profile.mapping.defaultTo",{model:r[u].trim()}):h.placeholder,"aria-invalid":!!y||void 0,"aria-describedby":y?"extra-".concat(d,"-error"):void 0,onChange:function(e){return o(d,e.target.value)}}),y?(0,g.jsx)("p",{id:"extra-".concat(d,"-error"),className:"text-xs text-destructive",children:l7(i,y)}):null]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"extra-".concat(u),className:"text-xs md:sr-only",children:p.label}),(0,g.jsx)(cm,{id:"extra-".concat(u),value:null!=(n=r[u])?n:"",placeholder:p.placeholder,"aria-invalid":!!m||void 0,"aria-describedby":m?"extra-".concat(u,"-error"):void 0,onChange:function(e){return o(u,e.target.value)}}),m?(0,g.jsx)("p",{id:"extra-".concat(u,"-error"),className:"text-xs text-destructive",children:l7(i,m)}):null]}),(0,g.jsx)(pB,{role:c,field:f?l.get(f):void 0,value:f?r[f]:void 0,error:f?a["extra:".concat(f)]:void 0,onChange:o})]},c)}),s?(0,g.jsxs)("div",{className:pU,children:[(0,g.jsx)("div",{className:"flex h-10 items-center rounded-lg border bg-muted/45 px-3 text-sm font-medium",children:"Subagent"}),(0,g.jsx)("div",{className:"flex h-10 items-center rounded-lg border bg-muted/30 px-3 text-sm text-muted-foreground",children:i("profile.mapping.notInMenu")}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cv,{htmlFor:"extra-subagentModel",className:"text-xs md:sr-only",children:s.label}),(0,g.jsx)(cm,{id:"extra-subagentModel",value:null!=(t=r.subagentModel)?t:"",placeholder:s.placeholder,"aria-invalid":!!a["extra:subagentModel"]||void 0,"aria-describedby":a["extra:subagentModel"]?"extra-subagentModel-error":void 0,onChange:function(e){return o("subagentModel",e.target.value)}}),a["extra:subagentModel"]?(0,g.jsx)("p",{id:"extra-subagentModel-error",className:"text-xs text-destructive",children:l7(i,a["extra:subagentModel"])}):null]}),(0,g.jsx)(pB,{role:"Subagent",field:l.get(pR),value:r[pR],error:a["extra:".concat(pR)],onChange:o})]}):null]})]})}function pB(e){var t=e.role,n=e.field,r=e.value,a=e.error,o=e.onChange,i=(0,x.Bd)().t;if(!n)return(0,g.jsx)("div",{"data-slot":"one-m-unsupported",className:"flex h-10 items-center rounded-lg border border-dashed bg-muted/20 px-3 text-sm text-muted-foreground",children:i("profile.mapping.oneMUnsupported",{role:t})});var l="extra-".concat(n.key);return(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)("div",{className:"flex h-10 items-center",children:(0,g.jsxs)("label",{htmlFor:l,className:"flex cursor-pointer items-center gap-2 text-sm text-muted-foreground",children:[(0,g.jsx)(ch,{id:l,checked:"true"===r,"aria-label":n.label,"aria-invalid":!!a||void 0,"aria-describedby":a?"".concat(l,"-error"):void 0,onCheckedChange:function(e){return o(n.key,!0===e?"true":"false")}}),(0,g.jsx)("span",{className:"md:hidden",children:n.label}),(0,g.jsx)("span",{className:"hidden md:inline",children:i("profile.mapping.enable")})]})}),a?(0,g.jsx)("p",{id:"".concat(l,"-error"),className:"text-xs text-destructive",children:l7(i,a)}):null]})}let pK=O("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),pV=O("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function pq(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pW(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function pZ(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){pW(o,r,a,i,l,"next",e)}function l(e){pW(o,r,a,i,l,"throw",e)}i(void 0)})}}function pG(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){pG(e,t,n[t])})}return e}function pQ(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function pY(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||p0(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pX(e){return function(e){if(Array.isArray(e))return pq(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p0(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p0(e,t){if(e){if("string"==typeof e)return pq(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pq(e,t)}}function p1(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function p2(e){var t,n=e.open,r=e.onOpenChange,a=(0,x.s9)().locale,o=(0,x.Bd)().t,i=ss(function(e){return e.providers}),l=ss(function(e){return e.providersLoading}),s=ss(function(e){return e.providersError}),c=ss(function(e){return e.loadProviders}),u=ss(function(e){return e.deleteProvider}),d=pY((0,y.useState)({kind:"list"}),2),f=d[0],p=d[1],h=pY((0,y.useState)(null),2),m=h[0],v=h[1],b=pY((0,y.useState)(null),2),w=b[0],k=b[1],j=pY((0,y.useState)(null),2),S=j[0],O=j[1],C=pY((0,y.useState)(null),2),N=C[0],P=C[1],E=pY((0,y.useState)({}),2),_=E[0],z=E[1],A=ss(function(e){return e.revealProvider});(0,y.useEffect)(function(){n&&(p({kind:"list"}),v(null),k(null),P(null),null===i&&c())},[n,i,c]);var R=null!=i?i:[];return(0,g.jsxs)(lc,{open:n,onOpenChange:r,children:[(0,g.jsxs)(lT,{className:"max-h-[88vh] overflow-y-auto sm:max-w-2xl",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:"create"===f.kind?o("vault.createTitle"):"edit"===f.kind?o("vault.editTitle",{name:f.entry.name}):o("vault.title")}),(0,g.jsx)(lI,{children:"list"===f.kind?o("vault.intro"):o("vault.formIntro")})]}),l&&0===R.length?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:o("vault.loading")}):null,s?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,s)}):null,"create"===f.kind||"edit"===f.kind?(0,g.jsx)(p4,{entry:"edit"===f.kind?f.entry:null,onCancel:function(){p({kind:"list"}),k(null)},onSaved:function(e){p({kind:"list"}),v(e),k(null)}}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:o("vault.entryCount",{count:R.length})}),(0,g.jsxs)(oo,{size:"sm",onClick:function(){return p({kind:"create"})},children:[(0,g.jsx)(T,{}),o("vault.add")]})]}),m?(0,g.jsx)("div",{className:"rounded-xl bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600 dark:text-emerald-400",children:m.map(function(e){return(0,g.jsx)("p",{children:l7(o,e)},e.key+e.scope)})}):null,w?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,w)}):null,0===R.length?(0,g.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:o("vault.empty")}):(0,g.jsx)("ul",{className:"max-h-80 divide-y overflow-y-auto rounded-xl border",children:R.map(function(e){var t,n,r;return(0,g.jsxs)("li",{className:"px-4 py-3",children:[(0,g.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,g.jsxs)("div",{className:"min-w-0",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsx)("p",{className:"font-medium",children:e.name}),e.apiKeyConfigured?(0,g.jsx)(aI,{variant:"secondary",children:o("vault.keyConfigured")}):(0,g.jsx)(aI,{variant:"outline",children:o("vault.keyMissing")}),(0,g.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:(t=e.updatedAt,n=a,Number.isNaN((r=new Date(t)).getTime())?t:r.toLocaleString(n))})]}),e.notes?(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e.notes}):null,e.endpoints.length>0?(0,g.jsx)("ul",{className:"mt-2 space-y-1",children:e.endpoints.map(function(e){return(0,g.jsxs)("li",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,g.jsx)("code",{className:"font-mono text-xs",children:e.key}),(0,g.jsx)("span",{className:"break-all font-mono text-[11px] text-muted-foreground",children:e.baseUrl})]},e.key)})}):(0,g.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("vault.noEndpoints")})]}),(0,g.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":void 0!==_[e.id]?o("vault.hide",{name:e.name}):o("vault.reveal",{name:e.name}),onClick:function(){pZ(function(){var t;return p1(this,function(n){switch(n.label){case 0:if(void 0!==_[e.id])return z(function(t){var n=pJ({},t);return delete n[e.id],n}),[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,A(e.id)];case 2:return t=n.sent().apiKey,z(function(n){return pQ(pJ({},n),pG({},e.id,t))}),[3,4];case 3:return k(l8(n.sent(),"vault.revealFailed")),[3,4];case 4:return[2]}})})()},children:void 0!==_[e.id]?(0,g.jsx)(pK,{}):(0,g.jsx)(pV,{})}),(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":o("vault.edit",{name:e.name}),onClick:function(){p({kind:"edit",entry:e}),k(null)},children:(0,g.jsx)(fp,{})}),(0,g.jsx)(oo,{size:"icon",variant:"ghost","aria-label":o("vault.delete",{name:e.name}),onClick:function(){P(null),O(e)},children:(0,g.jsx)(fh,{className:"text-destructive"})})]})]}),void 0!==_[e.id]?(0,g.jsx)("p",{className:"mt-2 break-all rounded-lg bg-muted/60 px-3 py-2 font-mono text-xs",children:_[e.id]}):null]},e.id)})})]}),"list"===f.kind?(0,g.jsx)(lR,{children:(0,g.jsx)(oo,{variant:"outline",onClick:function(){return r(!1)},children:o("vault.close")})}):null]}),(0,g.jsx)(sj,{open:null!==S,onOpenChange:function(e){return!e&&O(null)},children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:o("vault.deleteTitle")}),(0,g.jsx)(s$,{children:o("vault.deleteBody",{name:null!=(t=null==S?void 0:S.name)?t:""})})]}),N?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(o,N)}):null,(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:o("common.cancel")}),(0,g.jsx)(sU,{onClick:function(e){e.preventDefault(),S&&pZ(function(){return p1(this,function(e){switch(e.label){case 0:P(null),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,u(S.id)];case 2:return e.sent(),O(null),v([{key:"vault.deleted"}]),[3,4];case 3:return P(l8(e.sent(),"vault.deleteFailed")),[3,4];case 4:return[2]}})})()},children:o("common.delete")})]})]})})]})}function p4(e){var t,n,r=e.entry,a=e.onCancel,o=e.onSaved,i=(0,x.Bd)().t,l=ss(function(e){return e.createProvider}),s=ss(function(e){return e.updateProvider}),c=ss(function(e){return e.probeDraft}),u=null!==r,d=pY((0,y.useState)(null!=(t=null==r?void 0:r.name)?t:""),2),f=d[0],p=d[1],h=pY((0,y.useState)(""),2),m=h[0],v=h[1],b=pY((0,y.useState)(null!=(n=null==r?void 0:r.notes)?n:""),2),w=b[0],k=b[1],j=pY((0,y.useState)(function(){var e;return(null!=(e=null==r?void 0:r.endpoints)?e:[]).map(function(e){return{key:e.key,baseUrl:e.baseUrl,label:e.label}})}),2),S=j[0],O=j[1],C=pY((0,y.useState)(!1),2),N=C[0],P=C[1],E=pY((0,y.useState)(null),2),_=E[0],z=E[1],A=pY((0,y.useState)({}),2),R=A[0],L=A[1],I=pY((0,y.useState)({}),2),M=I[0],D=I[1],F=pY((0,y.useState)(!1),2),$=F[0],U=F[1],H=pY((0,y.useState)(null),2),B=H[0],K=H[1],V=pY((0,y.useState)(null),2),q=V[0],W=V[1],Z=pY((0,y.useState)(0),2),G=Z[0],J=Z[1],Q=JSON.stringify(S);function Y(e,t){O(function(n){return n.map(function(n,r){return r===e?pJ({},n,t):n})}),D(function(n){if(!n[e])return n;var r=pJ({},n),a=pJ({},r[e]);return void 0!==t.key&&delete a.key,void 0!==t.baseUrl&&delete a.baseUrl,0===Object.keys(a).length?delete r[e]:r[e]=a,r})}return(0,y.useEffect)(function(){K(null),W(null)},[m,Q]),(0,g.jsxs)("form",{onSubmit:function(e){return pZ(function(){var t,n,a,i,c,d,p,h,g,y,v,b;return p1(this,function(x){switch(x.label){case 0:e.preventDefault(),t=S.map(function(e){return{key:e.key.trim(),label:e.label.trim(),baseUrl:e.baseUrl.trim()}}),n=pJ({},f.trim()?{}:{name:{key:"vault.error.nameRequired"}},u||m.trim()?{}:{apiKey:{key:"vault.error.apiKeyRequired"}}),a=new Map,i=!0,c=!1,d=void 0;try{for(p=t[Symbol.iterator]();!(i=(h=p.next()).done);i=!0)(g=h.value).key&&a.set(g.key,(null!=(y=a.get(g.key))?y:0)+1)}catch(e){c=!0,d=e}finally{try{i||null==p.return||p.return()}finally{if(c)throw d}}if(v=Object.fromEntries(t.flatMap(function(e,t){var n,r={};return e.key?e.key.includes("/")||e.key.includes("\\")||e.key.length>60?r.key={key:"vault.error.endpointKeyInvalid",params:{max:60}}:(null!=(n=a.get(e.key))?n:0)>1&&(r.key={key:"vault.error.endpointKeyDuplicate"}):r.key={key:"vault.error.endpointKeyRequired"},e.baseUrl||(r.baseUrl={key:"vault.error.endpointUrlRequired"}),Object.keys(r).length>0?[[t,r]]:[]})),L(n),D(v),Object.keys(n).length>0||Object.keys(v).length>0)return z({key:"vault.error.checkFields"}),[2];b={name:f.trim(),notes:w.trim()||void 0,endpoints:t},P(!0),z(null),x.label=1;case 1:if(x.trys.push([1,6,7,8]),!(u&&r))return[3,3];return[4,s(r.id,pJ({},b,m.trim()?{apiKey:m.trim()}:{}))];case 2:return o([{key:"vault.updated"}].concat(pX(x.sent().warnings.map(l5)))),[3,5];case 3:return[4,l(pQ(pJ({},b),{apiKey:m.trim()}))];case 4:x.sent(),o([{key:"vault.created"}]),x.label=5;case 5:return[3,8];case 6:return z(l8(x.sent(),"vault.saveFailed")),[3,8];case 7:return P(!1),[7];case 8:return[2]}})})()},noValidate:!0,className:"space-y-4",children:[(0,g.jsxs)("div",{className:"grid gap-x-4 gap-y-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-name",children:i("vault.name")}),(0,g.jsx)(cm,{id:"provider-name",value:f,onChange:function(e){p(e.target.value),L(function(e){return pQ(pJ({},e),{name:void 0})})},placeholder:i("vault.namePlaceholder"),"aria-invalid":!!R.name||void 0,"aria-describedby":R.name?"provider-name-error":void 0}),R.name?(0,g.jsx)("p",{id:"provider-name-error",className:"text-xs text-destructive",children:l7(i,R.name)}):null]}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-api-key",children:i("vault.apiKey")}),(0,g.jsx)(cm,{id:"provider-api-key",type:"password",value:m,onChange:function(e){v(e.target.value),L(function(e){return pQ(pJ({},e),{apiKey:void 0})})},placeholder:u?i("vault.apiKeyKeep"):i("vault.apiKeyRequiredPlaceholder"),"aria-invalid":!!R.apiKey||void 0,"aria-describedby":R.apiKey?"provider-api-key-error":void 0}),R.apiKey?(0,g.jsx)("p",{id:"provider-api-key-error",className:"text-xs text-destructive",children:l7(i,R.apiKey)}):null]}),(0,g.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,g.jsx)(cv,{htmlFor:"provider-notes",children:i("vault.notes")}),(0,g.jsx)(pm,{id:"provider-notes",rows:2,value:w,onChange:function(e){return k(e.target.value)}})]})]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{children:i("vault.endpoints")}),(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:i("vault.endpointsHint")}),0===S.length?(0,g.jsx)("p",{className:"rounded-xl border border-dashed px-3 py-3 text-center text-xs text-muted-foreground",children:i("vault.noEndpointDrafts")}):(0,g.jsx)("div",{className:"space-y-2",children:S.map(function(e,t){var n,r,a,o,l,s;return(0,g.jsxs)("div",{className:"grid items-start gap-2 sm:grid-cols-[10rem_minmax(0,1fr)_minmax(0,1fr)_auto]",children:[(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cm,{"aria-label":i("vault.endpointKeyLabel",{index:t+1}),value:e.key,onChange:function(e){return Y(t,{key:e.target.value})},placeholder:i("vault.endpointKeyPlaceholder"),"aria-invalid":null!=(n=M[t])&&!!n.key||void 0,"aria-describedby":(null==(r=M[t])?void 0:r.key)?"endpoint-".concat(t,"-key-error"):void 0}),(null==(a=M[t])?void 0:a.key)?(0,g.jsx)("p",{id:"endpoint-".concat(t,"-key-error"),className:"text-xs text-destructive",children:l7(i,M[t].key)}):null]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)(cm,{"aria-label":i("vault.endpointUrlLabel",{index:t+1}),value:e.baseUrl,onChange:function(e){return Y(t,{baseUrl:e.target.value})},placeholder:i("vault.endpointUrlPlaceholder"),"aria-invalid":null!=(o=M[t])&&!!o.baseUrl||void 0,"aria-describedby":(null==(l=M[t])?void 0:l.baseUrl)?"endpoint-".concat(t,"-url-error"):void 0}),(null==(s=M[t])?void 0:s.baseUrl)?(0,g.jsx)("p",{id:"endpoint-".concat(t,"-url-error"),className:"text-xs text-destructive",children:l7(i,M[t].baseUrl)}):null]}),(0,g.jsx)(cm,{"aria-label":i("vault.endpointLabelLabel",{index:t+1}),value:e.label,onChange:function(e){return Y(t,{label:e.target.value})},placeholder:i("vault.endpointLabelPlaceholder")}),(0,g.jsx)(oo,{type:"button",size:"icon",variant:"ghost","aria-label":i("vault.removeEndpoint",{index:t+1}),onClick:function(){O(function(e){return e.filter(function(e,n){return n!==t})}),D({})},children:(0,g.jsx)(fh,{})})]},t)})}),(0,g.jsxs)(oo,{type:"button",size:"sm",variant:"outline",onClick:function(){return O(function(e){return pX(e).concat([{key:"",baseUrl:"",label:""}])})},children:[(0,g.jsx)(T,{}),i("vault.addEndpoint")]}),(0,g.jsx)(p3,{options:S.map(function(e,t){return{index:t,key:e.key,baseUrl:e.baseUrl}}).filter(function(e){return e.baseUrl.trim()}),targetIndex:G,onTargetChange:J,hasStoredKey:u,hasTypedKey:m.trim().length>0,onMissingKey:function(){return L(function(e){return pQ(pJ({},e),{apiKey:{key:"vault.error.apiKeyRequired"}})})},probing:$,result:B,probeError:q,onProbe:function(){return pZ(function(){var e,t,n,a;return p1(this,function(o){switch(o.label){case 0:if(!(n=null!=(e=(t=S.map(function(e,t){return{endpoint:e,index:t}}).filter(function(e){return""!==e.endpoint.baseUrl.trim()})).find(function(e){return e.index===G}))?e:t[0]))return K(null),W({key:"probe.missingBaseUrl"}),[2];if(!u&&!m.trim())return K(null),W(null),L(function(e){return pQ(pJ({},e),{apiKey:{key:"vault.error.apiKeyRequired"}})}),[2];U(!0),W(null),K(null),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,c(pJ({baseUrl:n.endpoint.baseUrl},m.trim()?{apiKey:m}:{providerId:null!=(a=null==r?void 0:r.id)?a:""}))];case 2:return K(o.sent()),[3,5];case 3:return W(l8(o.sent(),"vault.probeFailed")),[3,5];case 4:return U(!1),[7];case 5:return[2]}})})()}})]}),_?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(i,_)}):null,(0,g.jsxs)(lR,{className:"flex-row justify-end gap-2 space-x-0",children:[(0,g.jsx)(oo,{type:"button",variant:"outline",className:"min-w-24",onClick:a,children:i("common.cancel")}),(0,g.jsx)(oo,{type:"submit",className:"min-w-24",disabled:N,children:N?i("vault.saving"):u?i("vault.saveChanges"):i("vault.add")})]})]})}function p3(e){var t,n,r=e.options,a=e.targetIndex,o=e.onTargetChange,i=e.hasStoredKey,l=e.hasTypedKey,s=e.onMissingKey,c=e.probing,u=e.result,d=e.probeError,f=e.onProbe,p=(0,x.Bd)().t;if(0===r.length&&!i)return null;var h=null!=(t=r.find(function(e){return e.index===a}))?t:r[0];return(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-t pt-3",children:[(0,g.jsxs)(oo,{type:"button",variant:"outline",size:"sm",disabled:c||0===r.length&&!l,onClick:function(){l||i?f():s()},children:[c?(0,g.jsx)(f2,{className:"animate-spin"}):null,p(c?"probe.probing":"probe.action")]}),r.length>1?(0,g.jsxs)(df,{value:String(null!=(n=null==h?void 0:h.index)?n:""),onValueChange:function(e){return o(Number(e))},children:[(0,g.jsx)(fe,{className:"h-9 w-56","aria-label":p("vault.probeEndpointLabel"),children:(0,g.jsx)(dh,{})}),(0,g.jsx)(fr,{children:r.map(function(e){return(0,g.jsx)(fa,{value:String(e.index),children:e.key||e.baseUrl},e.index)})})]}):null,d?(0,g.jsxs)("span",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[(0,g.jsx)(pp,{className:"size-4 shrink-0","aria-hidden":!0}),l7(p,d)]}):u?(0,g.jsx)(ph,{result:u}):null]})}let p5=O("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),p6=O("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);var p8=d(2935);function p9(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p7(){var e,t=(0,x.Bd)().t,n=function(e){if(Array.isArray(e))return e}(e=(0,y.useState)("light"))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(e)||function(e){if(e){if("string"==typeof e)return p9(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p9(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),r=n[0],a=n[1];return(0,y.useEffect)(function(){var e=(0,p8.PY)();a(e),(0,p8.AZ)(e)},[]),(0,g.jsx)(oo,{type:"button",size:"icon",variant:"outline","aria-label":t("dark"===r?"theme.toLight":"theme.toDark"),onClick:function(){return a(function(e){return(0,p8.OD)(e)})},children:"dark"===r?(0,g.jsx)(p5,{}):(0,g.jsx)(p6,{})})}let he=O("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),ht=O("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),hn=O("file-lock-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v1",key:"jmtmu2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"5",x:"2",y:"13",rx:"1",key:"10y5wo"}],["path",{d:"M8 13v-2a2 2 0 1 0-4 0v2",key:"1pdxzg"}]]);function hr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ha(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function ho(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){ha(o,r,a,i,l,"next",e)}function l(e){ha(o,r,a,i,l,"throw",e)}i(void 0)})}}function hi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||hl(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hl(e,t){if(e){if("string"==typeof e)return hr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hr(e,t)}}function hs(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function hc(e){var t,n,r,a=e.open,o=e.onOpenChange,i=(0,x.Bd)().t,l=ss(function(e){return e.loadHarnesses}),s=ss(function(e){return e.setNotice}),c=(0,y.useRef)(null),u=hi((0,y.useState)(""),2),d=u[0],f=u[1],p=hi((0,y.useState)(""),2),h=p[0],m=p[1],v=hi((0,y.useState)(null),2),b=v[0],w=v[1],k=hi((0,y.useState)(!1),2),j=k[0],S=k[1],O=hi((0,y.useState)(null),2),C=O[0],N=O[1],P=hi((0,y.useState)(""),2),E=P[0],_=P[1],z=hi((0,y.useState)(""),2),T=z[0],A=z[1],R=hi((0,y.useState)(null),2),L=R[0],I=R[1],M=hi((0,y.useState)(!1),2),D=M[0],$=M[1],U=hi((0,y.useState)(!1),2),H=U[0],B=U[1],K=hi((0,y.useState)("skip"),2),V=K[0],q=K[1],W=hi((0,y.useState)(!0),2),Z=W[0],G=W[1],J=hi((0,y.useState)(!1),2),Q=J[0],Y=J[1],X=hi((0,y.useState)(null),2),ee=X[0],et=X[1],en=hi((0,y.useState)(null),2),er=en[0],ea=en[1],eo=hi((0,y.useState)(null),2),ei=eo[0],el=eo[1];(0,y.useEffect)(function(){if(!a){S(!1),B(!1),$(!1),Y(!1);return}var e=!1;return lX("/api/transfer/export/preview").then(function(t){e||(w(t),S(!0===t.codexLoginCacheAvailable))}).catch(function(){e||w(null)}),function(){e=!0}},[a]);var es=d.length>=8&&d===h&&null===ee,ec=null!==C&&T.length>=8&&null===ee,eu=(null==L?void 0:L.conflictPolicy)===V&&(null==L?void 0:L.restoreActive)===Z,ed=null!==L&&eu&&!D&&null===ee,ef=L&&eu&&!D?function(e,t){switch(t){case"openai-api-key":return e("transfer.authEffect.openai-api-key");case"auth-override":return e("transfer.authEffect.auth-override");case"official-cleanup":return e("transfer.authEffect.official-cleanup");case"none":return null}}(i,L.codexActivationAuthEffect):null;return(0,g.jsx)(lc,{open:a,onOpenChange:o,children:(0,g.jsxs)(lT,{className:"max-h-[90vh] overflow-x-hidden overflow-y-auto sm:max-w-2xl",children:[(0,g.jsxs)(lA,{children:[(0,g.jsx)(lL,{children:i("transfer.title")}),(0,g.jsx)(lI,{children:i("transfer.intro")})]}),(0,g.jsxs)("section",{className:"space-y-4 rounded-2xl border bg-muted/25 p-4",children:[(0,g.jsxs)("div",{className:"flex items-start gap-3",children:[(0,g.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary",children:(0,g.jsx)(he,{className:"size-4"})}),(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"font-semibold",children:i("transfer.exportTitle")}),(0,g.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:i("transfer.exportIntro")})]})]}),(0,g.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"export-passphrase",children:i("transfer.passphrase")}),(0,g.jsx)(cm,{id:"export-passphrase",type:"password",autoComplete:"new-password",value:d,onChange:function(e){return f(e.target.value)},placeholder:i("transfer.passphrasePlaceholder",{min:8})})]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"export-passphrase-confirm",children:i("transfer.passphraseConfirm")}),(0,g.jsx)(cm,{id:"export-passphrase-confirm",type:"password",autoComplete:"new-password",value:h,onChange:function(e){return m(e.target.value)},placeholder:i("transfer.passphraseConfirmPlaceholder")})]})]}),h&&d!==h?(0,g.jsx)("p",{className:"text-xs text-destructive",children:i("transfer.passphraseMismatch")}):null,(null==b?void 0:b.codexLoginCacheAvailable)?(0,g.jsx)("label",{className:"block space-y-2 rounded-xl border border-amber-500/30 bg-amber-500/5 p-3 text-sm",children:(0,g.jsxs)("span",{className:"flex cursor-pointer items-start gap-3",children:[(0,g.jsx)(ch,{checked:j,onCheckedChange:function(e){return S(!0===e)},className:"mt-0.5"}),(0,g.jsxs)("span",{className:"min-w-0",children:[(0,g.jsx)("span",{className:"block font-medium",children:i("transfer.includeCache")}),(0,g.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-muted-foreground",children:i("transfer.includeCacheHint")})]})]})}):b?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:i("transfer.noCacheToExport")}):null,(0,g.jsxs)(oo,{type:"button",onClick:function(){ho(function(){return hs(this,function(e){switch(e.label){case 0:et("export"),el(null),ea(null),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,lX("/api/transfer/export",{method:"POST",body:JSON.stringify({passphrase:d,includeCodexLoginCache:j})})];case 2:var t,n,r,a,o;return t=e.sent(),n=new Date().toISOString().slice(0,10),r=new Blob(["".concat(JSON.stringify(t,null,2),"\n")],{type:"application/json"}),a=URL.createObjectURL(r),(o=document.createElement("a")).href=a,o.download="harness-switch-".concat(n,".hsw-backup"),o.click(),URL.revokeObjectURL(a),ea(j?i("transfer.exportedWithCache"):i("transfer.exportedWithoutCache")),[3,5];case 3:return el(l6(e.sent())),[3,5];case 4:return et(null),[7];case 5:return[2]}})})()},disabled:!es,children:[(0,g.jsx)(he,{}),"export"===ee?i("transfer.encrypting"):i("transfer.download")]})]}),(0,g.jsxs)("section",{className:"space-y-4 rounded-2xl border p-4",children:[(0,g.jsxs)("div",{className:"flex items-start gap-3",children:[(0,g.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary",children:(0,g.jsx)(ht,{className:"size-4"})}),(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"font-semibold",children:i("transfer.importTitle")}),(0,g.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:i("transfer.importIntro")})]})]}),(0,g.jsx)("input",{ref:c,type:"file",accept:".hsw-backup,application/json",className:"sr-only",onChange:function(e){var t,n;n=null==(t=e.target.files)?void 0:t[0],ho(function(){var e,t,r;return hs(this,function(a){switch(a.label){case 0:if(I(null),$(!1),Y(!1),B(!1),ea(null),el(null),!n)return N(null),_(""),[2];a.label=1;case 1:return a.trys.push([1,3,,4]),t=JSON.parse,[4,n.text()];case 2:if("harness-switch-encrypted-export"!==(e=t.apply(JSON,[a.sent()])).format||1!==e.version)return el({key:"transfer.notAnExport"}),N(null),_(""),[2];return N(e),_(n.name),[3,4];case 3:return r=a.sent(),N(null),_(""),el(l6(r)),[3,4];case 4:return[2]}})})()}}),(0,g.jsxs)("button",{type:"button",className:"flex w-full cursor-pointer items-center gap-3 rounded-xl border border-dashed bg-muted/20 px-4 py-4 text-left transition-colors hover:border-primary/40 hover:bg-primary/5",onClick:function(){var e;return null==(e=c.current)?void 0:e.click()},children:[(0,g.jsx)(hn,{className:"size-5 text-primary"}),(0,g.jsxs)("span",{className:"min-w-0",children:[(0,g.jsx)("span",{className:"block truncate text-sm font-medium",children:E||i("transfer.pickFile")}),(0,g.jsx)("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:i("transfer.pickFileHint")})]})]}),(0,g.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end",children:[(0,g.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"import-passphrase",children:i("transfer.passphrase")}),(0,g.jsx)(cm,{id:"import-passphrase",type:"password",value:T,onChange:function(e){A(e.target.value),I(null),$(!1),Y(!1),B(!1)},placeholder:i("transfer.importPassphrasePlaceholder")})]}),(0,g.jsx)(oo,{type:"button",variant:"outline",disabled:!ec,onClick:function(){ho(function(){var e,t,n;return hs(this,function(r){switch(r.label){case 0:if(!C)return[2];et("preview"),el(null),ea(null),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,lX("/api/transfer/preview",{method:"POST",body:JSON.stringify({envelope:C,passphrase:T,conflictPolicy:V,restoreActive:Z})})];case 2:return I(t=r.sent()),$(!1),Y(!1),B((null==(e=t.codexLoginCache)?void 0:e.available)===!0&&!0===t.codexLoginCache.migrationNeeded),[3,5];case 3:return n=r.sent(),I(null),el(l6(n)),[3,5];case 4:return et(null),[7];case 5:return[2]}})})()},children:"preview"===ee?i("transfer.inspecting"):i("transfer.inspect")})]}),L?(0,g.jsxs)("div",{className:"space-y-4 rounded-xl border bg-card p-4",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,g.jsx)(aI,{children:i("transfer.profileCount",{count:L.profileCount})}),(0,g.jsx)(aI,{variant:"secondary",children:i("transfer.providerCount",{count:L.providerCount})}),(0,g.jsx)(aI,{variant:L.conflicts.length>0?"outline":"secondary",children:i("transfer.conflictCount",{count:L.conflicts.length})}),(0,g.jsx)(aI,{variant:"secondary",children:i("transfer.activeCount",{count:L.activeCount})})]}),(0,g.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground",children:L.harnesses.map(function(e){return(0,g.jsx)("span",{children:i("transfer.harnessProfiles",{harness:F[e.harness],count:e.profiles})},e.harness)})}),L.conflicts.length>0?(0,g.jsx)("div",{className:"rounded-xl bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:i("transfer.conflictList",{items:L.conflicts.map(function(e){return"".concat(F[e.harness]," / ").concat(e.name)}).join(i("common.listSeparator"))})}):null,(null==(t=L.codexLoginCache)?void 0:t.available)&&L.codexLoginCache.migrationNeeded?(0,g.jsxs)("label",{className:"block space-y-2 rounded-xl border border-amber-500/30 bg-amber-500/5 p-3 text-sm",children:[(0,g.jsxs)("span",{className:"flex cursor-pointer items-start gap-3",children:[(0,g.jsx)(ch,{checked:H,onCheckedChange:function(e){return B(!0===e)},className:"mt-0.5"}),(0,g.jsxs)("span",{className:"min-w-0",children:[(0,g.jsx)("span",{className:"block font-medium",children:i("transfer.migrateCache")}),(0,g.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-muted-foreground",children:i("transfer.migrateCacheHint")})]})]}),(null==(n=L.codexLoginCache)?void 0:n.targetExists)?(0,g.jsx)("span",{className:"block text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:i("transfer.migrateCacheOverwrite")}):null]}):null,ef?(0,g.jsx)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:ef}):null,D?(0,g.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:i("transfer.previewStale")}):null,(0,g.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"conflict-policy",children:i("transfer.conflictPolicy")}),(0,g.jsxs)(df,{value:V,onValueChange:function(e){q(e),$(!0),Y(!1)},children:[(0,g.jsx)(fe,{id:"conflict-policy",children:(0,g.jsx)(dh,{})}),(0,g.jsxs)(fr,{children:[(0,g.jsx)(fa,{value:"skip",children:i("transfer.policySkip")}),(0,g.jsx)(fa,{value:"overwrite",children:i("transfer.policyOverwrite")})]})]})]}),(0,g.jsxs)("label",{className:"flex cursor-pointer items-center gap-3 rounded-xl border px-3 py-2 text-sm",children:[(0,g.jsx)(ch,{checked:Z,onCheckedChange:function(e){G(!0===e),$(!0),Y(!1)}}),i("transfer.restoreActive")]})]}),(0,g.jsxs)(oo,{type:"button",disabled:!ed,onClick:function(){return Y(!0)},children:[(0,g.jsx)(ht,{}),D?i("transfer.recheckNeeded"):i("transfer.confirmImport")]}),(0,g.jsx)(sj,{open:Q,onOpenChange:Y,children:(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:ef?i("transfer.confirmAuthTitle"):i("transfer.confirmTitle")}),(0,g.jsxs)(s$,{children:[i("transfer.confirmBody",{count:L.profileCount}),"overwrite"===V&&L.conflicts.length>0?i("transfer.confirmOverwrite",{count:L.conflicts.length}):i("transfer.confirmKeep"),H?(null==(r=L.codexLoginCache)?void 0:r.targetExists)?i("transfer.confirmCacheOverwrite"):i("transfer.confirmCacheWrite"):i("transfer.confirmCacheSkip"),ef?" ".concat(ef):null]})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:i("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){ho(function(){var e;return hs(this,function(t){switch(t.label){case 0:if(!C||!L||D)return[2];Y(!1),et("import"),el(null),t.label=1;case 1:return t.trys.push([1,4,5,6]),[4,lX("/api/transfer/import",{method:"POST",body:JSON.stringify({envelope:C,passphrase:T,conflictPolicy:V,restoreActive:Z,migrateCodexLoginCache:H})})];case 2:return e=t.sent(),[4,l()];case 3:var n,r,a,c;return t.sent(),s((c=[(n=i)("transfer.importedCount",{count:(r=e).imported})],r.overwritten>0&&c.push(n("transfer.overwrittenCount",{count:r.overwritten})),r.providersCopied>0&&c.push(n("transfer.providersCopiedCount",{count:r.providersCopied})),r.skipped>0&&c.push(n("transfer.skippedCount",{count:r.skipped})),r.activeRestored>0&&c.push(n("transfer.activeRestoredCount",{count:r.activeRestored})),c.push(n(r.codexLoginCacheMigrated?"transfer.cacheMigrated":"transfer.cacheNotMigrated")),[{key:"transfer.importedSummary",params:{parts:c.join(n("common.listSeparator"))}}].concat(function(e){if(Array.isArray(e))return hr(e)}(a=r.warnings.map(function(e){return l5(e)}))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(a)||hl(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()))),I(null),$(!1),B(!1),o(!1),[3,6];case 4:return el(l6(t.sent())),[3,6];case 5:return et(null),[7];case 6:return[2]}})})()},children:ef?i("transfer.proceedAware"):"overwrite"===V?i("transfer.proceedOverwrite"):i("transfer.proceedSafe")})]})]})})]}):null]}),er?(0,g.jsx)("p",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:er}):null,ei?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(i,ei)}):null]})})}function hu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hd(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function hf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hu(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hp(){var e=(0,x.Bd)().t,t=hf((0,y.useState)(null),2),n=t[0],r=t[1],a=hf((0,y.useState)(null),2),o=a[0],i=a[1],l=hf((0,y.useState)("idle"),2),s=l[0],c=l[1];return((0,y.useEffect)(function(){var e=!1;return lX("/api/update/check").then(function(t){!e&&(r(t.current),t.updateAvailable&&t.latest&&i(t.latest))}).catch(function(){}),function(){e=!0}},[]),"updating"===s)?(0,g.jsxs)("span",{className:"flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md bg-muted/70 px-2 font-mono text-[11px] text-muted-foreground",children:[(0,g.jsx)(f2,{className:"size-3 shrink-0 animate-spin"}),e("update.updating")]}):"failed"===s?(0,g.jsx)("span",{title:e("update.failedHint"),className:"flex h-6 shrink-0 items-center whitespace-nowrap rounded-md bg-destructive/10 px-2 font-mono text-[11px] text-destructive",children:e("update.failed")}):o?(0,g.jsxs)(oo,{variant:"outline",size:"sm","aria-label":e("update.toVersion",{version:o}),className:"h-6 shrink-0 gap-1 whitespace-nowrap px-2 font-mono text-[11px]",onClick:function(){var e;(e=function(){var e;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:c("updating"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,lX("/api/update",{method:"POST"})];case 2:case 3:return t.sent(),[3,4];case 4:e=Date.now()+18e4,t.label=5;case 5:if(!(Date.now()<e))return[3,11];return[4,new Promise(function(e){return setTimeout(e,2500)})];case 6:t.sent(),t.label=7;case 7:return t.trys.push([7,9,,10]),[4,lX("/api/version")];case 8:if(t.sent().version!==n)return window.location.reload(),[2];return[3,10];case 9:return t.sent(),[3,10];case 10:return[3,5];case 11:return c("failed"),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){hd(o,r,a,i,l,"next",e)}function l(e){hd(o,r,a,i,l,"throw",e)}i(void 0)})})()},children:[(0,g.jsx)(sh,{className:"size-3 shrink-0"}),(0,g.jsx)("span",{className:"sm:hidden",children:e("update.short")}),(0,g.jsx)("span",{className:"hidden sm:inline",children:e("update.toVersion",{version:o})})]}):null}let hh=O("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);function hm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hg(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function hy(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){hg(o,r,a,i,l,"next",e)}function l(e){hg(o,r,a,i,l,"throw",e)}i(void 0)})}}function hv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||hx(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hb(e){return function(e){if(Array.isArray(e))return hm(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||hx(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hx(e,t){if(e){if("string"==typeof e)return hm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hm(e,t)}}function hw(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function hk(e){var t=e.open,n=e.onOpenChange,r=(0,x.Bd)().t,a=ss(function(e){return e.users}),o=ss(function(e){return e.currentUser}),i=ss(function(e){return e.loadHarnesses}),l=ss(function(e){return e.loadProviders}),s=ss(function(e){return e.setNotice}),c=(0,y.useMemo)(function(){return a.filter(function(e){return e.username!==o&&!1!==e.manageable})},[a,o]),u=hv((0,y.useState)(""),2),d=u[0],f=u[1],p=hv((0,y.useState)(null),2),h=p[0],m=p[1],v=hv((0,y.useState)([]),2),b=v[0],w=v[1],k=hv((0,y.useState)(!1),2),j=k[0],S=k[1],O=hv((0,y.useState)(!1),2),C=O[0],N=O[1],P=hv((0,y.useState)(!1),2),E=P[0],_=P[1],z=hv((0,y.useState)(null),2),T=z[0],A=z[1],R=(0,y.useMemo)(function(){return D.flatMap(function(e){var t,n=null!=(t=null==h?void 0:h.conflicts.filter(function(t){return t.harness===e}).length)?t:0;return n>0?[{harness:e,count:n}]:[]})},[h]),L=o||r("notice.currentUser");function I(){return hy(function(){var e;return hw(this,function(t){switch(t.label){case 0:if(!d||!h)return[2];_(!0),A(null),t.label=1;case 1:return t.trys.push([1,4,5,6]),[4,lX("/api/users/sync",{method:"POST",body:JSON.stringify({sourceUser:d,conflictPolicy:"skip",overwriteHarnesses:b,migrateCodexLoginCache:j})})];case 2:return e=t.sent(),[4,Promise.all([i(),l()])];case 3:return t.sent(),s([{key:"sync.done",params:{imported:e.imported,overwritten:e.overwritten,skipped:e.skipped,providersCopied:e.providersCopied}},{key:e.codexLoginCacheMigrated?"sync.cacheMigrated":"sync.cacheNotMigrated"}].concat(hb(e.warnings.map(function(e){return l5(e)})))),n(!1),[3,6];case 4:return A(l6(t.sent())),[3,6];case 5:return _(!1),[7];case 6:return[2]}})})()}return(0,y.useEffect)(function(){t&&(f(function(e){var t,n;return c.some(function(t){return t.username===e})?e:null!=(t=null==(n=c[0])?void 0:n.username)?t:""}),m(null),w([]),S(!1),N(!1),A(null))},[t,c]),(0,g.jsx)(lc,{open:t,onOpenChange:n,children:(0,g.jsxs)(lT,{className:"flex max-h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] max-w-xl flex-col gap-0 overflow-hidden p-0 sm:max-h-[90dvh] sm:w-full",children:[(0,g.jsxs)(lA,{className:"shrink-0 border-b px-5 py-4 pr-12 text-left sm:px-6",children:[(0,g.jsx)(lL,{children:r("sync.title")}),(0,g.jsx)(lI,{children:r("sync.intro",{user:L})})]}),(0,g.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-6",children:[c.length>0?(0,g.jsxs)("div",{className:"space-y-5",children:[(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"sync-source-user",children:r("sync.sourceUser")}),(0,g.jsxs)(df,{value:d,onValueChange:function(e){f(e),m(null),w([]),S(!1)},children:[(0,g.jsx)(fe,{id:"sync-source-user",children:(0,g.jsx)(dh,{placeholder:r("sync.selectUser")})}),(0,g.jsx)(fr,{children:c.map(function(e){return(0,g.jsxs)(fa,{value:e.username,children:[e.username," \xb7 ",e.homeDir]},e.username)})})]})]}),h?(0,g.jsxs)("div",{className:"space-y-4 rounded-2xl border bg-muted/25 p-4",children:[(0,g.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,g.jsx)(aI,{variant:"secondary",children:r("sync.profileCount",{count:h.profileCount})}),(0,g.jsx)(aI,{variant:"secondary",children:r("sync.providerCount",{count:h.providerCount})}),(0,g.jsx)(aI,{variant:h.conflicts.length>0?"destructive":"outline",children:r("sync.conflictCount",{count:h.conflicts.length})})]}),h.conflicts.length>0?(0,g.jsxs)("div",{className:"space-y-3",children:[(0,g.jsxs)("div",{className:"space-y-1",children:[(0,g.jsx)(cv,{children:r("sync.overwriteByHarness")}),(0,g.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:r("sync.overwriteHint")})]}),(0,g.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:R.map(function(e){var t=e.harness,n=e.count;return(0,g.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 rounded-xl border bg-background/70 p-3 text-sm",children:[(0,g.jsx)(ch,{checked:b.includes(t),onCheckedChange:function(e){return w(function(n){return!0===e?hb(n).concat([t]):n.filter(function(e){return e!==t})})},className:"mt-0.5"}),(0,g.jsxs)("span",{children:[(0,g.jsx)("span",{className:"block font-medium",children:r("sync.overwriteHarness",{harness:F[t]})}),(0,g.jsx)("span",{className:"mt-1 block text-xs text-muted-foreground",children:r("sync.conflictsInHarness",{count:n})})]})]},t)})})]}):null,h.codexLoginCache.available&&h.codexLoginCache.migrationNeeded?(0,g.jsxs)("label",{className:"block space-y-3 rounded-xl border bg-background/70 p-3 text-sm",children:[(0,g.jsxs)("span",{className:"flex cursor-pointer items-start gap-3",children:[(0,g.jsx)(ch,{checked:j,onCheckedChange:function(e){return S(!0===e)},className:"mt-0.5"}),(0,g.jsxs)("span",{children:[(0,g.jsx)("span",{className:"block font-medium",children:r("sync.migrateCache")}),(0,g.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-muted-foreground",children:r("sync.migrateCacheHint")})]})]}),h.codexLoginCache.targetExists?(0,g.jsx)("span",{className:"block rounded-lg bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-300",children:r("sync.migrateCacheOverwrite")}):null]}):null,(0,g.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:r("sync.storeOnlyHint")})]}):null]}):(0,g.jsxs)("div",{className:"flex items-start gap-3 rounded-2xl border bg-muted/25 p-4",children:[(0,g.jsx)(hh,{className:"mt-0.5 size-5 text-muted-foreground"}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:r("sync.noOtherUsers")})]}),T?(0,g.jsx)("p",{className:"mt-4 text-sm text-destructive",children:l7(r,T)}):null]}),(0,g.jsx)(lR,{className:"shrink-0 border-t bg-card px-4 py-3 pb-[max(.75rem,env(safe-area-inset-bottom))] sm:px-6 sm:py-4",children:h?j?(0,g.jsxs)(sj,{open:C,onOpenChange:N,children:[(0,g.jsxs)(oo,{className:"w-full sm:w-auto",disabled:E,onClick:function(){return N(!0)},children:[(0,g.jsx)(s6,{}),E?r("sync.syncing"):r("sync.syncTo",{user:L})]}),(0,g.jsxs)(sI,{children:[(0,g.jsxs)(sM,{children:[(0,g.jsx)(sF,{children:r("sync.confirmCacheTitle")}),(0,g.jsx)(s$,{children:r("sync.confirmCacheBody",{source:d,target:L,extra:h.codexLoginCache.targetExists?r("sync.confirmCacheOverwrite"):r("sync.confirmCacheFresh")})})]}),(0,g.jsxs)(sD,{children:[(0,g.jsx)(sH,{children:r("common.cancel")}),(0,g.jsx)(sU,{onClick:function(){I()},children:r("sync.confirmCacheAction")})]})]})]}):(0,g.jsxs)(oo,{className:"w-full sm:w-auto",disabled:E,onClick:function(){I()},children:[(0,g.jsx)(s6,{}),E?r("sync.syncing"):r("sync.syncTo",{user:L})]}):(0,g.jsxs)(oo,{className:"w-full sm:w-auto",disabled:!d||E,onClick:function(){hy(function(){var e;return hw(this,function(t){switch(t.label){case 0:if(!d)return[2];_(!0),A(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,lX("/api/users/sync/preview",{method:"POST",body:JSON.stringify({sourceUser:d})})];case 2:return m(t.sent()),w([]),S(!1),N(!1),[3,5];case 3:return e=t.sent(),m(null),w([]),A(l6(e)),[3,5];case 4:return _(!1),[7];case 5:return[2]}})})()},children:[(0,g.jsx)(s6,{}),E?r("sync.inspecting"):r("sync.inspect")]})})]})})}function hj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hS(){var e,t=function(e){if(Array.isArray(e))return e}(e=(0,y.useState)(null))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(e)||function(e){if(e){if("string"==typeof e)return hj(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return hj(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),n=t[0],r=t[1];return((0,y.useEffect)(function(){var e=!1;return lX("/api/version").then(function(t){e||r(t.version)}).catch(function(){}),function(){e=!0}},[]),n)?(0,g.jsxs)("span",{className:"shrink-0 whitespace-nowrap rounded-md bg-muted/70 px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:["v",n]}):null}function hO(){return(0,x.Bd)().t,null}function hC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hN(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function hP(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){hN(o,r,a,i,l,"next",e)}function l(e){hN(o,r,a,i,l,"throw",e)}i(void 0)})}}function hE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hC(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h_(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function hz(){var e,t,n,r=(0,x.s9)().locale,a=(0,x.Bd)().t,o=ss(function(e){return e.harnesses}),i=ss(function(e){return e.envFile}),l=ss(function(e){return e.backups}),s=hE((0,y.useState)(null),2),c=s[0],u=s[1],d=hE((0,y.useState)(!1),2),f=d[0],p=d[1],h=hE((0,y.useState)(!1),2),m=h[0],v=h[1],b=hE((0,y.useState)(!1),2),w=b[0],k=b[1],j=hE((0,y.useState)(!1),2),S=j[0],O=j[1],R=hE((0,y.useState)(!1),2),L=R[0],I=R[1],M=hE((0,y.useState)("claude"),2),D=M[0],F=M[1],$=o.find(function(e){return e.id===(null==c?void 0:c.harnessId)}),U=null!=(e=o.find(function(e){return e.id===D}))?e:o[0];return(0,g.jsxs)("div",{className:"min-h-[100dvh] bg-background",children:[(0,g.jsx)("header",{className:"sticky top-0 z-20 border-b bg-card/90 backdrop-blur-xl",children:(0,g.jsxs)("div",{className:"flex min-h-20 flex-wrap items-center justify-between gap-x-4 gap-y-2 px-4 py-2 sm:px-6",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,g.jsx)("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl bg-primary text-primary-foreground shadow-[0_10px_24px_-12px_rgb(99_91_255/0.8)]",children:(0,g.jsx)(C,{className:"size-5"})}),(0,g.jsxs)("div",{className:"min-w-0",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,g.jsx)("h1",{className:"min-w-0 flex-1 truncate text-base font-semibold tracking-tight",children:"harness-switch"}),(0,g.jsx)(hS,{}),(0,g.jsx)(hO,{}),(0,g.jsx)(hp,{})]}),(0,g.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:a("app.tagline")})]})]}),(0,g.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return O(!0)},children:[(0,g.jsx)(N,{}),(0,g.jsx)("span",{className:"hidden lg:inline",children:a("nav.syncUserConfig")})]}),(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return I(!0)},children:[(0,g.jsx)(P,{}),(0,g.jsx)("span",{className:"hidden lg:inline",children:a("nav.importExisting")})]}),(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return p(!0)},children:[(0,g.jsx)(E,{}),(0,g.jsx)("span",{className:"hidden sm:inline",children:a("nav.transfer")})]}),(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return v(!0)},children:[(0,g.jsx)(_,{}),(0,g.jsx)("span",{className:"hidden sm:inline",children:a("nav.githubSync")})]}),(0,g.jsxs)(oo,{variant:"outline",size:"sm",onClick:function(){return k(!0)},children:[(0,g.jsx)(z,{}),(0,g.jsx)("span",{className:"hidden sm:inline",children:a("nav.vault")})]}),(0,g.jsx)(pn,{}),(0,g.jsx)(p7,{}),(0,g.jsx)(hT,{})]})]})}),(0,g.jsxs)("div",{className:"grid xl:grid-cols-[17rem_minmax(0,1fr)_18rem]",children:[(0,g.jsx)(hA,{harnesses:o,value:null==U?void 0:U.id,onChange:F}),U?(0,g.jsxs)("main",{role:"tabpanel",id:"harness-panel-".concat(U.id),"aria-labelledby":"harness-tab-".concat(U.id),className:"min-w-0 space-y-6 p-4 sm:p-6 xl:p-8",children:[(0,g.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h2",{className:"text-2xl font-semibold tracking-tight",children:U.label}),(0,g.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a("harness.subtitle")})]}),(0,g.jsxs)(oo,{className:"self-start sm:self-auto",onClick:function(){return u({harnessId:U.id,profile:null})},children:[(0,g.jsx)(T,{}),a("harness.newProfile")]})]}),(0,g.jsx)(fC,{harness:U,onAdd:function(){return u({harnessId:U.id,profile:null})},onEdit:function(e){return u({harnessId:U.id,profile:e})}}),(0,g.jsxs)("details",{className:"group rounded-2xl border bg-card px-5 py-4 text-sm shadow-[0_12px_34px_-28px_rgb(36_39_70/0.35)]",children:[(0,g.jsxs)("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 font-medium",children:[(0,g.jsx)("span",{className:"font-mono text-[13px]",children:a("env.title")}),(0,g.jsx)(A,{className:"size-4 text-muted-foreground transition-transform group-open:rotate-180"})]}),(0,g.jsx)("p",{className:"mt-4 leading-relaxed text-muted-foreground",children:a("env.intro")}),(0,g.jsxs)("code",{className:"mt-3 block rounded-xl bg-muted/70 px-4 py-3 font-mono text-[13px]",children:["source ",i||"~/.harness-switch/env.sh"]}),(0,g.jsx)("p",{className:"mt-3 leading-relaxed text-muted-foreground",children:a("env.note")})]})]}):null,U?(0,g.jsx)(hR,{harness:U,latestBackup:l.find(function(e){return e.harness===U.id}),locale:r}):null]}),c&&$?(0,g.jsx)(pI,{harness:$,profile:c.profile,onOpenChange:function(e){return!e&&u(null)}},"".concat(c.harnessId,"-").concat(null!=(t=null==(n=c.profile)?void 0:n.name)?t:"new")):null,(0,g.jsx)(hc,{open:f,onOpenChange:p}),(0,g.jsx)(fu,{open:m,onOpenChange:v}),(0,g.jsx)(p2,{open:w,onOpenChange:k}),(0,g.jsx)(hk,{open:S,onOpenChange:O}),(0,g.jsx)(f7,{open:L,onOpenChange:I}),(0,g.jsx)(pr,{})]})}function hT(){var e=(0,x.Bd)().t,t=ss(function(e){return e.logout}),n=ss(function(e){return e.users}),r=ss(function(e){return e.currentUser}),a=ss(function(e){return e.usersLoading}),o=ss(function(e){return e.switchUser}),i=hE((0,y.useState)(!1),2),l=i[0],s=i[1],c=(0,y.useRef)(null);return(0,y.useEffect)(function(){var e=function(e){var t;(null==(t=c.current)?void 0:t.contains(e.target))||s(!1)};if(l)return window.addEventListener("pointerdown",e),function(){return window.removeEventListener("pointerdown",e)}},[l]),(0,g.jsxs)("div",{ref:c,className:"relative",children:[(0,g.jsxs)(oo,{variant:"outline",size:"sm","aria-label":e("nav.currentLocalUser"),"aria-expanded":l,"aria-haspopup":"menu",disabled:a,onClick:function(){return s(function(e){return!e})},children:[(0,g.jsx)(R,{}),(0,g.jsx)("span",{className:"max-w-28 truncate",children:r||e("nav.localUser")}),(0,g.jsx)(A,{className:aR("transition-transform",l&&"rotate-180")})]}),l?(0,g.jsxs)("div",{role:"menu","aria-label":e("nav.currentLocalUser"),className:"absolute right-0 top-full z-30 mt-2 w-52 rounded-xl border bg-popover p-1 text-popover-foreground shadow-lg",children:[(0,g.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:e("nav.currentLocalUser")}),n.map(function(t){var n,i=!1===t.manageable,l=i?l7(e,{key:t.blockCode?l3(t.blockCode):"error.user.notSwitchable",params:t.blockParams,fallback:t.blockReason}):"",c=a||t.username===r||i;return(0,g.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":t.username===r,disabled:c,title:i?null!=(n=t.blockReason)?n:l:void 0,onClick:function(){var e;e=t.username,hP(function(){return h_(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,o(e)];case 1:return t.sent(),s(!1),[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}})})()},className:aR("flex w-full flex-col items-start rounded-lg px-3 py-2 text-left text-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35",c?"cursor-default opacity-60":"cursor-pointer hover:bg-accent hover:text-accent-foreground"),children:[(0,g.jsxs)("span",{className:"flex w-full items-center gap-1.5",children:[i?(0,g.jsx)(L,{className:"size-3 shrink-0","aria-hidden":!0}):null,(0,g.jsx)("span",{className:"truncate",children:t.username})]}),i?(0,g.jsx)("span",{className:"mt-0.5 text-xs leading-snug text-muted-foreground",children:l}):null]},t.username)}),(0,g.jsx)("div",{className:"my-1 border-t"}),(0,g.jsxs)("button",{type:"button",role:"menuitem",disabled:a,onClick:function(){hP(function(){return h_(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,t()];case 1:return e.sent(),s(!1),[3,3];case 2:return e.sent(),[3,3];case 3:return[2]}})})()},className:aR("flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm text-destructive transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35",a?"cursor-default opacity-60":"cursor-pointer hover:bg-destructive/10"),children:[(0,g.jsx)(I,{className:"size-4"}),e("nav.signOut")]})]}):null]})}function hA(e){var t=e.harnesses,n=e.value,r=e.onChange,a=(0,x.Bd)().t;return(0,g.jsx)("div",{role:"tablist","aria-label":a("nav.switchHarness"),"aria-orientation":"vertical",className:"flex gap-2 overflow-x-auto border-b bg-card/45 p-3 xl:min-h-[calc(100dvh-80px)] xl:flex-col xl:overflow-x-visible xl:border-b-0 xl:border-r xl:p-4",children:t.map(function(e,o){var i,l,s,c=e.id===n,u=(null==(l=e.active)?void 0:l.official)?a("harness.official"):null!=(i=null==(s=e.active)?void 0:s.name)?i:null;return(0,g.jsxs)("button",{type:"button",role:"tab",id:"harness-tab-".concat(e.id),"aria-controls":"harness-panel-".concat(e.id),"aria-selected":c,tabIndex:c?0:-1,onClick:function(){return r(e.id)},onKeyDown:function(e){return function(e,n){var a="ArrowLeft"===e.key||"ArrowUp"===e.key,o="ArrowRight"===e.key||"ArrowDown"===e.key;if(a||o||"Home"===e.key||"End"===e.key){e.preventDefault();var i=n;i="Home"===e.key?0:"End"===e.key?t.length-1:(n+(o?1:-1)+t.length)%t.length;var l=t[i];if(l){r(l.id);var s,c,u=null==(s=e.currentTarget.parentElement)?void 0:s.querySelectorAll('[role="tab"]');null==u||null==(c=u[i])||c.focus()}}}(e,o)},className:aR("flex min-w-[12rem] shrink-0 cursor-pointer items-center gap-3 rounded-xl px-3 py-3 text-left transition-[color,background-color,box-shadow,transform] duration-150 active:translate-y-px xl:min-w-0 xl:w-full",c?"bg-primary/[0.09] text-primary shadow-[inset_0_0_0_1px_rgb(99_91_255/0.13)]":"text-muted-foreground hover:bg-card hover:text-foreground"),children:[(0,g.jsx)("span",{className:aR("flex size-10 shrink-0 items-center justify-center rounded-xl border bg-card shadow-[0_4px_12px_-8px_rgb(36_39_70/0.28)]",c?"border-primary/20":"border-border"),children:(0,g.jsx)(f1,{id:e.id})}),(0,g.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,g.jsx)("span",{className:"block truncate text-sm font-medium text-current",children:e.label}),(0,g.jsx)("span",{className:"mt-0.5 block truncate font-mono text-[11px] text-muted-foreground",children:null===u?a("harness.currentInactive"):a("harness.current",{name:u})})]}),(0,g.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:e.profiles.length})]},e.id)})})}function hR(e){var t=e.harness,n=e.latestBackup,r=e.locale,a=(0,x.Bd)().t;return(0,g.jsx)("aside",{className:"border-t bg-card/35 p-4 sm:p-6 xl:min-h-[calc(100dvh-80px)] xl:border-l xl:border-t-0 xl:p-5",children:(0,g.jsxs)("div",{className:"space-y-4 xl:sticky xl:top-[100px]",children:[(0,g.jsxs)("section",{className:"rounded-2xl border bg-card p-5 shadow-[0_12px_34px_-28px_rgb(36_39_70/0.38)]",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(M,{className:"size-4 text-primary"}),(0,g.jsx)("h3",{className:"font-semibold",children:a("harness.writeTargets")})]}),(0,g.jsxs)("div",{className:"mt-5 space-y-4",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:a("harness.application")}),(0,g.jsx)("p",{className:"mt-1 text-sm font-medium",children:t.label})]}),t.targets.map(function(e){return(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:e.label}),(0,g.jsx)("p",{className:"mt-1 break-all font-mono text-xs leading-relaxed",children:e.path})]},e.key)}),(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:a("harness.writeMode")}),(0,g.jsx)("p",{className:"mt-1 text-sm",children:a("replace"===t.mode?"harness.modeReplace":"harness.modeAdditive")})]})]})]}),(0,g.jsx)(sJ,{harness:t}),(0,g.jsx)(pu,{harness:t}),(0,g.jsxs)("section",{className:"rounded-2xl border bg-card p-5 shadow-[0_12px_34px_-28px_rgb(36_39_70/0.38)]",children:[(0,g.jsx)("h3",{className:"font-semibold",children:a("backup.latest")}),n?(0,g.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:a("backup.profile")}),(0,g.jsx)("p",{className:"mt-1 truncate text-sm font-medium",children:n.profile})]}),(0,g.jsxs)("p",{className:"font-mono text-[11px] leading-relaxed text-muted-foreground",children:[new Date(n.createdAt).toLocaleString(r)," \xb7"," ",a("backup.fileCount",{count:n.files.length})]})]}):(0,g.jsx)("p",{className:"mt-3 text-sm text-muted-foreground",children:a("backup.empty")}),(0,g.jsx)("div",{className:"mt-4 border-t pt-4",children:(0,g.jsx)(sd,{harnessId:t.id})})]})]})})}function hL(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hI(e,t,n,r,a,o,i){try{var l=e[o](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,a)}function hM(){var e,t=(0,x.Bd)().t,n=ss(function(e){return e.login}),r=ss(function(e){return e.loading}),a=function(e){if(Array.isArray(e))return e}(e=(0,y.useState)(null))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return a}}(e)||function(e){if(e){if("string"==typeof e)return hL(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return hL(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=a[0],i=a[1];return(0,g.jsxs)("main",{className:"grid min-h-[100dvh] lg:grid-cols-2",children:[(0,g.jsxs)("section",{className:"hidden flex-col justify-between border-r bg-card p-10 lg:flex",children:[(0,g.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:t("app.brandMark")}),(0,g.jsxs)("div",{className:"max-w-sm space-y-3",children:[(0,g.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:t("login.title")}),(0,g.jsx)("p",{className:"text-sm leading-relaxed text-muted-foreground",children:t("login.intro")})]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)(pn,{}),(0,g.jsx)(p7,{})]})]}),(0,g.jsx)("section",{className:"flex items-center justify-center px-4 py-10",children:(0,g.jsxs)("form",{className:"w-full max-w-sm space-y-5",onSubmit:function(e){var t;return(t=function(){var t,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(a){switch(a.label){case 0:e.preventDefault(),t=new FormData(e.currentTarget),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n(String(null!=(r=t.get("password"))?r:""))];case 2:return a.sent(),[3,4];case 3:return i(l6(a.sent())),[3,4];case 4:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(e){hI(o,r,a,i,l,"next",e)}function l(e){hI(o,r,a,i,l,"throw",e)}i(void 0)})})()},children:[(0,g.jsxs)("div",{className:"flex items-start justify-between gap-3 lg:hidden",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:t("app.brandMark")}),(0,g.jsx)("h1",{className:"mt-2 text-2xl font-semibold tracking-tight",children:t("login.title")})]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)(pn,{}),(0,g.jsx)(p7,{})]})]}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:t("login.hint")}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(cv,{htmlFor:"password",children:t("login.password")}),(0,g.jsx)(cm,{id:"password",name:"password",type:"password",autoFocus:!0,required:!0})]}),o?(0,g.jsx)("p",{className:"text-sm text-destructive",children:l7(t,o)}):null,(0,g.jsx)(oo,{className:"w-full",type:"submit",disabled:r,children:t(r?"login.submitting":"login.submit")})]})})]})}(0,b.createRoot)(document.getElementById("root")).render((0,g.jsx)(y.StrictMode,{children:(0,g.jsx)(x.CY,{children:(0,g.jsx)(function(){var e=(0,x.Bd)().t,t=ss(function(e){return e.sessionChecked}),n=ss(function(e){return e.authenticated}),r=ss(function(e){return e.loadSession});return((0,y.useEffect)(function(){r()},[r]),t)?n?(0,g.jsx)(hz,{}):(0,g.jsx)(hM,{}):(0,g.jsx)("div",{className:"flex min-h-[100dvh] items-center justify-center text-sm text-muted-foreground",children:e("app.checkingSession")})},{})})}))})()})();
|