@sentry/junior-dashboard 0.262.0 → 0.263.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.
package/dist/client.js
CHANGED
|
@@ -67,7 +67,7 @@ ${l}
|
|
|
67
67
|
|
|
68
68
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let s=i[1];if(t===i[0]){o(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(s.cycle){o(i);continue}if(s.count>1&&e.reused==="ref"){o(i);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function $K(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;$K(r);let a=Object.keys(r);if(a.length!==1||a[0]!=="type")return;let o=r.type;for(let i of Array.isArray(o)?o:[o]){if(typeof i!="string")return;n.includes(i)||n.push(i)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var MK=new Set(["type","properties","required","additionalProperties"]),PK=["oneOf","anyOf"];function DK(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function sz(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let i in o)if(!MK.has(i))return null;t.push(o)}let n={},r=new Set;for(let o of t){for(let i in o.properties){if(Object.prototype.hasOwnProperty.call(n,i))continue;let s=[];for(let u of t){let d=u.properties?.[i]??DK(u);d!=null&&(s.some(f=>JSON.stringify(f)===JSON.stringify(d))||s.push(d))}let l=s.length===1?s[0]:sz(s)??{allOf:s};fr(n,i,l)}for(let i of o.required??[])r.add(i)}let a={type:"object",properties:n};if(r.size&&(a.required=[...r]),t.every(o=>o.additionalProperties===!1))a.additionalProperties=!1;else{let o=[];for(let i of t){let s=DK(i);s&&!o.some(l=>JSON.stringify(l)===JSON.stringify(s))&&o.push(s)}o.length===1?a.additionalProperties=o[0]:o.length>1&&(a.additionalProperties={allOf:o})}return a}function RCe(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let a of MK)if(a in e)return;let n=t.filter(a=>PK.some(o=>Array.isArray(a[o]))),r=null;if(!n.length)r=sz(t);else{let a=n[0],o=PK.find(l=>Array.isArray(a[l]));if(Object.keys(a).length!==1)return;let i=t.filter(l=>l!==a),s=a[o].map(l=>sz([...i,l]));if(s.some(l=>!l))return;r={[o]:s}}r&&(delete e.allOf,F0(e,r))}function Em(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=s=>{let l=e.seen.get(s);if(l.ref===null)return;let u=l.def??l.schema,d={...u},f=l.ref;if(l.ref=null,f){r(f);let h=e.seen.get(f),p=h.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(p)):F0(u,p),F0(u,d),s._zod.parent===f)for(let x in u)x==="$ref"||x==="allOf"||x in d||delete u[x];if(p.$ref&&h.def)for(let x in u)x==="$ref"||x==="allOf"||x in h.def&&JSON.stringify(u[x])===JSON.stringify(h.def[x])&&delete u[x]}let m=s._zod.parent;if(m&&m!==f){r(m);let h=e.seen.get(m);if(h?.schema.$ref&&(u.$ref=h.schema.$ref,h.def))for(let p in u)p==="$ref"||p==="allOf"||p in h.def&&JSON.stringify(u[p])===JSON.stringify(h.def[p])&&delete u[p]}e.override({zodSchema:s,jsonSchema:u,path:l.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())r(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())$K(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let l of e.seen.values())for(let u of[l.schema,l.def]){let d=u?.allOf;if(!Array.isArray(d))continue;let f=s.get(d);f?f.push(u):s.set(d,[u])}for(let l of e.intersections)for(let u of s.get(l)??[])RCe(u)}}let a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(s)}F0(a,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&a.id===o&&delete a.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let l=s[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,fr(i,l.defId,l.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?a.$defs=i:a.definitions=i);try{let s=JSON.parse(JSON.stringify(a));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:_y(t,"input",e.processors),output:_y(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function ts(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ts(r.element,n);if(r.type==="set")return ts(r.valueType,n);if(r.type==="lazy")return ts(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return ts(r.innerType,n);if(r.type==="intersection")return ts(r.left,n)||ts(r.right,n);if(r.type==="record"||r.type==="map")return ts(r.keyType,n)||ts(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ts(r.in,n)||ts(r.out,n);if(r.type==="object"){for(let a in r.shape)if(ts(r.shape[a],n))return!0;return!1}if(r.type==="union"){for(let a of r.options)if(ts(a,n))return!0;return!1}if(r.type==="tuple"){for(let a of r.items)if(ts(a,n))return!0;return!!(r.rest&&ts(r.rest,n))}return!1}var lz=(e,t={})=>n=>{let r=Lm({...n,processors:t});return ea(e,r),Am(r,e),Em(r,e)},_y=(e,t,n={})=>r=>{let{libraryOptions:a,target:o}=r??{},i=Lm({...a??{},target:o,io:t,processors:n});return ea(e,i),Am(i,e),Em(i,e)};var ICe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dz=(e,t,n,r)=>{let a=n;a.type="string";let{minimum:o,maximum:i,format:s,patterns:l,contentEncoding:u,laxFormat:d}=e._zod.bag;if(typeof o=="number"&&(a.minLength=o),typeof i=="number"&&(a.maxLength=i),s&&(a.format=ICe[s]??s,a.format===""&&delete a.format,(s==="time"||d)&&delete a.format),u&&(a.contentEncoding=u),l&&l.size>0){let f=[...l];f.length===1?a.pattern=f[0].source:f.length>1&&(a.allOf=[...f.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},fz=(e,t,n,r)=>{let a=n,{minimum:o,maximum:i,format:s,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof s=="string"&&s.includes("int")?a.type="integer":a.type="number";let f=typeof d=="number"&&d>=(o??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";f?h?(a.minimum=d,a.exclusiveMinimum=!0):a.exclusiveMinimum=d:typeof o=="number"&&(a.minimum=o),m?h?(a.maximum=u,a.exclusiveMaximum=!0):a.exclusiveMaximum=u:typeof i=="number"&&(a.maximum=i),typeof l=="number"&&(Number.isFinite(l)&&l!==0?a.multipleOf=Math.abs(l):Ro(e,t,a,r,`A multipleOf divisor of ${l} cannot be represented in JSON Schema`))},mz=(e,t,n,r)=>{n.type="boolean"},pz=(e,t,n,r)=>{Ro(e,t,n,r,"BigInt cannot be represented in JSON Schema")},hz=(e,t,n,r)=>{Ro(e,t,n,r,"Symbols cannot be represented in JSON Schema")},gz=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},vz=(e,t,n,r)=>{Ro(e,t,n,r,"Undefined cannot be represented in JSON Schema")},yz=(e,t,n,r)=>{Ro(e,t,n,r,"Void cannot be represented in JSON Schema")},bz=(e,t,n,r)=>{n.not={}},xz=(e,t,n,r)=>{},Sz=(e,t,n,r)=>{},wz=(e,t,n,r)=>{Ro(e,t,n,r,"Date cannot be represented in JSON Schema")},Cz=(e,t,n,r)=>{let a=e._zod.def,o=h0(a.entries);if(o.length===0){n.not={};return}o.every(i=>typeof i=="number")&&(n.type="number"),o.every(i=>typeof i=="string")&&(n.type="string"),n.enum=o},kz=(e,t,n,r)=>{let a=e._zod.def;if(a.values.length===0){n.not={};return}let o=[];for(let i of a.values)if(i===void 0){if(Ro(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(Ro(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(i))}else o.push(i);if(o.length!==0)if(o.length===1){let i=o[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else o.every(i=>typeof i=="number")&&(n.type="number"),o.every(i=>typeof i=="string")&&(n.type="string"),o.every(i=>typeof i=="boolean")&&(n.type="boolean"),o.every(i=>i===null)&&(n.type="null"),n.enum=o},Rz=(e,t,n,r)=>{Ro(e,t,n,r,"NaN cannot be represented in JSON Schema")},Iz=(e,t,n,r)=>{let a=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");a.type="string",a.pattern=o.source},Tz=(e,t,n,r)=>{let a=n,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:s,mime:l}=e._zod.bag;i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),l?l.length===1?(o.contentMediaType=l[0],Object.assign(a,o)):(Object.assign(a,o),a.anyOf=l.map(u=>({contentMediaType:u}))):Object.assign(a,o)},Nz=(e,t,n,r)=>{n.type="boolean"},_z=(e,t,n,r)=>{Ro(e,t,n,r,"Custom types cannot be represented in JSON Schema")},Lz=(e,t,n,r)=>{Ro(e,t,n,r,"Function types cannot be represented in JSON Schema")},Az=(e,t,n,r)=>{Ro(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Ez=(e,t,n,r)=>{Ro(e,t,n,r,"Map cannot be represented in JSON Schema")},Pz=(e,t,n,r)=>{Ro(e,t,n,r,"Set cannot be represented in JSON Schema")},Dz=(e,t,n,r)=>{let a=n,o=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;typeof i=="number"&&(a.minItems=i),typeof s=="number"&&(a.maxItems=s),a.type="array",a.items=ea(o.element,t,{...r,path:[...r.path,"items"]})};function H0(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?H0(t.out):t.type==="catch"?H0(t.innerType):e._zod.optin}var $z=(e,t,n,r)=>{let a=n,o=e._zod.def,i=o.shape;if(Object.getOwnPropertySymbols(i).length&&Ro(e,t,a,r,"Symbol keys cannot be represented in JSON Schema"))return;a.type="object",a.properties={};for(let d in i)fr(a.properties,d,ea(i[d],t,{...r,path:[...r.path,"properties",d]}));let l=new Set(Object.keys(i)),u=new Set([...l].filter(d=>{let f=o.shape[d];return t.io==="input"?H0(f)===void 0:f._zod.optout===void 0}));u.size>0&&(a.required=Array.from(u)),o.catchall?._zod.def.type==="never"?a.additionalProperties=!1:o.catchall?o.catchall&&(a.additionalProperties=ea(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(a.additionalProperties=!1)},UI=(e,t,n,r)=>{let a=e._zod.def,o=a.inclusive===!1,i=a.options.map((s,l)=>ea(s,t,{...r,path:[...r.path,o?"oneOf":"anyOf",l]}));o?n.oneOf=i:n.anyOf=i},Mz=(e,t,n,r)=>{let a=e._zod.def,o=ea(a.left,t,{...r,path:[...r.path,"allOf",0]}),i=ea(a.right,t,{...r,path:[...r.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,l=[...s(o)?o.allOf:[o],...s(i)?i.allOf:[i]];n.allOf=l,t.intersections.push(l)},Oz=(e,t,n,r)=>{let a=n,o=e._zod.def;a.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((g,x)=>ea(g,t,{...r,path:[...r.path,i,x]})),u=o.rest?ea(o.rest,t,{...r,path:[...r.path,s,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,d=o.items.length;for(;d>0;){let g=o.items[d-1];if(!(t.io==="input"?H0(g)!==void 0:g._zod.optout==="optional"))break;d--}let f=o.items.length,m=!o.rest;t.target==="draft-2020-12"?(a.prefixItems=l,m?a.items=!1:u&&(a.items=u),d>0&&(a.minItems=d),m&&(a.maxItems=f)):t.target==="openapi-3.0"?(a.items={anyOf:l},u&&a.items.anyOf.push(u),d>0&&(a.minItems=d),m&&(a.maxItems=f)):(a.items=l,m?a.additionalItems=!1:u&&(a.additionalItems=u),d>0&&(a.minItems=d),m&&(a.maxItems=f));let{minimum:h,maximum:p}=e._zod.bag;typeof h=="number"&&(a.minItems=h),typeof p=="number"&&(a.maxItems=p)};function cz(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let p=e.get(t)?.def;if(!p)return t;let g=cz(e,p,n);return g===p?t:g}for(let p of["anyOf","oneOf"]){let g=t[p];if(!Array.isArray(g))continue;let x=g.map(y=>cz(e,y,n));x.some((y,v)=>y!==g[v])&&(t={...t,[p]:x})}let r=Array.isArray(t.type)?t.type:[t.type],a=!r.includes("string")&&r.some(p=>p==="number"||p==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!a&&!o?.some(p=>typeof p=="number"))return t;let{minimum:i,maximum:s,exclusiveMinimum:l,exclusiveMaximum:u,multipleOf:d,format:f,id:m,...h}=t;return h.enum?h.enum=h.enum.map(p=>typeof p=="number"?String(p):p):typeof h.const=="number"&&(h.const=String(h.const)),a&&(h.type="string",o||(h.pattern=(r.includes("number")?Tm:R0).source)),h}var uz=new WeakMap;function TCe(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of uz.get(e)??[]){let a=e.seen.get(r),o=(a?.def??a?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let i=cz(t,o,new Set);i!==o&&n.set(o,i)}if(n.size)for(let r of e.seen.values())for(let a of[r.schema,r.def]){let o=a&&n.get(a.propertyNames);o&&(a.propertyNames=o)}}var zz=(e,t,n,r)=>{let a=n,o=e._zod.def;a.type="object";let i=o.keyType,l=i._zod.bag?.patterns;if(o.mode==="loose"&&l&&l.size>0){let f=ea(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});a.patternProperties={};for(let m of l)fr(a.patternProperties,m.source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){a.propertyNames=ea(o.keyType,t,{...r,path:[...r.path,"propertyNames"]});let f=uz.get(t);f||(f=[],uz.set(t,f),t.deferred.push(()=>TCe(t))),f.push(e)}a.additionalProperties=ea(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let u=i._zod.values,d=t.io==="input"&&H0(o.valueType)!==void 0;if(u&&!o.partial&&!d){let f=[...u].filter(m=>typeof m=="string"||typeof m=="number");f.length>0&&(a.required=f.map(String))}},Uz=(e,t,n,r)=>{let a=e._zod.def,o=ea(a.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=a.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},jz=(e,t,n,r)=>{let a=e._zod.def;ea(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType},Bz=Symbol();function OK(e,t,n,r,a){let o=!1,i=JSON.stringify(e,(s,l)=>typeof l!="bigint"?l:(o=!0,null));return o?(Ro(t,n,r,a,"BigInt defaults cannot be represented in JSON Schema"),Bz):JSON.parse(i)}var Fz=(e,t,n,r)=>{let a=e._zod.def;ea(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType;let i=OK(a.defaultValue,e,t,n,r);i!==Bz&&(n.default=i)},Hz=(e,t,n,r)=>{let a=e._zod.def;ea(a.innerType,t,r);let o=t.seen.get(e);if(o.ref=a.innerType,t.io!=="input")return;let i=OK(a.defaultValue,e,t,n,r);i!==Bz&&(n._prefault=i)},Vz=(e,t,n,r)=>{let a=e._zod.def;ea(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType;let i;try{i=a.catchValue(void 0)}catch{Ro(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=i},qz=(e,t,n,r)=>{let a=e._zod.def,o=a.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?o?a.out:a.in:a.out;ea(i,t,r);let s=t.seen.get(e);s.ref=i},Gz=(e,t,n,r)=>{let a=e._zod.def;ea(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType,n.readOnly=!0},Zz=(e,t,n,r)=>{let a=e._zod.def;ea(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType},jI=(e,t,n,r)=>{let a=e._zod.def;ea(a.innerType,t,r);let o=t.seen.get(e);o.ref=a.innerType},Wz=(e,t,n,r)=>{let a=e._zod.innerType;ea(a,t,r);let o=t.seen.get(e);o.ref=a},zI={string:dz,number:fz,boolean:mz,bigint:pz,symbol:hz,null:gz,undefined:vz,void:yz,never:bz,any:xz,unknown:Sz,date:wz,enum:Cz,literal:kz,nan:Rz,template_literal:Iz,file:Tz,success:Nz,custom:_z,function:Lz,transform:Az,map:Ez,set:Pz,array:Dz,object:$z,union:UI,intersection:Mz,tuple:Oz,record:zz,nullable:Uz,nonoptional:jz,default:Fz,prefault:Hz,catch:Vz,pipe:qz,readonly:Gz,promise:Zz,optional:jI,lazy:Wz};function BI(e,t){if("_idmap"in e){let r=e,a=Lm({...t,processors:zI}),o={};for(let l of r._idmap.entries()){let[u,d]=l;ea(d,a)}let i={},s={registry:r,uri:t?.uri,defs:o};a.external=s;for(let l of r._idmap.entries()){let[u,d]=l;Am(a,d),fr(i,u,Em(a,d))}if(Object.keys(o).length>0){let l=a.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[l]:o}}return{schemas:i}}let n=Lm({...t,processors:zI});return ea(e,n),Am(n,e),Em(n,e)}var FI=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Lm({processors:zI,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return ea(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Am(this.ctx,t);let r=Em(this.ctx,t),{"~standard":a,...o}=r;return o}};var zK={};var zy={};to(zy,{ZodAny:()=>hU,ZodArray:()=>bU,ZodBase64:()=>sT,ZodBase64URL:()=>lT,ZodBigInt:()=>My,ZodBigIntFormat:()=>dT,ZodBoolean:()=>$y,ZodCIDRv4:()=>oT,ZodCIDRv6:()=>iT,ZodCUID:()=>YI,ZodCUID2:()=>XI,ZodCatch:()=>jU,ZodCodec:()=>X0,ZodCreditCard:()=>lU,ZodCustom:()=>ew,ZodCustomStringFormat:()=>Py,ZodDate:()=>Z0,ZodDefault:()=>DU,ZodDiscriminatedUnion:()=>SU,ZodE164:()=>cT,ZodEmail:()=>WI,ZodEmoji:()=>JI,ZodEnum:()=>Ay,ZodExactOptional:()=>hT,ZodFile:()=>LU,ZodFunction:()=>JU,ZodGUID:()=>KI,ZodIPv4:()=>aT,ZodIPv6:()=>rT,ZodISODate:()=>Dm,ZodISODateTime:()=>Pm,ZodISODuration:()=>Mm,ZodISOTime:()=>$m,ZodIntersection:()=>wU,ZodJWT:()=>uT,ZodKSUID:()=>nT,ZodLazy:()=>ZU,ZodLiteral:()=>_U,ZodMAC:()=>sU,ZodMap:()=>TU,ZodNaN:()=>FU,ZodNanoID:()=>QI,ZodNever:()=>vU,ZodNonOptional:()=>gT,ZodNull:()=>mU,ZodNullable:()=>PU,ZodNumber:()=>Dy,ZodNumberFormat:()=>Oh,ZodObject:()=>K0,ZodOptional:()=>Q0,ZodPipe:()=>Y0,ZodPrefault:()=>MU,ZodPreprocess:()=>HU,ZodPromise:()=>KU,ZodReadonly:()=>VU,ZodRecord:()=>Ly,ZodSet:()=>NU,ZodString:()=>Ey,ZodStringFormat:()=>ba,ZodSuccess:()=>UU,ZodSymbol:()=>dU,ZodTemplateLiteral:()=>GU,ZodTransform:()=>AU,ZodTuple:()=>kU,ZodType:()=>Wt,ZodULID:()=>eT,ZodURL:()=>G0,ZodUUID:()=>zu,ZodUndefined:()=>fU,ZodUnion:()=>J0,ZodUnknown:()=>gU,ZodVoid:()=>yU,ZodXID:()=>tT,ZodXor:()=>xU,_ZodString:()=>ZI,_default:()=>$U,_function:()=>WJ,any:()=>RJ,array:()=>W0,base64:()=>sJ,base64url:()=>lJ,bigint:()=>xJ,boolean:()=>uU,catch:()=>BU,check:()=>KJ,cidrv4:()=>oJ,cidrv6:()=>iJ,codec:()=>VJ,creditCard:()=>uJ,cuid:()=>QK,cuid2:()=>YK,custom:()=>JJ,date:()=>TJ,describe:()=>QJ,discriminatedUnion:()=>PJ,e164:()=>cJ,email:()=>BK,emoji:()=>KK,enum:()=>mT,exactOptional:()=>EU,file:()=>jJ,float32:()=>gJ,float64:()=>vJ,function:()=>WJ,guid:()=>FK,hash:()=>hJ,hex:()=>pJ,hostname:()=>mJ,httpUrl:()=>WK,instanceof:()=>XJ,int:()=>qI,int32:()=>yJ,int64:()=>SJ,intersection:()=>CU,invertCodec:()=>qJ,ipv4:()=>nJ,ipv6:()=>rJ,json:()=>tQ,jwt:()=>dJ,keyof:()=>NJ,ksuid:()=>tJ,lazy:()=>WU,literal:()=>UJ,looseObject:()=>AJ,looseRecord:()=>$J,mac:()=>aJ,map:()=>MJ,meta:()=>YJ,nan:()=>HJ,nanoid:()=>JK,nativeEnum:()=>zJ,never:()=>fT,nonoptional:()=>zU,null:()=>pU,nullable:()=>q0,nullish:()=>BJ,number:()=>cU,object:()=>_J,optional:()=>$h,partialRecord:()=>DJ,pipe:()=>GI,prefault:()=>OU,preprocess:()=>nQ,promise:()=>ZJ,readonly:()=>qU,record:()=>IU,refine:()=>QU,set:()=>OJ,strictObject:()=>LJ,string:()=>V0,stringFormat:()=>fJ,stringbool:()=>eQ,success:()=>FJ,superRefine:()=>YU,symbol:()=>CJ,templateLiteral:()=>GJ,transform:()=>pT,tuple:()=>RU,uint32:()=>bJ,uint64:()=>wJ,ulid:()=>XK,undefined:()=>kJ,union:()=>Oy,unknown:()=>Dh,url:()=>ZK,uuid:()=>HK,uuidv4:()=>VK,uuidv6:()=>qK,uuidv7:()=>GK,void:()=>IJ,xid:()=>eJ,xor:()=>EJ});var HI={};to(HI,{endsWith:()=>Sy,gt:()=>Mu,gte:()=>Il,includes:()=>by,length:()=>Ph,lowercase:()=>vy,lt:()=>$u,lte:()=>Rl,maxLength:()=>Eh,maxSize:()=>_m,mime:()=>wy,minLength:()=>Kd,minSize:()=>Ou,multipleOf:()=>Nm,negative:()=>PI,nonnegative:()=>$I,nonpositive:()=>DI,normalize:()=>Cy,overwrite:()=>Zc,positive:()=>EI,properties:()=>OI,property:()=>MI,regex:()=>gy,size:()=>Ah,slugify:()=>Ty,startsWith:()=>xy,toLowerCase:()=>Ry,toUpperCase:()=>Iy,trim:()=>ky,uppercase:()=>yy});var UK=new WeakSet([Object.prototype,Error.prototype]);function VI(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var jK=(e,t)=>{w0.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);UK.has(n)||(UK.add(n),VI(n,"format",r=>a=>k0(r,a)),VI(n,"flatten",r=>a=>C0(r,a)),VI(n,"addIssue",r=>a=>{r.issues.push(a),r.message=JSON.stringify(r.issues,iy,2)}),VI(n,"addIssues",r=>a=>{r.issues.push(...a),r.message=JSON.stringify(r.issues,iy,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},_Ce=M("ZodError",jK),Gs=M("ZodError",jK,void 0,{Parent:Error});var Kz=cy(Gs),Jz=uy(Gs),Qz=dy(Gs),Yz=fy(Gs),Xz=CR(Gs),eU=kR(Gs),tU=RR(Gs),nU=IR(Gs),aU=TR(Gs),rU=NR(Gs),oU=_R(Gs),iU=LR(Gs);function ACe(){qo.localeError||Lr(oI())}function Mh(){qo.memoizer||Lr({memoizer:D0()})}var Wt=M("ZodType",(e,t)=>(ACe(),Rt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ne.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Xn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(QU(e,t))},superRefine(e,t){return this.check(YU(e,t))},overwrite(e){return this.check(Zc(e))},optional(){return $h(this)},exactOptional(){return EU(this)},nullable(){return q0(this)},nullish(){return $h(q0(this))},nonoptional(e){return zU(this,e)},array(){return W0(this)},or(e){return Oy([this,e])},and(e){return CU(this,e)},transform(e){return GI(this,pT(e))},default(e){return $U(this,e)},prefault(e){return OU(this,e)},catch(e){return BU(this,e)},pipe(e){return GI(this,e)},readonly(){return qU(this)},describe(e){let t=this.clone();return ii.add(t,{description:e}),t},meta(...e){if(e.length===0)return ii.get(this);let t=this.clone();return ii.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ne.hide(this,"~standard",{...BR(this),jsonSchema:{input:_y(this,"input"),output:_y(this,"output")}})},set"~standard"(e){ne.own(this,"~standard",e)},parse:function e(t,n){return Kz(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Jz(this,t,n,{callee:e})},safeParse(e,t){return Qz(this,e,t)},async safeParseAsync(e,t){return Yz(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ne.own(this,"spa",e)},encode:function e(t,n){return Xz(this,t,n,{callee:e})},decode:function e(t,n){return eU(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await tU(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await nU(this,t,n,{callee:e})},safeEncode(e,t){return aU(this,e,t)},safeDecode(e,t){return rU(this,e,t)},async safeEncodeAsync(e,t){return oU(this,e,t)},async safeDecodeAsync(e,t){return iU(this,e,t)},toJSONSchema(e){return lz(this,{})(e)},get description(){return ii.get(this)?.description},get _def(){return this._zod.def}}),ZI=M("_ZodString",(e,t)=>{Ih.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,a,o)=>dz(e,r,a,o);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(gy(...e))},includes(...e){return this.check(by(...e))},startsWith(...e){return this.check(xy(...e))},endsWith(...e){return this.check(Sy(...e))},min(...e){return this.check(Kd(...e))},max(...e){return this.check(Eh(...e))},length(...e){return this.check(Ph(...e))},nonempty(...e){return this.check(Kd(1,...e))},lowercase(e){return this.check(vy(e))},uppercase(e){return this.check(yy(e))},trim(){return this.check(ky())},normalize(...e){return this.check(Cy(...e))},toLowerCase(){return this.check(Ry())},toUpperCase(){return this.check(Iy())},slugify(){return this.check(Ty())}}),Ey=M("ZodString",(e,t)=>{Ih.init(e,t),ZI.init(e,t)},{email(e){return this.check(dI(WI,e))},url(e){return this.check(O0(G0,e))},jwt(e){return this.check(AI(uT,e))},emoji(e){return this.check(vI(JI,e))},guid(e){return this.check(fI(KI,e))},uuid(e){return this.check(mI(zu,e))},uuidv4(e){return this.check(pI(zu,e))},uuidv6(e){return this.check(hI(zu,e))},uuidv7(e){return this.check(gI(zu,e))},nanoid(e){return this.check(yI(QI,e))},cuid(e){return this.check(bI(YI,e))},cuid2(e){return this.check(xI(XI,e))},ulid(e){return this.check(SI(eT,e))},base64(e){return this.check(NI(sT,e))},base64url(e){return this.check(_I(lT,e))},xid(e){return this.check(wI(tT,e))},ksuid(e){return this.check(CI(nT,e))},ipv4(e){return this.check(kI(aT,e))},ipv6(e){return this.check(RI(rT,e))},cidrv4(e){return this.check(II(oT,e))},cidrv6(e){return this.check(TI(iT,e))},e164(e){return this.check(LI(cT,e))},datetime(e){return this.check(z0(Pm,e))},date(e){return this.check(U0(Dm,e))},time(e){return this.check(j0($m,e))},duration(e){return this.check(B0(Mm,e))}});function V0(e){return RO(Ey,e)}var ba=M("ZodStringFormat",(e,t)=>{ua.init(e,t),ZI.init(e,t)}),Pm=M("ZodISODateTime",(e,t)=>{gM.init(e,t),ba.init(e,t)}),Dm=M("ZodISODate",(e,t)=>{vM.init(e,t),ba.init(e,t)}),$m=M("ZodISOTime",(e,t)=>{yM.init(e,t),ba.init(e,t)}),Mm=M("ZodISODuration",(e,t)=>{bM.init(e,t),ba.init(e,t)}),WI=M("ZodEmail",(e,t)=>{oM.init(e,t),ba.init(e,t)});function BK(e){return dI(WI,e)}var KI=M("ZodGUID",(e,t)=>{aM.init(e,t),ba.init(e,t)});function FK(e){return fI(KI,e)}var zu=M("ZodUUID",(e,t)=>{rM.init(e,t),ba.init(e,t)});function HK(e){return mI(zu,e)}function VK(e){return pI(zu,e)}function qK(e){return hI(zu,e)}function GK(e){return gI(zu,e)}var G0=M("ZodURL",(e,t)=>{lM.init(e,t),ba.init(e,t)});function ZK(e){return O0(G0,e)}function WK(e){return O0(G0,{protocol:Xi.httpProtocol,hostname:Xi.domain,...ne.normalizeParams(e)})}var JI=M("ZodEmoji",(e,t)=>{cM.init(e,t),ba.init(e,t)});function KK(e){return vI(JI,e)}var QI=M("ZodNanoID",(e,t)=>{uM.init(e,t),ba.init(e,t)});function JK(e){return yI(QI,e)}var YI=M("ZodCUID",(e,t)=>{dM.init(e,t),ba.init(e,t)});function QK(e){return bI(YI,e)}var XI=M("ZodCUID2",(e,t)=>{fM.init(e,t),ba.init(e,t)});function YK(e){return xI(XI,e)}var eT=M("ZodULID",(e,t)=>{mM.init(e,t),ba.init(e,t)});function XK(e){return SI(eT,e)}var tT=M("ZodXID",(e,t)=>{pM.init(e,t),ba.init(e,t)});function eJ(e){return wI(tT,e)}var nT=M("ZodKSUID",(e,t)=>{hM.init(e,t),ba.init(e,t)});function tJ(e){return CI(nT,e)}var aT=M("ZodIPv4",(e,t)=>{xM.init(e,t),ba.init(e,t)});function nJ(e){return kI(aT,e)}var sU=M("ZodMAC",(e,t)=>{wM.init(e,t),ba.init(e,t)});function aJ(e){return TO(sU,e)}var rT=M("ZodIPv6",(e,t)=>{SM.init(e,t),ba.init(e,t)});function rJ(e){return RI(rT,e)}var oT=M("ZodCIDRv4",(e,t)=>{CM.init(e,t),ba.init(e,t)});function oJ(e){return II(oT,e)}var iT=M("ZodCIDRv6",(e,t)=>{kM.init(e,t),ba.init(e,t)});function iJ(e){return TI(iT,e)}var sT=M("ZodBase64",(e,t)=>{RM.init(e,t),ba.init(e,t)});function sJ(e){return NI(sT,e)}var lT=M("ZodBase64URL",(e,t)=>{IM.init(e,t),ba.init(e,t)});function lJ(e){return _I(lT,e)}var cT=M("ZodE164",(e,t)=>{TM.init(e,t),ba.init(e,t)});function cJ(e){return LI(cT,e)}var lU=M("ZodCreditCard",(e,t)=>{NM.init(e,t),ba.init(e,t)});function uJ(e){return NO(lU,e)}var uT=M("ZodJWT",(e,t)=>{_M.init(e,t),ba.init(e,t)});function dJ(e){return AI(uT,e)}var Py=M("ZodCustomStringFormat",(e,t)=>{LM.init(e,t),ba.init(e,t)});function fJ(e,t,n={}){return Ny(Py,e,t,n)}function mJ(e){return Ny(Py,"hostname",Xi.hostname,e)}function pJ(e){return Ny(Py,"hex",Xi.hex,e)}function hJ(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,a=Xi[r];if(!a)throw new Error(`Unrecognized hash format: ${r}`);return Ny(Py,r,a,t)}var Dy=M("ZodNumber",(e,t)=>{JR.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,a,o)=>fz(e,r,a,o);let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null},{gt(e,t){return this.check(Mu(e,t))},gte(e,t){return this.check(Il(e,t))},min(e,t){return this.check(Il(e,t))},lt(e,t){return this.check($u(e,t))},lte(e,t){return this.check(Rl(e,t))},max(e,t){return this.check(Rl(e,t))},int(e){return this.check(qI(e))},safe(e){return this.check(qI(e))},positive(e){return this.check(Mu(0,e))},nonnegative(e){return this.check(Il(0,e))},negative(e){return this.check($u(0,e))},nonpositive(e){return this.check(Rl(0,e))},multipleOf(e,t){return this.check(Nm(e,t))},step(e,t){return this.check(Nm(e,t))},finite(){return this}});function cU(e){return LO(Dy,e)}var Oh=M("ZodNumberFormat",(e,t)=>{AM.init(e,t),Dy.init(e,t)});function qI(e){return EO(Oh,e)}function gJ(e){return PO(Oh,e)}function vJ(e){return DO(Oh,e)}function yJ(e){return $O(Oh,e)}function bJ(e){return MO(Oh,e)}var $y=M("ZodBoolean",(e,t)=>{L0.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>mz(e,n,r,a)});function uU(e){return OO($y,e)}var My=M("ZodBigInt",(e,t)=>{QR.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,a,o)=>pz(e,r,a,o);let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null},{gte(e,t){return this.check(Il(e,t))},min(e,t){return this.check(Il(e,t))},gt(e,t){return this.check(Mu(e,t))},lt(e,t){return this.check($u(e,t))},lte(e,t){return this.check(Rl(e,t))},max(e,t){return this.check(Rl(e,t))},positive(e){return this.check(Mu(BigInt(0),e))},negative(e){return this.check($u(BigInt(0),e))},nonpositive(e){return this.check(Rl(BigInt(0),e))},nonnegative(e){return this.check(Il(BigInt(0),e))},multipleOf(e,t){return this.check(Nm(e,t))}});function xJ(e){return UO(My,e)}var dT=M("ZodBigIntFormat",(e,t)=>{EM.init(e,t),My.init(e,t)});function SJ(e){return BO(dT,e)}function wJ(e){return FO(dT,e)}var dU=M("ZodSymbol",(e,t)=>{PM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>hz(e,n,r,a)});function CJ(e){return HO(dU,e)}var fU=M("ZodUndefined",(e,t)=>{DM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>vz(e,n,r,a)});function kJ(e){return VO(fU,e)}var mU=M("ZodNull",(e,t)=>{$M.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>gz(e,n,r,a)});function pU(e){return qO(mU,e)}var hU=M("ZodAny",(e,t)=>{MM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>xz(e,n,r,a)});function RJ(){return GO(hU)}var gU=M("ZodUnknown",(e,t)=>{OM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Sz(e,n,r,a)});function Dh(){return ZO(gU)}var vU=M("ZodNever",(e,t)=>{zM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>bz(e,n,r,a)});function fT(e){return WO(vU,e)}var yU=M("ZodVoid",(e,t)=>{UM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>yz(e,n,r,a)});function IJ(e){return KO(yU,e)}var Z0=M("ZodDate",(e,t)=>{jM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,a,o)=>wz(e,r,a,o),e.min=(r,a)=>e.check(Il(r,a)),e.max=(r,a)=>e.check(Rl(r,a));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function TJ(e){return JO(Z0,e)}var bU=M("ZodArray",(e,t)=>{Mh(),BM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Dz(e,n,r,a),e.element=t.element},{min(e,t){return this.check(Kd(e,t))},nonempty(e){return this.check(Kd(1,e))},max(e,t){return this.check(Eh(e,t))},length(e,t){return this.check(Ph(e,t))},unwrap(){return this.element}});function W0(e,t){return XO(bU,e,t)}function NJ(e){let t=e._zod.def.shape;return mT(Object.keys(t))}var K0=M("ZodObject",(e,t)=>{Mh(),FM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>$z(e,n,r,a),ne.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return mT(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Dh()})},loose(){return this.clone({...this._zod.def,catchall:Dh()})},strict(){return this.clone({...this._zod.def,catchall:fT()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ne.extend(this,e)},safeExtend(e){return ne.safeExtend(this,e)},merge(e){return ne.merge(this,e)},pick(e){return ne.pick(this,e)},omit(e){return ne.omit(this,e)},partial(...e){return ne.partial(Q0,this,e[0])},exactPartial(...e){return ne.partial(hT,this,e[0],"exactPartial")},required(...e){return ne.required(gT,this,e[0])}});function _J(e,t){let n={type:"object",shape:e??{},...ne.normalizeParams(t)};return new K0(n)}function LJ(e,t){return new K0({type:"object",shape:e,catchall:fT(),...ne.normalizeParams(t)})}function AJ(e,t){return new K0({type:"object",shape:e,catchall:Dh(),...ne.normalizeParams(t)})}var J0=M("ZodUnion",(e,t)=>{A0.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>UI(e,n,r,a),e.options=t.options});function Oy(e,t){return new J0({type:"union",options:e,...ne.normalizeParams(t)})}var xU=M("ZodXor",(e,t)=>{J0.init(e,t),HM.init(e,t),e._zod.processJSONSchema=(n,r,a)=>UI(e,n,r,a),e.options=t.options});function EJ(e,t){return new xU({type:"union",options:e,inclusive:!1,...ne.normalizeParams(t)})}var SU=M("ZodDiscriminatedUnion",(e,t)=>{J0.init(e,t),qM.init(e,t)});function PJ(e,t,n){return new SU({type:"union",options:t,discriminator:e,...ne.normalizeParams(n)})}var wU=M("ZodIntersection",(e,t)=>{GM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Mz(e,n,r,a)});function CU(e,t){return new wU({type:"intersection",left:e,right:t})}var kU=M("ZodTuple",(e,t)=>{Mh(),YR.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Oz(e,n,r,a)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Q0({type:"optional",innerType:t}))})}});function RU(e,t,n){let r=t instanceof Rt,a=r?n:t,o=r?t:null;return new kU({type:"tuple",items:e,rest:o,...ne.normalizeParams(a)})}var Ly=M("ZodRecord",(e,t)=>{Mh(),ZM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>zz(e,n,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function IU(e,t,n){return!t||!t._zod?new Ly({type:"record",keyType:V0(),valueType:e,...ne.normalizeParams(t)}):new Ly({type:"record",keyType:e,valueType:t,...ne.normalizeParams(n)})}function DJ(e,t,n){return new Ly({type:"record",keyType:e,valueType:t,...ne.normalizeParams(n),partial:!0})}function $J(e,t,n){return new Ly({type:"record",keyType:e,valueType:t,mode:"loose",...ne.normalizeParams(n)})}var TU=M("ZodMap",(e,t)=>{Mh(),WM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Ez(e,n,r,a),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Ou(...n)),e.nonempty=n=>e.check(Ou(1,n)),e.max=(...n)=>e.check(_m(...n)),e.size=(...n)=>e.check(Ah(...n))});function MJ(e,t,n){return new TU({type:"map",keyType:e,valueType:t,...ne.normalizeParams(n)})}var NU=M("ZodSet",(e,t)=>{Mh(),KM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Pz(e,n,r,a),e.min=(...n)=>e.check(Ou(...n)),e.nonempty=n=>e.check(Ou(1,n)),e.max=(...n)=>e.check(_m(...n)),e.size=(...n)=>e.check(Ah(...n))});function OJ(e,t){return new NU({type:"set",valueType:e,...ne.normalizeParams(t)})}var Ay=M("ZodEnum",(e,t)=>{JM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,a,o)=>Cz(e,r,a,o),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(r,a)=>{let o={};for(let i of r)if(n.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ay({...t,checks:[],...ne.normalizeParams(a),entries:o})},e.exclude=(r,a)=>{let o={...t.entries};for(let i of r)if(n.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new Ay({...t,checks:[],...ne.normalizeParams(a),entries:o})}});function mT(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ay({type:"enum",entries:n,...ne.normalizeParams(t)})}function zJ(e,t){return new Ay({type:"enum",entries:e,...ne.normalizeParams(t)})}var _U=M("ZodLiteral",(e,t)=>{QM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>kz(e,n,r,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function UJ(e,t){return new _U({type:"literal",values:Array.isArray(e)?e:[e],...ne.normalizeParams(t)})}var LU=M("ZodFile",(e,t)=>{YM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Tz(e,n,r,a),e.min=(n,r)=>e.check(Ou(n,r)),e.max=(n,r)=>e.check(_m(n,r)),e.mime=(n,r)=>e.check(wy(Array.isArray(n)?n:[n],r))});function jJ(e){return ez(LU,e)}var AU=M("ZodTransform",(e,t)=>{Mh(),XM.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Az(e,n,r,a),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Im(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(ne.issue(o,n.value,t));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=e),n.issues.push(ne.issue(i))}};let a=t.transform(n.value,n);return a instanceof Promise?a.then(o=>(n.value=o,n)):(n.value=a,n)}});function pT(e){return new AU({type:"transform",transform:e})}var Q0=M("ZodOptional",(e,t)=>{XR.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>jI(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function $h(e){return new Q0({type:"optional",innerType:e})}var hT=M("ZodExactOptional",(e,t)=>{eO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>jI(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function EU(e){return new hT({type:"optional",innerType:e})}var PU=M("ZodNullable",(e,t)=>{tO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Uz(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function q0(e){return new PU({type:"nullable",innerType:e})}function BJ(e){return $h(q0(e))}var DU=M("ZodDefault",(e,t)=>{nO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Fz(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $U(e,t){return new DU({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ne.shallowClone(t)}})}var MU=M("ZodPrefault",(e,t)=>{aO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Hz(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function OU(e,t){return new MU({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ne.shallowClone(t)}})}var gT=M("ZodNonOptional",(e,t)=>{rO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>jz(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function zU(e,t){return new gT({type:"nonoptional",innerType:e,...ne.normalizeParams(t)})}var UU=M("ZodSuccess",(e,t)=>{oO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Nz(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function FJ(e){return new UU({type:"success",innerType:e})}var jU=M("ZodCatch",(e,t)=>{iO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Vz(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function BU(e,t){return new jU({type:"catch",innerType:e,catchValue:typeof t=="function"?t:ne.constantCatch(t)})}var FU=M("ZodNaN",(e,t)=>{sO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Rz(e,n,r,a)});function HJ(e){return YO(FU,e)}var Y0=M("ZodPipe",(e,t)=>{eI.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>qz(e,n,r,a),e.in=t.in,e.out=t.out});function GI(e,t){return new Y0({type:"pipe",in:e,out:t})}var X0=M("ZodCodec",(e,t)=>{Y0.init(e,t),E0.init(e,t)});function VJ(e,t,n){return new X0({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function qJ(e){let t=e._zod.def;return new X0({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var HU=M("ZodPreprocess",(e,t)=>{Y0.init(e,t),lO.init(e,t)}),VU=M("ZodReadonly",(e,t)=>{cO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Gz(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function qU(e){return new VU({type:"readonly",innerType:e})}var GU=M("ZodTemplateLiteral",(e,t)=>{uO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Iz(e,n,r,a)});function GJ(e,t){return new GU({type:"template_literal",parts:e,...ne.normalizeParams(t)})}var ZU=M("ZodLazy",(e,t)=>{P0.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Wz(e,n,r,a),e.unwrap=()=>e._zod.def.getter()});function WU(e){return new ZU({type:"lazy",getter:e})}var KU=M("ZodPromise",(e,t)=>{fO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Zz(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function ZJ(e){return new KU({type:"promise",innerType:e})}var JU=M("ZodFunction",(e,t)=>{dO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Lz(e,n,r,a)});function WJ(e){return new JU({type:"function",input:Array.isArray(e?.input)?RU(e?.input):e?.input??W0(Dh()),output:e?.output??Dh()})}var ew=M("ZodCustom",(e,t)=>{mO.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>_z(e,n,r,a)});function KJ(e){let t=new Ta({check:"custom"});return t._zod.check=e,t}function JJ(e,t){return tz(ew,e??(()=>!0),t)}function QU(e,t={}){return nz(ew,e,t)}function YU(e,t){return az(e,t)}var QJ=rz,YJ=oz;function XJ(e,t={}){let n=new ew({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...ne.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var eQ=(...e)=>iz({Codec:X0,Boolean:$y,String:Ey},...e);function tQ(e){let t=WU(()=>Oy([V0(e),cU(),uU(),pU(),W0(t),IU(V0(),t)]));return t}function nQ(e,t){return new HU({type:"pipe",in:pT(e),out:t})}var ECe={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function PCe(e){Lr({customError:e})}function DCe(){return Lr().customError}var XU;XU||(XU={});var tw={};to(tw,{ZodISODate:()=>Dm,ZodISODateTime:()=>Pm,ZodISODuration:()=>Mm,ZodISOTime:()=>$m,date:()=>MCe,datetime:()=>$Ce,duration:()=>zCe,time:()=>OCe});function $Ce(e){return z0(Pm,e)}function MCe(e){return U0(Dm,e)}function OCe(e){return j0($m,e)}function zCe(e){return B0(Mm,e)}var Te={...zy,...HI,iso:tw},UCe=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function jCe(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function aQ(e,t){return e.map((n,r)=>r<t?n:n.optional())}function BCe(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function FCe(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let a=n[1]===void 0?void 0:BCe(n[1]);if(!a||!t.defs[a])throw new Error(`Reference not found: ${e}`);return t.defs[a]}throw new Error(`Reference not found: ${e}`)}function HCe(e,t){return Te.transform(r=>r).check(r=>{let a=r.value;if(!(typeof a!="object"||a===null||Array.isArray(a)))for(let o of Object.getOwnPropertyNames(a)){let i=t.safeParse(o);i.success||r.issues.push({code:"invalid_key",origin:"record",issues:i.error.issues,input:o,path:[o],continue:!0})}}).pipe(e)}function rQ(e,t){if(e!==!1)return e===void 0||e===!0?Te.any():Zs(e,t)}var VCe=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function oQ(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return Te.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let a=e.$ref;if(t.refs.has(a))return t.refs.get(a);if(t.processing.has(a))return Te.lazy(()=>{if(!t.refs.has(a))throw new Error(`Circular reference not resolved: ${a}`);return t.refs.get(a)});t.processing.add(a);let o=FCe(a,t),i=Zs(o,t);return t.refs.set(a,i),t.processing.delete(a),i}if(e.enum!==void 0){let a=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&a.length===1&&a[0]===null)return Te.null();if(a.length===0)return Te.never();if(a.length===1)return Te.literal(a[0]);if(a.every(i=>typeof i=="string"))return Te.enum(a);let o=a.map(i=>Te.literal(i));return o.length<2?o[0]:Te.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return Te.literal(e.const);let n=e.type;if(Array.isArray(n)){let a=n.map(o=>{let i={...e,type:o};return oQ(i,t)});return a.length===0?Te.never():a.length===1?a[0]:Te.union(a)}if(!n)return Te.any();let r;switch(n){case"string":{let a=Te.string();if(e.format){let o=e.format;o==="email"?a=a.check(Te.email()):o==="uri"||o==="uri-reference"?a=a.check(Te.url()):o==="uuid"||o==="guid"?a=a.check(Te.uuid()):o==="date-time"?a=a.check(Te.iso.datetime({offset:!0})):o==="date"?a=a.check(Te.iso.date()):o==="time"?a=a.check(Te.regex(VCe)):o==="duration"?a=a.check(Te.iso.duration()):o==="hostname"?a=a.check(Te.hostname()):o==="ipv4"?a=a.check(Te.ipv4()):o==="ipv6"?a=a.check(Te.ipv6()):o==="mac"?a=a.check(Te.mac()):o==="cidr"?a=a.check(Te.cidrv4()):o==="cidr-v6"?a=a.check(Te.cidrv6()):o==="base64"?a=a.check(Te.base64()):o==="base64url"?a=a.check(Te.base64url()):o==="e164"?a=a.check(Te.e164()):o==="credit_card"?a=a.check(Te.creditCard()):o==="jwt"?a=a.check(Te.jwt()):o==="emoji"?a=a.check(Te.emoji()):o==="nanoid"?a=a.check(Te.nanoid()):o==="cuid"?a=a.check(Te.cuid()):o==="cuid2"?a=a.check(Te.cuid2()):o==="ulid"?a=a.check(Te.ulid()):o==="xid"?a=a.check(Te.xid()):o==="ksuid"&&(a=a.check(Te.ksuid()))}typeof e.minLength=="number"&&(a=a.min(e.minLength)),typeof e.maxLength=="number"&&(a=a.max(e.maxLength)),e.pattern&&(a=a.regex(new RegExp(e.pattern))),r=a;break}case"number":case"integer":{let a=n==="integer"?Te.number().int():Te.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(a=a.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(a=a.max(e.maximum)),typeof e.exclusiveMinimum=="number"?a=a.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(a=a.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?a=a.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(a=a.lt(e.maximum)),typeof e.multipleOf=="number"&&(a=a.multipleOf(e.multipleOf)),r=a;break}case"boolean":{r=Te.boolean();break}case"null":{r=Te.null();break}case"object":{let a={},o=e.properties||{},i=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?Zs(e.additionalProperties,t):void 0;for(let[l,u]of Object.entries(o)){let d=Zs(u,t);fr(a,l,i.has(l)?d:d.optional())}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),d=[];for(let m of u){let h=Zs(l[m],t),p=Te.string().regex(new RegExp(m));d.push(Te.looseRecord(p,h))}let f=[];if(Object.keys(a).length>0&&f.push(Te.object(a).passthrough()),f.push(...d),f.length===0)r=Te.object({}).passthrough();else if(f.length===1)r=f[0];else{let m=Te.intersection(f[0],f[1]);for(let h=2;h<f.length;h++)m=Te.intersection(m,f[h]);r=m}if(e.additionalProperties===!1){let m=Object.keys(a),h=u.map(g=>new RegExp(g)),p=r;r=r.check(g=>{if(!oc(g.value))return;let x=[];for(let y of Object.keys(g.value))m.includes(y)||h.some(v=>v.test(y))||x.push(y);x.length&&g.issues.push({code:"unrecognized_keys",keys:x,input:g.value,inst:p})})}}else{let l=Te.object(a);e.additionalProperties===!1?r=l.strict():s?r=l.catchall(s):r=l.passthrough()}if(e.propertyNames!==void 0&&e.propertyNames!==!0){let l=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;r=HCe(r,Zs(l,t))}break}case"array":{let a=e.prefixItems,o=e.items;if(a&&Array.isArray(a)){let i=typeof e.minItems=="number"?e.minItems:0,s=a.map(f=>Zs(f,t)),l=aQ(s,i),u=Array.isArray(o)?void 0:rQ(o,t),d=Te.tuple(l);r=u?d.rest(u):d,typeof e.minItems=="number"&&(r=r.check(Te.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(Te.maxLength(e.maxItems)))}else if(Array.isArray(o)){let i=typeof e.minItems=="number"?e.minItems:0,s=o.map(f=>Zs(f,t)),l=aQ(s,i),u=rQ(e.additionalItems,t),d=Te.tuple(l);r=u?d.rest(u):d,typeof e.minItems=="number"&&(r=r.check(Te.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(Te.maxLength(e.maxItems)))}else if(o!==void 0){let i=Zs(o,t),s=Te.array(i);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),r=s}else r=Te.array(Te.any());break}default:throw new Error(`Unsupported type: ${n}`)}return r}function Zs(e,t){if(typeof e=="boolean")return e?Te.any():Te.never();let n=oQ(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(u=>Zs(u,t)),l=Te.union(s);n=r?Te.intersection(n,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(u=>Zs(u,t)),l=Te.xor(s);n=r?Te.intersection(n,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:Te.any();else{let s=r?n:Zs(e.allOf[0],t),l=r?0:1;for(let u=l;u<e.allOf.length;u++)s=Te.intersection(s,Zs(e.allOf[u],t));n=s}e.nullable===!0&&t.version==="openapi-3.0"&&(n=Te.nullable(n)),e.readOnly===!0&&(n=Te.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let a={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of o)s in e&&(a[s]=e[s]);let i=["contentEncoding","contentMediaType","contentSchema"];for(let s of i)s in e&&(a[s]=e[s]);e.propertyNames!==void 0&&e.type==="object"&&e.$ref===void 0&&(a.propertyNames=e.propertyNames);for(let s of Object.keys(e))UCe.has(s)||fr(a,s,e[s]);return Object.keys(a).length>0&&t.registry.add(n,a),e.description&&(n=n.describe(e.description)),n}function iQ(e,t){if(typeof e=="boolean")return e?Te.any():Te.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=jCe(n,t?.defaultTarget),a=n.$defs||n.definitions||{},o={version:r,defs:a,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??ii};return Zs(n,o)}var sQ=Symbol("z.visit/resolving");function nw(e,t){let n=typeof t=="function"?t:(i,s)=>{let l=t[i._zod.def.type];return l?l(i,s):i},r=new Map;function a(i){let s=r.get(i);if(s===sQ)return new P0({type:"lazy",getter:()=>r.get(i)});if(s!==void 0)return s;r.set(i,sQ);let l=o(i),u=n(l,l!==i);return r.set(i,u),u}function o(i){let s=i._zod.def,l=s.type;switch(l){case"object":{let u=s.shape,d=Object.keys(u),f=!1,m={};for(let p of d){let g=a(u[p]);g!==u[p]&&(f=!0),m[p]=g}let h=s.catchall;return s.catchall&&(h=a(s.catchall),h!==s.catchall&&(f=!0)),f?Xn(i,{...s,shape:m,catchall:h}):i}case"array":{let u=a(s.element);return u===s.element?i:Xn(i,{...s,element:u})}case"tuple":{let u=s.items,d=!1,f=[];for(let h of u){let p=a(h);p!==h&&(d=!0),f.push(p)}let m=s.rest;return s.rest&&(m=a(s.rest),m!==s.rest&&(d=!0)),d?Xn(i,{...s,items:f,rest:m}):i}case"record":case"map":{let u=a(s.keyType),d=a(s.valueType);return u===s.keyType&&d===s.valueType?i:Xn(i,{...s,keyType:u,valueType:d})}case"set":{let u=a(s.valueType);return u===s.valueType?i:Xn(i,{...s,valueType:u})}case"union":{let u=s.options,d=!1,f=[];for(let m of u){let h=a(m);h!==m&&(d=!0),f.push(h)}return d?Xn(i,{...s,options:f}):i}case"intersection":{let u=a(s.left),d=a(s.right);return u===s.left&&d===s.right?i:Xn(i,{...s,left:u,right:d})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=a(s.innerType);return u===s.innerType?i:Xn(i,{...s,innerType:u})}case"pipe":{let u=a(s.in),d=a(s.out);return u===s.in&&d===s.out?i:Xn(i,{...s,in:u,out:d})}case"function":{let u=a(s.input),d=a(s.output);return u===s.input&&d===s.output?i:Xn(i,{...s,input:u,output:d})}case"lazy":{let u=s.getter,{_cachedInner:d,...f}=s;return Xn(i,{...f,getter:()=>a(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return i;default:return i}}return a(e)}function lQ(e){return nw(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:Oy(n.options)}})}function qCe(e,t){if(!t?.length)return e;let n=e._zod.def;return Xn(e,qc(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function cQ(e){return qCe(e.out,e.checks)}function GCe(e){return e.in._zod.traits.has("$ZodTransform")?cQ(e):e.in}function uQ(e){return nw(e,{pipe:t=>GCe(t._zod.def),default:(t,n)=>n?$h(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function dQ(e){return nw(e,{pipe:t=>cQ(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var e4={};to(e4,{bigint:()=>JCe,boolean:()=>KCe,date:()=>QCe,number:()=>WCe,string:()=>ZCe});function ZCe(e){return IO(Ey,e)}function WCe(e){return AO(Dy,e)}function KCe(e){return zO($y,e)}function JCe(e){return jO(My,e)}function QCe(e){return QO(Z0,e)}var fQ=["none","low","medium","high","xhigh"];var vT=c.string().regex(/^[a-z][a-z0-9_-]*$/);var ns=c.string().trim().min(1).max(160),Uy=c.number().int().nonnegative(),YCe=c.discriminatedUnion("type",[c.strictObject({type:c.literal("code_change"),author:ns.optional(),sourceBranch:ns.optional(),targetBranch:ns.optional(),reviewers:c.array(ns).max(5).optional(),review:c.enum(["required","approved","changes_requested"]).optional(),checks:c.strictObject({passed:Uy,failed:Uy,pending:Uy}).optional(),mergeable:c.boolean().optional(),changedFiles:Uy.optional(),additions:Uy.optional(),deletions:Uy.optional()}),c.strictObject({type:c.literal("task"),assignees:c.array(ns).max(5).optional(),priority:ns.optional(),project:ns.optional(),cycle:ns.optional(),dueDate:c.iso.date().optional(),labels:c.array(ns).max(5).optional()}),c.strictObject({type:c.literal("deployment"),project:ns.optional(),environment:ns.optional(),revision:ns.optional(),branch:ns.optional()}),c.strictObject({type:c.literal("calendar_event"),when:ns.optional(),attendees:c.array(ns).max(5).optional()})]);function pQ(e){if(!e)return[];let t=[],n=a=>a?.length?`${a.join(", ")}${a.length===5?" (up to 5 shown)":""}`:void 0;function r(a,o,i){i!==void 0&&i!==""&&t.push({key:a,label:o,value:String(i)})}switch(e.type){case"code_change":r("sourceBranch","Branch",e.sourceBranch);break;case"task":r("assignees","Assignees",e.assignees?.length===0?"Unassigned":n(e.assignees)),r("priority","Priority",e.priority),r("project","Project",e.project),r("cycle","Cycle",e.cycle),r("dueDate","Due",e.dueDate),r("labels","Labels",n(e.labels));break;case"deployment":r("environment","Environment",e.environment),r("project","Project",e.project),r("revision","Revision",e.revision),r("branch","Branch",e.branch);break;case"calendar_event":r("when","When",e.when),r("attendees","Attendees",n(e.attendees))}return t.slice(0,4)}var zh=c.enum(["task","code_change","automation","deployment","calendar_event","item"]);var t4=c.object({kind:c.literal("object"),key:c.string().trim().min(1).max(256),label:c.string().trim().min(1).max(256),objectType:zh,title:c.string().trim().min(1).max(512),url:c.url().max(2048).refine(e=>["http:","https:"].includes(new URL(e).protocol)).nullable(),description:c.string().max(4e3).optional(),status:c.string().trim().min(1).max(100).optional(),trigger:c.string().max(4e3).optional(),warning:c.string().max(1e3).optional(),displayType:c.string().trim().min(1).max(80).optional(),sourceUpdatedAt:c.iso.datetime({offset:!0}).optional(),facts:YCe.refine(e=>new TextEncoder().encode(JSON.stringify(e)).length<=4096,"Object facts must not exceed 4 KiB").optional()}).strict().refine(e=>!e.facts||(e.facts.type==="deployment"?e.objectType==="deployment"||e.objectType==="item":e.facts.type===e.objectType),"Object facts must match the object type"),JGe=t4.safeExtend({plugin:c.string().min(1)});function XCe(e){try{let t=new URL(e).protocol;return t==="http:"||t==="https:"}catch{return!1}}var eke=c.object({kind:c.literal("resource_link"),objectType:zh.optional(),key:c.string().trim().min(1).max(256),label:c.string().trim().min(1).max(256),url:c.string().url().max(2048).refine(XCe,"URL must use HTTP or HTTPS."),description:c.string().trim().min(1).max(512).optional(),status:c.enum(["open","draft","closed","merged","warning"]).optional()}).strict(),hQ=c.discriminatedUnion("kind",[eke,t4]),tke=c.enum(["circle-dot","circle-dashed","circle-x","git-merge","git-pull-request","triangle-alert"]),gQ=c.object({icon:tke.optional(),objectType:zh.optional(),status:c.string().trim().min(1).max(100).optional(),key:c.string().trim().min(1).max(256),label:c.string().trim().min(1).max(256)}).strict(),rw=c.enum(["closed","merged","open"]),QGe=c.object({closedAt:c.date().optional(),conversationIds:c.array(c.string().min(1)).default([]),mergedAt:c.date().optional(),number:c.number().int().positive(),openedAt:c.date(),providerId:c.string().min(1),repository:c.object({name:c.string().min(1),providerId:c.string().min(1),url:c.string().url().optional()}).strict(),state:rw,title:c.string().min(1).optional(),updatedAt:c.date(),url:c.string().url().optional()}).strict(),YGe=c.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/),nke=c.enum(["activity","brain","calendar","check","database","info","key","link","sparkles","warning"]),ake=c.object({content:c.string().min(1).max(32768).optional(),description:c.string().trim().min(1).max(2e3).optional(),metadata:c.array(c.string().trim().min(1).max(120)).max(8).optional(),title:c.string().trim().min(1).max(4e3)}).strict(),vQ=c.object({details:c.array(ake).max(100).optional(),icon:nke.optional(),preview:c.string().trim().min(1).max(500).optional(),title:c.string().trim().min(1).max(120)}).strict();var bT=c.string().regex(/^T[A-Z0-9]+$/),n4=c.string().regex(/^(C|G|D)[A-Z0-9]+$/),yQ=c.string().regex(/^local:[a-z0-9_-]+:[a-z0-9][a-z0-9_-]*$/),xT=c.string().min(1).refine(e=>e===e.trim()&&e.toLowerCase()!=="unknown"),yT=xT,ht=c.string().refine(e=>e.trim().length>0),Go=ht.refine(e=>e===e.trim()),rke=c.object({id:ht,provider:Go}).strict().extend({provider:c.literal("slack"),teamId:bT,channelId:n4,threadTs:Go.optional()}).strict(),XGe=c.discriminatedUnion("provider",[rke]),eZe=c.enum(["slack","local"]),bQ=c.enum(["public","private"]),a4=c.enum(["public","private"]),jy=c.object({platform:c.literal("slack"),teamId:bT,channelId:n4,threadTs:Go.optional()}).strict(),oke=c.object({platform:c.literal("local"),conversationId:yQ}).strict(),ike=c.discriminatedUnion("platform",[jy,oke]),ow=c.object({action:c.literal("send_message"),destination:jy}).strict(),ske=c.object({kind:c.literal("slack"),teamId:bT,channelId:n4,visibility:bQ,messageTs:ht.optional(),threadTs:ht.optional()}).strict(),lke=c.object({kind:c.literal("local"),visibility:c.literal("private"),conversationId:yQ}).strict(),cke=c.object({kind:c.literal("web"),visibility:bQ,conversationId:Go}).strict(),uke=c.object({kind:c.literal("event"),eventKey:Go,eventType:Go,identifier:Go,namespace:Go}).strict(),xQ={automationId:Go.optional(),automationRunId:Go.optional()},dke=c.object({kind:c.literal("scheduled_automation"),...xQ}).strict(),fke=c.object({kind:c.literal("event_automation"),...xQ}).strict(),mke=c.object({kind:c.literal("plugin_dispatch")}).strict(),pke=c.object({kind:c.literal("agent_invocation")}).strict(),hke=c.discriminatedUnion("kind",[ske,lke,cke,uke,dke,fke,mke,pke]);function gke(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let t=e;if("kind"in t){let o=typeof t.kind=="string"?{event_task:"event_automation",resource_event:"event",scheduled_task:"scheduled_automation"}[t.kind]:void 0;return o?{...t,kind:o}:e}if(t.platform!=="slack"&&t.platform!=="local"&&t.platform!=="web")return e;let{location:n,platform:r,...a}=t;return{...a,kind:r}}var vke=c.preprocess(gke,hke),yke=c.discriminatedUnion("allowedWhen",[c.object({type:c.literal("user"),userId:yT,allowedWhen:c.literal("private-direct-conversation")}).strict(),c.object({type:c.literal("user"),userId:yT,allowedWhen:c.literal("scheduled-automation"),taskId:Go}).strict()]),r4={email:ht.optional(),fullName:ht.optional(),userId:yT,userName:ht.optional()},bke=c.object({...r4,platform:c.literal("slack"),teamId:bT}).strict(),xke=c.object({...r4,platform:c.literal("local")}).strict(),Ske=c.object({...r4,platform:c.literal("web")}).strict(),wke=c.object({platform:c.literal("system"),name:yT}).strict(),aw=c.discriminatedUnion("platform",[bke,xke,Ske,wke]),Cke=c.object({displayName:ht.optional(),handle:ht.optional(),id:Go,provider:Go,providerSubjectId:Go,providerTenantId:Go.optional()}).strict(),tZe=c.object({displayName:ht.optional(),email:ht.max(320),id:Go,identities:c.array(Cke).max(100),isAdmin:c.literal(!0).optional()}).strict(),kke=c.record(c.string(),c.string()).superRefine((e,t)=>{let n=Object.entries(e);if(n.length>20){t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata has too many keys"});return}for(let[r,a]of n){if(!r.trim()){t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata values must be strings",path:[r]});continue}r.length>128&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata key exceeds the maximum length",path:[r]}),/[\r\n]/.test(r)&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata keys must be single-line strings",path:[r]}),/[\r\n]/.test(a)&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata values must be single-line strings",path:[r]}),a.length>512&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata value exceeds the maximum length",path:[r]})}}),Rke=c.object({label:Go.pipe(c.string().max(48)).refine(e=>!/[\r\n]/.test(e)),detail:Go.pipe(c.string().max(128)).refine(e=>!/[\r\n]/.test(e)).optional()}).strict(),nZe=c.object({idempotencyKey:ht.pipe(c.string().max(512)),credentialSubject:yke.optional(),destination:jy,destinationVisibility:a4,input:ht.pipe(c.string().max(32e3)),metadata:kke.optional(),replyAttribution:Rke.optional()}).strict();var Ike=c.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_-]*$/),aZe=c.object({text:c.string().trim().min(1).max(8e3)}).strict(),rZe=c.object({kind:Ike,version:c.number().int().positive(),content:c.record(c.string(),c.unknown())}).strict();var Tke=4e3,Nke=8e3;var _ke=4e3,Lke=1e3,Ake=c.record(c.string(),c.unknown()).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:"custom",message:"Event data may include at most 32 keys."}),new TextEncoder().encode(JSON.stringify(e)).byteLength>4e3&&t.addIssue({code:"custom",message:`Event data may be at most ${_ke} JSON bytes.`})}),Qd=c.string().regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/).describe("Canonical dotted event type, such as issue.closed or pull_request.review.changes_requested."),SQ=c.string().regex(/^[a-z][a-z0-9_]*$/).describe("Canonical plugin-defined resource type, such as issue or pull_request."),wQ=/^[a-z][a-zA-Z0-9]*$/,Eke=c.object({kind:c.enum(["boolean","string","number"]),description:c.string().trim().min(1).max(200),enum:c.array(c.string().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{e.enum&&e.kind!=="string"&&t.addIssue({code:"custom",message:'Event match field enum requires kind "string".',path:["enum"]})}),Pke=c.record(c.string().regex(wQ),Eke).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:"custom",message:"Event match keys may include at most 32 keys."})}),o4=c.record(c.string().regex(wQ),c.union([c.boolean(),c.number().finite(),c.string().min(1),c.array(c.union([c.number().finite(),c.string().min(1)])).min(1)])).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:"custom",message:"Event match may include at most 32 keys."});for(let[n,r]of Object.entries(e))Array.isArray(r)&&r.some(a=>typeof a=="boolean")&&t.addIssue({code:"custom",message:`Event match field "${n}" cannot use a boolean list.`,path:[n]})});var Dke=c.object({format:c.string().trim().min(1).max(200),pattern:c.instanceof(RegExp)}).strict(),i4=c.object({type:SQ,identifier:Dke.optional(),supportedEvents:c.array(Qd).min(1),suggestedEvents:c.array(Qd).optional(),matchFields:Pke.optional(),guidance:c.record(Qd,c.string().trim().min(1).max(Lke)).optional()}).strict().superRefine((e,t)=>{let n=new Set;e.supportedEvents.forEach((a,o)=>{n.has(a)&&t.addIssue({code:"custom",message:`Duplicate supported event type "${a}".`,path:["supportedEvents",o]}),n.add(a)});for(let a of Object.keys(e.guidance??{}))n.has(a)||t.addIssue({code:"custom",message:`Guidance event type "${a}" is not supported.`,path:["guidance",a]});let r=new Set;e.suggestedEvents?.forEach((a,o)=>{r.has(a)&&t.addIssue({code:"custom",message:`Duplicate suggested event type "${a}".`,path:["suggestedEvents",o]}),n.has(a)||t.addIssue({code:"custom",message:`Suggested event type "${a}" is not supported.`,path:["suggestedEvents",o]}),r.add(a)})}),oZe=c.object({resourceTypes:c.array(i4).min(1),isEnabled:c.function({input:[],output:c.boolean()}).optional(),normalizeIdentifier:c.function({input:[c.string()],output:c.string()}).optional()}).strict().superRefine((e,t)=>{let n=new Set;e.resourceTypes.forEach((r,a)=>{n.has(r.type)&&t.addIssue({code:"custom",message:`Duplicate resource type "${r.type}".`,path:["resourceTypes",a,"type"]}),n.add(r.type)})});var iZe=c.object({identifier:c.string().min(1),label:c.string().min(1),namespace:c.string().min(1),suggestedEvents:c.array(Qd).optional(),supportedEvents:c.array(Qd),type:SQ}).strict(),sZe=c.object({events:c.array(Qd).min(1),id:c.string().min(1)}).strict(),mQ=c.union([c.object({provider:c.string().min(1),handle:c.string().min(1)}).strict(),c.object({email:c.string().trim().min(3)}).strict()]),$ke=c.object({objectType:zh.optional(),eventKey:c.string().min(1),eventType:Qd,identifier:c.string().min(1),occurredAtMs:c.number().finite(),terminal:c.boolean().optional(),trustedSummary:c.string().min(1).transform(e=>e.slice(0,Tke)),data:Ake.optional(),untrustedText:c.string().transform(e=>e.slice(0,Nke)).optional(),people:c.array(mQ).max(20).optional(),doneBy:mQ.optional()}).strict(),lZe=$ke.extend({namespace:c.string().min(1)}),Mke=c.object({authority:c.enum(["instruction","context"]),actor:aw.optional()}).strict(),Oke=c.discriminatedUnion("type",[c.object({type:c.literal("message"),role:c.enum(["user","assistant"]),text:c.string().min(1),provenance:Mke.optional(),isRunActor:c.boolean().optional()}).strict(),c.object({type:c.literal("toolResult"),toolName:c.string().min(1),isError:c.boolean(),text:c.string().min(1).optional()}).strict()]),cZe=c.object({actorUserId:c.string().min(1).optional(),completedAtMs:c.number().finite(),conversationId:c.string().min(1),destination:ike,locationId:c.string().min(1).optional(),actors:c.array(aw),actor:aw.optional(),runId:c.string().min(1),source:vke,transcript:c.array(Oke)}).strict();var uZe=c.discriminatedUnion("type",[c.object({type:c.literal("text"),text:c.string()}).strict(),c.object({type:c.literal("image"),data:c.string(),mimeType:c.string()}).strict()]),zke=c.object({arguments:c.record(c.string(),c.unknown()),reason:c.string().min(1).optional()}).strict(),dZe=c.object({objectAnnotations:c.array(t4).optional(),target:c.string().min(1).optional(),truncated:c.boolean().optional(),continuation:zke.optional()}).passthrough(),fZe=c.enum(["auto","review","approve"]);var mZe=c.object({auth:c.object({user:c.object({email:c.string().nullable().optional(),emailVerified:c.boolean().optional(),isAdmin:c.boolean(),name:c.string().nullable().optional()}).strict()}).strict(),pluginName:ht}).strict(),Uke=c.string().regex(/^[a-z][a-z0-9-]*$/),jke=c.string().regex(/^[a-z][a-z0-9.-]*$/),Bke=c.union([c.literal("read"),c.literal("write")]),CQ=c.object({provider:Uke,scope:ht.optional(),type:c.literal("oauth")}).strict(),kQ=c.object({displayName:ht.optional(),handle:ht.optional(),id:ht,label:ht.optional(),url:ht.optional(),verifiedEmails:c.array(ht).optional()}).strict(),pZe=c.object({account:kQ.optional(),accessToken:ht,expiresAt:c.number().finite().optional(),refreshToken:ht,refreshTokenExpiresAt:c.number().finite().optional(),scope:ht.optional()}).strict(),hZe=c.object({access:Bke,leaseScope:ht.optional(),name:jke,reason:ht.optional(),requirements:c.array(ht).min(1).optional()}).strict(),Fke=c.object({domain:c.string().min(1),headers:c.record(c.string(),c.string()).refine(e=>Object.keys(e).length>0)}).strict(),Hke=c.object({account:kQ.optional(),authorization:CQ.optional(),expiresAt:c.string().refine(e=>Number.isFinite(Date.parse(e))),headerTransforms:c.array(Fke).min(1)}).strict(),gZe=c.discriminatedUnion("type",[c.object({lease:Hke,type:c.literal("lease")}).strict(),c.object({authorization:CQ.optional(),message:ht,type:c.literal("needed")}).strict(),c.object({message:ht,type:c.literal("unavailable")}).strict()]);var Vke=ht.max(64).regex(/^[a-z][a-z0-9-]*$/),qke=ht.max(80),Gke=ht.max(500),Zke=c.enum(["primary","profile","admin"]),Wke=c.object({detail:ht.max(500).optional(),label:ht.max(80),tone:c.enum(["good","neutral","warning"]).optional(),value:ht.max(120)}).strict(),Kke=c.object({label:ht.max(80),value:ht.max(500)}).strict(),Jke=c.object({confirmation:ht.max(500).optional(),href:ht.max(500).regex(/^\/api\/plugins\/[a-z][a-z0-9-]*(?:\/|$)/),label:ht.max(80),method:c.enum(["DELETE","GET"]),tone:c.enum(["danger","neutral"]).optional()}).strict(),Qke=c.object({actions:c.array(Jke).max(4).optional(),description:ht.max(1e3).optional(),id:ht.max(128),metadata:c.array(Kke).max(8).optional(),title:ht.max(4e3)}).strict(),vZe=c.object({emptyText:ht.max(500).optional(),metrics:c.array(Wke).max(6).optional(),nextCursor:ht.max(1e3).optional(),records:c.array(Qke).max(100),searchPlaceholder:ht.max(120).optional(),type:c.literal("list")}).strict(),Yke=c.object({description:Gke,id:Vke,label:qke,navigation:Zke,pluginDisplayName:ht.max(200),pluginName:ht.max(100)}).strict(),yZe=c.array(Yke),Xke=ht.max(1e3).optional(),e1e=ht.max(64).optional(),t1e=c.string().trim().max(200).optional(),bZe=c.object({cursor:Xke,filter:e1e,limit:c.number().int().min(1).max(50),query:t1e}).strict();var n1e=c.object({input:c.number().finite().nonnegative().optional(),output:c.number().finite().nonnegative().optional(),cacheRead:c.number().finite().nonnegative().optional(),cacheWrite:c.number().finite().nonnegative().optional(),total:c.number().finite().nonnegative().optional()}).strict(),l4=c.object({inputTokens:c.number().int().nonnegative().optional(),outputTokens:c.number().int().nonnegative().optional(),cachedInputTokens:c.number().int().nonnegative().optional(),cacheCreationTokens:c.number().int().nonnegative().optional(),reasoningTokens:c.number().int().nonnegative().optional(),totalTokens:c.number().int().nonnegative().optional(),cost:n1e.optional()}).strict(),a1e=c.union([c.literal("instruction"),c.literal("context")]),r1e=c.object({authority:a1e,actor:aw.optional()}).strict();var kZe=c.record(c.string(),c.unknown()),RZe=c.object({item:c.string()}).passthrough();function o1e(e){return e==="user_message"||e==="assistant_message"||e==="tool_result"||e==="handoff"||e==="compaction"}var i1e=c.object({type:c.literal("user_message"),role:c.never().optional(),provenance:r1e}).passthrough(),s1e=c.object({type:c.literal("assistant_message"),role:c.never().optional()}).passthrough(),l1e=c.object({type:c.literal("tool_result"),role:c.never().optional()}).passthrough(),IQ=c.discriminatedUnion("type",[i1e,s1e,l1e]),c1e=c.object({item:IQ,sourceEventSeq:c.number().int().nonnegative().optional()}).strict(),RQ=c.array(c1e),u1e=c.object({reason:c.literal("capacity"),estimatedInputTokens:c.number().int().nonnegative(),replacementInputTokens:c.number().int().nonnegative().optional(),triggerTokens:c.number().int().nonnegative(),inputLimitTokens:c.number().int().positive(),inputMessageCount:c.number().int().nonnegative(),retainedMessageCount:c.number().int().nonnegative(),summaryChars:c.number().int().nonnegative()}).strict(),TQ=c.discriminatedUnion("type",[c.object({type:c.literal("handoff"),modelProfile:vT,modelId:c.string().min(1),reasoningLevel:c.string().min(1).optional(),triggeringToolCallId:c.string().min(1).optional(),summary:c.string().min(1).optional(),replacementHistory:RQ}).strict(),c.object({type:c.literal("compaction"),modelProfile:vT,modelId:c.string().min(1),details:u1e.optional(),summary:c.string().min(1).optional(),replacementHistory:RQ}).strict()]),IZe=c.object({data:TQ,createdAtMs:c.number().finite()}).strict(),d1e=c.object({type:c.literal("mcp_provider_connected"),provider:c.string().min(1),credentialSubjectId:c.string().min(1)}).strict(),f1e=c.object({type:c.literal("mcp_provider_connected_unowned"),provider:c.string().min(1)}).strict(),NQ=c.union([c.literal("plugin"),c.literal("mcp")]),m1e=c.object({type:c.literal("authorization_requested"),kind:NQ,provider:c.string().min(1),actorId:c.string().min(1),authorizationId:c.string().min(1),delivery:c.union([c.literal("private_link_sent"),c.literal("private_link_reused")])}).strict(),p1e=c.object({type:c.literal("authorization_completed"),kind:NQ,provider:c.string().min(1),actorId:c.string().min(1),authorizationId:c.string().min(1)}).strict(),h1e=c.object({type:c.literal("tool_execution_started"),toolCallId:c.string().min(1),toolName:c.string().min(1)}).strict(),g1e=c.object({type:c.literal("guardian_action_reviewed"),turnId:c.string().min(1),toolCallId:c.string().min(1),toolName:c.string().min(1),costUsd:c.number().finite().nonnegative().optional(),decision:c.enum(["allow","ask","deny"]),riskLevel:c.enum(["low","medium","high","critical"]),userAuthorization:c.enum(["high","medium","low","unknown"])}).strict(),v1e=c.union([c.literal("user"),c.literal("assistant"),c.literal("system")]),_Q=c.object({type:c.literal("message"),messageId:c.string().min(1),role:v1e,text:c.string(),authorIdentityId:c.string().min(1).optional(),meta:c.record(c.string(),c.unknown()).optional()}).strict(),y1e=_Q.extend({type:c.literal("message_updated")}),b1e=c.object({type:c.literal("message_handled"),messageId:c.string().min(1)}).strict(),x1e=c.object({type:c.literal("messages_summarized"),historyFromSeq:c.number().int().nonnegative(),compactions:c.array(c.object({coveredMessageCount:c.number().int().nonnegative(),createdAtMs:c.number(),id:c.string().min(1),summary:c.string()}).strict())}).strict(),S1e=c.enum(["slack","api","scheduler","internal"]),ST=c.enum(["agent_run_failed","delivery_failed","model_execution_failed","persistence_failed"]),wT=c.enum(["auth","permission","rate_limit","capacity","timeout","network","server","invalid_request","invalid_response","quota","content_policy","unknown","empty_output","tool_errors","suppressed_output"]),w1e=c.object({type:c.literal("turn_started"),turnId:c.string().min(1),inputMessageIds:c.array(c.string().min(1)).min(1),surface:S1e}).strict().refine(e=>new Set(e.inputMessageIds).size===e.inputMessageIds.length,"turn input message ids must be unique"),C1e=c.object({type:c.literal("turn_routed"),turnId:c.string().min(1),modelProfile:vT,modelId:c.string().min(1),costUsd:c.number().finite().nonnegative().optional(),reasoningLevel:c.enum(fQ),confidence:c.number().min(0).max(1).optional(),source:c.enum(["configured","inherited","router"])}).strict(),k1e=c.object({type:c.literal("turn_context"),turnId:c.string().min(1),pluginName:c.string().min(1),kind:c.string().min(1).max(64),version:c.number().int().positive(),content:c.record(c.string(),c.unknown())}).strict(),R1e=c.object({type:c.literal("structured_event"),namespace:c.string().regex(/^[a-z][a-z0-9-]*$/),name:c.string().regex(/^[a-z][a-z0-9_]*$/),version:c.number().int().positive(),turnId:c.string().min(1).optional(),content:c.record(c.string(),c.unknown())}).strict(),I1e=c.object({id:c.string().min(1),filename:c.string().min(1),contentType:c.string().min(1),bytes:c.number().int().nonnegative()}).strict(),T1e=c.object({type:c.literal("attachments_delivered"),attachments:c.array(I1e).min(1),toolCallId:c.string().min(1).optional(),turnId:c.string().min(1).optional()}).strict(),N1e=c.object({type:c.literal("turn_completed"),turnId:c.string().min(1),outcome:c.enum(["success","no_reply","cancelled"])}).strict(),_1e=c.object({type:c.literal("turn_failed"),turnId:c.string().min(1),failureCode:ST,failureReason:wT.optional(),eventId:c.string().regex(/^[a-f0-9]{32}$/i).optional()}).strict(),L1e=c.object({type:c.literal("subagent_started"),subagentInvocationId:c.string().min(1),subagentKind:c.string().min(1),agentName:c.string().min(1).optional(),task:c.string().min(1).optional(),title:c.string().min(1).optional(),modelId:c.string().min(1).optional(),parentToolCallId:c.string().min(1).optional(),reasoningLevel:c.string().min(1).optional(),childConversationId:c.string().min(1)}).strict(),A1e=c.object({type:c.literal("subagent_ended"),subagentInvocationId:c.string().min(1),outcome:c.union([c.literal("success"),c.literal("blocked"),c.literal("error"),c.literal("aborted")]),errorCode:c.string().min(1).optional()}).strict(),LQ=c.union([_Q,y1e,IQ,d1e,m1e,p1e,h1e,g1e,b1e,x1e,w1e,k1e,R1e,T1e,C1e,N1e,_1e,L1e,A1e]),E1e=c.union([LQ,TQ,f1e]),P1e=["message","message_updated","user_message","assistant_message","tool_result","mcp_provider_connected","mcp_provider_connected_unowned","authorization_requested","authorization_completed","tool_execution_started","guardian_action_reviewed","message_handled","messages_summarized","turn_started","turn_context","structured_event","attachments_delivered","turn_routed","turn_completed","turn_failed","subagent_started","subagent_ended","handoff","compaction"],TZe=c.enum(P1e),D1e=c.object({type:c.literal("unknown"),originalType:c.string().min(1),payload:c.unknown()}).strict(),s4=c.object({schemaVersion:c.number().int().nonnegative(),seq:c.number().int().nonnegative(),historyVersion:c.number().int().nonnegative(),idempotencyKey:c.string().min(1).optional(),createdAtMs:c.number().finite()}).strict(),NZe=c.union([s4.extend({schemaVersion:c.union([c.literal(1),c.literal(2)]),data:E1e}).refine(e=>e.schemaVersion===1||o1e(e.data.type)),s4.extend({data:D1e})]),_Ze=s4.extend({type:c.string().min(1),payload:c.unknown()});var LZe=c.object({data:LQ,idempotencyKey:c.string().min(1).optional(),createdAtMs:c.number().finite()}).strict();var Ai=c.string().trim().min(1).max(400),c4=c.string().url().max(2048),iw=c.string().datetime(),AQ=c.object({provider:c.string().trim().min(1).max(100),channelName:Ai.optional()}).strict(),$1e=c.enum(["in_progress","answered","done","partial","blocked","abandoned"]),EQ=c.object({repository:Ai,number:c.number().int().positive(),title:Ai.optional(),url:c4,state:rw,openedAt:iw.optional(),mergedAt:iw.optional(),closedAt:iw.optional()}).strict(),M1e=c.object({kind:c.enum(["code_change","resource","url"]),label:Ai,url:c4,status:Ai.optional()}).strict(),O1e=c.object({startedAt:iw,lastActivityAt:iw,durationMs:c.number().int().nonnegative(),participants:c.array(c.object({name:Ai,messages:c.number().int().positive()}).strict()),userMessages:c.number().int().nonnegative(),assistantMessages:c.number().int().nonnegative(),toolResults:c.number().int().nonnegative(),events:c.number().int().nonnegative(),turns:c.number().int().positive().optional(),location:AQ.optional(),codeChanges:c.array(EQ)}).strict(),z1e=c.object({schemaVersion:c.literal(1),record:O1e,summary:c.string().trim().min(1).max(600),intent:Ai,outcome:c.object({status:$1e,text:c.string().trim().min(1).max(600)}).strict(),decisions:c.array(c.object({text:Ai,by:Ai.optional(),kind:c.enum(["stated","confirmed","assumed"])}).strict()).max(20),openDecisions:c.array(c.object({text:Ai,owner:Ai.optional()}).strict()).max(20),facts:c.array(Ai).max(30),links:c.array(M1e).max(40),keywords:c.array(c.string().trim().toLowerCase().min(1).max(400)).max(12)}).strict(),U1e=c.object({index:c.number().int().nonnegative(),role:c.enum(["user","assistant","tool","event"]),author:Ai.optional(),text:c.string().min(1),createdAtMs:c.number().int().nonnegative(),turnId:c.string().min(1).optional()}).strict(),j1e=c.object({label:Ai,url:c4,status:Ai.optional()}).strict(),$Ze=c.object({conversationId:c.string().min(1),title:Ai.optional(),visibility:c.enum(["private","public"]),location:AQ.optional(),entries:c.array(U1e),codeChanges:c.array(EQ),resources:c.array(j1e)}).strict();var Om=["image/png","image/jpeg","image/gif","image/webp"];var sw=3145728,u4=3,B1e=c.object({filename:c.string().trim().min(1).max(255),contentType:c.enum(Om),data:c.string().min(4).max(sw*4/3).regex(/^[A-Za-z0-9+/]*={0,2}$/).refine(e=>e.length%4===0)}).strict(),d4=c.object({id:c.string().min(1),filename:c.string().min(1),contentType:c.string().min(1),bytes:c.number().int().nonnegative()}).strict();var F1e=c.object({kind:c.literal("automation"),id:c.string().min(1),title:c.string().min(1).max(160),url:c.string().url().nullable(),instruction:c.string().max(4e3),trigger:c.string().min(1),warning:c.string().nullable()}).strict();function H1e(e){return[e.title,e.warning,e.trigger,e.instruction,e.url,`Automation ID: ${e.id}`].filter(Boolean).join(`
|
|
69
69
|
`)}var MZe=F1e.extend({operation:c.enum(["created","updated","deleted"]).optional()});function f4(e){switch(e.kind){case"object":return[e.title,e.label!==e.title?e.label:void 0,e.description,e.status,...pQ(e.facts).map(t=>`${t.label}: ${t.value}`),e.trigger,e.warning,e.url].filter(Boolean).join(`
|
|
70
|
-
`);case"automation":return H1e(e)}}var V1e=c.object({plugin:c.string().min(1),key:c.string().min(1)}).strict(),q1e=V1e.extend({kind:c.literal("object")});function m4(e,t){return e.map(n=>{let r=t.find(a=>a.kind===n.kind&&a.plugin===n.plugin&&a.key===n.key);return r?G1e(r):{...n,objectType:"item",title:n.key,label:n.key,url:null,warning:"Saved annotation is unavailable."}})}function G1e(e){let{createdAt:t,updatedAt:n,...r}=e;return r.kind==="object"?r:{...r,kind:"object",objectType:r.objectType??"item",title:r.label}}var CT=c.object({auxiliaryCostUsd:c.number().finite().nonnegative().optional(),count:c.number().int().positive(),cumulativeDurationMs:c.number(),cumulativeUsage:l4.optional()}).strict(),Z1e=c.enum(["active","completed","failed"]),W1e=c.enum(["api","internal","scheduler","slack"]),lw=l4,K1e=c.object({conversationId:c.string().min(1)}).strict(),OZe=c.object({attachmentId:c.string().min(1),conversationId:c.string().min(1)}).strict(),J1e=c.object({limit:c.coerce.number().int().min(1).max(1e3).default(500)}).strict(),Q1e=c.object({before:c.string().min(1),limit:c.coerce.number().int().min(1).max(1e3).default(500)}).strict(),Y1e=c.object({actorEmail:c.string().trim().email().transform(e=>e.toLowerCase()).optional(),codeRepositoryId:c.string().uuid().optional(),q:c.string().trim().max(200).optional(),status:c.enum(["active","archived"]).default("active")}).strict(),X1e=c.object({archived:c.boolean(),lastSeenAt:c.string().datetime()}).strict(),p4=c.object({archivedAt:c.string().datetime().nullable()}).strict(),PQ=c.object({idempotencyKey:c.string().trim().min(1).max(200),message:c.string().trim().max(32e3),images:c.array(B1e).max(3).optional()}).strict().refine(e=>!!(e.message||e.images?.length),"Add a message or an image.").refine(e=>(e.images??[]).reduce((t,n)=>t+n.data.length,0)<=sw*4/3,"Images must total 3 MB or less."),eRe=PQ.safeExtend({visibility:c.enum(["private","public"]).optional()}),cw=c.object({conversationId:c.string().min(1),messageId:c.string().min(1),status:c.enum(["accepted","duplicate"])}).strict(),sc=c.object({email:c.string().optional(),fullName:c.string().optional(),slackUserId:c.string().optional(),slackUserName:c.string().optional()}).strict(),DQ=c.enum(["defer","interrupt"]),$Q=c.object({actorIdentity:sc.optional(),createdAt:c.string().datetime(),delivery:DQ,inboundMessageId:c.string().min(1),messageId:c.string().min(1),receivedAt:c.string().datetime(),role:c.literal("user"),source:c.enum(["slack","web"]),text:c.string().optional(),attachments:c.array(d4).optional(),redacted:c.literal(!0).optional()}).strict().superRefine((e,t)=>{e.text===void 0==(e.redacted!==!0)&&t.addIssue({code:"custom",message:"pending message content must be text or explicitly redacted"}),e.redacted&&(e.actorIdentity||e.attachments)&&t.addIssue({code:"custom",message:"redacted pending messages must not expose actor identity or attachments"})}),MQ=c.object({authorizationUrl:c.string().url(),completionText:c.string().min(1),label:c.string().min(1)}).strict(),h4=c.object({authorization:MQ.optional(),conversationId:c.string().min(1),generatedAt:c.string().datetime(),messages:c.array($Q)}).strict(),tRe=c.object({inboundMessageIds:c.array(c.string().min(1)).min(1).optional(),receivedBefore:c.string().datetime().optional()}).strict(),g4=c.object({cancelledCount:c.number().int().nonnegative(),cancelledInboundMessageIds:c.array(c.string().min(1)),conversationId:c.string().min(1)}).strict(),kT=c.object({costUsd:c.number().finite().nonnegative(),operations:c.array(c.object({costUsd:c.number().finite().nonnegative(),events:c.number().int().positive(),name:c.string().min(1),namespace:c.string().min(1)}).strict()).min(1)}).strict(),nRe=c.object({id:c.string().min(1).optional(),kind:c.enum(["scheduled","event"]),label:c.string().min(1).optional(),title:c.string().min(1).optional(),triggerMessageId:c.string().min(1).optional(),triggerLabel:c.string().min(1).optional(),credentialMode:c.enum(["creator","system"]).optional(),credentialUser:c.string().min(1).optional()}).strict().superRefine((e,t)=>{!!e.id!=!!e.label&&t.addIssue({code:"custom",message:"sourceTask id and label must both be set or both omitted"})}),aRe=hQ.and(c.object({plugin:c.string().min(1),createdAt:c.string().datetime(),updatedAt:c.string().datetime()})),OQ=c.object({createdAt:c.string().datetime(),mentions:c.array(sc).optional(),role:c.enum(["assistant","user"]),text:c.string().min(1)}).strict(),By=c.object({displayTitle:c.string(),activityPreview:OQ.optional(),cumulativeDurationMs:c.number(),cumulativeUsage:lw.optional(),auxiliaryCosts:kT.optional(),childAgentTotals:CT.optional(),conversationId:c.string(),isParticipant:c.boolean(),visibility:c.enum(["private","public"]).optional(),status:Z1e,startedAt:c.string(),lastSeenAt:c.string(),lastProgressAt:c.string(),surface:W1e,actorIdentity:sc.optional(),participants:c.array(sc).optional(),archivedAt:c.string().datetime().nullable().optional(),channel:c.string().optional(),channelName:c.string().optional(),channelNameRedacted:c.boolean().optional(),locationId:c.string().optional(),sentryTraceUrl:c.string().optional(),locationUrl:c.string().url().optional(),traceId:c.string().optional(),annotations:c.array(aRe).optional(),sidebarAnnotations:c.array(gQ).optional(),assignedWork:c.boolean().optional(),finishedWorkAt:c.string().datetime().optional(),isPriority:c.boolean().optional(),unfinishedWork:c.boolean().optional()}).strict(),rRe=c.object({eventType:c.string().min(1),label:c.string().min(1).optional(),objectType:zh.optional(),trustedSummary:c.string().min(1).optional()}).strict(),oRe=c.object({type:c.literal("message"),messageId:c.string().min(1),role:c.enum(["assistant","system","user"]),source:c.enum(["slack","web"]).optional(),actorIdentity:sc.optional(),eventType:c.string().min(1).optional(),eventObjectType:zh.optional(),explicitMention:c.boolean().optional(),trustedSummary:c.string().min(1).optional(),events:c.array(rRe).optional(),cards:c.array(q1e).optional(),text:c.string().optional(),attachments:c.array(d4).optional(),redacted:c.literal(!0).optional()}).strict().superRefine((e,t)=>{e.text===void 0==(e.redacted!==!0)&&t.addIssue({code:"custom",message:"message content must be text or explicitly redacted"}),e.redacted&&(e.actorIdentity||e.cards||e.attachments||e.events)&&t.addIssue({code:"custom",message:"redacted messages must not expose actor identity, cards, attachments, or events"})}),iRe=c.object({type:c.literal("message_handled"),messageId:c.string().min(1)}).strict(),sRe=c.object({toolCallId:c.string().min(1),name:c.string().min(1),status:c.enum(["running","completed","error"]),startedAt:c.string().datetime().optional(),startedSeq:c.number().int().nonnegative().optional(),input:c.unknown().optional(),output:c.unknown().optional()}).strict().superRefine((e,t)=>{e.startedAt===void 0!=(e.startedSeq===void 0)&&t.addIssue({code:"custom",message:"tool start sequence and timestamp must be provided together"})}),zQ=c.object({type:c.literal("reasoning"),text:c.string().min(1).optional(),redacted:c.literal(!0).optional()}).strict().superRefine((e,t)=>{e.text===void 0==(e.redacted!==!0)&&t.addIssue({code:"custom",message:"reasoning content must be text or explicitly redacted"})}),lRe=c.object({type:c.literal("tool_call"),toolCallId:c.string().min(1)}).strict(),cRe=c.object({parts:c.array(c.discriminatedUnion("type",[zQ,lRe])).min(1)}).strict(),uRe=c.object({type:c.literal("tool_calls"),calls:c.array(sRe).min(1),assistant:cRe.optional()}).strict().superRefine((e,t)=>{if(!e.assistant)return;let n=new Map;for(let a of e.calls)n.set(a.toolCallId,(n.get(a.toolCallId)??0)+1);let r=new Map;for(let a of e.assistant.parts)a.type==="tool_call"&&r.set(a.toolCallId,(r.get(a.toolCallId)??0)+1);(n.size!==r.size||[...n].some(([a,o])=>r.get(a)!==o))&&t.addIssue({code:"custom",path:["assistant","parts"],message:"assistant tool parts must reference every call exactly once"})}),dRe=c.object({type:c.literal("assistant_message"),parts:c.array(zQ)}).strict(),fRe=c.discriminatedUnion("state",[c.object({type:c.literal("turn_lifecycle"),turnId:c.string().min(1),state:c.enum(["succeeded","no_reply"])}).strict(),c.object({type:c.literal("turn_lifecycle"),turnId:c.string().min(1),state:c.literal("started"),inputMessageIds:c.array(c.string().min(1)).min(1).optional()}).strict(),c.object({type:c.literal("turn_lifecycle"),turnId:c.string().min(1),state:c.literal("failed"),failureCode:ST,failureReason:wT.optional(),eventId:c.string().regex(/^[a-f0-9]{32}$/i).optional(),sentryEventUrl:c.string().url().optional()}).strict()]),mRe=c.object({type:c.literal("turn_routed"),turnId:c.string().min(1),modelProfile:c.string().min(1),modelId:c.string().min(1),costUsd:c.number().finite().nonnegative().optional(),reasoningLevel:c.string().min(1),confidence:c.number().min(0).max(1).optional(),source:c.enum(["configured","inherited","router"])}).strict(),pRe=c.object({type:c.literal("guardian_action_reviewed"),turnId:c.string().min(1),toolCallId:c.string().min(1),toolName:c.string().min(1),decision:c.enum(["allow","ask","deny"]),riskLevel:c.enum(["low","medium","high","critical"]),userAuthorization:c.enum(["high","medium","low","unknown"])}).strict(),hRe=c.object({type:c.literal("turn_context"),turnId:c.string().min(1),pluginName:c.string().min(1),kind:c.string().min(1),version:c.number().int().positive(),content:c.record(c.string(),c.unknown())}).strict(),gRe=c.object({type:c.literal("structured_event"),namespace:c.string().min(1),name:c.string().min(1),version:c.number().int().positive(),turnId:c.string().min(1).optional(),presentation:vQ}).strict(),vRe=c.object({type:c.literal("attachments_delivered"),attachments:c.array(d4).min(1)}).strict(),yRe=c.object({type:c.literal("compaction"),modelProfile:c.string().min(1).optional(),modelId:c.string().min(1).optional(),summary:c.string().min(1).optional(),details:c.object({reason:c.literal("capacity"),estimatedInputTokens:c.number().int().nonnegative(),replacementInputTokens:c.number().int().nonnegative().optional(),triggerTokens:c.number().int().nonnegative(),inputLimitTokens:c.number().int().positive(),inputMessageCount:c.number().int().nonnegative(),retainedMessageCount:c.number().int().nonnegative(),summaryChars:c.number().int().nonnegative()}).strict().optional()}).strict(),bRe=c.object({type:c.literal("handoff"),modelProfile:c.string().min(1),modelId:c.string().min(1),reasoningLevel:c.string().min(1).optional(),triggeringToolCallId:c.string().min(1).optional(),summary:c.string().min(1).optional()}).strict(),xRe=c.object({type:c.literal("subagent"),startedSeq:c.number().int().nonnegative(),startedAt:c.string().datetime(),childConversationId:c.string().min(1),subagentKind:c.string().min(1),agentName:c.string().min(1).optional(),task:c.string().min(1).optional(),title:c.string().min(1).optional(),parentToolCallId:c.string().min(1).optional(),status:c.enum(["running","completed","blocked","error","aborted"])}).strict(),UQ=c.discriminatedUnion("type",[oRe,iRe,dRe,uRe,fRe,hRe,gRe,vRe,mRe,pRe,yRe,bRe,xRe]),v4=c.object({seq:c.number().int().nonnegative(),createdAt:c.string().datetime(),data:UQ,mentions:c.array(sc).optional(),model:c.object({modelId:c.string().min(1),modelProfile:c.string().min(1).optional(),reasoningLevel:c.string().min(1).optional()}).strict().optional(),modelCall:c.object({provider:c.string().min(1).optional(),api:c.string().min(1).optional(),stopReason:c.string().min(1).optional(),usage:lw.optional()}).strict().optional()}).strict(),y4=c.discriminatedUnion("status",[c.object({status:c.literal("available")}).strict(),c.object({status:c.literal("redacted"),reason:c.literal("non_public_conversation")}).strict(),c.object({status:c.literal("expired"),expiredAt:c.string().datetime()}).strict()]),SRe=c.object({modelId:c.string(),usage:lw}).strict();function jQ(e,t){e.eventHistory.status==="expired"&&e.events.length>0&&t.addIssue({code:"custom",path:["events"],message:"expired event history must not contain events"});for(let n=1;n<e.events.length;n+=1)e.events[n].seq<=e.events[n-1].seq&&t.addIssue({code:"custom",path:["events",n,"seq"],message:"report event sequences must be strictly increasing"});for(let[n,r]of e.events.entries())r.data.type==="message"&&(e.eventHistory.status==="redacted"&&r.data.redacted!==!0&&t.addIssue({code:"custom",path:["events",n,"data"],message:"redacted event history must redact messages"}),e.eventHistory.status==="available"&&r.data.redacted===!0&&t.addIssue({code:"custom",path:["events",n,"data"],message:"available event history must expose messages"})),e.eventHistory.status==="redacted"&&r.data.type==="tool_calls"&&r.data.calls.some(a=>a.input!==void 0||a.output!==void 0)&&t.addIssue({code:"custom",path:["events",n,"data"],message:"redacted event history must redact tool payloads"}),e.eventHistory.status==="redacted"&&r.data.type==="assistant_message"&&r.data.parts.some(a=>a.text!==void 0)&&t.addIssue({code:"custom",path:["events",n,"data"],message:"redacted event history must redact assistant messages"}),e.eventHistory.status==="available"&&r.data.type==="assistant_message"&&r.data.parts.some(a=>a.redacted===!0)&&t.addIssue({code:"custom",path:["events",n,"data"],message:"available event history must expose reasoning"}),r.data.type==="tool_calls"&&(e.eventHistory.status==="redacted"&&r.data.assistant?.parts.some(a=>a.type==="reasoning"&&a.text!==void 0)||e.eventHistory.status==="available"&&r.data.assistant?.parts.some(a=>a.type==="reasoning"&&a.redacted===!0))&&t.addIssue({code:"custom",path:["events",n,"data","assistant"],message:"assistant reasoning must match event history visibility"})}var wRe=c.object({messageId:c.string().min(1).max(500),idempotencyKey:c.string().trim().min(1).max(200)}).strict(),b4=c.object({conversationId:c.string()}).strict(),CRe=c.object({conversationId:c.string().min(1),label:c.string().min(1)}).strict(),x4=By.extend({agentTree:c.array(CRe).min(2).optional(),canFork:c.boolean().optional(),forkedFromConversationId:c.string().optional(),forkedFromTitle:c.string().optional(),forks:c.array(c.string()).optional(),brief:c.object({content:z1e,mentions:c.array(sc).optional(),updatedAt:c.string().datetime(),version:c.number().int().positive()}).strict().optional(),modelUsage:c.array(SRe).optional(),events:c.array(v4),eventHistory:y4,previousCursor:c.string().min(1).optional(),generatedAt:c.string(),sentryConversationUrl:c.string().optional(),sourceTask:nRe.optional()}).strict().superRefine(jQ),S4=c.object({events:c.array(v4),eventHistory:y4,previousCursor:c.string().min(1).optional(),generatedAt:c.string()}).strict().superRefine(jQ),RT=c.object({conversations:c.array(By),source:c.literal("conversation_index"),generatedAt:c.string()}).strict();var kRe=c.enum(["current_conversation","task_creator"]).describe("Where to send the message. Use current_conversation for posts, digests, summaries, and channel reminders. Use task_creator only when the user asks for a direct reminder or notification."),RRe=c.object({action:c.literal("send_message"),destination:kRe}).strict(),qQ=c.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Use a local date in YYYY-MM-DD format."),GQ=c.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"Use local time in HH:MM format."),ZQ=c.string().min(1).max(80).describe("IANA timezone the user asked for, for example America/New_York. Omit or use null to use the creator's timezone on create, or to keep the saved timezone on update. Do not guess it from office locations.").nullable().optional(),IRe=c.enum(["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]),TRe=c.object({kind:c.literal("one_off").describe("A schedule that runs once."),timezone:ZQ,timing:c.discriminatedUnion("type",[c.object({type:c.literal("after").describe("Run after a relative delay from the server clock."),value:c.number().int().positive().max(1e5),unit:c.enum(["second","minute","hour","day","week"])}).strict(),c.object({type:c.literal("at").describe("Run at an explicit local calendar date and time."),date:qQ.describe("Requested local calendar date in YYYY-MM-DD format."),time:GQ.describe("Requested local wall-clock time in HH:MM format.")}).strict()]).describe("Relative delay or explicit local time for the one-off run.")}).strict(),NRe=c.object({kind:c.literal("recurring").describe("A repeating calendar schedule."),frequency:c.enum(["daily","weekly","monthly","yearly"]).describe("Recurring tasks can run at most once per day."),interval:c.number().int().positive().max(365).describe("Repeat every N frequency units. Defaults to 1.").nullable().optional(),time:GQ.describe("Local wall-clock time for each occurrence in HH:MM format."),weekdays:c.array(IRe).min(1).max(7).describe("Required for weekly schedules.").nullable().optional(),dayOfMonth:c.number().int().min(1).max(31).describe("Required for monthly and yearly schedules.").nullable().optional(),month:c.number().int().min(1).max(12).describe("Required for yearly schedules, where January is 1.").nullable().optional(),startDate:qQ.describe("Optional local calendar date that anchors the recurrence. Omit to start with the next matching occurrence.").nullable().optional(),timezone:ZQ}).strict().superRefine((e,t)=>{e.frequency==="weekly"&&e.weekdays==null&&t.addIssue({code:"custom",message:"Weekly schedules require weekdays.",path:["weekdays"]}),(e.frequency==="monthly"||e.frequency==="yearly")&&e.dayOfMonth==null&&t.addIssue({code:"custom",message:`${e.frequency} schedules require dayOfMonth.`,path:["dayOfMonth"]}),e.frequency==="yearly"&&e.month==null&&t.addIssue({code:"custom",message:"Yearly schedules require month.",path:["month"]}),e.frequency!=="weekly"&&e.weekdays!=null&&t.addIssue({code:"custom",message:"weekdays applies only to weekly schedules.",path:["weekdays"]}),e.frequency!=="monthly"&&e.frequency!=="yearly"&&e.dayOfMonth!=null&&t.addIssue({code:"custom",message:"dayOfMonth applies only to monthly or yearly schedules.",path:["dayOfMonth"]}),e.frequency!=="yearly"&&e.month!=null&&t.addIssue({code:"custom",message:"month applies only to yearly schedules.",path:["month"]})}),WQ=c.union([TRe,NRe]);var KQ=c.object({slackUserId:xT,fullName:c.string().optional(),userName:c.string().optional()}).strict(),C4=c.object({events:c.array(Qd).min(1),label:c.string().min(1),match:o4.optional(),namespace:c.string().min(1),identifier:c.string().min(1).max(300),resourceType:c.string().min(1)}).strict(),JQ=jy.omit({threadTs:!0}),_Re=ow.extend({destination:JQ}),LRe=c.object({id:c.string().min(1),createdAtMs:c.number().finite(),createdBy:KQ,creatorIdentityId:c.string().min(1),credentialMode:c.enum(["system","creator"]),destination:JQ,destinationVisibility:a4,outcomes:c.array(_Re).max(5),task:c.object({text:c.string().min(1)}).strict(),trigger:C4}).strict(),ARe=c.string().trim().min(1).max(60),QQ=c.string().trim().min(1).max(4e3),WZe=QQ.describe("Work to perform when the Automation runs. It runs later without this conversation, so write it to stand alone: name each person with their Slack mention, such as <@U123>, instead of me, my, or you. Preserve the user's scope, targets, and constraints. Do not add permissions or side effects the user did not request."),YQ=c.object({title:ARe.optional(),instruction:QQ.optional(),credentialMode:c.enum(["system","creator"]).optional(),outcomes:c.array(c.union([RRe,ow])).max(5).optional()}),ERe=YQ.extend({schedule:WQ.optional(),status:c.enum(["active","blocked"]).optional()}).strict(),PRe=YQ.extend({trigger:C4.extend({identifier:c.string().trim().min(1).max(300),label:c.string().trim().min(1).max(500)}).optional()}).strict(),DRe=c.enum(["active","blocked","paused","completed","deleted"]),$Re=c.enum(["system","creator"]),MRe=c.enum(["pending","running","completed","failed","blocked","skipped"]),ORe=c.object({slackUserId:xT,fullName:c.string().optional(),userName:c.string().optional()}).strict(),zRe=c.object({dayOfMonth:c.number().optional(),frequency:c.enum(["daily","weekly","monthly","yearly"]),interval:c.number(),month:c.number().optional(),startDate:c.string(),time:c.object({hour:c.number(),minute:c.number()}).strict(),weekdays:c.array(c.number()).optional()}).strict(),URe=c.object({description:c.string(),kind:c.enum(["one_off","recurring"]),recurrence:zRe.optional(),timezone:c.string()}).strict(),jRe=c.object({platform:c.literal("system"),name:c.string()}).strict(),XQ=jy.omit({threadTs:!0}),BRe=c.object({action:c.literal("send_message"),destination:XQ}).strict(),TT=c.object({id:c.string(),conversationAccess:c.object({audience:c.enum(["direct","group","channel"]),visibility:c.enum(["private","public"])}).strict(),createdAtMs:c.number(),createdBy:ORe,creatorIdentityId:c.string(),credentialMode:$Re,destination:XQ,executionActor:jRe.optional(),lastRunAtMs:c.number().optional(),nextRunAtMs:c.number().optional(),originalRequest:c.string().optional(),runNowAtMs:c.number().optional(),schedule:URe,status:DRe,statusReason:c.string().optional(),outcomes:c.array(BRe).max(5),task:c.object({text:c.string()}).strict(),title:c.string().optional(),updatedAtMs:c.number()}).strict(),KZe=c.object({id:c.string(),attempt:c.number(),claimedAtMs:c.number(),completedAtMs:c.number().optional(),dispatchId:c.string().optional(),errorMessage:c.string().optional(),resultMessageTs:c.string().optional(),scheduledForMs:c.number(),startedAtMs:c.number().optional(),status:MRe,taskId:c.string()}).strict(),JZe=Object.freeze({platform:"system",name:"scheduled-automation"}),FRe=c.object({channelId:c.string().min(1),label:c.string().min(1),teamId:c.string().min(1),visibility:c.enum(["private","public"])}).strict(),eY=c.object({1:c.number().int().nonnegative(),7:c.number().int().nonnegative(),30:c.number().int().nonnegative(),90:c.number().int().nonnegative()}).strict(),tY=c.object({credentialMode:c.enum(["creator","system"]),createdAt:c.string().datetime(),createdBy:c.string().min(1),createdByAvatarUrl:c.string().url().optional(),createdByEmail:c.string().trim().email().optional(),destination:FRe,id:c.string().min(1),instruction:c.string().min(1),mentions:c.array(sc).optional(),lastConversationId:c.string().min(1).optional(),lastRunAt:c.string().datetime().optional(),lastRunStatus:c.enum(["blocked","completed","failed"]).optional(),ownedByViewer:c.boolean(),runs:eY,outcomes:c.array(ow).max(5),title:c.string().min(1),totalRuns:c.number().int().nonnegative()}),nY=tY.extend({kind:c.literal("scheduled"),nextRunAt:c.string().datetime().optional(),schedule:c.string().min(1),timezone:c.string().min(1),statusReason:c.string().optional(),status:c.enum(["active","blocked","paused","completed"])}).strict(),aY=tY.extend({events:c.array(c.string().min(1)).min(1),match:o4.optional(),kind:c.literal("event"),resource:c.string().min(1),source:c.string().min(1),triggerAvailable:c.boolean(),statusReason:c.string().optional(),status:c.enum(["active","blocked","paused"])}).strict(),dw=c.discriminatedUnion("kind",[nY,aY]),rY=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),w4=c.object({costUsd:c.number().finite().nonnegative(),date:rY,event:c.number().int().nonnegative(),scheduled:c.number().int().nonnegative()}).strict(),NT=c.object({q:c.string().trim().max(200).optional(),scope:c.enum(["all","mine","public","attention"]).default("all"),type:c.enum(["all","scheduled","event"]).default("all"),state:c.enum(["all","active","blocked","paused","completed","unavailable"]).default("all"),creator:c.string().max(300).optional(),destination:c.string().max(300).optional(),sort:c.enum(["newest","oldest","title"]).default("newest"),page:c.coerce.number().int().min(1).max(1e6).default(1),pageSize:c.coerce.number().int().min(1).max(100).default(25)}).strict(),BQ=c.object({value:c.string(),label:c.string()}).strict(),k4=c.object({executionDays:c.array(w4),executionHours:c.array(w4).optional(),executionSixHours:c.array(w4).optional(),automations:c.array(dw),total:c.number().int().nonnegative(),page:c.number().int().positive(),pageSize:c.number().int().positive(),counts:c.object({all:c.number().int().nonnegative(),mine:c.number().int().nonnegative(),public:c.number().int().nonnegative(),private:c.number().int().nonnegative()}).strict(),creators:c.array(BQ),destinations:c.array(BQ)}).strict(),oY=c.object({id:c.string().min(1)}).strict(),iY=c.enum(["blocked","completed","failed"]),R4=c.object({conversationId:c.string().min(1).optional(),costUsd:c.number().finite().nonnegative().optional(),durationMs:c.number().finite().nonnegative().optional(),executedAt:c.string().datetime(),executionId:c.string().min(1),status:iY,title:c.string().min(1).optional(),totalTokens:c.number().int().nonnegative().optional()}).strict(),IT=c.object({blocked:c.number().int().nonnegative(),completed:c.number().int().nonnegative(),date:rY,failed:c.number().int().nonnegative()}).strict(),I4=c.object({executionDays:c.array(IT),executionHours:c.array(IT).optional(),executionSixHours:c.array(IT).optional(),executions:c.array(R4),automation:dw,truncated:c.boolean()}).strict(),sY=R4.extend({kind:c.enum(["scheduled","event"]),automationId:c.string().min(1),automationTitle:c.string().min(1)}).strict(),T4=c.object({runs:c.array(sY),truncated:c.boolean()}).strict(),FQ={title:c.string().nullable(),instruction:c.string()},HQ={version:c.number().int().positive(),createdAt:c.string().datetime(),editedBy:KQ.nullable()},lY=c.discriminatedUnion("kind",[c.object({...HQ,kind:c.literal("scheduled"),definition:TT.pick({credentialMode:!0,destination:!0,outcomes:!0,schedule:!0}).extend(FQ).strict()}).strict(),c.object({...HQ,kind:c.literal("event"),definition:LRe.pick({credentialMode:!0,destination:!0,outcomes:!0,trigger:!0}).extend(FQ).strict()}).strict()]),N4=c.object({versions:c.array(lY),activeVersion:c.number().int().positive().nullable(),truncated:c.boolean()}).strict(),HRe=oY.extend({version:c.coerce.number().int().positive()}).strict(),uw=c.string().regex(/^[a-f0-9]{64}$/),VRe=c.object({revision:uw}).strict(),QZe=c.object({action:c.enum(["pause","resume"]),revision:uw}).strict(),VQ=TT.pick({destination:!0,createdBy:!0}).extend({id:c.string().min(1),revision:uw,title:c.string().nullable(),instruction:c.string(),credentialMode:c.enum(["system","creator"]),outcomes:c.array(ow).max(5),ownedByViewer:c.boolean()}),lc=c.discriminatedUnion("kind",[VQ.merge(TT.pick({schedule:!0})).extend({kind:c.literal("scheduled"),nextRunAtMs:c.number().optional(),status:c.enum(["active","blocked","paused","completed"])}).strict(),VQ.extend({kind:c.literal("event"),trigger:C4,triggerAvailable:c.boolean(),status:c.enum(["active","blocked","paused"])}).strict()]),_4=c.discriminatedUnion("kind",[ERe.omit({status:!0}).extend({kind:c.literal("scheduled"),revision:uw}).strict(),PRe.extend({kind:c.literal("event"),revision:uw}).strict()]),qRe=c.object({error:c.string(),code:c.enum(["invalid_edit","conflict","not_found"]),fields:c.record(c.string(),c.array(c.string())).optional()}).strict(),L4=c.array(i4.safeExtend({namespace:c.string()})),A4=WQ,E4=TT.pick({schedule:!0}).extend({nextRunAtMs:c.number()}).strict();var GRe=c.object({status:c.literal("ok"),service:c.string(),timestamp:c.string()}).strict(),cY=c.object({configKeys:c.array(c.string()),description:c.string(),displayName:c.string(),name:c.string()}).strict(),P4=c.array(cY),D4=c.object({name:c.string(),pluginProvider:c.string().optional()}).strict(),$4=c.array(D4),uY=c.object({dir:c.string(),hasMigrationsDir:c.boolean(),hasSkillsDir:c.boolean(),packageName:c.string()}).strict(),dY=c.object({packageNames:c.array(c.string()),packages:c.array(uY),manifestRoots:c.array(c.string()),skillRoots:c.array(c.string()),tracingIncludes:c.array(c.string())}).strict(),ZRe=c.object({cwd:c.string(),homeDir:c.string(),descriptionText:c.string().optional(),providers:c.array(c.string()),skills:c.array(D4),packagedContent:dY}).strict(),M4=c.enum(["danger","good","neutral","warning"]),WRe=c.object({label:c.string(),tone:M4.optional(),value:c.string()}).strict(),KRe=c.object({key:c.string(),label:c.string()}).strict(),JRe=c.object({id:c.string(),tone:M4.optional(),values:c.record(c.string(),c.string())}).strict(),QRe=c.object({fields:c.array(KRe).optional(),emptyText:c.string().optional(),records:c.array(JRe).optional(),title:c.string()}).strict(),YRe=c.object({categories:c.array(c.object({id:c.string().min(1),label:c.string().min(1),values:c.record(c.string(),c.number().finite())}).strict()).max(100),description:c.string().optional(),emptyText:c.string().optional(),id:c.string().min(1),series:c.array(c.object({format:c.literal("usd").optional(),key:c.string().min(1),label:c.string().min(1),tone:M4.optional()}).strict()).min(1).max(8),timeRangeDays:c.array(c.union([c.literal(1),c.literal(7),c.literal(30),c.literal(90)])).min(1).max(4).optional(),title:c.string().min(1),type:c.literal("bar_chart")}).strict(),fY=c.object({generatedAt:c.string().optional(),metrics:c.array(WRe).optional(),recordSets:c.array(QRe).optional(),title:c.string().optional(),pluginName:c.string(),widgets:c.array(YRe).max(12).optional()}).strict(),_T=c.object({generatedAt:c.string(),reports:c.array(fY),source:c.literal("plugins")}).strict(),mY=36e5,eWe=6*mY,tWe=24*mY;async function O4(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${e.conversationId}\0${e.idempotencyKey}`));return`api-msg:${Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("").slice(0,24)}`}var j=Symbol.for("drizzle:entityKind");function lo(e,t){if(!e||typeof e!="object")return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,j))throw new Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(j in n&&n[j]===t[j])return!0;n=Object.getPrototypeOf(n)}return!1}var Uh=class{constructor(t,n){this.table=t,this.config=n,this.name=n.name,this.keyAsName=n.keyAsName,this.notNull=n.notNull,this.default=n.default,this.defaultFn=n.defaultFn,this.onUpdateFn=n.onUpdateFn,this.hasDefault=n.hasDefault,this.primary=n.primaryKey,this.isUnique=n.isUnique,this.uniqueName=n.uniqueName,this.uniqueType=n.uniqueType,this.dataType=n.dataType,this.columnType=n.columnType,this.generated=n.generated,this.generatedIdentity=n.generatedIdentity}static[j]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(t){return t}mapToDriverValue(t){return t}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}};var LT=class{static[j]="ColumnBuilder";config;constructor(t,n,r){this.config={name:t,keyAsName:t==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:n,columnType:r,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(t){return this.config.default=t,this.config.hasDefault=!0,this}$defaultFn(t){return this.config.defaultFn=t,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(t){return this.config.onUpdateFn=t,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(t){this.config.name===""&&(this.config.name=t)}};var Yd=Symbol.for("drizzle:Name");var AT=class{static[j]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(t,n){this.reference=()=>{let{name:r,columns:a,foreignColumns:o}=t();return{name:r,columns:a,foreignTable:o[0].table,foreignColumns:o}},n&&(this._onUpdate=n.onUpdate,this._onDelete=n.onDelete)}onUpdate(t){return this._onUpdate=t===void 0?"no action":t,this}onDelete(t){return this._onDelete=t===void 0?"no action":t,this}build(t){return new z4(t,this)}},z4=class{constructor(t,n){this.table=t,this.reference=n.reference,this.onUpdate=n._onUpdate,this.onDelete=n._onDelete}static[j]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:t,columns:n,foreignColumns:r}=this.reference(),a=n.map(s=>s.name),o=r.map(s=>s.name),i=[this.table[Yd],...a,r[0].table[Yd],...o];return t??`${i.join("_")}_fk`}};function ET(e,...t){return e(...t)}function B4(e,t){return`${e[Yd]}_${t.join("_")}_unique`}var U4=class{constructor(t,n){this.name=n,this.columns=t}static[j]="PgUniqueConstraintBuilder";columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(t){return new j4(t,this.columns,this.nullsNotDistinctConfig,this.name)}},pY=class{static[j]="PgUniqueOnConstraintBuilder";name;constructor(t){this.name=t}on(...t){return new U4(t,this.name)}},j4=class{constructor(t,n,r,a){this.table=t,this.columns=n,this.name=a??B4(this.table,this.columns.map(o=>o.name)),this.nullsNotDistinct=r}static[j]="PgUniqueConstraint";columns;name;nullsNotDistinct=!1;getName(){return this.name}};function hY(e,t,n){for(let r=t;r<e.length;r++){let a=e[r];if(a==="\\"){r++;continue}if(a==='"')return[e.slice(t,r).replace(/\\/g,""),r+1];if(!n&&(a===","||a==="}"))return[e.slice(t,r).replace(/\\/g,""),r]}return[e.slice(t).replace(/\\/g,""),e.length]}function gY(e,t=0){let n=[],r=t,a=!1;for(;r<e.length;){let o=e[r];if(o===","){(a||r===t)&&n.push(""),a=!0,r++;continue}if(a=!1,o==="\\"){r+=2;continue}if(o==='"'){let[l,u]=hY(e,r+1,!0);n.push(l),r=u;continue}if(o==="}")return[n,r+1];if(o==="{"){let[l,u]=gY(e,r+1);n.push(l),r=u;continue}let[i,s]=hY(e,r,!1);n.push(i),r=s}return[n,r]}function vY(e){let[t]=gY(e,1);return t}function F4(e){return`{${e.map(t=>Array.isArray(t)?F4(t):typeof t=="string"?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}var Ee=class extends LT{foreignKeyConfigs=[];static[j]="PgColumnBuilder";array(t){return new V4(this.config.name,this,t)}references(t,n={}){return this.foreignKeyConfigs.push({ref:t,actions:n}),this}unique(t,n){return this.config.isUnique=!0,this.config.uniqueName=t,this.config.uniqueType=n?.nulls,this}generatedAlwaysAs(t){return this.config.generated={as:t,type:"always",mode:"stored"},this}buildForeignKeys(t,n){return this.foreignKeyConfigs.map(({ref:r,actions:a})=>ET((o,i)=>{let s=new AT(()=>{let l=o();return{columns:[t],foreignColumns:[l]}});return i.onUpdate&&s.onUpdate(i.onUpdate),i.onDelete&&s.onDelete(i.onDelete),s.build(n)},r,a))}buildExtraConfigColumn(t){return new H4(t,this.config)}},be=class extends Uh{constructor(t,n){n.uniqueName||(n.uniqueName=B4(t,[n.name])),super(t,n),this.table=t}static[j]="PgColumn"},H4=class extends be{static[j]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(t){return this.indexConfig.opClass=t,this}},Fy=class{static[j]="IndexedColumn";constructor(t,n,r,a){this.name=t,this.keyAsName=n,this.type=r,this.indexConfig=a}name;keyAsName;type;indexConfig},V4=class extends Ee{static[j]="PgArrayBuilder";constructor(t,n,r){super(t,"array","PgArray"),this.config.baseBuilder=n,this.config.size=r}build(t){let n=this.config.baseBuilder.build(t);return new q4(t,this.config,n)}},q4=class e extends be{constructor(t,n,r,a){super(t,n),this.baseColumn=r,this.range=a,this.size=n.size}size;static[j]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(t){return typeof t=="string"&&(t=vY(t)),t.map(n=>this.baseColumn.mapFromDriverValue(n))}mapToDriverValue(t,n=!1){let r=t.map(a=>a===null?null:lo(this.baseColumn,e)?this.baseColumn.mapToDriverValue(a,!0):this.baseColumn.mapToDriverValue(a));return n?r:F4(r)}};var yY=class extends Ee{static[j]="PgEnumObjectColumnBuilder";constructor(t,n){super(t,"string","PgEnumObjectColumn"),this.config.enum=n}build(t){return new G4(t,this.config)}},G4=class extends be{static[j]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(t,n){super(t,n),this.enum=n.enum}getSQLType(){return this.enum.enumName}},bY=Symbol.for("drizzle:isPgEnum");function SY(e){return!!e&&typeof e=="function"&&bY in e&&e[bY]===!0}var xY=class extends Ee{static[j]="PgEnumColumnBuilder";constructor(t,n){super(t,"string","PgEnumColumn"),this.config.enum=n}build(t){return new Z4(t,this.config)}},Z4=class extends be{static[j]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(t,n){super(t,n),this.enum=n.enum}getSQLType(){return this.enum.enumName}};var Hy=class{static[j]="Subquery";constructor(t,n,r,a=!1,o=[]){this._={brand:"Subquery",sql:t,selectedFields:n,alias:r,isWith:a,usedTables:o}}},wY=class extends Hy{static[j]="WithSubquery"};var CY="0.45.2";var W4,K4,kY={startActiveSpan(e,t){return W4?(K4||(K4=W4.trace.getTracer("drizzle-orm",CY)),ET((n,r)=>r.startActiveSpan(e,a=>{try{return t(a)}catch(o){throw a.setStatus({code:n.SpanStatusCode.ERROR,message:o instanceof Error?o.message:"Unknown error"}),o}finally{a.end()}}),W4,K4)):t()}};var Vy=Symbol.for("drizzle:ViewBaseConfig");var J4=Symbol.for("drizzle:Schema"),RY=Symbol.for("drizzle:Columns"),IY=Symbol.for("drizzle:ExtraConfigColumns"),Q4=Symbol.for("drizzle:OriginalName"),Y4=Symbol.for("drizzle:BaseName"),fw=Symbol.for("drizzle:IsAlias"),TY=Symbol.for("drizzle:ExtraConfigBuilder"),XRe=Symbol.for("drizzle:IsDrizzleTable"),Fr=class{static[j]="Table";static Symbol={Name:Yd,Schema:J4,OriginalName:Q4,Columns:RY,ExtraConfigColumns:IY,BaseName:Y4,IsAlias:fw,ExtraConfigBuilder:TY};[Yd];[Q4];[J4];[RY];[IY];[Y4];[fw]=!1;[XRe]=!0;[TY]=void 0;constructor(t,n,r){this[Yd]=this[Q4]=t,this[J4]=n,this[Y4]=r}};var NY=class{static[j]="FakePrimitiveParam"};function eIe(e){return e!=null&&typeof e.getSQL=="function"}function tIe(e){let t={sql:"",params:[]};for(let n of e)t.sql+=n.sql,t.params.push(...n.params),n.typings?.length&&(t.typings||(t.typings=[]),t.typings.push(...n.typings));return t}var Tl=class{static[j]="StringChunk";value;constructor(t){this.value=Array.isArray(t)?t:[t]}getSQL(){return new Hr([this])}},Hr=class e{constructor(t){this.queryChunks=t;for(let n of t)if(lo(n,Fr)){let r=n[Fr.Symbol.Schema];this.usedTables.push(r===void 0?n[Fr.Symbol.Name]:r+"."+n[Fr.Symbol.Name])}}static[j]="SQL";decoder=_Y;shouldInlineParams=!1;usedTables=[];append(t){return this.queryChunks.push(...t.queryChunks),this}toQuery(t){return kY.startActiveSpan("drizzle.buildSQL",n=>{let r=this.buildQueryFromSourceParams(this.queryChunks,t);return n?.setAttributes({"drizzle.query.text":r.sql,"drizzle.query.params":JSON.stringify(r.params)}),r})}buildQueryFromSourceParams(t,n){let r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:a,escapeName:o,escapeParam:i,prepareTyping:s,inlineParams:l,paramStartIndex:u}=r;return tIe(t.map(d=>{if(lo(d,Tl))return{sql:d.value.join(""),params:[]};if(lo(d,mw))return{sql:o(d.value),params:[]};if(d===void 0)return{sql:"",params:[]};if(Array.isArray(d)){let f=[new Tl("(")];for(let[m,h]of d.entries())f.push(h),m<d.length-1&&f.push(new Tl(", "));return f.push(new Tl(")")),this.buildQueryFromSourceParams(f,r)}if(lo(d,e))return this.buildQueryFromSourceParams(d.queryChunks,{...r,inlineParams:l||d.shouldInlineParams});if(lo(d,Fr)){let f=d[Fr.Symbol.Schema],m=d[Fr.Symbol.Name];return{sql:f===void 0||d[fw]?o(m):o(f)+"."+o(m),params:[]}}if(lo(d,Uh)){let f=a.getColumnCasing(d);if(n.invokeSource==="indexes")return{sql:o(f),params:[]};let m=d.table[Fr.Symbol.Schema];return{sql:d.table[fw]||m===void 0?o(d.table[Fr.Symbol.Name])+"."+o(f):o(m)+"."+o(d.table[Fr.Symbol.Name])+"."+o(f),params:[]}}if(lo(d,X4)){let f=d[Vy].schema,m=d[Vy].name;return{sql:f===void 0||d[Vy].isAlias?o(m):o(f)+"."+o(m),params:[]}}if(lo(d,PT)){if(lo(d.value,pw))return{sql:i(u.value++,d),params:[d],typings:["none"]};let f=d.value===null?null:d.encoder.mapToDriverValue(d.value);if(lo(f,e))return this.buildQueryFromSourceParams([f],r);if(l)return{sql:this.mapInlineParam(f,r),params:[]};let m=["none"];return s&&(m=[s(d.encoder)]),{sql:i(u.value++,f),params:[f],typings:m}}return lo(d,pw)?{sql:i(u.value++,d),params:[d],typings:["none"]}:lo(d,e.Aliased)&&d.fieldAlias!==void 0?{sql:o(d.fieldAlias),params:[]}:lo(d,Hy)?d._.isWith?{sql:o(d._.alias),params:[]}:this.buildQueryFromSourceParams([new Tl("("),d._.sql,new Tl(") "),new mw(d._.alias)],r):SY(d)?d.schema?{sql:o(d.schema)+"."+o(d.enumName),params:[]}:{sql:o(d.enumName),params:[]}:eIe(d)?d.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([d.getSQL()],r):this.buildQueryFromSourceParams([new Tl("("),d.getSQL(),new Tl(")")],r):l?{sql:this.mapInlineParam(d,r),params:[]}:{sql:i(u.value++,d),params:[d],typings:["none"]}}))}mapInlineParam(t,{escapeString:n}){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return t.toString();if(typeof t=="string")return n(t);if(typeof t=="object"){let r=t.toString();return n(r==="[object Object]"?JSON.stringify(t):r)}throw new Error("Unexpected param value: "+t)}getSQL(){return this}as(t){return t===void 0?this:new e.Aliased(this,t)}mapWith(t){return this.decoder=typeof t=="function"?{mapFromDriverValue:t}:t,this}inlineParams(){return this.shouldInlineParams=!0,this}if(t){return t?this:void 0}},mw=class{constructor(t){this.value=t}static[j]="Name";brand;getSQL(){return new Hr([this])}};var _Y={mapFromDriverValue:e=>e},LY={mapToDriverValue:e=>e},qWe={..._Y,...LY},PT=class{constructor(t,n=LY){this.value=t,this.encoder=n}static[j]="Param";brand;getSQL(){return new Hr([this])}};function Uu(e,...t){let n=[];(t.length>0||e.length>0&&e[0]!=="")&&n.push(new Tl(e[0]));for(let[r,a]of t.entries())n.push(a,new Tl(e[r+1]));return new Hr(n)}(e=>{function t(){return new Hr([])}e.empty=t;function n(l){return new Hr(l)}e.fromList=n;function r(l){return new Hr([new Tl(l)])}e.raw=r;function a(l,u){let d=[];for(let[f,m]of l.entries())f>0&&u!==void 0&&d.push(u),d.push(m);return new Hr(d)}e.join=a;function o(l){return new mw(l)}e.identifier=o;function i(l){return new pw(l)}e.placeholder=i;function s(l,u){return new PT(l,u)}e.param=s})(Uu||(Uu={}));(e=>{class t{constructor(r,a){this.sql=r,this.fieldAlias=a}static[j]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(Hr||(Hr={}));var pw=class{constructor(t){this.name=t}static[j]="Placeholder";getSQL(){return new Hr([this])}};var nIe=Symbol.for("drizzle:IsDrizzleView"),X4=class{static[j]="View";[Vy];[nIe]=!0;constructor({name:t,schema:n,selectedFields:r,query:a}){this[Vy]={name:t,originalName:t,schema:n,selectedFields:r,query:a,isExisting:!a,isAlias:!1}}getSQL(){return new Hr([this])}};Uh.prototype.getSQL=function(){return new Hr([this])};Fr.prototype.getSQL=function(){return new Hr([this])};Hy.prototype.getSQL=function(){return new Hr([this])};function Rn(e,t){return{name:typeof e=="string"&&e.length>0?e:"",config:typeof e=="object"?e:t}}var ZWe=typeof TextDecoder>"u"?null:new TextDecoder;var Xd=class extends Ee{static[j]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(t){if(t){let{name:n,...r}=t;this.config.generatedIdentity={type:"always",sequenceName:n,sequenceOptions:r}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(t){if(t){let{name:n,...r}=t;this.config.generatedIdentity={type:"byDefault",sequenceName:n,sequenceOptions:r}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}};var e5=class extends Xd{static[j]="PgBigInt53Builder";constructor(t){super(t,"number","PgBigInt53")}build(t){return new t5(t,this.config)}},t5=class extends be{static[j]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}},n5=class extends Xd{static[j]="PgBigInt64Builder";constructor(t){super(t,"bigint","PgBigInt64")}build(t){return new a5(t,this.config)}},a5=class extends be{static[j]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(t){return BigInt(t)}};function AY(e,t){let{name:n,config:r}=Rn(e,t);return r.mode==="number"?new e5(n):new n5(n)}var r5=class extends Ee{static[j]="PgBigSerial53Builder";constructor(t){super(t,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new o5(t,this.config)}},o5=class extends be{static[j]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}},i5=class extends Ee{static[j]="PgBigSerial64Builder";constructor(t){super(t,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(t){return new s5(t,this.config)}},s5=class extends be{static[j]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(t){return BigInt(t)}};function EY(e,t){let{name:n,config:r}=Rn(e,t);return r.mode==="number"?new r5(n):new i5(n)}var l5=class extends Ee{static[j]="PgBooleanBuilder";constructor(t){super(t,"boolean","PgBoolean")}build(t){return new c5(t,this.config)}},c5=class extends be{static[j]="PgBoolean";getSQLType(){return"boolean"}};function hw(e){return new l5(e??"")}var u5=class extends Ee{static[j]="PgCharBuilder";constructor(t,n){super(t,"string","PgChar"),this.config.length=n.length,this.config.enumValues=n.enum}build(t){return new d5(t,this.config)}},d5=class extends be{static[j]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}};function PY(e,t={}){let{name:n,config:r}=Rn(e,t);return new u5(n,r)}var f5=class extends Ee{static[j]="PgCidrBuilder";constructor(t){super(t,"string","PgCidr")}build(t){return new m5(t,this.config)}},m5=class extends be{static[j]="PgCidr";getSQLType(){return"cidr"}};function DY(e){return new f5(e??"")}var p5=class extends Ee{static[j]="PgCustomColumnBuilder";constructor(t,n,r){super(t,"custom","PgCustomColumn"),this.config.fieldConfig=n,this.config.customTypeParams=r}build(t){return new h5(t,this.config)}},h5=class extends be{static[j]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(t,n){super(t,n),this.sqlName=n.customTypeParams.dataType(n.fieldConfig),this.mapTo=n.customTypeParams.toDriver,this.mapFrom=n.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(t){return typeof this.mapFrom=="function"?this.mapFrom(t):t}mapToDriverValue(t){return typeof this.mapTo=="function"?this.mapTo(t):t}};function $Y(e){return(t,n)=>{let{name:r,config:a}=Rn(t,n);return new p5(r,a,e)}}var ju=class extends Ee{static[j]="PgDateColumnBaseBuilder";defaultNow(){return this.default(Uu`now()`)}};var g5=class extends ju{static[j]="PgDateBuilder";constructor(t){super(t,"date","PgDate")}build(t){return new v5(t,this.config)}},v5=class extends be{static[j]="PgDate";getSQLType(){return"date"}mapFromDriverValue(t){return typeof t=="string"?new Date(t):t}mapToDriverValue(t){return t.toISOString()}},y5=class extends ju{static[j]="PgDateStringBuilder";constructor(t){super(t,"string","PgDateString")}build(t){return new b5(t,this.config)}},b5=class extends be{static[j]="PgDateString";getSQLType(){return"date"}mapFromDriverValue(t){return typeof t=="string"?t:t.toISOString().slice(0,-14)}};function MY(e,t){let{name:n,config:r}=Rn(e,t);return r?.mode==="date"?new g5(n):new y5(n)}var x5=class extends Ee{static[j]="PgDoublePrecisionBuilder";constructor(t){super(t,"number","PgDoublePrecision")}build(t){return new S5(t,this.config)}},S5=class extends be{static[j]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(t){return typeof t=="string"?Number.parseFloat(t):t}};function OY(e){return new x5(e??"")}var w5=class extends Ee{static[j]="PgInetBuilder";constructor(t){super(t,"string","PgInet")}build(t){return new C5(t,this.config)}},C5=class extends be{static[j]="PgInet";getSQLType(){return"inet"}};function zY(e){return new w5(e??"")}var k5=class extends Xd{static[j]="PgIntegerBuilder";constructor(t){super(t,"number","PgInteger")}build(t){return new R5(t,this.config)}},R5=class extends be{static[j]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(t){return typeof t=="string"?Number.parseInt(t):t}};function qy(e){return new k5(e??"")}var I5=class extends Ee{static[j]="PgIntervalBuilder";constructor(t,n){super(t,"string","PgInterval"),this.config.intervalConfig=n}build(t){return new T5(t,this.config)}},T5=class extends be{static[j]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let t=this.fields?` ${this.fields}`:"",n=this.precision?`(${this.precision})`:"";return`interval${t}${n}`}};function UY(e,t={}){let{name:n,config:r}=Rn(e,t);return new I5(n,r)}var N5=class extends Ee{static[j]="PgJsonBuilder";constructor(t){super(t,"json","PgJson")}build(t){return new _5(t,this.config)}},_5=class extends be{static[j]="PgJson";constructor(t,n){super(t,n)}getSQLType(){return"json"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}};function jY(e){return new N5(e??"")}var L5=class extends Ee{static[j]="PgJsonbBuilder";constructor(t){super(t,"json","PgJsonb")}build(t){return new A5(t,this.config)}},A5=class extends be{static[j]="PgJsonb";constructor(t,n){super(t,n)}getSQLType(){return"jsonb"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}};function as(e){return new L5(e??"")}var E5=class extends Ee{static[j]="PgLineBuilder";constructor(t){super(t,"array","PgLine")}build(t){return new P5(t,this.config)}},P5=class extends be{static[j]="PgLine";getSQLType(){return"line"}mapFromDriverValue(t){let[n,r,a]=t.slice(1,-1).split(",");return[Number.parseFloat(n),Number.parseFloat(r),Number.parseFloat(a)]}mapToDriverValue(t){return`{${t[0]},${t[1]},${t[2]}}`}},D5=class extends Ee{static[j]="PgLineABCBuilder";constructor(t){super(t,"json","PgLineABC")}build(t){return new $5(t,this.config)}},$5=class extends be{static[j]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(t){let[n,r,a]=t.slice(1,-1).split(",");return{a:Number.parseFloat(n),b:Number.parseFloat(r),c:Number.parseFloat(a)}}mapToDriverValue(t){return`{${t.a},${t.b},${t.c}}`}};function BY(e,t){let{name:n,config:r}=Rn(e,t);return!r?.mode||r.mode==="tuple"?new E5(n):new D5(n)}var M5=class extends Ee{static[j]="PgMacaddrBuilder";constructor(t){super(t,"string","PgMacaddr")}build(t){return new O5(t,this.config)}},O5=class extends be{static[j]="PgMacaddr";getSQLType(){return"macaddr"}};function FY(e){return new M5(e??"")}var z5=class extends Ee{static[j]="PgMacaddr8Builder";constructor(t){super(t,"string","PgMacaddr8")}build(t){return new U5(t,this.config)}},U5=class extends be{static[j]="PgMacaddr8";getSQLType(){return"macaddr8"}};function HY(e){return new z5(e??"")}var j5=class extends Ee{static[j]="PgNumericBuilder";constructor(t,n,r){super(t,"string","PgNumeric"),this.config.precision=n,this.config.scale=r}build(t){return new B5(t,this.config)}},B5=class extends be{static[j]="PgNumeric";precision;scale;constructor(t,n){super(t,n),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(t){return typeof t=="string"?t:String(t)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}},F5=class extends Ee{static[j]="PgNumericNumberBuilder";constructor(t,n,r){super(t,"number","PgNumericNumber"),this.config.precision=n,this.config.scale=r}build(t){return new H5(t,this.config)}},H5=class extends be{static[j]="PgNumericNumber";precision;scale;constructor(t,n){super(t,n),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}},V5=class extends Ee{static[j]="PgNumericBigIntBuilder";constructor(t,n,r){super(t,"bigint","PgNumericBigInt"),this.config.precision=n,this.config.scale=r}build(t){return new q5(t,this.config)}},q5=class extends be{static[j]="PgNumericBigInt";precision;scale;constructor(t,n){super(t,n),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}};function VY(e,t){let{name:n,config:r}=Rn(e,t),a=r?.mode;return a==="number"?new F5(n,r?.precision,r?.scale):a==="bigint"?new V5(n,r?.precision,r?.scale):new j5(n,r?.precision,r?.scale)}var G5=class extends Ee{static[j]="PgPointTupleBuilder";constructor(t){super(t,"array","PgPointTuple")}build(t){return new Z5(t,this.config)}},Z5=class extends be{static[j]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){let[n,r]=t.slice(1,-1).split(",");return[Number.parseFloat(n),Number.parseFloat(r)]}return[t.x,t.y]}mapToDriverValue(t){return`(${t[0]},${t[1]})`}},W5=class extends Ee{static[j]="PgPointObjectBuilder";constructor(t){super(t,"json","PgPointObject")}build(t){return new K5(t,this.config)}},K5=class extends be{static[j]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){let[n,r]=t.slice(1,-1).split(",");return{x:Number.parseFloat(n),y:Number.parseFloat(r)}}return t}mapToDriverValue(t){return`(${t.x},${t.y})`}};function qY(e,t){let{name:n,config:r}=Rn(e,t);return!r?.mode||r.mode==="tuple"?new G5(n):new W5(n)}function aIe(e){let t=[];for(let n=0;n<e.length;n+=2)t.push(Number.parseInt(e.slice(n,n+2),16));return new Uint8Array(t)}function GY(e,t){let n=new ArrayBuffer(8),r=new DataView(n);for(let a=0;a<8;a++)r.setUint8(a,e[t+a]);return r.getFloat64(0,!0)}function J5(e){let t=aIe(e),n=0,r=t[n];n+=1;let a=new DataView(t.buffer),o=a.getUint32(n,r===1);n+=4;let i;if(o&536870912&&(i=a.getUint32(n,r===1),n+=4),(o&65535)===1){let s=GY(t,n);n+=8;let l=GY(t,n);return n+=8,[s,l]}throw new Error("Unsupported geometry type")}var Q5=class extends Ee{static[j]="PgGeometryBuilder";constructor(t){super(t,"array","PgGeometry")}build(t){return new Y5(t,this.config)}},Y5=class extends be{static[j]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(t){return J5(t)}mapToDriverValue(t){return`point(${t[0]} ${t[1]})`}},X5=class extends Ee{static[j]="PgGeometryObjectBuilder";constructor(t){super(t,"json","PgGeometryObject")}build(t){return new e3(t,this.config)}},e3=class extends be{static[j]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(t){let n=J5(t);return{x:n[0],y:n[1]}}mapToDriverValue(t){return`point(${t.x} ${t.y})`}};function ZY(e,t){let{name:n,config:r}=Rn(e,t);return!r?.mode||r.mode==="tuple"?new Q5(n):new X5(n)}var t3=class extends Ee{static[j]="PgRealBuilder";constructor(t,n){super(t,"number","PgReal"),this.config.length=n}build(t){return new n3(t,this.config)}},n3=class extends be{static[j]="PgReal";constructor(t,n){super(t,n)}getSQLType(){return"real"}mapFromDriverValue=t=>typeof t=="string"?Number.parseFloat(t):t};function WY(e){return new t3(e??"")}var a3=class extends Ee{static[j]="PgSerialBuilder";constructor(t){super(t,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new r3(t,this.config)}},r3=class extends be{static[j]="PgSerial";getSQLType(){return"serial"}};function KY(e){return new a3(e??"")}var o3=class extends Xd{static[j]="PgSmallIntBuilder";constructor(t){super(t,"number","PgSmallInt")}build(t){return new i3(t,this.config)}},i3=class extends be{static[j]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=t=>typeof t=="string"?Number(t):t};function JY(e){return new o3(e??"")}var s3=class extends Ee{static[j]="PgSmallSerialBuilder";constructor(t){super(t,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new l3(t,this.config)}},l3=class extends be{static[j]="PgSmallSerial";getSQLType(){return"smallserial"}};function QY(e){return new s3(e??"")}var c3=class extends Ee{static[j]="PgTextBuilder";constructor(t,n){super(t,"string","PgText"),this.config.enumValues=n.enum}build(t){return new u3(t,this.config)}},u3=class extends be{static[j]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}};function We(e,t={}){let{name:n,config:r}=Rn(e,t);return new c3(n,r)}var d3=class extends ju{constructor(t,n,r){super(t,"string","PgTime"),this.withTimezone=n,this.precision=r,this.config.withTimezone=n,this.config.precision=r}static[j]="PgTimeBuilder";build(t){return new f3(t,this.config)}},f3=class extends be{static[j]="PgTime";withTimezone;precision;constructor(t,n){super(t,n),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}};function YY(e,t={}){let{name:n,config:r}=Rn(e,t);return new d3(n,r.withTimezone??!1,r.precision)}var m3=class extends ju{static[j]="PgTimestampBuilder";constructor(t,n,r){super(t,"date","PgTimestamp"),this.config.withTimezone=n,this.config.precision=r}build(t){return new p3(t,this.config)}},p3=class extends be{static[j]="PgTimestamp";withTimezone;precision;constructor(t,n){super(t,n),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(t){return typeof t=="string"?new Date(this.withTimezone?t:t+"+0000"):t}mapToDriverValue=t=>t.toISOString()},h3=class extends ju{static[j]="PgTimestampStringBuilder";constructor(t,n,r){super(t,"string","PgTimestampString"),this.config.withTimezone=n,this.config.precision=r}build(t){return new g3(t,this.config)}},g3=class extends be{static[j]="PgTimestampString";withTimezone;precision;constructor(t,n){super(t,n),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(t){if(typeof t=="string")return t;let n=t.toISOString().slice(0,-1).replace("T"," ");if(this.withTimezone){let r=t.getTimezoneOffset(),a=r<=0?"+":"-";return`${n}${a}${Math.floor(Math.abs(r)/60).toString().padStart(2,"0")}`}return n}};function DT(e,t={}){let{name:n,config:r}=Rn(e,t);return r?.mode==="string"?new h3(n,r.withTimezone??!1,r.precision):new m3(n,r?.withTimezone??!1,r?.precision)}var v3=class extends Ee{static[j]="PgUUIDBuilder";constructor(t){super(t,"string","PgUUID")}defaultRandom(){return this.default(Uu`gen_random_uuid()`)}build(t){return new y3(t,this.config)}},y3=class extends be{static[j]="PgUUID";getSQLType(){return"uuid"}};function XY(e){return new v3(e??"")}var b3=class extends Ee{static[j]="PgVarcharBuilder";constructor(t,n){super(t,"string","PgVarchar"),this.config.length=n.length,this.config.enumValues=n.enum}build(t){return new x3(t,this.config)}},x3=class extends be{static[j]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}};function eX(e,t={}){let{name:n,config:r}=Rn(e,t);return new b3(n,r)}var S3=class extends Ee{static[j]="PgBinaryVectorBuilder";constructor(t,n){super(t,"string","PgBinaryVector"),this.config.dimensions=n.dimensions}build(t){return new w3(t,this.config)}},w3=class extends be{static[j]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}};function tX(e,t){let{name:n,config:r}=Rn(e,t);return new S3(n,r)}var C3=class extends Ee{static[j]="PgHalfVectorBuilder";constructor(t,n){super(t,"array","PgHalfVector"),this.config.dimensions=n.dimensions}build(t){return new k3(t,this.config)}},k3=class extends be{static[j]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){return t.slice(1,-1).split(",").map(n=>Number.parseFloat(n))}};function nX(e,t){let{name:n,config:r}=Rn(e,t);return new C3(n,r)}var R3=class extends Ee{static[j]="PgSparseVectorBuilder";constructor(t,n){super(t,"string","PgSparseVector"),this.config.dimensions=n.dimensions}build(t){return new I3(t,this.config)}},I3=class extends be{static[j]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}};function aX(e,t){let{name:n,config:r}=Rn(e,t);return new R3(n,r)}var T3=class extends Ee{static[j]="PgVectorBuilder";constructor(t,n){super(t,"array","PgVector"),this.config.dimensions=n.dimensions}build(t){return new N3(t,this.config)}},N3=class extends be{static[j]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){return t.slice(1,-1).split(",").map(n=>Number.parseFloat(n))}};function rX(e,t){let{name:n,config:r}=Rn(e,t);return new T3(n,r)}function oX(){return{bigint:AY,bigserial:EY,boolean:hw,char:PY,cidr:DY,customType:$Y,date:MY,doublePrecision:OY,inet:zY,integer:qy,interval:UY,json:jY,jsonb:as,line:BY,macaddr:FY,macaddr8:HY,numeric:VY,point:qY,geometry:ZY,real:WY,serial:KY,smallint:JY,smallserial:QY,text:We,time:YY,timestamp:DT,uuid:XY,varchar:eX,bit:tX,halfvec:nX,sparsevec:aX,vector:rX}}var _3=Symbol.for("drizzle:PgInlineForeignKeys"),iX=Symbol.for("drizzle:EnableRLS"),jh=class extends Fr{static[j]="PgTable";static Symbol=Object.assign({},Fr.Symbol,{InlineForeignKeys:_3,EnableRLS:iX});[_3]=[];[iX]=!1;[Fr.Symbol.ExtraConfigBuilder]=void 0;[Fr.Symbol.ExtraConfigColumns]={}};function rIe(e,t,n,r,a=e){let o=new jh(e,r,a),i=typeof t=="function"?t(oX()):t,s=Object.fromEntries(Object.entries(i).map(([d,f])=>{let m=f;m.setName(d);let h=m.build(o);return o[_3].push(...m.buildForeignKeys(h,o)),[d,h]})),l=Object.fromEntries(Object.entries(i).map(([d,f])=>{let m=f;m.setName(d);let h=m.buildExtraConfigColumn(o);return[d,h]})),u=Object.assign(o,s);return u[Fr.Symbol.Columns]=s,u[Fr.Symbol.ExtraConfigColumns]=l,n&&(u[jh.Symbol.ExtraConfigBuilder]=n),Object.assign(u,{enableRLS:()=>(u[jh.Symbol.EnableRLS]=!0,u)})}var Bh=(e,t,n)=>rIe(e,t,n,void 0);function sX(...e){return e[0].columns?new $T(e[0].columns,e[0].name):new $T(e)}var $T=class{static[j]="PgPrimaryKeyBuilder";columns;name;constructor(t,n){this.columns=t,this.name=n}build(t){return new L3(t,this.columns,this.name)}},L3=class{constructor(t,n,r){this.table=t,this.columns=n,this.name=r}static[j]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[jh.Symbol.Name]}_${this.columns.map(t=>t.name).join("_")}_pk`}};var MT=class{constructor(t,n){this.unique=t,this.name=n}static[j]="PgIndexBuilderOn";on(...t){return new gw(t.map(n=>{if(lo(n,Hr))return n;n=n;let r=new Fy(n.name,!!n.keyAsName,n.columnType,n.indexConfig);return n.indexConfig=JSON.parse(JSON.stringify(n.defaultConfig)),r}),this.unique,!1,this.name)}onOnly(...t){return new gw(t.map(n=>{if(lo(n,Hr))return n;n=n;let r=new Fy(n.name,!!n.keyAsName,n.columnType,n.indexConfig);return n.indexConfig=n.defaultConfig,r}),this.unique,!0,this.name)}using(t,...n){return new gw(n.map(r=>{if(lo(r,Hr))return r;r=r;let a=new Fy(r.name,!!r.keyAsName,r.columnType,r.indexConfig);return r.indexConfig=JSON.parse(JSON.stringify(r.defaultConfig)),a}),this.unique,!0,this.name,t)}},gw=class{static[j]="PgIndexBuilder";config;constructor(t,n,r,a,o="btree"){this.config={name:a,columns:t,unique:n,only:r,method:o}}concurrently(){return this.config.concurrently=!0,this}with(t){return this.config.with=t,this}where(t){return this.config.where=t,this}build(t){return new A3(this.config,t)}},A3=class{static[j]="PgIndex";config;constructor(t,n){this.config={...t,table:n}}};function rs(e){return new MT(!1,e)}function vw(e){return new MT(!0,e)}var Io=e=>DT(e,{withTimezone:!0}),lX=c.enum(["channel","dm","group","local_conversation","thread","web_session"]),oIe=Bh("junior_destinations",{id:We("id").primaryKey(),provider:We("provider").notNull(),providerTenantId:We("provider_tenant_id").notNull().default(""),providerDestinationId:We("provider_destination_id").notNull(),kind:We("kind").$type().notNull(),parentDestinationId:We("parent_destination_id"),displayName:We("display_name"),visibility:We("visibility").$type().notNull().default("unknown"),metadata:as("metadata_json"),createdAt:Io("created_at").notNull(),updatedAt:Io("updated_at").notNull()},e=>[vw("junior_destinations_provider_destination_uidx").on(e.provider,e.providerTenantId,e.providerDestinationId),rs("junior_destinations_provider_kind_idx").on(e.provider,e.kind)]),iIe=Bh("junior_users",{id:We("id").primaryKey(),primaryEmail:We("primary_email").notNull(),primaryEmailNormalized:We("primary_email_normalized").notNull(),displayName:We("display_name"),timezone:We("timezone"),isAdmin:hw("is_admin").notNull().default(!1),createdAt:Io("created_at").notNull(),updatedAt:Io("updated_at").notNull()},e=>[vw("junior_users_primary_email_normalized_uidx").on(e.primaryEmailNormalized)]),E3=Bh("junior_identities",{id:We("id").primaryKey(),kind:We("kind").$type().notNull(),provider:We("provider").notNull(),providerTenantId:We("provider_tenant_id").notNull().default(""),providerSubjectId:We("provider_subject_id").notNull(),displayName:We("display_name"),handle:We("handle"),email:We("email"),avatarUrl:We("avatar_url"),metadata:as("metadata_json"),createdAt:Io("created_at").notNull(),updatedAt:Io("updated_at").notNull(),userId:We("user_id").references(()=>iIe.id),emailNormalized:We("email_normalized"),emailVerified:hw("email_verified").notNull().default(!1),signedInAt:Io("signed_in_at")},e=>[vw("junior_identities_provider_subject_uidx").on(e.provider,e.providerTenantId,e.providerSubjectId),rs("junior_identities_user_idx").on(e.userId),rs("junior_identities_verified_email_idx").on(e.emailNormalized).where(Uu`${e.emailVerified} = true AND ${e.emailNormalized} IS NOT NULL`),rs("junior_identities_kind_provider_idx").on(e.kind,e.provider)]),Fh=Bh("junior_conversations",{conversationId:We("conversation_id").primaryKey(),schemaVersion:qy("schema_version").notNull().default(1),source:We("source").$type(),sessionSource:as("source_json").$type(),location:as("location_json").$type(),destinationId:We("destination_id").references(()=>oIe.id),destination:as("destination_json").$type(),actorIdentityId:We("actor_identity_id").references(()=>E3.id),creatorIdentityId:We("creator_identity_id").references(()=>E3.id),credentialSubjectIdentityId:We("credential_subject_identity_id").references(()=>E3.id),actor:as("actor_json").$type(),channelName:We("channel_name"),title:We("title"),createdAt:Io("created_at").notNull(),lastActivityAt:Io("last_activity_at").notNull(),updatedAt:Io("updated_at").notNull(),executionUpdatedAt:Io("execution_updated_at"),executionStatus:We("execution_status").$type().notNull(),runId:We("run_id"),lastCheckpointAt:Io("last_checkpoint_at"),lastEnqueuedAt:Io("last_enqueued_at"),parentConversationId:We("parent_conversation_id").references(()=>Fh.conversationId),forkedFromConversationId:We("forked_from_conversation_id").references(()=>Fh.conversationId,{onDelete:"set null"}),rootConversationId:We("root_conversation_id").references(()=>Fh.conversationId),transcriptPurgedAt:Io("transcript_purged_at"),stoppedAt:Io("stopped_at"),durationMs:qy("duration_ms").notNull().default(0),usage:as("usage_json").$type(),executionDurationMs:qy("execution_duration_ms").notNull().default(0),executionUsage:as("execution_usage_json").$type(),metricRunId:We("metric_run_id"),legacyArchivedAt:Io("archived_at")},e=>[rs("junior_conversations_last_activity_idx").on(e.lastActivityAt.desc(),e.conversationId),rs("junior_conversations_active_idx").using("btree",Uu`coalesce(${e.executionUpdatedAt}, ${e.updatedAt})`,e.conversationId).where(Uu`${e.executionStatus} <> 'idle'`),rs("junior_conversations_destination_activity_idx").on(e.destinationId,e.lastActivityAt.desc()),rs("junior_conversations_actor_activity_idx").on(e.actorIdentityId,e.lastActivityAt.desc()),rs("junior_conversations_parent_idx").on(e.parentConversationId),rs("junior_conversations_forked_from_idx").on(e.forkedFromConversationId),rs("junior_conversations_root_idx").on(e.rootConversationId)]);var cX=["pending","running","paused","blocked","completed","failed","stopped"];var dYe=Bh("junior_agent_bindings",{parentConversationId:We("parent_conversation_id").notNull().references(()=>Fh.conversationId),name:We("name").notNull(),childConversationId:We("child_conversation_id").notNull().references(()=>Fh.conversationId)},e=>[sX({columns:[e.parentConversationId,e.name]}),vw("junior_agent_bindings_child_idx").on(e.childConversationId)]),fYe=Bh("junior_agent_invocations",{invocationId:We("invocation_id").primaryKey(),parentConversationId:We("parent_conversation_id").notNull().references(()=>Fh.conversationId),childConversationId:We("child_conversation_id").notNull().references(()=>Fh.conversationId),agentName:We("agent_name"),input:We("input").notNull(),title:We("title"),actor:as("actor_json").$type().notNull(),credentialContext:as("credential_context_json").$type(),source:as("source_json").$type().notNull(),destination:as("destination_json").$type().notNull(),destinationVisibility:We("destination_visibility").$type(),agentType:We("agent_type").$type(),modelProfile:We("model_profile").$type(),reasoningLevel:We("reasoning_level").$type(),parentToolCallId:We("parent_tool_call_id"),status:We("status").$type().notNull(),mailboxStatus:We("mailbox_status").$type().notNull(),parentMailboxStatus:We("parent_mailbox_status").$type(),result:We("result"),errorMessage:We("error_message"),createdAt:Io("created_at").notNull(),updatedAt:Io("updated_at").notNull(),terminalAt:Io("terminal_at")},e=>[rs("junior_agent_invocations_child_idx").on(e.childConversationId),rs("junior_agent_invocations_mailbox_idx").on(e.mailboxStatus,e.createdAt),rs("junior_agent_invocations_parent_mailbox_idx").on(e.parentMailboxStatus,e.terminalAt)]);var sIe=c.object({error:c.string().min(1)}).strict(),Gy=c.object({active:c.number(),conversations:c.number(),durationMs:c.number(),failed:c.number(),label:c.string(),costUsd:c.number().optional(),tokens:c.number().optional()}).strict(),dX=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),P3=c.object({cachedInputTokens:c.number().optional(),cacheCreationTokens:c.number().optional(),conversations:c.number(),costUsd:c.number().optional(),date:dX,durationMs:c.number(),inputTokens:c.number().optional(),tokens:c.number().optional()}).strict(),D3=c.object({allow:c.number(),ask:c.number(),costUsd:c.number().optional(),date:dX,deny:c.number(),requests:c.number()}).strict(),lIe=c.object({allow:c.number(),ask:c.number(),costUsd:c.number().optional(),deny:c.number(),metricDays:c.array(D3),metricHours:c.array(D3).optional(),metricSixHours:c.array(D3).optional(),requests:c.number()}).strict(),O3=c.object({active:c.number(),cachedInputTokens:c.number().optional(),cacheCreationTokens:c.number().optional(),conversations:c.number(),durationMs:c.number(),failed:c.number(),generatedAt:c.string(),guardian:lIe,metricDays:c.array(P3),metricHours:c.array(P3).optional(),metricSixHours:c.array(P3).optional(),locations:c.array(Gy),actors:c.array(Gy),source:c.literal("conversation_index"),costUsd:c.number().optional(),inputTokens:c.number().optional(),tokens:c.number().optional(),windowEnd:c.string(),windowStart:c.string()}).strict(),cIe=c.object({inboundMessageId:c.string().min(1),text:c.string().min(1)}).strict(),z3=c.object({conversationId:c.string().min(1),status:c.enum(["no_work","requested"]),stoppedInboundMessageIds:c.array(c.string().min(1)),stoppedMessages:c.array(cIe)}).strict(),fX=c.object({auxiliaryCosts:kT.optional(),childAgentTotals:CT.optional(),conversationId:c.string().min(1),cumulativeDurationMs:c.number(),cumulativeUsage:lw.optional(),error:c.string().min(1).optional(),name:c.string().min(1).optional(),redacted:c.literal(!0).optional(),status:c.enum(cX),task:c.string().optional(),title:c.string().min(1).optional(),updatedAt:c.string().datetime()}).strict().superRefine((e,t)=>{e.task===void 0==(e.redacted!==!0)&&t.addIssue({code:"custom",message:"child agent task must be text or explicitly redacted"}),e.redacted&&(e.name||e.title||e.error)&&t.addIssue({code:"custom",message:"redacted child agents must not expose a name, title, or error"})}),U3=c.object({agents:c.array(fX),conversationId:c.string().min(1)}).strict(),jT=c.object({closed:c.number().int().nonnegative(),costUsd:c.number().nonnegative().optional(),created:c.number().int().nonnegative(),medianCostUsd:c.number().nonnegative().optional(),medianMergeTimeMs:c.number().nonnegative().optional(),merged:c.number().int().nonnegative(),mergeRate:c.number().min(0).max(1).optional(),open:c.number().int().nonnegative()}).strict(),uIe=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),Bu=c.object({closed:c.number().int().nonnegative(),created:c.number().int().nonnegative(),date:uIe,merged:c.number().int().nonnegative()}).strict(),mX=c.object({closed:c.number().int().nonnegative(),created:c.number().int().nonnegative(),id:c.string().uuid(),medianCostUsd:c.number().nonnegative().optional(),merged:c.number().int().nonnegative(),mergeRate:c.number().min(0).max(1).optional(),name:c.string().min(1),open:c.number().int().nonnegative(),provider:c.string().min(1),url:c.string().url().optional()}).strict(),BT=c.object({closedAt:c.string().optional(),id:c.string().uuid(),mergedAt:c.string().optional(),number:c.number().int().positive(),openedAt:c.string(),provider:c.string().min(1),repository:c.string().min(1),state:rw,title:c.string().optional(),url:c.string().url().optional()}).strict(),j3=c.object({activityDays:c.array(Bu),activityHours:c.array(Bu).optional(),activitySixHours:c.array(Bu).optional(),changes:c.array(BT),generatedAt:c.string(),repositories:c.array(mX),summary:jT,windowEnd:c.string(),windowStart:c.string()}).strict(),dIe=c.object({repositoryId:c.string().uuid()}).strict(),B3=c.object({activityDays:c.array(Bu),activityHours:c.array(Bu).optional(),activitySixHours:c.array(Bu).optional(),changes:c.array(BT),generatedAt:c.string(),repository:c.object({id:c.string().uuid(),name:c.string().min(1),provider:c.string().min(1),url:c.string().url().optional()}).strict(),summary:jT,windowEnd:c.string(),windowStart:c.string(),workspaces:c.array(c.object({id:c.string().min(1),name:c.string().min(1)}).strict())}).strict(),F3=c.object({activityDays:c.array(Bu),activityHours:c.array(Bu).optional(),activitySixHours:c.array(Bu).optional(),changes:c.array(BT),generatedAt:c.string(),summary:jT,windowEnd:c.string(),windowStart:c.string()}).strict(),pX=c.object({provider:c.string(),displayName:c.string(),description:c.string(),account:c.object({label:c.string(),url:c.string().optional()}).strict().optional(),connected:c.boolean()}).strict(),H3=c.object({connections:c.array(pX)}).strict(),fIe=c.object({provider:c.string().regex(/^[a-z][a-z0-9-]*$/).max(64)}).strict(),V3=c.object({authorizationUrl:c.string().url()}).strict(),q3=c.object({disconnected:c.literal(!0)}).strict(),zT=c.object({active:c.number(),conversations:c.number(),date:c.string(),durationMs:c.number(),failed:c.number(),tokens:c.number().optional()}).strict();var mIe=c.object({locationId:c.string().min(1)}).strict(),hX=Gy.extend({id:c.string(),firstSeenAt:c.string(),kind:lX,lastSeenAt:c.string(),provider:c.string(),providerDestinationId:c.string(),visibility:c.literal("public")}).strict(),pIe=Gy.extend({actor:sc}).strict(),hIe=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),UT=c.object({date:hIe,privateConversations:c.number(),publicConversations:c.number()}).strict(),G3=c.object({activityDays:c.array(UT),activityHours:c.array(UT).optional(),activitySixHours:c.array(UT).optional(),generatedAt:c.string(),locations:c.array(hX),privateActivity:Gy,source:c.literal("conversation_index"),windowEnd:c.string(),windowStart:c.string()}).strict(),Z3=hX.extend({activityDays:c.array(zT),activityHours:c.array(zT).optional(),activitySixHours:c.array(zT).optional(),actors:c.array(pIe),generatedAt:c.string(),recentConversations:c.array(By),source:c.literal("conversation_index"),windowEnd:c.string(),windowStart:c.string()}).strict(),gIe=c.object({email:c.string().trim().min(1)}).strict(),uX=Gy.omit({costUsd:!0}),gX=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),$3=c.object({active:c.number(),conversations:c.number(),costUsd:c.number().optional(),date:gX,durationMs:c.number(),failed:c.number(),tokens:c.number().optional()}).strict(),M3=c.object({activePeople:c.number(),conversations:c.number(),date:gX}).strict(),vX=c.object({active:c.number(),activeDays:c.number(),conversations:c.number(),durationMs:c.number(),failed:c.number(),tokens:c.number().optional()}).strict(),OT=c.object({conversations:c.number().int().nonnegative(),costUsd:c.number().finite().nonnegative(),durationMs:c.number().finite().nonnegative(),priorCostUsd:c.number().finite().nonnegative()}).strict(),vIe=c.object({1:OT,7:OT,30:OT,90:OT}).strict(),yX=sc.extend({email:c.string().min(1)}).strict(),yIe=vX.extend({firstSeenAt:c.string(),lastSeenAt:c.string(),actor:yX,windows:vIe}).strict(),W3=c.object({activityDays:c.array(M3),activityHours:c.array(M3).optional(),activitySixHours:c.array(M3).optional(),generatedAt:c.string(),people:c.array(yIe),source:c.literal("conversation_index"),windowEnd:c.string(),windowStart:c.string()}).strict(),K3=c.object({activityDays:c.array($3),activityHours:c.array($3).optional(),activitySixHours:c.array($3).optional(),generatedAt:c.string(),locations:c.array(uX),recentConversations:c.array(By),actor:yX,source:c.literal("conversation_index"),surfaces:c.array(uX),totals:vX,windowEnd:c.string(),windowStart:c.string()}).strict(),J3=c.object({generatedAt:c.string(),sevenDaysUsd:c.number().finite().nonnegative(),source:c.literal("conversation_index"),thirtyDaysUsd:c.number().finite().nonnegative(),windowEnd:c.string(),windowStart:c.string()}).strict(),Q3=c.object({id:c.string().uuid(),name:c.string(),tokenSuffix:c.string(),createdAt:c.string().datetime(),expiresAt:c.string().datetime(),lastUsedAt:c.string().datetime().nullable()}).strict(),Y3=c.object({tokens:c.array(Q3)}).strict(),bIe=c.object({name:c.string().trim().min(1).max(80)}).strict(),X3=Q3.extend({token:c.string().startsWith("jr_pat_")}).strict(),xIe=c.object({id:c.string().uuid()}).strict(),SIe=c.object({revoked:c.literal(!0)}).strict(),bX=c.object({provider:c.string(),displayName:c.string(),userOAuth:c.boolean(),tools:c.array(c.string()),connected:c.boolean(),connectedAt:c.string().optional(),connectedBy:c.string().optional()}).strict(),ej=c.object({serviceAccounts:c.array(bX)}).strict(),wIe=c.object({provider:c.string().regex(/^[a-z][a-z0-9-]*$/).max(64)}).strict(),tj=c.object({authorizationUrl:c.string().url()}).strict(),nj=c.object({disconnected:c.literal(!0)}).strict(),CIe=c.object({provider:c.string(),repo:c.string()}).strict(),xX=c.object({provider:c.string(),repo:c.string(),checkoutPath:c.string()}).strict(),kIe=c.object({id:c.string(),generatedAt:c.iso.datetime(),buildDurationMs:c.number().int().nonnegative(),sizeBytes:c.number().int().nonnegative().nullable()}).strict(),SX=c.object({id:c.string(),generatedAt:c.iso.datetime(),buildDurationMs:c.number().int().nonnegative(),dependencyCount:c.number().int().nonnegative()}).strict(),Zy=c.object({id:c.string().uuid(),name:c.string(),setupScript:c.string(),vcpus:c.number().int().positive().nullable(),repos:c.array(xX),snapshot:kIe.nullable()}).strict(),yw=c.object({baselineSnapshot:SX.nullable(),defaultVcpus:c.number().int().positive().nullable(),workspaces:c.array(Zy)}).strict(),RIe=c.object({name:c.string(),setupScript:c.string().optional(),vcpus:c.number().int().positive().nullable().optional(),repos:c.array(CIe)}).strict(),IIe=c.object({id:c.string().uuid()}).strict(),TIe=c.object({deleted:c.literal(!0)}).strict(),wX=c.object({count:c.number().int().nonnegative(),date:c.string(),metric:c.string().min(1),name:c.string().min(1),namespace:c.string().min(1)}).strict(),aj=c.object({generatedAt:c.string().datetime(),stats:c.array(wX),windowEnd:c.string(),windowStart:c.string()}).strict();var os=c.string().trim().min(1).max(160),Wy=c.number().int().nonnegative(),NIe=c.discriminatedUnion("type",[c.strictObject({type:c.literal("code_change"),author:os.optional(),sourceBranch:os.optional(),targetBranch:os.optional(),reviewers:c.array(os).max(5).optional(),review:c.enum(["required","approved","changes_requested"]).optional(),checks:c.strictObject({passed:Wy,failed:Wy,pending:Wy}).optional(),mergeable:c.boolean().optional(),changedFiles:Wy.optional(),additions:Wy.optional(),deletions:Wy.optional()}),c.strictObject({type:c.literal("task"),assignees:c.array(os).max(5).optional(),priority:os.optional(),project:os.optional(),cycle:os.optional(),dueDate:c.iso.date().optional(),labels:c.array(os).max(5).optional()}),c.strictObject({type:c.literal("deployment"),project:os.optional(),environment:os.optional(),revision:os.optional(),branch:os.optional()}),c.strictObject({type:c.literal("calendar_event"),when:os.optional(),attendees:c.array(os).max(5).optional()})]);function kX(e){if(!e)return[];let t=[],n=a=>a?.length?`${a.join(", ")}${a.length===5?" (up to 5 shown)":""}`:void 0;function r(a,o,i){i!==void 0&&i!==""&&t.push({key:a,label:o,value:String(i)})}switch(e.type){case"code_change":r("sourceBranch","Branch",e.sourceBranch);break;case"task":r("assignees","Assignees",e.assignees?.length===0?"Unassigned":n(e.assignees)),r("priority","Priority",e.priority),r("project","Project",e.project),r("cycle","Cycle",e.cycle),r("dueDate","Due",e.dueDate),r("labels","Labels",n(e.labels));break;case"deployment":r("environment","Environment",e.environment),r("project","Project",e.project),r("revision","Revision",e.revision),r("branch","Branch",e.branch);break;case"calendar_event":r("when","When",e.when),r("attendees","Attendees",n(e.attendees))}return t.slice(0,4)}var HT=c.enum(["task","code_change","automation","deployment","calendar_event","item"]),_Ie={task:"Ticket",code_change:"Code change",automation:"Automation",deployment:"Deployment",calendar_event:"Calendar event",item:"Item"};function cc(e){let t=e.objectType==="item"&&e.facts?.type==="deployment"?"deployment":e.objectType,n=e.status?.toLowerCase(),r={task:"issue-opened",code_change:"git-pull-request",automation:"workflow",deployment:"rocket",calendar_event:"calendar",item:"package"}[t],a=t==="automation"?"info":"neutral";return t==="code_change"?(n==="draft"&&(r="git-pull-request-draft"),n==="closed"&&(r="git-pull-request-closed",a="danger"),n==="merged"&&(r="git-merge",a="accent"),n==="open"&&(a="success")):t==="task"?(n==="closed"&&(r="issue-closed",a="accent"),n==="open"&&(a="success")):t==="deployment"&&((n==="ready"||n==="succeeded")&&(a="success"),(n==="error"||n==="failed")&&(a="danger"),(n==="building"||n==="in_progress")&&(a="info")),(n==="warning"||n==="blocked")&&(a="warning"),{icon:r,tone:a,label:_Ie[t]}}function RX(e){return`/_junior/dashboard/object-icons/v1/${e}.png`}var oj=c.object({kind:c.literal("object"),key:c.string().trim().min(1).max(256),label:c.string().trim().min(1).max(256),objectType:HT,title:c.string().trim().min(1).max(512),url:c.url().max(2048).refine(e=>["http:","https:"].includes(new URL(e).protocol)).nullable(),description:c.string().max(4e3).optional(),status:c.string().trim().min(1).max(100).optional(),trigger:c.string().max(4e3).optional(),warning:c.string().max(1e3).optional(),displayType:c.string().trim().min(1).max(80).optional(),sourceUpdatedAt:c.iso.datetime({offset:!0}).optional(),facts:NIe.refine(e=>new TextEncoder().encode(JSON.stringify(e)).length<=4096,"Object facts must not exceed 4 KiB").optional()}).strict().refine(e=>!e.facts||(e.facts.type==="deployment"?e.objectType==="deployment"||e.objectType==="item":e.facts.type===e.objectType),"Object facts must match the object type"),AYe=oj.safeExtend({plugin:c.string().min(1)}),IX={"issue-opened":["M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z","M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"],"issue-closed":["M11.28 6.78a.75.75 0 0 0-1.06-1.06L7.25 8.69 5.78 7.22a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l3.5-3.5Z","M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 1 0-13 0 6.5 6.5 0 0 0 13 0Z"],"git-pull-request":["M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"],"git-pull-request-draft":["M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 14a2.25 2.25 0 1 1 0-4.5 2.25 2.25 0 0 1 0 4.5ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM14 7.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm0-4.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z"],"git-pull-request-closed":["M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75Zm-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"],"git-merge":["M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z"],workflow:["M0 1.75C0 .784.784 0 1.75 0h3.5C6.216 0 7 .784 7 1.75v3.5A1.75 1.75 0 0 1 5.25 7H4v4a1 1 0 0 0 1 1h4v-1.25C9 9.784 9.784 9 10.75 9h3.5c.966 0 1.75.784 1.75 1.75v3.5A1.75 1.75 0 0 1 14.25 16h-3.5A1.75 1.75 0 0 1 9 14.25v-.75H5A2.5 2.5 0 0 1 2.5 11V7h-.75A1.75 1.75 0 0 1 0 5.25Zm1.75-.25a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Zm9 9a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Z"],rocket:["M14.064 0h.186C15.216 0 16 .784 16 1.75v.186a8.752 8.752 0 0 1-2.564 6.186l-.458.459c-.314.314-.641.616-.979.904v3.207c0 .608-.315 1.172-.833 1.49l-2.774 1.707a.749.749 0 0 1-1.11-.418l-.954-3.102a1.214 1.214 0 0 1-.145-.125L3.754 9.816a1.218 1.218 0 0 1-.124-.145L.528 8.717a.749.749 0 0 1-.418-1.11l1.71-2.774A1.748 1.748 0 0 1 3.31 4h3.204c.288-.338.59-.665.904-.979l.459-.458A8.749 8.749 0 0 1 14.064 0ZM8.938 3.623h-.002l-.458.458c-.76.76-1.437 1.598-2.02 2.5l-1.5 2.317 2.143 2.143 2.317-1.5c.902-.583 1.74-1.26 2.499-2.02l.459-.458a7.25 7.25 0 0 0 2.123-5.127V1.75a.25.25 0 0 0-.25-.25h-.186a7.249 7.249 0 0 0-5.125 2.123ZM3.56 14.56c-.732.732-2.334 1.045-3.005 1.148a.234.234 0 0 1-.201-.064.234.234 0 0 1-.064-.201c.103-.671.416-2.273 1.15-3.003a1.502 1.502 0 1 1 2.12 2.12Zm6.94-3.935c-.088.06-.177.118-.266.175l-2.35 1.521.548 1.783 1.949-1.2a.25.25 0 0 0 .119-.213ZM3.678 8.116 5.2 5.766c.058-.09.117-.178.176-.266H3.309a.25.25 0 0 0-.213.119l-1.2 1.95ZM12 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"],calendar:["M4.75 0a.75.75 0 0 1 .75.75V2h5V.75a.75.75 0 0 1 1.5 0V2h1.25c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25V3.75C1 2.784 1.784 2 2.75 2H4V.75A.75.75 0 0 1 4.75 0ZM2.5 7.5v6.75c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25V7.5Zm10.75-4H2.75a.25.25 0 0 0-.25.25V6h11V3.75a.25.25 0 0 0-.25-.25Z"],package:["m8.878.392 5.25 3.045c.54.314.872.89.872 1.514v6.098a1.75 1.75 0 0 1-.872 1.514l-5.25 3.045a1.75 1.75 0 0 1-1.756 0l-5.25-3.045A1.75 1.75 0 0 1 1 11.049V4.951c0-.624.332-1.201.872-1.514L7.122.392a1.75 1.75 0 0 1 1.756 0ZM7.875 1.69l-4.63 2.685L8 7.133l4.755-2.758-4.63-2.685a.248.248 0 0 0-.25 0ZM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432Zm6.25 8.271 4.625-2.683a.25.25 0 0 0 .125-.216V5.677L8.75 8.432Z"]};function LIe(e){try{let t=new URL(e).protocol;return t==="http:"||t==="https:"}catch{return!1}}var AIe=c.object({kind:c.literal("resource_link"),objectType:HT.optional(),key:c.string().trim().min(1).max(256),label:c.string().trim().min(1).max(256),url:c.string().url().max(2048).refine(LIe,"URL must use HTTP or HTTPS."),description:c.string().trim().min(1).max(512).optional(),status:c.enum(["open","draft","closed","merged","warning"]).optional()}).strict(),EYe=c.discriminatedUnion("kind",[AIe,oj]),EIe=c.enum(["circle-dot","circle-dashed","circle-x","git-merge","git-pull-request","triangle-alert"]),PYe=c.object({icon:EIe.optional(),objectType:HT.optional(),status:c.string().trim().min(1).max(100).optional(),key:c.string().trim().min(1).max(256),label:c.string().trim().min(1).max(256)}).strict(),PIe=c.enum(["closed","merged","open"]),DYe=c.object({closedAt:c.date().optional(),conversationIds:c.array(c.string().min(1)).default([]),mergedAt:c.date().optional(),number:c.number().int().positive(),openedAt:c.date(),providerId:c.string().min(1),repository:c.object({name:c.string().min(1),providerId:c.string().min(1),url:c.string().url().optional()}).strict(),state:PIe,title:c.string().min(1).optional(),updatedAt:c.date(),url:c.string().url().optional()}).strict(),$Ye=c.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/),DIe=c.enum(["activity","brain","calendar","check","database","info","key","link","sparkles","warning"]),$Ie=c.object({content:c.string().min(1).max(32768).optional(),description:c.string().trim().min(1).max(2e3).optional(),metadata:c.array(c.string().trim().min(1).max(120)).max(8).optional(),title:c.string().trim().min(1).max(4e3)}).strict(),MYe=c.object({details:c.array($Ie).max(100).optional(),icon:DIe.optional(),preview:c.string().trim().min(1).max(500).optional(),title:c.string().trim().min(1).max(120)}).strict();var VT=c.string().regex(/^T[A-Z0-9]+$/),ij=c.string().regex(/^(C|G|D)[A-Z0-9]+$/),TX=c.string().regex(/^local:[a-z0-9_-]+:[a-z0-9][a-z0-9_-]*$/),MIe=c.string().min(1).refine(e=>e===e.trim()&&e.toLowerCase()!=="unknown"),FT=MIe,gt=c.string().refine(e=>e.trim().length>0),Zo=gt.refine(e=>e===e.trim()),OIe=c.object({id:gt,provider:Zo}).strict().extend({provider:c.literal("slack"),teamId:VT,channelId:ij,threadTs:Zo.optional()}).strict(),OYe=c.discriminatedUnion("provider",[OIe]),zYe=c.enum(["slack","local"]),NX=c.enum(["public","private"]),zIe=c.enum(["public","private"]),sj=c.object({platform:c.literal("slack"),teamId:VT,channelId:ij,threadTs:Zo.optional()}).strict(),UIe=c.object({platform:c.literal("local"),conversationId:TX}).strict(),jIe=c.discriminatedUnion("platform",[sj,UIe]),UYe=c.object({action:c.literal("send_message"),destination:sj}).strict(),BIe=c.object({kind:c.literal("slack"),teamId:VT,channelId:ij,visibility:NX,messageTs:gt.optional(),threadTs:gt.optional()}).strict(),FIe=c.object({kind:c.literal("local"),visibility:c.literal("private"),conversationId:TX}).strict(),HIe=c.object({kind:c.literal("web"),visibility:NX,conversationId:Zo}).strict(),VIe=c.object({kind:c.literal("event"),eventKey:Zo,eventType:Zo,identifier:Zo,namespace:Zo}).strict(),_X={automationId:Zo.optional(),automationRunId:Zo.optional()},qIe=c.object({kind:c.literal("scheduled_automation"),..._X}).strict(),GIe=c.object({kind:c.literal("event_automation"),..._X}).strict(),ZIe=c.object({kind:c.literal("plugin_dispatch")}).strict(),WIe=c.object({kind:c.literal("agent_invocation")}).strict(),KIe=c.discriminatedUnion("kind",[BIe,FIe,HIe,VIe,qIe,GIe,ZIe,WIe]);function JIe(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let t=e;if("kind"in t){let o=typeof t.kind=="string"?{event_task:"event_automation",resource_event:"event",scheduled_task:"scheduled_automation"}[t.kind]:void 0;return o?{...t,kind:o}:e}if(t.platform!=="slack"&&t.platform!=="local"&&t.platform!=="web")return e;let{location:n,platform:r,...a}=t;return{...a,kind:r}}var QIe=c.preprocess(JIe,KIe),YIe=c.discriminatedUnion("allowedWhen",[c.object({type:c.literal("user"),userId:FT,allowedWhen:c.literal("private-direct-conversation")}).strict(),c.object({type:c.literal("user"),userId:FT,allowedWhen:c.literal("scheduled-automation"),taskId:Zo}).strict()]),lj={email:gt.optional(),fullName:gt.optional(),userId:FT,userName:gt.optional()},XIe=c.object({...lj,platform:c.literal("slack"),teamId:VT}).strict(),eTe=c.object({...lj,platform:c.literal("local")}).strict(),tTe=c.object({...lj,platform:c.literal("web")}).strict(),nTe=c.object({platform:c.literal("system"),name:FT}).strict(),rj=c.discriminatedUnion("platform",[XIe,eTe,tTe,nTe]),aTe=c.object({displayName:gt.optional(),handle:gt.optional(),id:Zo,provider:Zo,providerSubjectId:Zo,providerTenantId:Zo.optional()}).strict(),jYe=c.object({displayName:gt.optional(),email:gt.max(320),id:Zo,identities:c.array(aTe).max(100),isAdmin:c.literal(!0).optional()}).strict(),rTe=c.record(c.string(),c.string()).superRefine((e,t)=>{let n=Object.entries(e);if(n.length>20){t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata has too many keys"});return}for(let[r,a]of n){if(!r.trim()){t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata values must be strings",path:[r]});continue}r.length>128&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata key exceeds the maximum length",path:[r]}),/[\r\n]/.test(r)&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata keys must be single-line strings",path:[r]}),/[\r\n]/.test(a)&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata values must be single-line strings",path:[r]}),a.length>512&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata value exceeds the maximum length",path:[r]})}}),oTe=c.object({label:Zo.pipe(c.string().max(48)).refine(e=>!/[\r\n]/.test(e)),detail:Zo.pipe(c.string().max(128)).refine(e=>!/[\r\n]/.test(e)).optional()}).strict(),BYe=c.object({idempotencyKey:gt.pipe(c.string().max(512)),credentialSubject:YIe.optional(),destination:sj,destinationVisibility:zIe,input:gt.pipe(c.string().max(32e3)),metadata:rTe.optional(),replyAttribution:oTe.optional()}).strict();var iTe=c.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_-]*$/),FYe=c.object({text:c.string().trim().min(1).max(8e3)}).strict(),HYe=c.object({kind:iTe,version:c.number().int().positive(),content:c.record(c.string(),c.unknown())}).strict();var sTe=4e3,lTe=8e3;var cTe=4e3,uTe=1e3,dTe=c.record(c.string(),c.unknown()).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:"custom",message:"Event data may include at most 32 keys."}),new TextEncoder().encode(JSON.stringify(e)).byteLength>4e3&&t.addIssue({code:"custom",message:`Event data may be at most ${cTe} JSON bytes.`})}),Hh=c.string().regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/).describe("Canonical dotted event type, such as issue.closed or pull_request.review.changes_requested."),LX=c.string().regex(/^[a-z][a-z0-9_]*$/).describe("Canonical plugin-defined resource type, such as issue or pull_request."),AX=/^[a-z][a-zA-Z0-9]*$/,fTe=c.object({kind:c.enum(["boolean","string","number"]),description:c.string().trim().min(1).max(200),enum:c.array(c.string().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{e.enum&&e.kind!=="string"&&t.addIssue({code:"custom",message:'Event match field enum requires kind "string".',path:["enum"]})}),mTe=c.record(c.string().regex(AX),fTe).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:"custom",message:"Event match keys may include at most 32 keys."})}),VYe=c.record(c.string().regex(AX),c.union([c.boolean(),c.number().finite(),c.string().min(1),c.array(c.union([c.number().finite(),c.string().min(1)])).min(1)])).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:"custom",message:"Event match may include at most 32 keys."});for(let[n,r]of Object.entries(e))Array.isArray(r)&&r.some(a=>typeof a=="boolean")&&t.addIssue({code:"custom",message:`Event match field "${n}" cannot use a boolean list.`,path:[n]})});var pTe=c.object({format:c.string().trim().min(1).max(200),pattern:c.instanceof(RegExp)}).strict(),hTe=c.object({type:LX,identifier:pTe.optional(),supportedEvents:c.array(Hh).min(1),suggestedEvents:c.array(Hh).optional(),matchFields:mTe.optional(),guidance:c.record(Hh,c.string().trim().min(1).max(uTe)).optional()}).strict().superRefine((e,t)=>{let n=new Set;e.supportedEvents.forEach((a,o)=>{n.has(a)&&t.addIssue({code:"custom",message:`Duplicate supported event type "${a}".`,path:["supportedEvents",o]}),n.add(a)});for(let a of Object.keys(e.guidance??{}))n.has(a)||t.addIssue({code:"custom",message:`Guidance event type "${a}" is not supported.`,path:["guidance",a]});let r=new Set;e.suggestedEvents?.forEach((a,o)=>{r.has(a)&&t.addIssue({code:"custom",message:`Duplicate suggested event type "${a}".`,path:["suggestedEvents",o]}),n.has(a)||t.addIssue({code:"custom",message:`Suggested event type "${a}" is not supported.`,path:["suggestedEvents",o]}),r.add(a)})}),qYe=c.object({resourceTypes:c.array(hTe).min(1),isEnabled:c.function({input:[],output:c.boolean()}).optional(),normalizeIdentifier:c.function({input:[c.string()],output:c.string()}).optional()}).strict().superRefine((e,t)=>{let n=new Set;e.resourceTypes.forEach((r,a)=>{n.has(r.type)&&t.addIssue({code:"custom",message:`Duplicate resource type "${r.type}".`,path:["resourceTypes",a,"type"]}),n.add(r.type)})});var GYe=c.object({identifier:c.string().min(1),label:c.string().min(1),namespace:c.string().min(1),suggestedEvents:c.array(Hh).optional(),supportedEvents:c.array(Hh),type:LX}).strict(),ZYe=c.object({events:c.array(Hh).min(1),id:c.string().min(1)}).strict(),CX=c.union([c.object({provider:c.string().min(1),handle:c.string().min(1)}).strict(),c.object({email:c.string().trim().min(3)}).strict()]),gTe=c.object({objectType:HT.optional(),eventKey:c.string().min(1),eventType:Hh,identifier:c.string().min(1),occurredAtMs:c.number().finite(),terminal:c.boolean().optional(),trustedSummary:c.string().min(1).transform(e=>e.slice(0,sTe)),data:dTe.optional(),untrustedText:c.string().transform(e=>e.slice(0,lTe)).optional(),people:c.array(CX).max(20).optional(),doneBy:CX.optional()}).strict(),WYe=gTe.extend({namespace:c.string().min(1)}),vTe=c.object({authority:c.enum(["instruction","context"]),actor:rj.optional()}).strict(),yTe=c.discriminatedUnion("type",[c.object({type:c.literal("message"),role:c.enum(["user","assistant"]),text:c.string().min(1),provenance:vTe.optional(),isRunActor:c.boolean().optional()}).strict(),c.object({type:c.literal("toolResult"),toolName:c.string().min(1),isError:c.boolean(),text:c.string().min(1).optional()}).strict()]),KYe=c.object({actorUserId:c.string().min(1).optional(),completedAtMs:c.number().finite(),conversationId:c.string().min(1),destination:jIe,locationId:c.string().min(1).optional(),actors:c.array(rj),actor:rj.optional(),runId:c.string().min(1),source:QIe,transcript:c.array(yTe)}).strict();var JYe=c.discriminatedUnion("type",[c.object({type:c.literal("text"),text:c.string()}).strict(),c.object({type:c.literal("image"),data:c.string(),mimeType:c.string()}).strict()]),bTe=c.object({arguments:c.record(c.string(),c.unknown()),reason:c.string().min(1).optional()}).strict(),QYe=c.object({objectAnnotations:c.array(oj).optional(),target:c.string().min(1).optional(),truncated:c.boolean().optional(),continuation:bTe.optional()}).passthrough(),YYe=c.enum(["auto","review","approve"]);var XYe=c.object({auth:c.object({user:c.object({email:c.string().nullable().optional(),emailVerified:c.boolean().optional(),isAdmin:c.boolean(),name:c.string().nullable().optional()}).strict()}).strict(),pluginName:gt}).strict(),xTe=c.string().regex(/^[a-z][a-z0-9-]*$/),STe=c.string().regex(/^[a-z][a-z0-9.-]*$/),wTe=c.union([c.literal("read"),c.literal("write")]),EX=c.object({provider:xTe,scope:gt.optional(),type:c.literal("oauth")}).strict(),PX=c.object({displayName:gt.optional(),handle:gt.optional(),id:gt,label:gt.optional(),url:gt.optional(),verifiedEmails:c.array(gt).optional()}).strict(),eXe=c.object({account:PX.optional(),accessToken:gt,expiresAt:c.number().finite().optional(),refreshToken:gt,refreshTokenExpiresAt:c.number().finite().optional(),scope:gt.optional()}).strict(),tXe=c.object({access:wTe,leaseScope:gt.optional(),name:STe,reason:gt.optional(),requirements:c.array(gt).min(1).optional()}).strict(),CTe=c.object({domain:c.string().min(1),headers:c.record(c.string(),c.string()).refine(e=>Object.keys(e).length>0)}).strict(),kTe=c.object({account:PX.optional(),authorization:EX.optional(),expiresAt:c.string().refine(e=>Number.isFinite(Date.parse(e))),headerTransforms:c.array(CTe).min(1)}).strict(),nXe=c.discriminatedUnion("type",[c.object({lease:kTe,type:c.literal("lease")}).strict(),c.object({authorization:EX.optional(),message:gt,type:c.literal("needed")}).strict(),c.object({message:gt,type:c.literal("unavailable")}).strict()]);var RTe=gt.max(64).regex(/^[a-z][a-z0-9-]*$/),ITe=gt.max(80),TTe=gt.max(500),NTe=c.enum(["primary","profile","admin"]),_Te=c.object({detail:gt.max(500).optional(),label:gt.max(80),tone:c.enum(["good","neutral","warning"]).optional(),value:gt.max(120)}).strict(),LTe=c.object({label:gt.max(80),value:gt.max(500)}).strict(),ATe=c.object({confirmation:gt.max(500).optional(),href:gt.max(500).regex(/^\/api\/plugins\/[a-z][a-z0-9-]*(?:\/|$)/),label:gt.max(80),method:c.enum(["DELETE","GET"]),tone:c.enum(["danger","neutral"]).optional()}).strict(),ETe=c.object({actions:c.array(ATe).max(4).optional(),description:gt.max(1e3).optional(),id:gt.max(128),metadata:c.array(LTe).max(8).optional(),title:gt.max(4e3)}).strict(),DX=c.object({emptyText:gt.max(500).optional(),metrics:c.array(_Te).max(6).optional(),nextCursor:gt.max(1e3).optional(),records:c.array(ETe).max(100),searchPlaceholder:gt.max(120).optional(),type:c.literal("list")}).strict(),PTe=c.object({description:TTe,id:RTe,label:ITe,navigation:NTe,pluginDisplayName:gt.max(200),pluginName:gt.max(100)}).strict(),$X=c.array(PTe),DTe=gt.max(1e3).optional(),$Te=gt.max(64).optional(),MTe=c.string().trim().max(200).optional(),aXe=c.object({cursor:DTe,filter:$Te,limit:c.number().int().min(1).max(50),query:MTe}).strict();var MX=c.object({email:c.string().trim().email(),emailVerified:c.boolean().optional(),name:c.string().nullable().optional()}).strict(),iXe=c.object({user:MX}).strict(),qT=c.object({user:MX.extend({isAdmin:c.boolean()}).strict()}).strict(),sXe=c.object({displayName:c.string().trim().min(1).max(80)}).strict(),OX=c.object({allowedDomainCount:c.number(),authRequired:c.boolean(),authPath:c.string(),basePath:c.string(),componentGallery:c.boolean(),sentryConversationLinks:c.boolean(),timeZone:c.string().optional(),version:c.string().min(1)}).strict();var bw=b($(),1);var zX="x-junior-version";var cj="junior:dashboard-version";function UX(e){let t=e.headers.get(zX)?.trim();!t||typeof window>"u"||window.dispatchEvent(new CustomEvent(cj,{detail:t}))}function jX(e){let[t,n]=(0,bw.useState)(e);return(0,bw.useEffect)(()=>{e&&n(e)},[e]),(0,bw.useEffect)(()=>{let r=a=>{n(a.detail)};return window.addEventListener(cj,r),()=>window.removeEventListener(cj,r)},[]),t}var Ar=class extends Error{status;fields;code;apiError;constructor(t,n,r,a){super(`${t} returned ${n}`),this.status=n,this.fields=a?.fields,this.code=a?.code,r?.trim()&&(this.apiError=r.trim())}};async function Ky(e,t){let n,r,a;try{let o=await t.json();typeof o.error=="string"&&(n=o.error),typeof o.code=="string"&&(a=o.code),o.fields&&typeof o.fields=="object"&&(r=Object.fromEntries(Object.entries(o.fields).filter(i=>Array.isArray(i[1])&&i[1].every(s=>typeof s=="string"))))}catch{}throw new Ar(e,t.status,n,{fields:r,code:a})}function Jy(){if(typeof window>"u")return;let e=window.__JUNIOR_DASHBOARD_BASE_PATH__??"/",t=e==="/"?"/auth/login":`${e}/auth/login`;if(window.location.pathname!==t){let n=`${window.location.pathname}${window.location.search||""}`,r=new URLSearchParams;n!=="/"&&r.set("next",n);let a=r.toString();window.location.assign(a?`${t}?${a}`:t)}}async function Qy(e,t,n){let r=await Xy(t,{body:JSON.stringify(n),credentials:"same-origin",headers:{"content-type":"application/json"},method:"PATCH"});return r.status===401&&Jy(),r.ok||await Ky(t,r),e.parse(await r.json())}async function co(e,t,n){let r=await Xy(t,{body:JSON.stringify(n),credentials:"same-origin",headers:{"content-type":"application/json"},method:"POST"});return r.status===401&&Jy(),r.ok||await Ky(t,r),e.parse(await r.json())}async function BX(e,t,n){let r=await Xy(t,{body:JSON.stringify(n),credentials:"same-origin",headers:{"content-type":"application/json"},method:"PUT"});return r.status===401&&Jy(),r.ok||await Ky(t,r),e.parse(await r.json())}async function zm(e){let t=await Xy(e,{credentials:"same-origin",method:"DELETE"});t.status===401&&Jy(),t.ok||await Ky(e,t)}async function Yy(e,t,n={}){let r=await Xy(t,{body:JSON.stringify(n),credentials:"same-origin",headers:{"content-type":"application/json"},method:"DELETE"});return r.status===401&&Jy(),r.ok||await Ky(t,r),e.parse(await r.json())}async function Xy(e,t){let n=await fetch(e,t);return UX(n),n}async function Ke(e,t,n){let r=await uj(t,n);return e.parse(await r.json())}async function uj(e,t,n){let r=await Xy(e,{credentials:"same-origin",...t?{signal:t}:void 0,...n?{cache:"no-store",headers:{"if-none-match":n}}:void 0});return r.status===401&&Jy(),!r.ok&&!(n&&r.status===304)&&await Ky(e,r),r}var GT=5*6e4,dj=5*6e4,OTe=1e3;function zTe(e,t=Date.now()){if(!e)return dj;let n=Date.parse(e);if(!Number.isFinite(n))return dj;let r=Math.max(0,t-n);return Math.max(OTe,dj-r)}function FX(){return Qe({queryKey:["dashboard","core"],queryFn:async({signal:e})=>{let[t,n]=await Promise.all([Ke(qT,"/api/me",e),Ke(OX,"/api/config",e)]);return{config:n,me:t}},retry:!1,staleTime:GT})}function UTe(){return Qe({queryKey:["dashboard","plugins"],queryFn:({signal:e})=>Ke(P4,"/api/plugins",e),retry:!1,staleTime:GT})}function HX(){return Qe({queryKey:["dashboard","plugin-user-pages"],queryFn:({signal:e})=>Ke($X,"/api/user-pages",e),retry:!1,staleTime:GT})}function ZT(e=""){return Qe({queryKey:["dashboard","conversations","viewer",{search:e}],queryFn:({signal:t})=>Ke(RT,`/api/conversations${e?`?q=${encodeURIComponent(e)}`:""}`,t),placeholderData:Mp,retry:!1})}function VX(){return Qe({queryKey:["dashboard","code"],queryFn:({signal:e})=>Ke(j3,"/api/code",e),retry:!1})}function qX(e){return Qe({enabled:!!e,queryKey:["dashboard","code","repositories",e],queryFn:({signal:t})=>Ke(B3,`/api/code/repositories/${encodeURIComponent(e)}`,t),retry:!1})}function WT(e,t=""){return Qe({enabled:!!e,queryKey:["dashboard","conversations","code-repository",{repositoryId:e,search:t}],queryFn:({signal:n})=>{let r=new URLSearchParams({codeRepositoryId:e});return t&&r.set("q",t),Ke(RT,`/api/conversations?${r.toString()}`,n)},placeholderData:Mp,retry:!1})}function GX(e,t){return Qe({enabled:e,queryKey:["dashboard","automations",t],queryFn:({signal:n})=>Ke(k4,`/api/automations${t?`?${t}`:""}`,n),placeholderData:Mp,retry:!1})}function eb(e,t){return Qe({enabled:e&&!!t,queryKey:["dashboard","automations","detail",t],queryFn:({signal:n})=>Ke(dw,`/api/automations/${encodeURIComponent(t)}`,n),retry:!1})}function ZX(e){return Qe({enabled:e,queryKey:["dashboard","automations","runs"],queryFn:({signal:t})=>Ke(T4,"/api/automations/runs",t),retry:!1})}function WX(e,t){return Qe({enabled:e&&!!t,queryKey:["dashboard","automations",t,"executions"],queryFn:({signal:n})=>Ke(I4,`/api/automations/${encodeURIComponent(t)}/executions`,n),retry:!1})}function KX(e,t){return Qe({enabled:e&&!!t,queryKey:["dashboard","automations",t,"versions"],queryFn:({signal:n})=>Ke(N4,`/api/automations/${encodeURIComponent(t)}/versions`,n),retry:!1})}function JX(){return Qe({queryKey:["dashboard","people"],queryFn:({signal:e})=>Ke(W3,"/api/people",e),retry:!1})}function QX(e){return Qe({enabled:!!e,queryKey:["dashboard","people",e],queryFn:async({signal:t})=>Ke(K3,`/api/people/${encodeURIComponent(e)}`,t),retry:!1})}function YX(e){return Qe({enabled:!!e,queryKey:["dashboard","people",e,"plugin-reports"],queryFn:({signal:t})=>Ke(_T,`/api/people/${encodeURIComponent(e)}/plugin-reports`,t),retry:!1})}function XX(e){return Qe({enabled:!!e,queryKey:["dashboard","people",e,"code"],queryFn:({signal:t})=>Ke(F3,`/api/people/${encodeURIComponent(e)}/code`,t),retry:!1})}function eee(e){return Qe({enabled:e,queryKey:["dashboard","personal-spend"],queryFn:({signal:t})=>Ke(J3,"/api/people/me/spend",t),refetchInterval:t=>zTe(t.state.data?.generatedAt),retry:!1,staleTime:0})}function tee(){return Qe({queryKey:["dashboard","locations"],queryFn:({signal:e})=>Ke(G3,"/api/locations",e),retry:!1})}function nee(e){return Qe({enabled:!!e,queryKey:["dashboard","locations",e],queryFn:async({signal:t})=>Ke(Z3,`/api/locations/${encodeURIComponent(e)}`,t),retry:!1})}function jTe(){return Qe({queryKey:["dashboard","skills"],queryFn:({signal:e})=>Ke($4,"/api/skills",e),retry:!1,staleTime:GT})}function BTe(){return Qe({queryKey:["dashboard","plugin-reports"],queryFn:({signal:e})=>Ke(_T,"/api/plugin-reports",e),retry:!1})}function aee(){return Qe({queryKey:["dashboard","stats"],queryFn:({signal:e})=>Ke(aj,"/api/stats",e),retry:!1})}function ree(e){let t=UTe(),n=Qe({queryKey:["dashboard","conversation-stats"],queryFn:({signal:i})=>Ke(O3,"/api/conversations/stats",i),retry:!1}),r=jTe(),a=BTe();return{data:t.data&&r.data?{...e,conversationStatsError:!!n.error,...n.data?{conversationStats:n.data}:void 0,conversationStatsLoading:n.isPending,pluginReportsError:!!a.error,...a.data?{pluginReports:a.data}:void 0,pluginReportsLoading:a.isPending,plugins:t.data,skills:r.data}:void 0,error:t.error??r.error,isPending:t.isPending||r.isPending}}var lee=b($(),1);var oee="Junior";function ln(){return typeof window>"u"?oee:window.__JUNIOR_DASHBOARD_AGENT_NAME__?.trim()||oee}function iee(e=ln()){return e.endsWith("s")?`${e}'`:`${e}'s`}function see(e,t=ln()){let n=e?.trim();return n?`${n} - ${t}`:t}function Ws(e){(0,lee.useEffect)(()=>{if(e?.trim())return document.title=see(e),()=>{document.title=see(void 0)}},[e])}function T(...e){return e.filter(Boolean).join(" ")}var uo="mx-auto w-full min-w-0 max-w-screen-xl",Fu="text-dashboard-text underline decoration-dashboard-border-heavy underline-offset-2 transition-colors hover:decoration-dashboard-text-muted",Vh="text-dashboard-text-muted hover:text-dashboard-text",cee="rounded-xl border border-dashboard-border-emphasis bg-dashboard-surface-raised shadow-[0_8px_32px_rgba(0,0,0,0.35)] transition-colors";var KT=b(w(),1),uee="inline-flex h-9 max-w-full items-center justify-center gap-2 rounded-md border border-dashboard-border-emphasis bg-dashboard-surface-raised px-3 font-sans text-sm font-medium leading-none text-dashboard-text transition-colors hover:border-dashboard-border-heavy hover:bg-dashboard-surface-hover hover:text-dashboard-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus",FTe="inline-flex h-9 max-w-full items-center justify-center gap-2 rounded-md border border-dashboard-border-strong bg-transparent px-3 font-sans text-sm font-medium leading-none text-dashboard-text-muted transition-colors hover:border-rose-300/40 hover:text-rose-300 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-rose-300/55";function ye({className:e,size:t="default",tone:n="default",type:r="button",...a}){let o=n==="danger";return(0,KT.jsx)("button",{...a,className:T("font-sans transition-colors disabled:cursor-not-allowed disabled:opacity-50",t==="icon"?T("grid size-9 place-items-center rounded-md border-0 bg-transparent p-0 focus-visible:outline-2 focus-visible:outline-offset-1 disabled:hover:!bg-transparent",o?"text-dashboard-text-muted hover:!bg-rose-300/10 hover:!text-rose-300 focus-visible:outline-rose-300/55 disabled:hover:!text-dashboard-text-muted":"text-dashboard-text-muted hover:!bg-dashboard-fill-strong hover:!text-dashboard-text focus-visible:outline-dashboard-focus disabled:hover:!text-dashboard-text-muted"):n==="primary"?"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-dashboard-text-solid bg-dashboard-text-solid px-3 font-sans text-sm font-medium leading-none text-dashboard-text-inverse hover:border-dashboard-text-subtle hover:bg-dashboard-text-subtle disabled:hover:border-dashboard-text-solid disabled:hover:bg-dashboard-text-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus":o?T(FTe,"disabled:hover:border-dashboard-border-strong disabled:hover:text-dashboard-text-muted"):T(uee,"disabled:hover:border-dashboard-border-emphasis disabled:hover:bg-dashboard-surface-raised disabled:hover:text-dashboard-text"),a.disabled?"":"cursor-pointer",e),type:r})}function Hu({className:e,...t}){return(0,KT.jsx)(fe,{...t,className:T(uee,"no-underline",e)})}function mr({className:e,pressed:t,type:n="button",variant:r,...a}){return(0,KT.jsx)("button",{...a,"aria-pressed":t,className:T(HTe[r],t?VTe[r]:qTe[r],e),type:n})}var HTe={pill:"cursor-pointer rounded-md border px-2 py-1 font-sans text-xs font-medium leading-tight transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus",segment:"inline-flex h-7 min-w-10 cursor-pointer items-center justify-center rounded-md border px-2 font-sans text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus",text:"cursor-pointer rounded-sm border-0 bg-transparent px-1.5 py-1 font-sans font-medium underline-offset-4 transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus"},VTe={pill:"border-dashboard-border-heavy bg-dashboard-text-solid text-dashboard-text-inverse",segment:"border-dashboard-border-interactive bg-dashboard-surface-active text-dashboard-text",text:"text-dashboard-text underline decoration-dashboard-text-solid"},qTe={pill:"border-dashboard-border-strong bg-dashboard-surface-raised text-dashboard-text-muted hover:border-dashboard-border-interactive hover:bg-dashboard-surface-hover hover:text-dashboard-text",segment:"border-transparent bg-transparent text-dashboard-text-muted hover:bg-dashboard-fill-hover hover:text-dashboard-text",text:"text-dashboard-text-muted hover:text-dashboard-text"};var qh=b(w(),1);function Ei(e){let t=e.tone==="error";return(0,qh.jsxs)("div",{role:t?"alert":"status",className:T("flex min-w-0 gap-3 rounded-md border p-4",t?"border-rose-300/25 bg-rose-300/5":"border-amber-300/25 bg-amber-300/5"),children:[(0,qh.jsx)(Li,{"aria-hidden":!0,size:18,className:T("mt-0.5 shrink-0",t?"text-rose-300":"text-amber-300")}),(0,qh.jsxs)("div",{className:"min-w-0",children:[(0,qh.jsx)("p",{className:"m-0 text-sm font-medium",children:e.title}),e.children?(0,qh.jsx)("div",{className:"mt-1 text-sm leading-relaxed text-dashboard-text-muted",children:e.children}):null]})]})}var xw=b(w(),1),GTe={accent:"text-dashboard-accent",danger:"text-rose-300",info:"text-cyan-300",neutral:"text-dashboard-text-muted",success:"text-emerald-300",warning:"text-amber-300"},ZTe={compact:"text-xs",default:"text-sm"};function In(e){return(0,xw.jsxs)("span",{className:T("inline-flex w-fit items-center gap-1.5 font-sans font-medium normal-case leading-snug tracking-normal",ZTe[e.size??"default"],GTe[e.tone??"neutral"],e.className),children:[(0,xw.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-current"}),(0,xw.jsx)("span",{className:"block first-letter:uppercase",children:e.children})]})}var dee=b(w(),1);function Z(e){let t=e.as??"div",n={none:"",sm:"p-4",md:"p-5 sm:p-6"}[e.padding??"none"],r=e.variant==="section"?"mb-4 border-dashboard-border-subtle bg-dashboard-fill-faint shadow-[0_24px_80px_rgba(0,0,0,0.18)]":e.variant==="raised"?"border-dashboard-border-emphasis bg-dashboard-surface-raised":"border-dashboard-border-subtle bg-dashboard-fill-faint";return(0,dee.jsx)(t,{className:T("min-w-0 overflow-hidden rounded-lg border",r,n,e.className),children:e.children})}var fee=b(w(),1);function $t(e){let t=e.as??"div";return(0,fee.jsx)(t,{"aria-hidden":"true",className:T("animate-pulse rounded-md bg-dashboard-fill-soft motion-reduce:animate-none",e.className)})}var Kt=b(w(),1);function To(e){let t=e.variant??"panel";return(0,Kt.jsxs)("div",{"aria-busy":"true","aria-live":"polite",className:T("grid gap-4",e.className),role:"status",children:[(0,Kt.jsx)("span",{className:"sr-only",children:e.label}),WTe(t)]})}function WTe(e){switch(e){case"stats":return(0,Kt.jsx)(KTe,{});case"overview":return(0,Kt.jsx)(JTe,{});case"list":return(0,Kt.jsx)(QTe,{});case"library":return(0,Kt.jsx)(YTe,{});case"panel":return(0,Kt.jsx)(Vu,{className:"min-h-64"})}}function KTe(){return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:Array.from({length:4},(e,t)=>(0,Kt.jsx)(Vu,{className:"min-h-[7.5rem] p-4 sm:min-h-32 sm:p-5"},t))}),(0,Kt.jsx)(Vu,{className:"min-h-[17rem]"})]})}function JTe(){return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,Kt.jsx)(Vu,{className:"min-h-[17rem]"}),(0,Kt.jsx)(Vu,{className:"min-h-[17rem]"})]}),(0,Kt.jsx)(tb,{className:"h-24 border-y border-dashboard-border-subtle bg-dashboard-fill-faint"}),(0,Kt.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,Kt.jsx)(Vu,{className:"min-h-56"}),(0,Kt.jsx)(Vu,{className:"min-h-56"})]})]})}function QTe(){return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)(Vu,{className:"min-h-20 p-4"}),(0,Kt.jsx)(tb,{className:"h-10 border-b border-dashboard-border-subtle"}),(0,Kt.jsx)(Vu,{className:"min-h-80"})]})}function YTe(){return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[(0,Kt.jsx)(tb,{className:"h-7 w-56 rounded-md bg-dashboard-fill-soft"}),(0,Kt.jsx)(tb,{className:"h-10 w-full max-w-md rounded-lg border border-dashboard-border-subtle bg-dashboard-fill-faint sm:w-72"})]}),(0,Kt.jsx)("div",{"aria-hidden":"true",className:"grid min-w-0 grid-cols-3 gap-1 border-b border-dashboard-border-subtle sm:flex",children:Array.from({length:3},(e,t)=>(0,Kt.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2.5 sm:justify-start",children:[(0,Kt.jsx)(tb,{className:"h-3 w-12 rounded-md bg-dashboard-fill-soft"}),(0,Kt.jsx)(tb,{className:"h-5 w-8 rounded-sm border border-dashboard-border-subtle bg-dashboard-fill-faint"})]},t))}),(0,Kt.jsx)(Vu,{className:"min-h-80"})]})}function Vu(e){return(0,Kt.jsx)(Z,{className:T("animate-pulse motion-reduce:animate-none",e.className),children:(0,Kt.jsx)("span",{"aria-hidden":"true"})})}function tb(e){return(0,Kt.jsx)($t,{className:e.className})}var fj=b(w(),1),XTe=[1,7,30,90];function mj(e){return e===1?"24h":`${e}d`}function nb(e){return e===1?"last 24 hours":`last ${e} days`}function nr(e){return e===1?"hour":e===7?"6hour":"day"}function mee(e){return e===1}function eNe(e){return e===7}function Pi(e){return e==="hour"?"hour":e==="6hour"?"6h":"day"}function ab(e){return e==="hour"?"hour":e==="6hour"?"6 hours":"day"}function Sw(e){return e==="hour"?"Hourly":e==="6hour"?"6-hour":"Daily"}function pr(e){return mee(e.range)&&e.hours?.length?e.hours.slice(-24):mee(e.range)?e.days.slice(-1):eNe(e.range)?e.sixHours?.length?[...e.sixHours]:e.hours?.length&&e.emptySixHour?tNe({empty:e.emptySixHour,hours:e.hours}):e.days.slice(-e.range):e.days.slice(-e.range)}function tNe(e){let t=new Map;for(let n of e.hours){let r=Date.parse(`${n.date}:00:00.000Z`);if(Number.isNaN(r))continue;let a=new Date(r);a.setUTCMinutes(0,0,0),a.setUTCHours(Math.floor(a.getUTCHours()/6)*6,0,0,0);let o=a.toISOString().slice(0,13),s={...t.get(o)??e.empty(o),date:o};for(let[l,u]of Object.entries(n))if(l!=="date"&&typeof u=="number"){let d=s[l];s[l]=(typeof d=="number"?d:0)+u}t.set(o,s)}if(e.hours.length>=24){let n=e.hours[e.hours.length-1]?.date,r=n?Date.parse(`${n}:00:00.000Z`):Date.now(),a=new Date(r);a.setUTCMinutes(0,0,0),a.setUTCHours(Math.floor(a.getUTCHours()/6)*6,0,0,0);let o=new Date(a.getTime()-9720*60*1e3),i=[];for(let s=new Date(o);s.getTime()<=a.getTime();s.setTime(s.getTime()+360*60*1e3)){let l=s.toISOString().slice(0,13);i.push(t.get(l)??e.empty(l))}return i}return[...t.values()].sort((n,r)=>n.date.localeCompare(r.date))}function rb(e){return(0,fj.jsx)("div",{"aria-label":"Reporting period",className:"flex items-center gap-1",role:"group",children:(e.options??XTe).map(t=>(0,fj.jsx)(mr,{onClick:()=>e.onChange(t),pressed:e.value===t,variant:"segment",children:mj(t)},t))})}var Um=b(w(),1);function It(e){Ws(e.documentTitle??(typeof e.title=="string"?e.title:void 0));let t=e.range!==void 0&&e.onRangeChange?(0,Um.jsx)(rb,{onChange:e.onRangeChange,...e.rangeOptions?{options:e.rangeOptions}:{},value:e.range}):void 0,n=e.actions??t;return(0,Um.jsxs)("header",{className:"flex min-w-0 items-center justify-between gap-6 border-b border-dashboard-border-subtle pb-4 sm:pb-6 max-md:flex-col max-md:items-stretch",children:[(0,Um.jsxs)("div",{className:"min-w-0",children:[(0,Um.jsx)("h2",{className:"m-0 font-display text-3xl font-light leading-none tracking-[-0.03em] text-dashboard-text sm:text-4xl",children:e.title}),(0,Um.jsx)("div",{className:"mt-2 max-w-2xl font-sans text-xs leading-relaxed text-dashboard-text-muted sm:text-sm",children:e.description})]}),n?(0,Um.jsx)("div",{className:"shrink-0",children:n}):null]})}var pee=b(w(),1);function is(e){return(0,pee.jsx)("div",{className:T(uo,"grid min-w-0 content-start gap-4 px-4 py-4 pb-[max(1rem,env(safe-area-inset-bottom))] sm:gap-6 sm:px-8 sm:py-8 sm:pb-8",e.className),children:e.children})}var Zh=b($(),1);var Gh=b($(),1);function Nl(e,t){let n=typeof t=="string"?t.startsWith("?")?t.slice(1):t:t?.toString()??"",r=e.indexOf("?"),a=r===-1?e:e.slice(0,r),o=r===-1?"":e.slice(r+1).replace(/^\?+/,""),i=new URLSearchParams(n);for(let[l,u]of new URLSearchParams(o))i.set(l,u);let s=i.toString();return s?`${a}?${s}`:a}function nNe(e,t){let n=e?.trim();return n&&t.includes(n)?n:void 0}function qu(e="q",t={}){let n=t.delayMs??250,r=t.resetPage??!1,[a,o]=$s(),i=a.get(e)?.trim()??"",[s,l]=(0,Gh.useState)(i);return(0,Gh.useEffect)(()=>{l(u=>u.trim()===i?u:i)},[i]),(0,Gh.useEffect)(()=>{let u=window.setTimeout(()=>{let d=s.trim();d!==i&&o(f=>{let m=new URLSearchParams(f);return r&&m.delete("page"),d?m.set(e,d):m.delete(e),m},{replace:!0})},n);return()=>window.clearTimeout(u)},[i,n,e,r,o,s]),[s,l,i]}function ef(e,t,n){let[r,a]=$s(),o=nNe(r.get(e),n)??t,i=(0,Gh.useCallback)(s=>{a(l=>{let u=new URLSearchParams(l);return s===t?u.delete(e):u.set(e,s),u},{replace:!0})},[t,e,a]);return[o,i]}var ob=b(w(),1);function hj(e){let{className:t,item:n}=e,r=sn(),a=Nl(n.to,r.search);if(n.isActive){let o=n.isActive(r.pathname);return(0,ob.jsx)(fe,{"aria-current":o?"page":void 0,className:t({isActive:o}),to:a,children:n.label})}return(0,ob.jsx)(lh,{className:t,end:n.end,to:a,children:n.label})}var pj=24;function gee(e){let t=e.scrollWidth-e.clientWidth;return{end:e.scrollLeft<t-1,start:e.scrollLeft>1}}function hee(e){let t=e.querySelector('[aria-current="page"]');if(!t||e.clientWidth===0)return;let n=gee(e),r=e.scrollLeft+(n.start?pj:0),a=e.scrollLeft+e.clientWidth-(n.end?pj:0),o=t.offsetLeft,i=o+t.offsetWidth;o>=r&&i<=a||(e.scrollLeft=o-(e.clientWidth-t.offsetWidth)/2)}function aNe(e){if(!e.start&&!e.end)return;let t=`${pj}px`,n=e.start?`transparent, black ${t}`:"black",r=e.end?`black calc(100% - ${t}), transparent`:"black",a=`linear-gradient(to right, ${n}, ${r})`;return{maskImage:a,WebkitMaskImage:a}}function Wh(e){let{pathname:t}=sn(),n=(0,Zh.useRef)(null),[r,a]=(0,Zh.useState)({end:!1,start:!1});(0,Zh.useLayoutEffect)(()=>{let i=n.current;if(!i)return;let s=()=>{let{end:u,start:d}=gee(i);a(f=>f.start===d&&f.end===u?f:{end:u,start:d})},l=new ResizeObserver(()=>{i.scrollLeft=0,hee(i),s()});s(),i.addEventListener("scroll",s,{passive:!0}),l.observe(i);for(let u of i.children)l.observe(u);return()=>{i.removeEventListener("scroll",s),l.disconnect()}},[]),(0,Zh.useLayoutEffect)(()=>{n.current&&hee(n.current)},[t]);let o=({isActive:i})=>T("relative flex h-10 items-center justify-center whitespace-nowrap font-sans text-sm font-medium no-underline transition-colors after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-dashboard-focus",i?"text-dashboard-text after:bg-dashboard-text-solid":"text-dashboard-text-muted hover:text-dashboard-text",e.fill?"min-w-max flex-[1_0_0]":"shrink-0");return(0,ob.jsx)("nav",{"aria-label":e.ariaLabel,className:T("flex min-w-0 max-w-full",!e.fill&&"w-fit"),children:(0,ob.jsx)("div",{className:T("relative -mx-1 flex gap-5 px-1 min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"),ref:n,style:aNe(r),children:e.items.map(i=>(0,ob.jsx)(hj,{className:o,item:i},i.to))})})}var Qn=b($(),1),ww=b(Is(),1),uc=b(w(),1),Gu=(0,Qn.createContext)(null);function JT(e){let[t,n]=(0,Qn.useState)(null),[r,a]=(0,Qn.useState)(null),[o,i]=(0,Qn.useState)(null),[s,l]=(0,Qn.useState)(null),u=(0,Qn.useRef)(null),d=(0,Qn.useCallback)(y=>{n(y)},[]),f=(0,Qn.useCallback)(y=>{a(y)},[]),m=(0,Qn.useCallback)(y=>{i(y)},[]),h=(0,Qn.useCallback)(y=>{l(y)},[]),p=(0,Qn.useCallback)(y=>{u.current=y},[]),g=(0,Qn.useCallback)(()=>{u.current?.()},[]),x=(0,Qn.useMemo)(()=>({mobileHeaderActionsSlot:o,mobileHeaderActionsSlotRef:m,mobileHeaderLiveSlot:s,mobileHeaderLiveSlotRef:h,mobileSecondarySlot:r,mobileSecondarySlotRef:f,openMobileNavigation:g,registerOpenMobileNavigation:p,secondarySlot:t,secondarySlotRef:d}),[o,m,s,h,r,f,g,p,t,d]);return(0,uc.jsx)(Gu.Provider,{value:x,children:e.children})}function vee(e){let t=(0,Qn.useContext)(Gu);if(!t)throw new Error("DashboardChrome requires DashboardChromeProvider");return(0,uc.jsxs)("div",{className:"sticky top-0 z-30 bg-dashboard-bg/95 pt-[env(safe-area-inset-top)]",children:[(0,uc.jsxs)("div",{className:"border-b border-dashboard-border-strong",children:[e.header,(0,uc.jsx)("div",{className:"hidden md:block",ref:t.secondarySlotRef})]}),e.banner]})}function yee(){let e=(0,Qn.useContext)(Gu);if(!e)throw new Error("MobileSecondaryNavigationSlot requires DashboardChromeProvider");return(0,uc.jsx)("div",{ref:e.mobileSecondarySlotRef})}function bee(){let e=(0,Qn.useContext)(Gu);if(!e)throw new Error("MobileHeaderActionsSlot requires DashboardChromeProvider");return(0,uc.jsx)("div",{className:"col-start-3 row-start-1 flex min-w-0 items-center justify-self-end md:hidden",ref:e.mobileHeaderActionsSlotRef})}function xee(){let e=(0,Qn.useContext)(Gu);if(!e)throw new Error("MobileHeaderLiveSlot requires DashboardChromeProvider");return(0,uc.jsx)("div",{className:"flex shrink-0 items-center md:hidden",ref:e.mobileHeaderLiveSlotRef})}function See(e){let t=(0,Qn.useContext)(Gu);return t?.mobileHeaderActionsSlot?(0,ww.createPortal)(e.children,t.mobileHeaderActionsSlot):null}function wee(e){let t=(0,Qn.useContext)(Gu);return t?.mobileHeaderLiveSlot?(0,ww.createPortal)(e.children,t.mobileHeaderLiveSlot):null}function Cee(){let e=(0,Qn.useContext)(Gu);return e?e.openMobileNavigation:null}function kee(e){let t=(0,Qn.useContext)(Gu),n=(0,Qn.useRef)(e);n.current=e,(0,Qn.useEffect)(()=>{if(!t)return;let r=()=>{n.current?.()};return t.registerOpenMobileNavigation(e?r:null),()=>{t.registerOpenMobileNavigation(null)}},[t,e])}function Ree(e){let t=(0,Qn.useContext)(Gu);return t?t.secondarySlot?(0,uc.jsxs)(uc.Fragment,{children:[(0,ww.createPortal)(e.desktop,t.secondarySlot),t.mobileSecondarySlot?(0,ww.createPortal)(e.mobile,t.mobileSecondarySlot):null]}):null:e.desktop}var Zu=b(w(),1);function jm(e){let t=({isActive:n})=>T("rounded-lg px-3 py-3 pl-6 font-sans text-sm font-medium no-underline transition-colors",n?"bg-dashboard-accent/[0.1] text-dashboard-accent-text":T("hover:bg-dashboard-fill-faint",Vh));return(0,Zu.jsxs)("div",{className:"min-w-0",children:[(0,Zu.jsx)(Ree,{desktop:(0,Zu.jsx)("div",{className:T(uo,"min-w-0 px-4 md:px-8"),children:(0,Zu.jsx)(Wh,{ariaLabel:e.ariaLabel,items:e.items})}),mobile:(0,Zu.jsx)("nav",{"aria-label":e.ariaLabel,className:"mt-3 grid gap-1 border-t border-dashboard-border pt-3",children:e.items.map(n=>(0,Zu.jsx)(hj,{className:t,item:n},n.to))})}),(0,Zu.jsx)("div",{className:"border-b border-dashboard-border px-4 pt-2 sm:px-8 md:hidden",children:(0,Zu.jsx)(Wh,{ariaLabel:e.ariaLabel,fill:!0,items:e.items})}),e.children]})}var Wu=b(w(),1),rNe=new Set(["list","runs"]);function oNe(e){if(e==="/automations/list"||/^\/automations\/(scheduled|event)\/[^/]+\/edit$/.test(e))return!0;let t=e.match(/^\/automations\/([^/]+)$/);return!!(t?.[1]&&!rNe.has(t[1]))}var iNe=[{end:!0,label:"Overview",to:"/automations"},{isActive:oNe,label:"Automations",to:"/automations/list"},{label:"Runs",to:"/automations/runs"}];function gj(e){return(0,Wu.jsx)(jm,{ariaLabel:"Automations navigation",items:iNe,children:e.children})}function _l(e){return(0,Wu.jsx)(gj,{children:(0,Wu.jsx)(is,{children:e.children})})}function Kh(e){return(0,Wu.jsxs)(Wu.Fragment,{children:[(0,Wu.jsx)(It,{description:e.description,title:e.title}),(0,Wu.jsx)(To,{label:e.label,variant:e.variant})]})}var fc=b($(),1);var ib=b(w(),1),sNe={compact:"font-sans font-medium text-xs text-dashboard-text-muted",default:"text-sm font-semibold text-dashboard-text"},lNe={compact:"grid gap-1.5",default:"grid gap-2"};function cn(e){let t=e.size??"default";return(0,ib.jsxs)("div",{className:T(lNe[t],e.className),children:[(0,ib.jsx)("label",{className:sNe[t],htmlFor:e.htmlFor,children:e.label}),e.children,e.error?(0,ib.jsx)("p",{id:e.htmlFor?`${e.htmlFor}-error`:void 0,role:"alert",className:"m-0 text-xs leading-relaxed text-rose-300",children:e.error}):null,e.help?(0,ib.jsx)("p",{id:e.htmlFor?`${e.htmlFor}-help`:void 0,className:"m-0 text-xs leading-relaxed text-dashboard-text-muted sm:text-sm",children:e.help}):null]})}var vj=b(w(),1),Iee="block w-full rounded-md border border-dashboard-border-emphasis bg-dashboard-ink px-3 py-2 font-sans text-sm text-dashboard-text placeholder:text-dashboard-text-muted/70 focus:border-dashboard-focus focus:outline-none focus:ring-1 focus:ring-dashboard-focus/25 aria-invalid:border-rose-300 disabled:cursor-not-allowed disabled:opacity-50";function xa({className:e,type:t="text",size:n="default",...r}){return(0,vj.jsx)("input",{...r,className:T(Iee,n==="comfortable"&&"min-h-11 text-base sm:min-h-10 sm:text-sm",e),type:t})}function tf({className:e,prose:t=!1,...n}){return(0,vj.jsx)("textarea",{...n,className:T(Iee,"min-h-36",t?"font-sans leading-relaxed":"font-mono",e)})}var Jh=b(w(),1);function dc(e){return(0,Jh.jsxs)("section",{className:"grid min-w-0 gap-5 border-t border-dashboard-border-emphasis py-8 md:grid-cols-[12rem_minmax(0,1fr)] md:gap-10",children:[(0,Jh.jsxs)("div",{children:[(0,Jh.jsx)("h2",{className:"m-0 font-display text-lg font-medium",children:e.title}),e.detail?(0,Jh.jsx)("p",{className:"mt-2 mb-0 text-sm leading-relaxed text-dashboard-text-muted",children:e.detail}):null]}),(0,Jh.jsx)("div",{className:"grid min-w-0 content-start gap-5",children:e.children})]})}var eN=b($(),1);var Cw=b(w(),1),cNe={form:"min-h-11 rounded-md border border-dashboard-border-emphasis bg-dashboard-ink pl-3 py-2 text-base text-dashboard-text focus:border-dashboard-focus focus:outline-none aria-invalid:border-rose-300 sm:min-h-10 sm:text-sm",filter:"h-9 rounded-lg border border-dashboard-border-emphasis bg-dashboard-control pl-2 text-sm text-dashboard-text transition-colors hover:border-dashboard-border-interactive focus:border-dashboard-focus focus:outline-none focus:ring-1 focus:ring-dashboard-focus/25",sort:"h-full bg-dashboard-control pl-2 font-sans text-xs text-dashboard-text-muted outline-none"};function hr({className:e,variant:t="form",...n}){let r=!n.multiple&&(n.size??1)<=1;return(0,Cw.jsxs)("span",{className:T("relative block w-full min-w-0",t==="sort"&&"h-full"),children:[(0,Cw.jsx)("select",{...n,className:T("block w-full min-w-0 disabled:cursor-not-allowed disabled:opacity-60 [color-scheme:var(--dashboard-color-scheme,dark)]",cNe[t],r?"appearance-none pr-9 forced-colors:appearance-auto":"pr-3",e)}),r?(0,Cw.jsx)(dh,{"aria-hidden":"true",className:T("pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-dashboard-text-muted forced-colors:hidden",n.disabled&&"opacity-60"),size:16}):null]})}var QT=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function YT(e){return{title:e.title??"",instruction:e.instruction,credentialMode:e.credentialMode,outcomes:e.outcomes,trigger:e.kind==="event"?e.trigger:void 0}}function XT(e){let t=e.schedule.recurrence;if(e.schedule.kind==="recurring"&&t){let{time:n,weekdays:r,...a}=t;return{kind:"recurring",...a,timezone:e.schedule.timezone,time:`${String(n.hour).padStart(2,"0")}:${String(n.minute).padStart(2,"0")}`,weekdays:r?.flatMap(o=>QT[o]??[])}}if(e.nextRunAtMs){let n=new Intl.DateTimeFormat("en-CA",{timeZone:e.schedule.timezone,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(e.nextRunAtMs),r=a=>n.find(o=>o.type===a)?.value??"";return{kind:"one_off",timezone:e.schedule.timezone,timing:{type:"at",date:`${r("year")}-${r("month")}-${r("day")}`,time:`${r("hour")}:${r("minute")}`}}}return{kind:"recurring",frequency:"daily",time:"09:00",timezone:e.schedule.timezone}}function Tee(e,t){let n={};return t.title!==(e.title??"")&&(n.title=t.title),t.instruction!==e.instruction&&(n.instruction=t.instruction),t.credentialMode!==e.credentialMode&&(n.credentialMode=t.credentialMode),JSON.stringify(t.outcomes)!==JSON.stringify(e.outcomes)&&(n.outcomes=t.outcomes),e.kind==="scheduled"&&t.schedule&&(n.schedule=t.schedule),e.kind==="event"&&JSON.stringify(t.trigger)!==JSON.stringify(e.trigger)&&(n.trigger=t.trigger),n}var wt=b(w(),1);function Nee(e){let t=e.value??XT(e.automation),[n,r]=(0,eN.useState)(e.value);(0,eN.useEffect)(()=>{let f=setTimeout(()=>r(e.value),300);return()=>clearTimeout(f)},[e.value]);let a=A4.safeParse(n),o=Qe({queryKey:["dashboard","automation-schedule-preview",e.automation.id,n],enabled:!!n&&a.success,retry:!1,queryFn:()=>co(E4,`/api/automations/${encodeURIComponent(e.automation.id)}/preview`,n)}),i=t.kind==="recurring"?t.frequency:"once",s=t.kind==="recurring"?t.time:t.timing.time,l=e.value?o.data?.nextRunAtMs:e.automation.nextRunAtMs,u=e.value!==n||o.isFetching,d=o.error instanceof Ar?o.error.apiError:o.error?"Schedule preview could not be loaded. Try again.":e.value&&!a.success&&!u?a.error.issues[0]?.message:void 0;return(0,wt.jsxs)(wt.Fragment,{children:[(0,wt.jsxs)("div",{className:"grid grid-cols-1 items-start gap-4 sm:grid-cols-2",children:[(0,wt.jsx)(cn,{label:"Repeat",htmlFor:"schedule-frequency",children:(0,wt.jsxs)(hr,{id:"schedule-frequency",value:i,onChange:f=>{let m=f.target.value;m!=="once"&&m!=="daily"&&m!=="weekly"&&m!=="monthly"&&m!=="yearly"||e.onChange(m==="once"?{kind:"one_off",timezone:t.timezone??e.automation.schedule.timezone,timing:{type:"at",date:"",time:s}}:{kind:"recurring",timezone:t.timezone,time:s,frequency:m,interval:1,weekdays:m==="weekly"?["monday"]:void 0,dayOfMonth:["monthly","yearly"].includes(m)?1:void 0,month:m==="yearly"?1:void 0})},children:[(0,wt.jsx)("option",{value:"once",children:"Once"}),(0,wt.jsx)("option",{value:"daily",children:"Every day"}),(0,wt.jsx)("option",{value:"weekly",children:"Every week"}),(0,wt.jsx)("option",{value:"monthly",children:"Every month"}),(0,wt.jsx)("option",{value:"yearly",children:"Every year"})]})}),(0,wt.jsx)(cn,{label:"Time",htmlFor:"schedule-time",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-time",type:"time",value:s,onChange:f=>e.onChange(t.kind==="recurring"?{...t,time:f.target.value}:{...t,timing:{type:"at",date:t.timing.date,time:f.target.value}})})})]}),t.kind==="recurring"?(0,wt.jsxs)(wt.Fragment,{children:[t.frequency==="weekly"?(0,wt.jsxs)("fieldset",{children:[(0,wt.jsx)("legend",{className:"mb-2 text-sm font-semibold",children:"On"}),(0,wt.jsx)("div",{className:"grid grid-cols-7 gap-1.5",children:[...QT.slice(1),QT[0]].map(f=>(0,wt.jsx)("button",{type:"button","aria-label":f,"aria-pressed":t.weekdays?.includes(f)??!1,onClick:()=>e.onChange({...t,weekdays:t.weekdays?.includes(f)?t.weekdays.filter(m=>m!==f):[...t.weekdays??[],f]}),className:T("min-h-11 cursor-pointer rounded-md border px-1 text-xs font-medium capitalize focus-visible:outline-2 focus-visible:outline-dashboard-focus sm:min-h-10 sm:text-sm",t.weekdays?.includes(f)?"border-dashboard-focus/50 bg-dashboard-focus/10 text-dashboard-focus":"border-dashboard-border-emphasis text-dashboard-text-muted hover:bg-dashboard-fill-hover"),children:f.slice(0,3)},f))})]}):null,(0,wt.jsxs)("div",{className:"grid grid-cols-1 items-start gap-4 sm:grid-cols-2",children:[(0,wt.jsx)(cn,{label:"Interval",htmlFor:"schedule-interval",help:"Number of calendar periods between runs.",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-interval",type:"number",min:1,max:365,value:t.interval??1,onChange:f=>e.onChange({...t,interval:f.target.valueAsNumber})})}),(0,wt.jsx)(cn,{label:"Start date",htmlFor:"schedule-start",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-start",type:"date",value:t.startDate??"",onChange:f=>e.onChange({...t,startDate:f.target.value||void 0})})})]}),t.frequency==="monthly"||t.frequency==="yearly"?(0,wt.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,wt.jsx)(cn,{label:"Day of month",htmlFor:"schedule-day",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-day",type:"number",min:1,max:31,value:t.dayOfMonth??1,onChange:f=>e.onChange({...t,dayOfMonth:f.target.valueAsNumber})})}),t.frequency==="yearly"?(0,wt.jsx)(cn,{label:"Month",htmlFor:"schedule-month",children:(0,wt.jsx)(hr,{id:"schedule-month",value:t.month??1,onChange:f=>e.onChange({...t,month:Number(f.target.value)}),children:Array.from({length:12},(f,m)=>(0,wt.jsx)("option",{value:m+1,children:new Intl.DateTimeFormat("en",{month:"long",timeZone:"UTC"}).format(new Date(Date.UTC(2026,m,1)))},m))})}):null]}):null]}):(0,wt.jsx)(cn,{label:"Date",htmlFor:"schedule-date",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-date",type:"date",value:t.timing.date,onChange:f=>e.onChange({...t,timing:{type:"at",time:s,date:f.target.value}})})}),(0,wt.jsxs)(cn,{label:"Timezone",htmlFor:"schedule-timezone",help:"Use an IANA timezone. The schedule follows local time, including daylight saving time.",children:[(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-timezone",list:"automation-timezones",value:t.timezone??"",onChange:f=>e.onChange({...t,timezone:f.target.value})}),(0,wt.jsx)("datalist",{id:"automation-timezones",children:["UTC",...Intl.supportedValuesOf("timeZone")].map(f=>(0,wt.jsx)("option",{children:f},f))})]}),(0,wt.jsxs)("div",{role:"status",className:"flex gap-3 rounded-md bg-dashboard-fill-soft p-3 text-sm leading-relaxed",children:[(0,wt.jsx)(Bc,{"aria-hidden":!0,size:17,className:"mt-0.5 shrink-0 text-dashboard-text-muted"}),(0,wt.jsx)("div",{children:u?"Checking schedule\u2026":d?(0,wt.jsxs)(wt.Fragment,{children:[(0,wt.jsx)("span",{className:"text-rose-300",children:d}),o.error?(0,wt.jsx)(ye,{onClick:()=>{o.refetch()},children:"Try again"}):null]}):l?(0,wt.jsxs)(wt.Fragment,{children:["Next run"," ",new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short",timeZone:e.value?o.data?.schedule.timezone??"UTC":e.automation.schedule.timezone}).format(l)]}):"No next run."})]}),e.value?(0,wt.jsx)(ye,{className:"w-fit",onClick:()=>e.onChange(void 0),children:"Keep saved schedule"}):null]})}var rn=b(w(),1);function _ee(e){let t=Qe({queryKey:["dashboard","automation-event-catalog"],queryFn:({signal:o})=>Ke(L4,"/api/automations/event-catalog",o),retry:!1}),n=t.data?.find(o=>o.namespace===e.value.namespace&&o.type===e.value.resourceType),r=!n||e.value.events.some(o=>!n.supportedEvents.includes(o))||Object.entries(e.value.match??{}).some(([o,i])=>{let s=n.matchFields?.[o];return s?(Array.isArray(i)?i:[i]).some(l=>typeof l!==s.kind||s.enum&&!s.enum.includes(String(l))):!0}),a=(o,i)=>{let s={...e.value.match};i===void 0?delete s[o]:s[o]=i,e.onChange({...e.value,match:s})};return(0,rn.jsxs)(rn.Fragment,{children:[t.error?(0,rn.jsxs)(Ei,{title:"Event choices could not be loaded.",children:["Saved values are kept."," ",(0,rn.jsx)(ye,{onClick:()=>{t.refetch()},children:"Try again"})]}):t.isPending?(0,rn.jsx)("p",{role:"status",children:"Loading event choices\u2026"}):null,r&&t.data?(0,rn.jsxs)(Ei,{title:"Saved trigger \xB7 Kept unchanged",children:["Some saved values are not in the current catalog. You can edit other fields, or select a new resource type to replace the trigger.",(0,rn.jsx)("pre",{className:"whitespace-pre-wrap break-all text-xs",children:JSON.stringify(e.value,null,2)})]}):null,(0,rn.jsx)(cn,{label:r?"Replace trigger":"Resource type",htmlFor:"trigger-resource",children:(0,rn.jsxs)(hr,{id:"trigger-resource",value:r?"":`${e.value.namespace}:${e.value.resourceType}`,onChange:o=>{let i=t.data?.find(s=>`${s.namespace}:${s.type}`===o.target.value);i&&window.confirm("Replace the saved trigger? Its resource, events, and conditions will be cleared.")&&e.onChange({namespace:i.namespace,resourceType:i.type,identifier:"",label:"",events:[]})},children:[(0,rn.jsx)("option",{value:"",disabled:!0,children:"Keep saved trigger"}),t.data?.map(o=>(0,rn.jsxs)("option",{value:`${o.namespace}:${o.type}`,children:[o.namespace," \xB7 ",o.type.replaceAll("_"," ")]},`${o.namespace}:${o.type}`))]})}),!r&&n?(0,rn.jsxs)(rn.Fragment,{children:[(0,rn.jsx)(cn,{label:"Resource name",htmlFor:"trigger-label",children:(0,rn.jsx)(xa,{size:"comfortable",id:"trigger-label",value:e.value.label,onChange:o=>e.onChange({...e.value,label:o.target.value})})}),(0,rn.jsx)(cn,{label:"Resource identifier",htmlFor:"trigger-identifier",help:"Use the exact provider resource identifier, not its display name.",children:(0,rn.jsx)(xa,{size:"comfortable",id:"trigger-identifier",value:e.value.identifier,onChange:o=>e.onChange({...e.value,identifier:o.target.value})})}),(0,rn.jsxs)("fieldset",{children:[(0,rn.jsx)("legend",{className:"mb-2 text-sm font-semibold",children:"Run on these events"}),(0,rn.jsx)("div",{className:"divide-y divide-dashboard-border-subtle rounded-md border border-dashboard-border-emphasis",children:n.supportedEvents.map(o=>(0,rn.jsxs)("label",{className:"flex min-h-11 cursor-pointer items-start gap-3 px-3 py-3 text-sm",children:[(0,rn.jsx)("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0 accent-dashboard-focus",checked:e.value.events.includes(o),onChange:()=>e.onChange({...e.value,events:e.value.events.includes(o)?e.value.events.filter(i=>i!==o):[...e.value.events,o]})}),(0,rn.jsxs)("span",{className:"min-w-0 break-words",children:[o.replaceAll("_"," ").replaceAll("."," \xB7 "),n.guidance?.[o]?(0,rn.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-dashboard-text-muted",children:n.guidance[o]}):null]})]},o))})]}),Object.keys(n.matchFields??{}).length?(0,rn.jsxs)("fieldset",{className:"grid gap-4",children:[(0,rn.jsx)("legend",{className:"mb-3 text-sm font-semibold",children:"Only when"}),(0,rn.jsx)("p",{className:"m-0 text-xs leading-relaxed text-dashboard-text-muted",children:"All conditions must match. Leave a field blank to match any value. Existing lists match any one listed value."}),Object.entries(n.matchFields??{}).map(([o,i])=>{let s=e.value.match?.[o];return(0,rn.jsx)(cn,{label:o,htmlFor:`match-${o}`,help:i.description,children:Array.isArray(s)?(0,rn.jsxs)("div",{className:"text-sm",children:[(0,rn.jsx)("span",{className:"break-all",children:s.join(", ")})," ",(0,rn.jsx)(ye,{onClick:()=>a(o,void 0),children:"Remove condition"})]}):i.kind==="boolean"||i.enum?(0,rn.jsxs)(hr,{id:`match-${o}`,value:s===void 0?"":String(s),onChange:l=>a(o,l.target.value===""?void 0:i.kind==="boolean"?l.target.value==="true":l.target.value),children:[(0,rn.jsx)("option",{value:"",children:"Any value"}),(i.enum??["true","false"]).map(l=>(0,rn.jsx)("option",{children:l},l))]}):(0,rn.jsx)(xa,{size:"comfortable",id:`match-${o}`,type:i.kind==="number"?"number":"text",step:"any",value:s===void 0?"":String(s),onChange:l=>a(o,l.target.value===""?void 0:i.kind==="number"?l.target.valueAsNumber:l.target.value)})},o)})]}):null]}):null,JSON.stringify(e.value)!==JSON.stringify(e.original)?(0,rn.jsx)(ye,{className:"w-fit",onClick:()=>e.onChange(e.original),children:"Keep saved trigger"}):null]})}function Qh(e,t){return typeof e.destination=="string"?e.destination==="task_creator"?"Creator \xB7 Direct message":`${t.label} \xB7 ${t.visibility}`:e.destination.channelId===t.channelId&&e.destination.teamId===t.teamId?`${t.label} \xB7 ${t.visibility}`:`Saved destination \xB7 ${e.destination.channelId}`}var da=b(w(),1);function tN(e){return e.outcomes.length?(0,da.jsx)("ol",{className:"m-0 grid gap-2 pl-5 text-sm",children:e.outcomes.map((t,n)=>(0,da.jsx)("li",{children:Qh(t,e.destination)},n))}):(0,da.jsx)("p",{className:"m-0 text-sm",children:"No success message"})}function Lee(e){let t=e.original.length?e.original:[{action:"send_message",destination:"current_conversation"}],n=[...e.original.flatMap((r,a)=>typeof r.destination=="string"?[]:[{value:`saved:${a}`,label:Qh(r,e.destination),outcome:r}]),{value:"current_conversation",label:`${e.destination.label} \xB7 ${e.destination.visibility}`,outcome:{action:"send_message",destination:"current_conversation"}},{value:"task_creator",label:"Creator \xB7 Direct message",outcome:{action:"send_message",destination:"task_creator"}}];return(0,da.jsxs)(da.Fragment,{children:[(0,da.jsxs)("fieldset",{children:[(0,da.jsx)("legend",{className:"sr-only",children:"Success messages"}),(0,da.jsx)("div",{className:"flex flex-wrap gap-x-6 gap-y-3",children:[!0,!1].map(r=>(0,da.jsxs)("label",{className:"inline-flex min-h-8 cursor-pointer items-center gap-2 text-sm",children:[(0,da.jsx)("input",{type:"radio",name:"messages",className:"size-4 accent-dashboard-focus",checked:!!e.value.length===r,onChange:()=>e.onChange(r?t:[])}),r?"Send a message":"No success message"]},String(r)))})]}),e.value.length?(0,da.jsxs)("div",{className:"grid gap-4 sm:gap-2",children:[e.value.map((r,a)=>{let o=e.original.findIndex(i=>JSON.stringify(i)===JSON.stringify(r));return(0,da.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,da.jsxs)("span",{className:"w-4 text-xs text-dashboard-text-muted",children:[a+1,"."]}),(0,da.jsx)("div",{className:T("min-w-0 flex-1",e.value.length>1&&"order-last basis-full sm:order-none sm:basis-auto"),children:(0,da.jsx)(hr,{"aria-label":`Message ${a+1} destination`,value:typeof r.destination=="string"?r.destination:`saved:${o}`,onChange:i=>{let s=n.find(l=>l.value===i.target.value);s&&e.onChange(e.value.map((l,u)=>u===a?s.outcome:l))},children:n.map(i=>(0,da.jsx)("option",{value:i.value,children:i.label},i.value))})}),e.value.length>1?(0,da.jsxs)(da.Fragment,{children:[(0,da.jsx)(ye,{size:"icon",className:"ml-auto sm:ml-0","aria-label":`Move message ${a+1} up`,disabled:a===0,onClick:()=>{let i=[...e.value],s=i[a-1];s&&(i[a-1]=r,i[a]=s,e.onChange(i))},children:(0,da.jsx)(AS,{size:16})}),(0,da.jsx)(ye,{size:"icon","aria-label":`Remove message ${a+1}`,onClick:()=>e.onChange(e.value.filter((i,s)=>s!==a)),children:(0,da.jsx)(io,{size:16})})]}):null]},a)}),e.value.length<5?(0,da.jsxs)(ye,{className:"w-fit",onClick:()=>e.onChange([...e.value,{action:"send_message",destination:"task_creator"}]),children:[(0,da.jsx)(Wd,{size:15}),"Add message"]}):null]}):(0,da.jsx)("p",{className:"m-0 text-sm leading-relaxed text-dashboard-text-muted",children:"Junior still does the work. No message is sent after success."}),(0,da.jsxs)("p",{className:"m-0 text-xs leading-relaxed text-dashboard-text-muted",children:[e.value.length?"Messages are sent in this order. ":"","This does not limit actions in the instruction."]})]})}var Le=b(w(),1);function Eee(e){let[t,n]=(0,fc.useState)(e.automation),[r,a]=(0,fc.useState)(()=>YT(e.automation)),[o,i]=(0,fc.useState)({}),[s,l]=(0,fc.useState)(),u=(0,fc.useRef)(null),d=(0,fc.useRef)(!1),f=_r(),m=pn(),h=Tee(t,r),p=Object.keys(h).length>0,g={kind:t.kind,revision:t.revision,...h},x=I2(()=>p&&!d.current),y=(0,fc.useRef)(null);(0,fc.useEffect)(()=>{x.state==="blocked"&&y.current?.focus()},[x.state]);let v=`/api/automations/${encodeURIComponent(t.id)}`;(0,fc.useEffect)(()=>{let B=oe=>{p&&!d.current&&(oe.preventDefault(),oe.returnValue="")};return window.addEventListener("beforeunload",B),()=>window.removeEventListener("beforeunload",B)},[p]);let S=()=>requestAnimationFrame(()=>(u.current?.querySelector('[aria-invalid="true"]')??u.current?.querySelector("[data-save-error]"))?.focus()),C=zn({mutationFn:()=>Qy(lc,v,g),onSuccess:async()=>{d.current=!0,await m.invalidateQueries({queryKey:["dashboard","automations"]}),f(e.returnPath,{state:{automationSaved:!0}})},onError:B=>{i(B instanceof Ar?B.fields??{}:{}),S()}});function R(B){s&&(a(B?{...YT(s),...h}:YT(s)),n(s),l(void 0),C.reset(),i({}))}let I=zn({mutationFn:()=>Ke(lc,`${v}/edit`),onSuccess:l}),N=C.error instanceof Ar&&C.error.code==="conflict",k=B=>a(oe=>({...oe,...B})),z=B=>Object.entries(o).filter(([oe])=>oe===B||oe.startsWith(`${B}.`)).flatMap(([,oe])=>oe).join(" ")||void 0,L=t.kind==="scheduled"?"schedule":"trigger",q=t.ownedByViewer,P=e.summary.createdBy,V=!q&&t.credentialMode==="creator"&&(h.instruction!==void 0||t.kind==="event"&&h.trigger!==void 0),F=z(L),se=B=>({"aria-invalid":!!z(B)||void 0,"aria-describedby":z(B)?`${B}-error`:void 0});return(0,Le.jsxs)("form",{ref:u,noValidate:!0,onSubmit:B=>{if(B.preventDefault(),C.isPending||N||!p)return;let oe=_4.safeParse(g);if(!oe.success){let G={};for(let re of oe.error.issues)(G[re.path.join(".")]??=[]).push(re.message);i(G),S();return}i({}),C.mutate()},children:[x.state==="blocked"?(0,Le.jsx)("div",{tabIndex:-1,ref:y,className:"mb-6 outline-none",children:(0,Le.jsxs)(Ei,{title:"Discard unsaved changes?",children:[(0,Le.jsx)("p",{children:"Your changes have not been saved."}),(0,Le.jsxs)("div",{className:"flex gap-2",children:[(0,Le.jsx)(ye,{onClick:()=>x.reset(),children:"Keep editing"}),(0,Le.jsx)(ye,{onClick:()=>x.proceed(),children:"Discard changes"})]})]})}):null,C.error||Object.keys(o).length?(0,Le.jsx)("div",{tabIndex:-1,"data-save-error":!0,className:"mb-6 outline-none",children:(0,Le.jsxs)(Ei,{tone:N?"warning":"error",title:N?"This automation changed while you were editing.":"Changes could not be saved.",children:[(0,Le.jsxs)("p",{className:"mt-1",children:["Your edits are still here."," ",N?"Review the latest version before saving again.":C.error instanceof Ar?C.error.apiError:"Check the fields below, or try again."]}),N?(0,Le.jsx)(ye,{disabled:I.isPending,onClick:()=>I.mutate(),children:I.isPending?"Loading\u2026":"Review latest version"}):null,I.error?(0,Le.jsx)("p",{role:"alert",children:"The latest version could not be loaded. Try again."}):null]})}):null,s?(0,Le.jsx)("div",{className:"mb-6",children:(0,Le.jsxs)(Ei,{title:"Compare your edits with the latest saved version",children:[(0,Le.jsx)("p",{children:"Only the fields you changed are shown. Keeping your edits will replace these fields. Other saved fields stay unchanged."}),Object.entries(h).map(([B,oe])=>(0,Le.jsxs)("section",{className:"my-4",children:[(0,Le.jsx)("h3",{className:"text-sm font-semibold capitalize",children:B==="credentialMode"?"Credentials":B}),(0,Le.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,Le.jsxs)("div",{children:[(0,Le.jsx)("p",{children:"Latest saved"}),(0,Le.jsx)("pre",{className:"whitespace-pre-wrap break-words font-sans text-sm",children:Aee(B==="schedule"&&s.kind==="scheduled"?XT(s):s[B])})]}),(0,Le.jsxs)("div",{children:[(0,Le.jsx)("p",{children:"Your edit"}),(0,Le.jsx)("pre",{className:"whitespace-pre-wrap break-words font-sans text-sm",children:Aee(oe)})]})]})]},B)),(0,Le.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,Le.jsx)(ye,{onClick:()=>R(!0),children:"Keep my changed fields"}),(0,Le.jsx)(ye,{onClick:()=>R(!1),children:"Use latest saved version"})]})]})}):null,q?null:(0,Le.jsxs)("p",{className:"mt-0 mb-6 max-w-2xl text-sm leading-relaxed text-dashboard-text-muted",children:[P," created this automation. You can edit it because it is in a public channel. Only ",P," can change where results go or turn on their connected accounts. Version history keeps every saved change."]}),(0,Le.jsxs)("fieldset",{disabled:C.isPending,className:"min-w-0",children:[(0,Le.jsxs)(dc,{title:"What to do",detail:"Give Junior a clear instruction and a name you can find later.",children:[(0,Le.jsx)(cn,{label:"Title",htmlFor:"title",error:z("title"),children:(0,Le.jsx)(xa,{size:"comfortable",id:"title",value:r.title,placeholder:e.summary.title,onChange:B=>k({title:B.target.value}),...se("title")})}),(0,Le.jsxs)(cn,{label:"Instruction",htmlFor:"instruction",error:z("instruction"),children:[(0,Le.jsx)(tf,{prose:!0,id:"instruction",rows:8,value:r.instruction,onChange:B=>k({instruction:B.target.value}),...se("instruction"),className:"resize-y text-base sm:text-sm"}),(0,Le.jsxs)("p",{className:"m-0 text-right text-xs text-dashboard-text-muted",children:[r.instruction.length.toLocaleString()," / 4,000"]})]})]}),(0,Le.jsx)(dc,{title:"When to run",detail:t.kind==="scheduled"?"Choose a schedule in a specific timezone.":"Run when a matching event occurs.",children:(0,Le.jsxs)("div",{id:`${L}-error`,tabIndex:-1,"aria-invalid":!!F||void 0,className:"grid min-w-0 gap-5 outline-none",children:[F?(0,Le.jsx)("p",{role:"alert",className:"m-0 text-sm text-rose-300",children:F}):null,t.kind==="scheduled"?(0,Le.jsx)(Nee,{automation:t,value:r.schedule,onChange:B=>k({schedule:B})}):(0,Le.jsx)(_ee,{value:r.trigger??t.trigger,original:t.trigger,onChange:B=>k({trigger:B})})]})}),(0,Le.jsxs)(dc,{title:"Where results go",detail:"Choose who gets a message after successful work.",children:[z("outcomes")?(0,Le.jsx)("p",{role:"alert",className:"m-0 text-sm text-rose-300",children:z("outcomes")}):null,q?(0,Le.jsx)(Lee,{value:r.outcomes,original:t.outcomes,destination:e.summary.destination,onChange:B=>k({outcomes:B})}):(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(tN,{outcomes:t.outcomes,destination:e.summary.destination}),(0,Le.jsxs)("p",{className:"m-0 text-xs text-dashboard-text-muted",children:["Only ",P," can change where results go."]})]})]}),(0,Le.jsxs)(dc,{title:"Credentials",detail:"Choose which connected accounts Junior can use.",children:[(0,Le.jsxs)("fieldset",{className:"divide-y divide-dashboard-border-subtle rounded-md border border-dashboard-border-emphasis",children:[(0,Le.jsx)("legend",{className:"sr-only",children:"Credential mode"}),[["creator",q?"Your connected accounts":`${P}\u2019s connected accounts`,q?"Uses accounts connected by you, the creator.":`Uses accounts connected by ${P}. Only ${P} can turn this on.`],["system","System credentials only",q?"Does not use your connected accounts. Some work may not be possible.":"Does not use anyone\u2019s connected accounts. Some work may not be possible."]].map(([B,oe,G])=>(0,Le.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 px-4 py-4 has-checked:bg-dashboard-fill-soft has-disabled:cursor-not-allowed has-disabled:opacity-60",children:[(0,Le.jsx)("input",{type:"radio",name:"credentials",className:"mt-0.5 size-4 shrink-0 accent-dashboard-focus",checked:V?B==="system":r.credentialMode===B,disabled:B==="creator"&&!q&&(t.credentialMode!=="creator"||V),onChange:()=>k({credentialMode:B})}),(0,Le.jsxs)("span",{children:[(0,Le.jsx)("span",{className:"block text-sm font-medium",children:oe}),(0,Le.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-dashboard-text-muted",children:G})]})]},B))]}),V?(0,Le.jsxs)(Ei,{title:"Saving switches this automation to system credentials.",children:["Only ",P," can let a changed instruction",t.kind==="event"?" or trigger":""," use their connected accounts."]}):null,z("credentialMode")?(0,Le.jsx)("p",{role:"alert",children:z("credentialMode")}):null]})]}),(0,Le.jsx)("p",{className:"mb-5 text-xs leading-relaxed text-dashboard-text-muted sm:hidden",children:"Changes apply to future work. Saving does not run this automation."}),(0,Le.jsx)("div",{className:"sticky bottom-0 z-20 -mx-4 border-t border-dashboard-border-emphasis bg-dashboard-bg px-4 py-4 sm:-mx-8 sm:px-8",children:(0,Le.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,Le.jsxs)("div",{className:"min-w-0 flex-1",role:"status",children:[(0,Le.jsx)("p",{className:"m-0 text-xs font-medium sm:text-sm",children:C.isPending?"Saving\u2026":p?"Unsaved changes":"Unchanged"}),(0,Le.jsx)("p",{className:"mt-1 mb-0 hidden text-xs text-dashboard-text-muted sm:block",children:"Changes apply to future work. Saving does not run it."})]}),(0,Le.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,Le.jsx)(fe,{to:e.returnPath,className:"inline-flex min-h-11 items-center rounded-md border border-dashboard-border-emphasis px-3 text-sm text-dashboard-text no-underline sm:min-h-9",children:"Cancel"}),(0,Le.jsx)(ye,{type:"submit",tone:"primary",className:"min-h-11 sm:min-h-9",disabled:!p||C.isPending||N,children:"Save changes"})]})]})})]})}function Aee(e){return e==null?"Not set":typeof e=="string"?e:JSON.stringify(e,null,2)}var sb=b(w(),1);function Pee(){return(0,sb.jsx)("div",{role:"status","aria-label":"Loading automation editor",children:["What to do","When to run","Where results go","Credentials"].map((e,t)=>(0,sb.jsxs)(dc,{title:e,children:[(0,sb.jsx)($t,{className:"h-4 w-24"}),(0,sb.jsx)($t,{className:t===0?"h-48 w-full":"h-20 w-full"})]},e))})}var Un=b(w(),1);function Dee(e){let{automationId:t}=er(),n=sn(),r=eb(e.enabled,t),a=r.data&&!(r.data.kind==="scheduled"&&r.data.status==="completed"),o=Qe({queryKey:["dashboard","automations","edit",t],enabled:e.enabled&&!!a,retry:!1,queryFn:({signal:d})=>Ke(lc,`/api/automations/${encodeURIComponent(t)}/edit`,d)}),i=`/automations/list${n.search}`,s=r.data;Ws(s?a?`${s.title} \xB7 Edit`:s.title:"Edit automation");let l=s?.kind==="event"?s.status!=="active"?s.status:s.triggerAvailable?"active":"unavailable":s?.status,u=l==="active"?"success":l==="blocked"||l==="unavailable"?"warning":"neutral";return(0,Un.jsx)(gj,{children:(0,Un.jsxs)("div",{className:"mx-auto w-full min-w-0 max-w-5xl px-4 pt-7 sm:px-8 sm:pt-9",children:[(0,Un.jsxs)(fe,{to:i,className:"inline-flex min-h-8 items-center gap-2 text-sm text-dashboard-text-muted no-underline hover:text-dashboard-text",children:[(0,Un.jsx)(Ni,{"aria-hidden":!0,size:15}),"All automations"]}),(0,Un.jsxs)("div",{className:"mt-4 mb-8 flex flex-wrap items-start justify-between gap-4",children:[(0,Un.jsxs)("div",{className:"min-w-0",children:[(0,Un.jsx)("h1",{className:"m-0 break-words font-display text-3xl font-light tracking-tight",children:s&&!a?s.title:"Edit automation"}),s?(0,Un.jsxs)("p",{className:"mt-2 mb-0 text-sm text-dashboard-text-muted",children:["Created by ",s.ownedByViewer?"you":s.createdBy," \xB7"," ",s.destination.label]}):null]}),s?(0,Un.jsxs)("div",{className:"flex items-center gap-4",children:[(0,Un.jsx)(fe,{to:`/automations/${encodeURIComponent(s.id)}/versions${n.search}`,className:"text-sm text-dashboard-text-muted underline underline-offset-2 hover:text-dashboard-text",children:"Version history"}),(0,Un.jsx)(In,{tone:u,children:l==="unavailable"?"Trigger unavailable":l})]}):null]}),!s&&r.error||!o.data&&o.error?(0,Un.jsxs)(Ei,{tone:"error",title:"Automation could not be loaded.",children:["It may no longer be available, or you may not have access."," ",(0,Un.jsx)(ye,{onClick:()=>{r.refetch(),a&&o.refetch()},children:"Try again"})]}):!s||a&&!o.data?(0,Un.jsx)(Pee,{}):a&&o.data?(0,Un.jsx)(Eee,{automation:o.data,summary:s,returnPath:i},t):(0,Un.jsx)(uNe,{automation:s})]})})}function uNe({automation:e}){return(0,Un.jsxs)(Un.Fragment,{children:[(0,Un.jsx)("p",{className:"mb-6 text-sm text-dashboard-text-muted",children:"This automation has completed and cannot be edited. It will not run again."}),(0,Un.jsx)(dc,{title:"What to do",detail:"The saved instruction.",children:(0,Un.jsx)("p",{className:"m-0 whitespace-pre-wrap break-words text-sm leading-relaxed",children:e.instruction})}),(0,Un.jsx)(dc,{title:"When to run",detail:"The saved trigger.",children:e.kind==="scheduled"?(0,Un.jsxs)("p",{className:"m-0 text-sm",children:[e.schedule," \xB7 ",e.timezone]}):(0,Un.jsxs)("div",{className:"grid gap-3 text-sm",children:[(0,Un.jsx)("p",{className:"m-0 break-words",children:e.resource}),(0,Un.jsx)("p",{className:"m-0 break-words",children:e.events.join(", ")}),e.match?(0,Un.jsx)("pre",{className:"whitespace-pre-wrap break-words text-xs",children:JSON.stringify(e.match,null,2)}):null]})}),(0,Un.jsx)(dc,{title:"Where results go",detail:"Messages after successful work.",children:(0,Un.jsx)(tN,{outcomes:e.outcomes,destination:e.destination})}),(0,Un.jsx)(dc,{title:"Credentials",detail:"The accounts Junior can use.",children:(0,Un.jsx)("p",{className:"m-0 text-sm",children:e.credentialMode==="creator"?`Uses ${e.ownedByViewer?"your":`${e.createdBy}\u2019s`} connected accounts.`:"System credentials only."})})]})}var Gg=b($(),1);var $ee=b($(),1);function nN(){return(0,$ee.useSyncExternalStore)(e=>Cu.subscribe(e),()=>Cu.isOnline(),()=>!0)}var Oee=b(w(),1);function Mee(){return nN()?null:(0,Oee.jsx)("div",{"aria-live":"polite",className:"border-t border-amber-300/15 bg-amber-300/[0.07] px-3 py-1.5 text-center font-sans text-xs text-amber-100/80",role:"status",children:"You\u2019re offline. Drafts stay on this device."})}var yj=b(w(),1);function aN(){return(0,yj.jsx)("div",{className:"relative grid size-10 shrink-0 select-none place-items-center overflow-visible",children:(0,yj.jsx)("img",{alt:"",className:"relative size-11 max-w-none -translate-y-0.5 object-contain opacity-90 drop-shadow-[0_0_7px_rgba(255,255,255,0.16)]",draggable:!1,src:"/_junior/dashboard/avatar.png"})})}var zee=["relative","overflow-hidden","bg-white/15","before:absolute","before:inset-0","before:content-['']","before:bg-[linear-gradient(90deg,#ff4d6d,#ffb703,#56f39a,#4cc9f0,#9b5de5,#ff4d6d)]","before:bg-[length:200%_100%]","before:animate-[junior-rainbow-flow_1.2s_linear_infinite]","motion-reduce:before:animate-none"].join(" ");var Bm=b(w(),1);function Vr(e){return(0,Bm.jsx)("div",{className:T(uo,"grid min-h-[calc(100dvh-5rem)] place-items-center px-4 py-8 md:px-8"),children:(0,Bm.jsxs)("section",{className:"grid w-full max-w-lg grid-cols-[auto_minmax(0,1fr)] items-center gap-3 rounded-lg border border-dashboard-border-emphasis bg-dashboard-surface-raised p-4",children:[(0,Bm.jsx)(aN,{}),(0,Bm.jsxs)("div",{children:[(0,Bm.jsx)("div",{className:"font-bold",children:e.label}),(0,Bm.jsx)("div",{"aria-label":e.label,className:`${zee} mt-3 h-1.5 w-full`,role:"progressbar"})]})]})})}var bj="0.262.0",rN=typeof bj=="string"&&bj.trim()?bj:"unknown";var kw=b(w(),1);function Uee(e){return dNe(e.serverVersion)?(0,kw.jsxs)("div",{"aria-live":"polite",className:"flex flex-wrap items-center justify-center gap-x-3 gap-y-1 border-t border-dashboard-accent/15 bg-dashboard-accent/[0.07] px-3 py-1.5 text-center font-sans text-xs text-dashboard-accent-text/80",role:"status",children:[(0,kw.jsx)("span",{children:"The dashboard changed. Refresh to load the latest version."}),(0,kw.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0 font-sans font-semibold text-dashboard-accent-text underline decoration-dashboard-accent/40 underline-offset-2 hover:text-dashboard-text-solid",onClick:()=>window.location.reload(),type:"button",children:"Refresh"})]}):null}function dNe(e){return!!e&&rN!=="unknown"&&e!=="unknown"&&e!==rN}var Rw=b(w(),1);function Ku(e){return(0,Rw.jsxs)(is,{children:[(0,Rw.jsx)(It,{description:e.description,title:e.title}),(0,Rw.jsx)(To,{label:e.label,variant:e.variant})]})}var cd=b($(),1);var oN={"angular-html":()=>import("./chunks/angular-html-ZNDXTZDN.js"),"angular-ts":()=>import("./chunks/angular-ts-ON3WFVNV.js"),astro:()=>import("./chunks/astro-TCFNN3TA.js"),blade:()=>import("./chunks/blade-XRKVUGGE.js"),c:()=>import("./chunks/c-WHCDUHJR.js"),coffee:()=>import("./chunks/coffee-NWMA7ZVV.js"),coffeescript:()=>import("./chunks/coffee-NWMA7ZVV.js"),cpp:()=>import("./chunks/cpp-7ZDYJCCI.js"),"c++":()=>import("./chunks/cpp-7ZDYJCCI.js"),css:()=>import("./chunks/css-XF3SDJYW.js"),csv:()=>import("./chunks/csv-I2Y5BPVG.js"),glsl:()=>import("./chunks/glsl-SDKJ4MVB.js"),graphql:()=>import("./chunks/graphql-XJBKAS4G.js"),gql:()=>import("./chunks/graphql-XJBKAS4G.js"),haml:()=>import("./chunks/haml-QQIA6ZDV.js"),handlebars:()=>import("./chunks/handlebars-A4STSCQ6.js"),hbs:()=>import("./chunks/handlebars-A4STSCQ6.js"),html:()=>import("./chunks/html-T3MIDC6T.js"),"html-derivative":()=>import("./chunks/html-derivative-A5ABNIZH.js"),http:()=>import("./chunks/http-VGZ3EXS5.js"),hurl:()=>import("./chunks/hurl-TO4NQQLI.js"),imba:()=>import("./chunks/imba-P3ARIZRP.js"),java:()=>import("./chunks/java-WCBM5OUU.js"),javascript:()=>import("./chunks/javascript-TQH7GGAM.js"),js:()=>import("./chunks/javascript-TQH7GGAM.js"),cjs:()=>import("./chunks/javascript-TQH7GGAM.js"),mjs:()=>import("./chunks/javascript-TQH7GGAM.js"),jinja:()=>import("./chunks/jinja-UYMB4X6S.js"),jison:()=>import("./chunks/jison-ED4UFXGK.js"),json:()=>import("./chunks/json-XRHV7G5W.js"),json5:()=>import("./chunks/json5-2OA2ZMVI.js"),jsonc:()=>import("./chunks/jsonc-KO53QF6Y.js"),jsonl:()=>import("./chunks/jsonl-GHTNFMM6.js"),jsx:()=>import("./chunks/jsx-V5TSP3NI.js"),julia:()=>import("./chunks/julia-EI7BACOV.js"),jl:()=>import("./chunks/julia-EI7BACOV.js"),less:()=>import("./chunks/less-FPWZXUDW.js"),markdown:()=>import("./chunks/markdown-QWIM2DOI.js"),md:()=>import("./chunks/markdown-QWIM2DOI.js"),marko:()=>import("./chunks/marko-3POAQSZY.js"),mdc:()=>import("./chunks/mdc-KT6TTBUF.js"),mdx:()=>import("./chunks/mdx-CWS3UMSH.js"),php:()=>import("./chunks/php-3CK4FBZI.js"),postcss:()=>import("./chunks/postcss-7K34RN34.js"),pug:()=>import("./chunks/pug-IEW5PJRA.js"),jade:()=>import("./chunks/pug-IEW5PJRA.js"),python:()=>import("./chunks/python-GCPXLELR.js"),py:()=>import("./chunks/python-GCPXLELR.js"),r:()=>import("./chunks/r-XV5O7BSV.js"),regexp:()=>import("./chunks/regexp-655IUQFI.js"),regex:()=>import("./chunks/regexp-655IUQFI.js"),sass:()=>import("./chunks/sass-MSBN6O54.js"),scss:()=>import("./chunks/scss-N73GNFL4.js"),shellscript:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),bash:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),sh:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),shell:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),zsh:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),sql:()=>import("./chunks/sql-ZR72I7RP.js"),stylus:()=>import("./chunks/stylus-NVEQWGLA.js"),styl:()=>import("./chunks/stylus-NVEQWGLA.js"),svelte:()=>import("./chunks/svelte-ZZAXFLSI.js"),"ts-tags":()=>import("./chunks/ts-tags-MCSPJMMM.js"),lit:()=>import("./chunks/ts-tags-MCSPJMMM.js"),tsx:()=>import("./chunks/tsx-ZTNB67YL.js"),typescript:()=>import("./chunks/typescript-HV6B525T.js"),ts:()=>import("./chunks/typescript-HV6B525T.js"),cts:()=>import("./chunks/typescript-HV6B525T.js"),mts:()=>import("./chunks/typescript-HV6B525T.js"),vue:()=>import("./chunks/vue-WXFFFGZ3.js"),"vue-html":()=>import("./chunks/vue-html-SKWAUQDE.js"),"vue-vine":()=>import("./chunks/vue-vine-V3A5HTCZ.js"),wasm:()=>import("./chunks/wasm-JWJ5BADC.js"),wgsl:()=>import("./chunks/wgsl-ZCQ7MKDM.js"),wit:()=>import("./chunks/wit-MLLAONFF.js"),xml:()=>import("./chunks/xml-VST5CLIL.js"),yaml:()=>import("./chunks/yaml-BX3BWN2A.js"),yml:()=>import("./chunks/yaml-BX3BWN2A.js")};var iN=b(w(),1);function Di(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=Math.max(0,Math.floor(e));if(t<1e3)return`${t}ms`;if(t<6e4){let a=t/1e3;return`${a.toFixed(a<10?1:0)}s`}let n=[],r=[["mo",2592e6],["d",864e5],["h",36e5],["m",6e4],["s",1e3]];for(let[a,o]of r){let i=Math.floor(t/o);if(i!==0){if(n.push(`${i}${a}`),n.length===2)break;t%=o}}return n.join(" ")}function nf(e){return(0,iN.jsx)(iN.Fragment,{children:Di(e.value)||e.fallback||null})}function lb(e){return Date.parse(e.createdAt)}function Fm(e,t,n){return{parts:n,role:t,sourceSeq:e.seq,timestamp:lb(e),...e.mentions?{mentions:e.mentions}:void 0}}function fNe(e){let t=new Set;for(let n of e){let r=n.data;r.type==="handoff"&&r.triggeringToolCallId&&t.add(r.triggeringToolCallId),r.type==="subagent"&&r.parentToolCallId&&t.add(r.parentToolCallId)}return t}function mNe(e){let t=new Set;for(let n of e)n.messageId&&t.add(n.messageId);return t}function pNe(e,t){return{delivery:e.delivery,messageId:e.messageId,parts:e.redacted?[{type:"text",redacted:!0}]:[{type:"text",text:e.text??""}],...e.attachments?{attachments:e.attachments}:void 0,pending:!0,role:"user",source:e.source,sourceSeq:Number.MAX_SAFE_INTEGER-1e6+t,timestamp:Date.parse(e.createdAt),...e.actorIdentity?{actorIdentity:e.actorIdentity}:void 0}}function hNe(e,t){if(!t?.length)return e;let n=gNe(e,t);return n.length===0?e:[...e,...n]}function gNe(e,t){if(!t?.length)return[];let n=mNe(e);return t.filter(r=>!n.has(r.messageId)).map((r,a)=>pNe(r,a))}function xj(e,t){return Sj(e.events,e.annotations,t)}function Sj(e,t,n){let r=fNe(e),a=new Map,o=new Map,i=new Map,s=[],l=new Map,u=new Map,d,f=(h,p)=>{if(r.has(p.toolCallId))return;let g="output"in p?p.output:void 0,x=a.get(p.toolCallId);if(x){x.name=p.name,x.status=p.status,p.input!==void 0&&(x.input=p.input),g!==void 0&&(x.output=g),x.startedTimestamp===void 0&&p.startedAt&&(x.startedTimestamp=Date.parse(p.startedAt)),p.status!=="running"&&(x.resultTimestamp=lb(h));return}let y={type:"tool_call",id:p.toolCallId,name:p.name,status:p.status,...p.input===void 0?void 0:{input:p.input},...g===void 0?void 0:{output:g},...p.status==="running"?void 0:{resultTimestamp:lb(h)}},v={...Fm(h,"tool",[y]),sourceSeq:p.startedSeq??h.seq,timestamp:p.startedAt?Date.parse(p.startedAt):lb(h)};a.set(p.toolCallId,y),o.set(p.toolCallId,v),s.push(v)};for(let h of e){let p=h.data;if(p.type==="message"){let g={...Fm(h,p.role,[p.redacted?{type:"text",redacted:!0}:{type:"text",text:p.text}]),messageId:p.messageId,...p.attachments?{attachments:p.attachments}:void 0,...p.cards?{cards:m4(p.cards,t??[])}:void 0,...p.actorIdentity?{actorIdentity:p.actorIdentity}:void 0,...p.eventType?{eventType:p.eventType}:void 0,eventObjectType:p.eventObjectType,...p.trustedSummary?{trustedSummary:p.trustedSummary}:void 0,...p.events?{events:p.events}:void 0,...p.explicitMention!==void 0?{explicitMention:p.explicitMention}:void 0,...p.source?{source:p.source}:void 0};s.push(g),l.set(g.messageId,g),g.role==="user"&&(d=g);continue}if(p.type==="message_handled"){let g=l.get(p.messageId);g?.role==="user"&&g.explicitMention===!1&&!g.eventType&&(g.context=!0);continue}if(p.type==="assistant_message"){if(p.parts.length===0)continue;s.push(Fm(h,"assistant",p.parts.map(g=>g.redacted?{type:"reasoning",redacted:!0}:{type:"reasoning",text:g.text})));continue}if(p.type==="turn_lifecycle"&&p.state==="started"){let g=p.inputMessageIds?.map(y=>l.get(y)).filter(y=>y!==void 0),x=g?.slice().reverse().find(y=>y.role==="user");x?u.set(p.turnId,x):d&&u.set(p.turnId,d);for(let y of g??[])y.role==="user"&&y.explicitMention===!1&&!y.eventType&&(y.context=!0);continue}if(p.type==="turn_routed"){let g=u.get(p.turnId);g&&(g.route={modelProfile:p.modelProfile,modelId:p.modelId,reasoningLevel:p.reasoningLevel,...p.confidence!==void 0?{confidence:p.confidence}:void 0,source:p.source});continue}if(p.type==="turn_context"){let g=u.get(p.turnId);g&&(g.contexts??=[],g.contexts.push({content:p.content,kind:p.kind,loadedAt:h.createdAt,pluginName:p.pluginName,version:p.version}));continue}if(p.type==="tool_calls"){for(let g of p.calls)f(h,g);if(p.assistant){let g=[];for(let x of p.assistant.parts){if(x.type==="reasoning"){g.push(x.redacted?{type:"reasoning",redacted:!0}:{type:"reasoning",text:x.text});continue}if(r.has(x.toolCallId))continue;let y=a.get(x.toolCallId);if(!y)continue;let v=o.get(x.toolCallId);if(v){v.sourceSeq!==h.seq&&(y.startedTimestamp=v.timestamp);let S=s.indexOf(v);S>=0&&s.splice(S,1),o.delete(x.toolCallId)}g.push(y)}g.length>0&&s.push(Fm(h,"assistant",g))}continue}if(p.type==="subagent"){let g=`${p.childConversationId}:${p.startedSeq}`,x=i.get(g),y=p.status==="running"?void 0:lb(h);if(x){x.status=p.status,y===void 0?delete x.finishedTimestamp:x.finishedTimestamp=y;continue}let v={type:"subagent",id:g,childConversationId:p.childConversationId,subagentKind:p.subagentKind,status:p.status,...y===void 0?void 0:{finishedTimestamp:y},...p.agentName?{agentName:p.agentName}:void 0,...p.task?{task:p.task}:void 0,...p.title?{title:p.title}:void 0};i.set(g,v),s.push({...Fm(h,"tool",[v]),sourceSeq:p.startedSeq,timestamp:Date.parse(p.startedAt)});continue}if(p.type==="structured_event"){s.push(Fm(h,"system",[{type:"structured_event",...h.mentions?{mentions:h.mentions}:void 0,namespace:p.namespace,name:p.name,version:p.version,presentation:p.presentation}]));continue}if(p.type==="attachments_delivered"){s.push(Fm(h,"system",[{type:"attachments_delivered",attachments:p.attachments}]));continue}if(p.type==="compaction"||p.type==="handoff"){s.push(Fm(h,"system",[{type:"context_event",...h.mentions?{mentions:h.mentions}:void 0,event:p.type==="handoff"?{type:p.type,createdAt:h.createdAt,modelId:p.modelId,modelProfile:p.modelProfile,...p.summary?{summary:p.summary}:void 0,...p.reasoningLevel?{reasoningLevel:p.reasoningLevel}:void 0}:{type:p.type,createdAt:h.createdAt,...p.modelId?{modelId:p.modelId}:void 0,...p.modelProfile?{modelProfile:p.modelProfile}:void 0,...p.summary?{summary:p.summary}:void 0,...p.details?{details:p.details}:void 0}}]));continue}if(p.type==="turn_lifecycle"&&p.state==="failed"){s.push({role:p.failureCode==="delivery_failed"?"system":"assistant",failureCode:p.failureCode,...p.failureReason?{failureReason:p.failureReason}:void 0,...p.eventId?{eventId:p.eventId}:void 0,...p.sentryEventUrl?{sentryEventUrl:p.sentryEventUrl}:void 0,parts:[],sourceSeq:h.seq,timestamp:lb(h)});continue}}let m=s.filter(h=>h.role!=="user"||h.eventType!==void 0||h.explicitMention!==!1||h.context===!0).sort((h,p)=>h.sourceSeq-p.sourceSeq);return hNe(m,n)}function jee(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}}var Cj=jee();function Bee(e){Cj=e||jee()}function Vm(){return Cj}function lN(){return Cj}function vNe(e){return e.status==="active"}function yNe(e){return e.status==="failed"}function bNe(e){return e.status==="active"}function xNe(e){return e.status==="failed"}function cN(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Fa(e,t){let n=cN(e);return n==null?"none":new Date(n).toLocaleString(void 0,{...t,timeZone:lN()})}function ar(e){let t=cN(e);if(t==null)return"not updated yet";let n=Math.round((t-Date.now())/1e3),r=Math.abs(n),a=[["year",3600*24*365],["month",3600*24*30],["week",3600*24*7],["day",3600*24],["hour",3600],["minute",60]];for(let[o,i]of a)if(r>=i)return new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}).format(Math.round(n/i),o);return"just now"}function af(e){if(typeof e!="number"||!Number.isFinite(e))return"none";let t=Math.max(0,Math.floor(e));if(t<1e3)return`${t}ms`;let n=t/1e3;if(n<60)return`${n.toFixed(n<10?1:0)}s`;let r=Math.round(n),a=Math.floor(r/60),o=r%60;return`${a}m ${o}s`}function Fee(e){if(e===void 0)return;let t=typeof e=="string"?e:JSON.stringify(e);if(t===void 0)return;let n=new TextEncoder().encode(t).byteLength;return n<1e3?`${n}b`:`${Math.round(n/1e3)}kb`}function cb(e,t){if(!(typeof e!="number"||typeof t!="number"||t<e))return af(t-e)}function rf(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=Math.max(0,Math.floor(e));return t===0?"":Di(t)}function Pa(e,t=!1){if(typeof e!="number"||!Number.isFinite(e))return"no timestamp";let n=new Date(e);return t?n.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium",timeZone:lN()}):n.toLocaleTimeString(void 0,{timeZone:lN()})}function uN(e){if(typeof e!="number"||!Number.isFinite(e))return"no timestamp";let t=Math.round((e-Date.now())/1e3),n=Math.abs(t),r=[["year",3600*24*365],["month",3600*24*30],["week",3600*24*7],["day",3600*24],["hour",3600]],[a,o]=r.find(([,i])=>n>=i)??r.at(-1);return new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}).format(Math.round(t/o),a)}function Hee(e){let t=new Date(e),n={dateStyle:"medium",timeStyle:"long"};return{local:t.toLocaleString(void 0,{...n,timeZone:lN()}),utc:t.toLocaleString(void 0,{...n,timeZone:"UTC"})}}function Vee(e){if(typeof e!="number"||!Number.isFinite(e))return"0";let t=Math.max(0,Math.floor(e));if(t<1e3)return String(t);let n=[["t",1e12],["b",1e9],["m",1e6],["k",1e3]],[r,a]=n.find(([,s])=>t>=s)??n[1],o=t/a;return`${o>=100||Number.isInteger(o)||o>=10?Math.round(o).toString():(Math.floor(o*10)/10).toFixed(1).replace(/\.0$/,"")}${r}`}function Yh(e){return typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):void 0}function SNe(e){return[e.inputTokens,e.outputTokens,e.cachedInputTokens,e.cacheCreationTokens].reduce((t,n)=>{let r=Yh(n);return r===void 0?t:(t??0)+r},void 0)}function Xh(e){let t=e.toLowerCase();return t==="assistant"?"assistant":t==="user"?"user":t==="system"?"system":t.includes("tool")?"tool":"other"}function qm(e,t){let n=Xh(t.role);return n==="assistant"?ln():n==="user"?Hm(t.actorIdentity)??Hm(e.actorIdentity)??"User":n==="system"?"System":n==="tool"?"Tool":t.role||"Unknown"}function Se(e){return Vee(e)}function Ks(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?"0":e<10?(Math.round(e*10)/10).toFixed(1).replace(/\.0$/,""):Se(e)}function Wc(e){if(!e)return;let t={totalTokens:0};t.reasoningTokens=Yh(e.reasoningTokens);let n=SNe(e);if(n!==void 0)t.totalTokens=n,t.inputTokens=Yh(e.inputTokens),t.outputTokens=Yh(e.outputTokens),t.cachedInputTokens=Yh(e.cachedInputTokens),t.cacheCreationTokens=Yh(e.cacheCreationTokens);else{let r=Yh(e.totalTokens);r!==void 0&&(t.totalTokens=r,t.providerTotalTokens=r)}return t.totalTokens>0?t:void 0}function dN(e){if(!e?.length)return;let t={totalTokens:0};for(let n of e){let r=Wc(n.usage);if(r){t.totalTokens+=r.totalTokens;for(let a of["inputTokens","outputTokens","cachedInputTokens","cacheCreationTokens","reasoningTokens"]){let o=r[a];o!==void 0&&(t[a]=(t[a]??0)+o)}}}return t.totalTokens>0?t:void 0}function kj(e){return e?`${Vee(e.totalTokens)} tokens`:""}function fN(e){return kj(Wc(e))}function Iw(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function Rj(e,t){return Math.round((e+t)*1e12)/1e12}function ss(e){if(!e?.cost)return;let t={total:0},n=e.cost,r=Iw(n.total),a={input:Iw(n.input),output:Iw(n.output),cacheRead:Iw(n.cacheRead),cacheWrite:Iw(n.cacheWrite)},o=Object.values(a).reduce((i,s)=>i+(s??0),0);return t.total=Rj(t.total,r??o),t.input=a.input,t.output=a.output,t.cacheRead=a.cacheRead,t.cacheWrite=a.cacheWrite,r!==void 0||o>0?t:void 0}function mN(e){let t;for(let n of e??[]){let r=ss(n.usage);r&&(t=Rj(t??0,r.total))}return t===void 0?void 0:{total:t}}function vt(e){if(!e)return"";let t=e.total>0&&e.total<.01?4:2;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:t}).format(e.total)}function eg(e){return e?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:4}).format(e.total):""}function ub(e,t){if(!(!e&&!t))return{...e,total:Rj(e?.total??0,t?.costUsd??0)}}function pN(e,t){return vt(ub(ss(e),t))}function qee(e){return rf(e.cumulativeDurationMs)||"none"}function wNe(e,t){return(cN(t)??0)-(cN(e)??0)}function db(e){return e?.agentTree?.at(-1)?.label??(e?.displayTitle?.trim()||void 0)}function si(e){return e?.displayTitle??"Conversation"}function Hm(e){let t=e?.email?.trim()||void 0,n=e?.fullName?.trim()||void 0,r=e?.slackUserName?.trim()||void 0;return t??n??r??e?.slackUserId}function Kc(e,t={}){let n=e.channel;if(!n)return;let a=t.includeId??!0?` (${n})`:"";if(e.channelNameRedacted&&e.channelName)return`${e.channelName}${a}`;let o=e.channelName?.replace(/^#/,"");return n.startsWith("D")?`Direct Message${a}`:n.startsWith("C")?o?`#${o}${a}`:`Public Channel${a}`:n.startsWith("G")?o?.startsWith("mpdm-")?`Group DM${a}`:`Private Channel${a}`:o?`${o}${a}`:n}function CNe(e){return yNe(e)?"failed":vNe(e)?"active":"idle"}function Gm(e){return bNe(e)?"active":xNe(e)?"failed":"idle"}function Tw(e){return e.eventHistory.status==="redacted"?"Transcript hidden because this conversation is not public.":e.eventHistory.status==="expired"?"Transcript expired for this conversation.":CNe(e)==="active"?"Transcript pending while this conversation is active.":"Transcript unavailable for this conversation."}function Ll(e){return`/people/${encodeURIComponent(e)}`}function Gee(e){return`/system/locations/${encodeURIComponent(e)}`}function Al(e){return`/automations/${encodeURIComponent(e)}`}function kNe(e){let t=e?.trim().toLowerCase();if(!t)return"markdown";let r={console:"shellscript",htm:"html",js:"javascript",jsonl:"json",md:"markdown",ndjson:"json",sh:"shellscript",text:"markdown",txt:"markdown",xml:"xml",yml:"yaml"}[t]??t;return Object.hasOwn(oN,r)?r:"markdown"}function Zee(e){let t=e.trim();if(t)try{return JSON.stringify(JSON.parse(t),null,2)}catch{return}}function Wee(e){let t=e.trim().split(/\r?\n/).filter(r=>r.trim().length>0);if(t.length<2)return;let n=[];for(let r of t){let a=Zee(r);if(!a)return;n.push(a)}return n.join(`
|
|
70
|
+
`);case"automation":return H1e(e)}}var V1e=c.object({plugin:c.string().min(1),key:c.string().min(1)}).strict(),q1e=V1e.extend({kind:c.literal("object")});function m4(e,t){return e.map(n=>{let r=t.find(a=>a.kind===n.kind&&a.plugin===n.plugin&&a.key===n.key);return r?G1e(r):{...n,objectType:"item",title:n.key,label:n.key,url:null,warning:"Saved annotation is unavailable."}})}function G1e(e){let{createdAt:t,updatedAt:n,...r}=e;return r.kind==="object"?r:{...r,kind:"object",objectType:r.objectType??"item",title:r.label}}var CT=c.object({auxiliaryCostUsd:c.number().finite().nonnegative().optional(),count:c.number().int().positive(),cumulativeDurationMs:c.number(),cumulativeUsage:l4.optional()}).strict(),Z1e=c.enum(["active","completed","failed"]),W1e=c.enum(["api","internal","scheduler","slack"]),lw=l4,K1e=c.object({conversationId:c.string().min(1)}).strict(),OZe=c.object({attachmentId:c.string().min(1),conversationId:c.string().min(1)}).strict(),J1e=c.object({limit:c.coerce.number().int().min(1).max(1e3).default(500)}).strict(),Q1e=c.object({before:c.string().min(1),limit:c.coerce.number().int().min(1).max(1e3).default(500)}).strict(),Y1e=c.object({actorEmail:c.string().trim().email().transform(e=>e.toLowerCase()).optional(),codeRepositoryId:c.string().uuid().optional(),q:c.string().trim().max(200).optional(),status:c.enum(["active","archived"]).default("active")}).strict(),X1e=c.object({archived:c.boolean(),lastSeenAt:c.string().datetime()}).strict(),p4=c.object({archivedAt:c.string().datetime().nullable()}).strict(),PQ=c.object({idempotencyKey:c.string().trim().min(1).max(200),message:c.string().trim().max(32e3),images:c.array(B1e).max(3).optional()}).strict().refine(e=>!!(e.message||e.images?.length),"Add a message or an image.").refine(e=>(e.images??[]).reduce((t,n)=>t+n.data.length,0)<=sw*4/3,"Images must total 3 MB or less."),eRe=PQ.safeExtend({visibility:c.enum(["private","public"]).optional()}),cw=c.object({conversationId:c.string().min(1),messageId:c.string().min(1),status:c.enum(["accepted","duplicate"])}).strict(),sc=c.object({email:c.string().optional(),fullName:c.string().optional(),slackUserId:c.string().optional(),slackUserName:c.string().optional()}).strict(),DQ=c.enum(["defer","interrupt"]),$Q=c.object({actorIdentity:sc.optional(),createdAt:c.string().datetime(),delivery:DQ,inboundMessageId:c.string().min(1),messageId:c.string().min(1),receivedAt:c.string().datetime(),role:c.literal("user"),source:c.enum(["slack","web"]),text:c.string().optional(),attachments:c.array(d4).optional(),redacted:c.literal(!0).optional()}).strict().superRefine((e,t)=>{e.text===void 0==(e.redacted!==!0)&&t.addIssue({code:"custom",message:"pending message content must be text or explicitly redacted"}),e.redacted&&(e.actorIdentity||e.attachments)&&t.addIssue({code:"custom",message:"redacted pending messages must not expose actor identity or attachments"})}),MQ=c.object({authorizationUrl:c.string().url(),completionText:c.string().min(1),label:c.string().min(1)}).strict(),h4=c.object({authorization:MQ.optional(),conversationId:c.string().min(1),generatedAt:c.string().datetime(),messages:c.array($Q)}).strict(),tRe=c.object({inboundMessageIds:c.array(c.string().min(1)).min(1).optional(),receivedBefore:c.string().datetime().optional()}).strict(),g4=c.object({cancelledCount:c.number().int().nonnegative(),cancelledInboundMessageIds:c.array(c.string().min(1)),conversationId:c.string().min(1)}).strict(),kT=c.object({costUsd:c.number().finite().nonnegative(),operations:c.array(c.object({costUsd:c.number().finite().nonnegative(),events:c.number().int().positive(),name:c.string().min(1),namespace:c.string().min(1)}).strict()).min(1)}).strict(),nRe=c.object({id:c.string().min(1).optional(),kind:c.enum(["scheduled","event"]),label:c.string().min(1).optional(),title:c.string().min(1).optional(),triggerMessageId:c.string().min(1).optional(),triggerLabel:c.string().min(1).optional(),credentialMode:c.enum(["creator","system"]).optional(),credentialUser:c.string().min(1).optional()}).strict().superRefine((e,t)=>{!!e.id!=!!e.label&&t.addIssue({code:"custom",message:"sourceTask id and label must both be set or both omitted"})}),aRe=hQ.and(c.object({plugin:c.string().min(1),createdAt:c.string().datetime(),updatedAt:c.string().datetime()})),OQ=c.object({createdAt:c.string().datetime(),mentions:c.array(sc).optional(),role:c.enum(["assistant","user"]),text:c.string().min(1)}).strict(),By=c.object({displayTitle:c.string(),activityPreview:OQ.optional(),cumulativeDurationMs:c.number(),cumulativeUsage:lw.optional(),auxiliaryCosts:kT.optional(),childAgentTotals:CT.optional(),conversationId:c.string(),isParticipant:c.boolean(),visibility:c.enum(["private","public"]).optional(),status:Z1e,startedAt:c.string(),lastSeenAt:c.string(),lastProgressAt:c.string(),surface:W1e,actorIdentity:sc.optional(),participants:c.array(sc).optional(),archivedAt:c.string().datetime().nullable().optional(),channel:c.string().optional(),channelName:c.string().optional(),channelNameRedacted:c.boolean().optional(),locationId:c.string().optional(),sentryTraceUrl:c.string().optional(),locationUrl:c.string().url().optional(),traceId:c.string().optional(),annotations:c.array(aRe).optional(),sidebarAnnotations:c.array(gQ).optional(),assignedWork:c.boolean().optional(),finishedWorkAt:c.string().datetime().optional(),isPriority:c.boolean().optional(),unfinishedWork:c.boolean().optional()}).strict(),rRe=c.object({eventType:c.string().min(1),label:c.string().min(1).optional(),objectType:zh.optional(),trustedSummary:c.string().min(1).optional()}).strict(),oRe=c.object({type:c.literal("message"),messageId:c.string().min(1),role:c.enum(["assistant","system","user"]),source:c.enum(["slack","web"]).optional(),actorIdentity:sc.optional(),agentInvocationId:c.string().min(1).optional(),eventType:c.string().min(1).optional(),eventObjectType:zh.optional(),explicitMention:c.boolean().optional(),trustedSummary:c.string().min(1).optional(),events:c.array(rRe).optional(),cards:c.array(q1e).optional(),text:c.string().optional(),attachments:c.array(d4).optional(),redacted:c.literal(!0).optional()}).strict().superRefine((e,t)=>{e.text===void 0==(e.redacted!==!0)&&t.addIssue({code:"custom",message:"message content must be text or explicitly redacted"}),e.redacted&&(e.actorIdentity||e.cards||e.attachments||e.events)&&t.addIssue({code:"custom",message:"redacted messages must not expose actor identity, cards, attachments, or events"})}),iRe=c.object({type:c.literal("message_handled"),messageId:c.string().min(1)}).strict(),sRe=c.object({toolCallId:c.string().min(1),name:c.string().min(1),status:c.enum(["running","completed","error"]),startedAt:c.string().datetime().optional(),startedSeq:c.number().int().nonnegative().optional(),input:c.unknown().optional(),output:c.unknown().optional()}).strict().superRefine((e,t)=>{e.startedAt===void 0!=(e.startedSeq===void 0)&&t.addIssue({code:"custom",message:"tool start sequence and timestamp must be provided together"})}),zQ=c.object({type:c.literal("reasoning"),text:c.string().min(1).optional(),redacted:c.literal(!0).optional()}).strict().superRefine((e,t)=>{e.text===void 0==(e.redacted!==!0)&&t.addIssue({code:"custom",message:"reasoning content must be text or explicitly redacted"})}),lRe=c.object({type:c.literal("tool_call"),toolCallId:c.string().min(1)}).strict(),cRe=c.object({parts:c.array(c.discriminatedUnion("type",[zQ,lRe])).min(1)}).strict(),uRe=c.object({type:c.literal("tool_calls"),calls:c.array(sRe).min(1),assistant:cRe.optional()}).strict().superRefine((e,t)=>{if(!e.assistant)return;let n=new Map;for(let a of e.calls)n.set(a.toolCallId,(n.get(a.toolCallId)??0)+1);let r=new Map;for(let a of e.assistant.parts)a.type==="tool_call"&&r.set(a.toolCallId,(r.get(a.toolCallId)??0)+1);(n.size!==r.size||[...n].some(([a,o])=>r.get(a)!==o))&&t.addIssue({code:"custom",path:["assistant","parts"],message:"assistant tool parts must reference every call exactly once"})}),dRe=c.object({type:c.literal("assistant_message"),parts:c.array(zQ)}).strict(),fRe=c.discriminatedUnion("state",[c.object({type:c.literal("turn_lifecycle"),turnId:c.string().min(1),state:c.enum(["succeeded","no_reply"])}).strict(),c.object({type:c.literal("turn_lifecycle"),turnId:c.string().min(1),state:c.literal("started"),inputMessageIds:c.array(c.string().min(1)).min(1).optional()}).strict(),c.object({type:c.literal("turn_lifecycle"),turnId:c.string().min(1),state:c.literal("failed"),failureCode:ST,failureReason:wT.optional(),eventId:c.string().regex(/^[a-f0-9]{32}$/i).optional(),sentryEventUrl:c.string().url().optional()}).strict()]),mRe=c.object({type:c.literal("turn_routed"),turnId:c.string().min(1),modelProfile:c.string().min(1),modelId:c.string().min(1),costUsd:c.number().finite().nonnegative().optional(),reasoningLevel:c.string().min(1),confidence:c.number().min(0).max(1).optional(),source:c.enum(["configured","inherited","router"])}).strict(),pRe=c.object({type:c.literal("guardian_action_reviewed"),turnId:c.string().min(1),toolCallId:c.string().min(1),toolName:c.string().min(1),decision:c.enum(["allow","ask","deny"]),riskLevel:c.enum(["low","medium","high","critical"]),userAuthorization:c.enum(["high","medium","low","unknown"])}).strict(),hRe=c.object({type:c.literal("turn_context"),turnId:c.string().min(1),pluginName:c.string().min(1),kind:c.string().min(1),version:c.number().int().positive(),content:c.record(c.string(),c.unknown())}).strict(),gRe=c.object({type:c.literal("structured_event"),namespace:c.string().min(1),name:c.string().min(1),version:c.number().int().positive(),turnId:c.string().min(1).optional(),presentation:vQ}).strict(),vRe=c.object({type:c.literal("attachments_delivered"),attachments:c.array(d4).min(1)}).strict(),yRe=c.object({type:c.literal("compaction"),modelProfile:c.string().min(1).optional(),modelId:c.string().min(1).optional(),summary:c.string().min(1).optional(),details:c.object({reason:c.literal("capacity"),estimatedInputTokens:c.number().int().nonnegative(),replacementInputTokens:c.number().int().nonnegative().optional(),triggerTokens:c.number().int().nonnegative(),inputLimitTokens:c.number().int().positive(),inputMessageCount:c.number().int().nonnegative(),retainedMessageCount:c.number().int().nonnegative(),summaryChars:c.number().int().nonnegative()}).strict().optional()}).strict(),bRe=c.object({type:c.literal("handoff"),modelProfile:c.string().min(1),modelId:c.string().min(1),reasoningLevel:c.string().min(1).optional(),triggeringToolCallId:c.string().min(1).optional(),summary:c.string().min(1).optional()}).strict(),xRe=c.object({type:c.literal("subagent"),startedSeq:c.number().int().nonnegative(),startedAt:c.string().datetime(),childConversationId:c.string().min(1),subagentKind:c.string().min(1),agentName:c.string().min(1).optional(),task:c.string().min(1).optional(),title:c.string().min(1).optional(),parentToolCallId:c.string().min(1).optional(),status:c.enum(["running","completed","blocked","error","aborted"])}).strict(),UQ=c.discriminatedUnion("type",[oRe,iRe,dRe,uRe,fRe,hRe,gRe,vRe,mRe,pRe,yRe,bRe,xRe]),v4=c.object({seq:c.number().int().nonnegative(),createdAt:c.string().datetime(),data:UQ,mentions:c.array(sc).optional(),model:c.object({modelId:c.string().min(1),modelProfile:c.string().min(1).optional(),reasoningLevel:c.string().min(1).optional()}).strict().optional(),modelCall:c.object({provider:c.string().min(1).optional(),api:c.string().min(1).optional(),stopReason:c.string().min(1).optional(),usage:lw.optional()}).strict().optional()}).strict(),y4=c.discriminatedUnion("status",[c.object({status:c.literal("available")}).strict(),c.object({status:c.literal("redacted"),reason:c.literal("non_public_conversation")}).strict(),c.object({status:c.literal("expired"),expiredAt:c.string().datetime()}).strict()]),SRe=c.object({modelId:c.string(),usage:lw}).strict();function jQ(e,t){e.eventHistory.status==="expired"&&e.events.length>0&&t.addIssue({code:"custom",path:["events"],message:"expired event history must not contain events"});for(let n=1;n<e.events.length;n+=1)e.events[n].seq<=e.events[n-1].seq&&t.addIssue({code:"custom",path:["events",n,"seq"],message:"report event sequences must be strictly increasing"});for(let[n,r]of e.events.entries())r.data.type==="message"&&(e.eventHistory.status==="redacted"&&r.data.redacted!==!0&&t.addIssue({code:"custom",path:["events",n,"data"],message:"redacted event history must redact messages"}),e.eventHistory.status==="available"&&r.data.redacted===!0&&t.addIssue({code:"custom",path:["events",n,"data"],message:"available event history must expose messages"})),e.eventHistory.status==="redacted"&&r.data.type==="tool_calls"&&r.data.calls.some(a=>a.input!==void 0||a.output!==void 0)&&t.addIssue({code:"custom",path:["events",n,"data"],message:"redacted event history must redact tool payloads"}),e.eventHistory.status==="redacted"&&r.data.type==="assistant_message"&&r.data.parts.some(a=>a.text!==void 0)&&t.addIssue({code:"custom",path:["events",n,"data"],message:"redacted event history must redact assistant messages"}),e.eventHistory.status==="available"&&r.data.type==="assistant_message"&&r.data.parts.some(a=>a.redacted===!0)&&t.addIssue({code:"custom",path:["events",n,"data"],message:"available event history must expose reasoning"}),r.data.type==="tool_calls"&&(e.eventHistory.status==="redacted"&&r.data.assistant?.parts.some(a=>a.type==="reasoning"&&a.text!==void 0)||e.eventHistory.status==="available"&&r.data.assistant?.parts.some(a=>a.type==="reasoning"&&a.redacted===!0))&&t.addIssue({code:"custom",path:["events",n,"data","assistant"],message:"assistant reasoning must match event history visibility"})}var wRe=c.object({messageId:c.string().min(1).max(500),idempotencyKey:c.string().trim().min(1).max(200)}).strict(),b4=c.object({conversationId:c.string()}).strict(),CRe=c.object({conversationId:c.string().min(1),label:c.string().min(1)}).strict(),x4=By.extend({agentTree:c.array(CRe).min(2).optional(),canFork:c.boolean().optional(),forkedFromConversationId:c.string().optional(),forkedFromTitle:c.string().optional(),forks:c.array(c.string()).optional(),brief:c.object({content:z1e,mentions:c.array(sc).optional(),updatedAt:c.string().datetime(),version:c.number().int().positive()}).strict().optional(),modelUsage:c.array(SRe).optional(),events:c.array(v4),eventHistory:y4,previousCursor:c.string().min(1).optional(),generatedAt:c.string(),sentryConversationUrl:c.string().optional(),sourceTask:nRe.optional()}).strict().superRefine(jQ),S4=c.object({events:c.array(v4),eventHistory:y4,previousCursor:c.string().min(1).optional(),generatedAt:c.string()}).strict().superRefine(jQ),RT=c.object({conversations:c.array(By),source:c.literal("conversation_index"),generatedAt:c.string()}).strict();var kRe=c.enum(["current_conversation","task_creator"]).describe("Where to send the message. Use current_conversation for posts, digests, summaries, and channel reminders. Use task_creator only when the user asks for a direct reminder or notification."),RRe=c.object({action:c.literal("send_message"),destination:kRe}).strict(),qQ=c.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Use a local date in YYYY-MM-DD format."),GQ=c.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"Use local time in HH:MM format."),ZQ=c.string().min(1).max(80).describe("IANA timezone the user asked for, for example America/New_York. Omit or use null to use the creator's timezone on create, or to keep the saved timezone on update. Do not guess it from office locations.").nullable().optional(),IRe=c.enum(["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]),TRe=c.object({kind:c.literal("one_off").describe("A schedule that runs once."),timezone:ZQ,timing:c.discriminatedUnion("type",[c.object({type:c.literal("after").describe("Run after a relative delay from the server clock."),value:c.number().int().positive().max(1e5),unit:c.enum(["second","minute","hour","day","week"])}).strict(),c.object({type:c.literal("at").describe("Run at an explicit local calendar date and time."),date:qQ.describe("Requested local calendar date in YYYY-MM-DD format."),time:GQ.describe("Requested local wall-clock time in HH:MM format.")}).strict()]).describe("Relative delay or explicit local time for the one-off run.")}).strict(),NRe=c.object({kind:c.literal("recurring").describe("A repeating calendar schedule."),frequency:c.enum(["daily","weekly","monthly","yearly"]).describe("Recurring tasks can run at most once per day."),interval:c.number().int().positive().max(365).describe("Repeat every N frequency units. Defaults to 1.").nullable().optional(),time:GQ.describe("Local wall-clock time for each occurrence in HH:MM format."),weekdays:c.array(IRe).min(1).max(7).describe("Required for weekly schedules.").nullable().optional(),dayOfMonth:c.number().int().min(1).max(31).describe("Required for monthly and yearly schedules.").nullable().optional(),month:c.number().int().min(1).max(12).describe("Required for yearly schedules, where January is 1.").nullable().optional(),startDate:qQ.describe("Optional local calendar date that anchors the recurrence. Omit to start with the next matching occurrence.").nullable().optional(),timezone:ZQ}).strict().superRefine((e,t)=>{e.frequency==="weekly"&&e.weekdays==null&&t.addIssue({code:"custom",message:"Weekly schedules require weekdays.",path:["weekdays"]}),(e.frequency==="monthly"||e.frequency==="yearly")&&e.dayOfMonth==null&&t.addIssue({code:"custom",message:`${e.frequency} schedules require dayOfMonth.`,path:["dayOfMonth"]}),e.frequency==="yearly"&&e.month==null&&t.addIssue({code:"custom",message:"Yearly schedules require month.",path:["month"]}),e.frequency!=="weekly"&&e.weekdays!=null&&t.addIssue({code:"custom",message:"weekdays applies only to weekly schedules.",path:["weekdays"]}),e.frequency!=="monthly"&&e.frequency!=="yearly"&&e.dayOfMonth!=null&&t.addIssue({code:"custom",message:"dayOfMonth applies only to monthly or yearly schedules.",path:["dayOfMonth"]}),e.frequency!=="yearly"&&e.month!=null&&t.addIssue({code:"custom",message:"month applies only to yearly schedules.",path:["month"]})}),WQ=c.union([TRe,NRe]);var KQ=c.object({slackUserId:xT,fullName:c.string().optional(),userName:c.string().optional()}).strict(),C4=c.object({events:c.array(Qd).min(1),label:c.string().min(1),match:o4.optional(),namespace:c.string().min(1),identifier:c.string().min(1).max(300),resourceType:c.string().min(1)}).strict(),JQ=jy.omit({threadTs:!0}),_Re=ow.extend({destination:JQ}),LRe=c.object({id:c.string().min(1),createdAtMs:c.number().finite(),createdBy:KQ,creatorIdentityId:c.string().min(1),credentialMode:c.enum(["system","creator"]),destination:JQ,destinationVisibility:a4,outcomes:c.array(_Re).max(5),task:c.object({text:c.string().min(1)}).strict(),trigger:C4}).strict(),ARe=c.string().trim().min(1).max(60),QQ=c.string().trim().min(1).max(4e3),WZe=QQ.describe("Work to perform when the Automation runs. It runs later without this conversation, so write it to stand alone: name each person with their Slack mention, such as <@U123>, instead of me, my, or you. Preserve the user's scope, targets, and constraints. Do not add permissions or side effects the user did not request."),YQ=c.object({title:ARe.optional(),instruction:QQ.optional(),credentialMode:c.enum(["system","creator"]).optional(),outcomes:c.array(c.union([RRe,ow])).max(5).optional()}),ERe=YQ.extend({schedule:WQ.optional(),status:c.enum(["active","blocked"]).optional()}).strict(),PRe=YQ.extend({trigger:C4.extend({identifier:c.string().trim().min(1).max(300),label:c.string().trim().min(1).max(500)}).optional()}).strict(),DRe=c.enum(["active","blocked","paused","completed","deleted"]),$Re=c.enum(["system","creator"]),MRe=c.enum(["pending","running","completed","failed","blocked","skipped"]),ORe=c.object({slackUserId:xT,fullName:c.string().optional(),userName:c.string().optional()}).strict(),zRe=c.object({dayOfMonth:c.number().optional(),frequency:c.enum(["daily","weekly","monthly","yearly"]),interval:c.number(),month:c.number().optional(),startDate:c.string(),time:c.object({hour:c.number(),minute:c.number()}).strict(),weekdays:c.array(c.number()).optional()}).strict(),URe=c.object({description:c.string(),kind:c.enum(["one_off","recurring"]),recurrence:zRe.optional(),timezone:c.string()}).strict(),jRe=c.object({platform:c.literal("system"),name:c.string()}).strict(),XQ=jy.omit({threadTs:!0}),BRe=c.object({action:c.literal("send_message"),destination:XQ}).strict(),TT=c.object({id:c.string(),conversationAccess:c.object({audience:c.enum(["direct","group","channel"]),visibility:c.enum(["private","public"])}).strict(),createdAtMs:c.number(),createdBy:ORe,creatorIdentityId:c.string(),credentialMode:$Re,destination:XQ,executionActor:jRe.optional(),lastRunAtMs:c.number().optional(),nextRunAtMs:c.number().optional(),originalRequest:c.string().optional(),runNowAtMs:c.number().optional(),schedule:URe,status:DRe,statusReason:c.string().optional(),outcomes:c.array(BRe).max(5),task:c.object({text:c.string()}).strict(),title:c.string().optional(),updatedAtMs:c.number()}).strict(),KZe=c.object({id:c.string(),attempt:c.number(),claimedAtMs:c.number(),completedAtMs:c.number().optional(),dispatchId:c.string().optional(),errorMessage:c.string().optional(),resultMessageTs:c.string().optional(),scheduledForMs:c.number(),startedAtMs:c.number().optional(),status:MRe,taskId:c.string()}).strict(),JZe=Object.freeze({platform:"system",name:"scheduled-automation"}),FRe=c.object({channelId:c.string().min(1),label:c.string().min(1),teamId:c.string().min(1),visibility:c.enum(["private","public"])}).strict(),eY=c.object({1:c.number().int().nonnegative(),7:c.number().int().nonnegative(),30:c.number().int().nonnegative(),90:c.number().int().nonnegative()}).strict(),tY=c.object({credentialMode:c.enum(["creator","system"]),createdAt:c.string().datetime(),createdBy:c.string().min(1),createdByAvatarUrl:c.string().url().optional(),createdByEmail:c.string().trim().email().optional(),destination:FRe,id:c.string().min(1),instruction:c.string().min(1),mentions:c.array(sc).optional(),lastConversationId:c.string().min(1).optional(),lastRunAt:c.string().datetime().optional(),lastRunStatus:c.enum(["blocked","completed","failed"]).optional(),ownedByViewer:c.boolean(),runs:eY,outcomes:c.array(ow).max(5),title:c.string().min(1),totalRuns:c.number().int().nonnegative()}),nY=tY.extend({kind:c.literal("scheduled"),nextRunAt:c.string().datetime().optional(),schedule:c.string().min(1),timezone:c.string().min(1),statusReason:c.string().optional(),status:c.enum(["active","blocked","paused","completed"])}).strict(),aY=tY.extend({events:c.array(c.string().min(1)).min(1),match:o4.optional(),kind:c.literal("event"),resource:c.string().min(1),source:c.string().min(1),triggerAvailable:c.boolean(),statusReason:c.string().optional(),status:c.enum(["active","blocked","paused"])}).strict(),dw=c.discriminatedUnion("kind",[nY,aY]),rY=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),w4=c.object({costUsd:c.number().finite().nonnegative(),date:rY,event:c.number().int().nonnegative(),scheduled:c.number().int().nonnegative()}).strict(),NT=c.object({q:c.string().trim().max(200).optional(),scope:c.enum(["all","mine","public","attention"]).default("all"),type:c.enum(["all","scheduled","event"]).default("all"),state:c.enum(["all","active","blocked","paused","completed","unavailable"]).default("all"),creator:c.string().max(300).optional(),destination:c.string().max(300).optional(),sort:c.enum(["newest","oldest","title"]).default("newest"),page:c.coerce.number().int().min(1).max(1e6).default(1),pageSize:c.coerce.number().int().min(1).max(100).default(25)}).strict(),BQ=c.object({value:c.string(),label:c.string()}).strict(),k4=c.object({executionDays:c.array(w4),executionHours:c.array(w4).optional(),executionSixHours:c.array(w4).optional(),automations:c.array(dw),total:c.number().int().nonnegative(),page:c.number().int().positive(),pageSize:c.number().int().positive(),counts:c.object({all:c.number().int().nonnegative(),mine:c.number().int().nonnegative(),public:c.number().int().nonnegative(),private:c.number().int().nonnegative()}).strict(),creators:c.array(BQ),destinations:c.array(BQ)}).strict(),oY=c.object({id:c.string().min(1)}).strict(),iY=c.enum(["blocked","completed","failed"]),R4=c.object({conversationId:c.string().min(1).optional(),costUsd:c.number().finite().nonnegative().optional(),durationMs:c.number().finite().nonnegative().optional(),executedAt:c.string().datetime(),executionId:c.string().min(1),status:iY,title:c.string().min(1).optional(),totalTokens:c.number().int().nonnegative().optional()}).strict(),IT=c.object({blocked:c.number().int().nonnegative(),completed:c.number().int().nonnegative(),date:rY,failed:c.number().int().nonnegative()}).strict(),I4=c.object({executionDays:c.array(IT),executionHours:c.array(IT).optional(),executionSixHours:c.array(IT).optional(),executions:c.array(R4),automation:dw,truncated:c.boolean()}).strict(),sY=R4.extend({kind:c.enum(["scheduled","event"]),automationId:c.string().min(1),automationTitle:c.string().min(1)}).strict(),T4=c.object({runs:c.array(sY),truncated:c.boolean()}).strict(),FQ={title:c.string().nullable(),instruction:c.string()},HQ={version:c.number().int().positive(),createdAt:c.string().datetime(),editedBy:KQ.nullable()},lY=c.discriminatedUnion("kind",[c.object({...HQ,kind:c.literal("scheduled"),definition:TT.pick({credentialMode:!0,destination:!0,outcomes:!0,schedule:!0}).extend(FQ).strict()}).strict(),c.object({...HQ,kind:c.literal("event"),definition:LRe.pick({credentialMode:!0,destination:!0,outcomes:!0,trigger:!0}).extend(FQ).strict()}).strict()]),N4=c.object({versions:c.array(lY),activeVersion:c.number().int().positive().nullable(),truncated:c.boolean()}).strict(),HRe=oY.extend({version:c.coerce.number().int().positive()}).strict(),uw=c.string().regex(/^[a-f0-9]{64}$/),VRe=c.object({revision:uw}).strict(),QZe=c.object({action:c.enum(["pause","resume"]),revision:uw}).strict(),VQ=TT.pick({destination:!0,createdBy:!0}).extend({id:c.string().min(1),revision:uw,title:c.string().nullable(),instruction:c.string(),credentialMode:c.enum(["system","creator"]),outcomes:c.array(ow).max(5),ownedByViewer:c.boolean()}),lc=c.discriminatedUnion("kind",[VQ.merge(TT.pick({schedule:!0})).extend({kind:c.literal("scheduled"),nextRunAtMs:c.number().optional(),status:c.enum(["active","blocked","paused","completed"])}).strict(),VQ.extend({kind:c.literal("event"),trigger:C4,triggerAvailable:c.boolean(),status:c.enum(["active","blocked","paused"])}).strict()]),_4=c.discriminatedUnion("kind",[ERe.omit({status:!0}).extend({kind:c.literal("scheduled"),revision:uw}).strict(),PRe.extend({kind:c.literal("event"),revision:uw}).strict()]),qRe=c.object({error:c.string(),code:c.enum(["invalid_edit","conflict","not_found"]),fields:c.record(c.string(),c.array(c.string())).optional()}).strict(),L4=c.array(i4.safeExtend({namespace:c.string()})),A4=WQ,E4=TT.pick({schedule:!0}).extend({nextRunAtMs:c.number()}).strict();var GRe=c.object({status:c.literal("ok"),service:c.string(),timestamp:c.string()}).strict(),cY=c.object({configKeys:c.array(c.string()),description:c.string(),displayName:c.string(),name:c.string()}).strict(),P4=c.array(cY),D4=c.object({name:c.string(),pluginProvider:c.string().optional()}).strict(),$4=c.array(D4),uY=c.object({dir:c.string(),hasMigrationsDir:c.boolean(),hasSkillsDir:c.boolean(),packageName:c.string()}).strict(),dY=c.object({packageNames:c.array(c.string()),packages:c.array(uY),manifestRoots:c.array(c.string()),skillRoots:c.array(c.string()),tracingIncludes:c.array(c.string())}).strict(),ZRe=c.object({cwd:c.string(),homeDir:c.string(),descriptionText:c.string().optional(),providers:c.array(c.string()),skills:c.array(D4),packagedContent:dY}).strict(),M4=c.enum(["danger","good","neutral","warning"]),WRe=c.object({label:c.string(),tone:M4.optional(),value:c.string()}).strict(),KRe=c.object({key:c.string(),label:c.string()}).strict(),JRe=c.object({id:c.string(),tone:M4.optional(),values:c.record(c.string(),c.string())}).strict(),QRe=c.object({fields:c.array(KRe).optional(),emptyText:c.string().optional(),records:c.array(JRe).optional(),title:c.string()}).strict(),YRe=c.object({categories:c.array(c.object({id:c.string().min(1),label:c.string().min(1),values:c.record(c.string(),c.number().finite())}).strict()).max(100),description:c.string().optional(),emptyText:c.string().optional(),id:c.string().min(1),series:c.array(c.object({format:c.literal("usd").optional(),key:c.string().min(1),label:c.string().min(1),tone:M4.optional()}).strict()).min(1).max(8),timeRangeDays:c.array(c.union([c.literal(1),c.literal(7),c.literal(30),c.literal(90)])).min(1).max(4).optional(),title:c.string().min(1),type:c.literal("bar_chart")}).strict(),fY=c.object({generatedAt:c.string().optional(),metrics:c.array(WRe).optional(),recordSets:c.array(QRe).optional(),title:c.string().optional(),pluginName:c.string(),widgets:c.array(YRe).max(12).optional()}).strict(),_T=c.object({generatedAt:c.string(),reports:c.array(fY),source:c.literal("plugins")}).strict(),mY=36e5,eWe=6*mY,tWe=24*mY;async function O4(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${e.conversationId}\0${e.idempotencyKey}`));return`api-msg:${Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("").slice(0,24)}`}var j=Symbol.for("drizzle:entityKind");function lo(e,t){if(!e||typeof e!="object")return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,j))throw new Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(j in n&&n[j]===t[j])return!0;n=Object.getPrototypeOf(n)}return!1}var Uh=class{constructor(t,n){this.table=t,this.config=n,this.name=n.name,this.keyAsName=n.keyAsName,this.notNull=n.notNull,this.default=n.default,this.defaultFn=n.defaultFn,this.onUpdateFn=n.onUpdateFn,this.hasDefault=n.hasDefault,this.primary=n.primaryKey,this.isUnique=n.isUnique,this.uniqueName=n.uniqueName,this.uniqueType=n.uniqueType,this.dataType=n.dataType,this.columnType=n.columnType,this.generated=n.generated,this.generatedIdentity=n.generatedIdentity}static[j]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(t){return t}mapToDriverValue(t){return t}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}};var LT=class{static[j]="ColumnBuilder";config;constructor(t,n,r){this.config={name:t,keyAsName:t==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:n,columnType:r,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(t){return this.config.default=t,this.config.hasDefault=!0,this}$defaultFn(t){return this.config.defaultFn=t,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(t){return this.config.onUpdateFn=t,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(t){this.config.name===""&&(this.config.name=t)}};var Yd=Symbol.for("drizzle:Name");var AT=class{static[j]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(t,n){this.reference=()=>{let{name:r,columns:a,foreignColumns:o}=t();return{name:r,columns:a,foreignTable:o[0].table,foreignColumns:o}},n&&(this._onUpdate=n.onUpdate,this._onDelete=n.onDelete)}onUpdate(t){return this._onUpdate=t===void 0?"no action":t,this}onDelete(t){return this._onDelete=t===void 0?"no action":t,this}build(t){return new z4(t,this)}},z4=class{constructor(t,n){this.table=t,this.reference=n.reference,this.onUpdate=n._onUpdate,this.onDelete=n._onDelete}static[j]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:t,columns:n,foreignColumns:r}=this.reference(),a=n.map(s=>s.name),o=r.map(s=>s.name),i=[this.table[Yd],...a,r[0].table[Yd],...o];return t??`${i.join("_")}_fk`}};function ET(e,...t){return e(...t)}function B4(e,t){return`${e[Yd]}_${t.join("_")}_unique`}var U4=class{constructor(t,n){this.name=n,this.columns=t}static[j]="PgUniqueConstraintBuilder";columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(t){return new j4(t,this.columns,this.nullsNotDistinctConfig,this.name)}},pY=class{static[j]="PgUniqueOnConstraintBuilder";name;constructor(t){this.name=t}on(...t){return new U4(t,this.name)}},j4=class{constructor(t,n,r,a){this.table=t,this.columns=n,this.name=a??B4(this.table,this.columns.map(o=>o.name)),this.nullsNotDistinct=r}static[j]="PgUniqueConstraint";columns;name;nullsNotDistinct=!1;getName(){return this.name}};function hY(e,t,n){for(let r=t;r<e.length;r++){let a=e[r];if(a==="\\"){r++;continue}if(a==='"')return[e.slice(t,r).replace(/\\/g,""),r+1];if(!n&&(a===","||a==="}"))return[e.slice(t,r).replace(/\\/g,""),r]}return[e.slice(t).replace(/\\/g,""),e.length]}function gY(e,t=0){let n=[],r=t,a=!1;for(;r<e.length;){let o=e[r];if(o===","){(a||r===t)&&n.push(""),a=!0,r++;continue}if(a=!1,o==="\\"){r+=2;continue}if(o==='"'){let[l,u]=hY(e,r+1,!0);n.push(l),r=u;continue}if(o==="}")return[n,r+1];if(o==="{"){let[l,u]=gY(e,r+1);n.push(l),r=u;continue}let[i,s]=hY(e,r,!1);n.push(i),r=s}return[n,r]}function vY(e){let[t]=gY(e,1);return t}function F4(e){return`{${e.map(t=>Array.isArray(t)?F4(t):typeof t=="string"?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}var Ee=class extends LT{foreignKeyConfigs=[];static[j]="PgColumnBuilder";array(t){return new V4(this.config.name,this,t)}references(t,n={}){return this.foreignKeyConfigs.push({ref:t,actions:n}),this}unique(t,n){return this.config.isUnique=!0,this.config.uniqueName=t,this.config.uniqueType=n?.nulls,this}generatedAlwaysAs(t){return this.config.generated={as:t,type:"always",mode:"stored"},this}buildForeignKeys(t,n){return this.foreignKeyConfigs.map(({ref:r,actions:a})=>ET((o,i)=>{let s=new AT(()=>{let l=o();return{columns:[t],foreignColumns:[l]}});return i.onUpdate&&s.onUpdate(i.onUpdate),i.onDelete&&s.onDelete(i.onDelete),s.build(n)},r,a))}buildExtraConfigColumn(t){return new H4(t,this.config)}},be=class extends Uh{constructor(t,n){n.uniqueName||(n.uniqueName=B4(t,[n.name])),super(t,n),this.table=t}static[j]="PgColumn"},H4=class extends be{static[j]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(t){return this.indexConfig.opClass=t,this}},Fy=class{static[j]="IndexedColumn";constructor(t,n,r,a){this.name=t,this.keyAsName=n,this.type=r,this.indexConfig=a}name;keyAsName;type;indexConfig},V4=class extends Ee{static[j]="PgArrayBuilder";constructor(t,n,r){super(t,"array","PgArray"),this.config.baseBuilder=n,this.config.size=r}build(t){let n=this.config.baseBuilder.build(t);return new q4(t,this.config,n)}},q4=class e extends be{constructor(t,n,r,a){super(t,n),this.baseColumn=r,this.range=a,this.size=n.size}size;static[j]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(t){return typeof t=="string"&&(t=vY(t)),t.map(n=>this.baseColumn.mapFromDriverValue(n))}mapToDriverValue(t,n=!1){let r=t.map(a=>a===null?null:lo(this.baseColumn,e)?this.baseColumn.mapToDriverValue(a,!0):this.baseColumn.mapToDriverValue(a));return n?r:F4(r)}};var yY=class extends Ee{static[j]="PgEnumObjectColumnBuilder";constructor(t,n){super(t,"string","PgEnumObjectColumn"),this.config.enum=n}build(t){return new G4(t,this.config)}},G4=class extends be{static[j]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(t,n){super(t,n),this.enum=n.enum}getSQLType(){return this.enum.enumName}},bY=Symbol.for("drizzle:isPgEnum");function SY(e){return!!e&&typeof e=="function"&&bY in e&&e[bY]===!0}var xY=class extends Ee{static[j]="PgEnumColumnBuilder";constructor(t,n){super(t,"string","PgEnumColumn"),this.config.enum=n}build(t){return new Z4(t,this.config)}},Z4=class extends be{static[j]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(t,n){super(t,n),this.enum=n.enum}getSQLType(){return this.enum.enumName}};var Hy=class{static[j]="Subquery";constructor(t,n,r,a=!1,o=[]){this._={brand:"Subquery",sql:t,selectedFields:n,alias:r,isWith:a,usedTables:o}}},wY=class extends Hy{static[j]="WithSubquery"};var CY="0.45.2";var W4,K4,kY={startActiveSpan(e,t){return W4?(K4||(K4=W4.trace.getTracer("drizzle-orm",CY)),ET((n,r)=>r.startActiveSpan(e,a=>{try{return t(a)}catch(o){throw a.setStatus({code:n.SpanStatusCode.ERROR,message:o instanceof Error?o.message:"Unknown error"}),o}finally{a.end()}}),W4,K4)):t()}};var Vy=Symbol.for("drizzle:ViewBaseConfig");var J4=Symbol.for("drizzle:Schema"),RY=Symbol.for("drizzle:Columns"),IY=Symbol.for("drizzle:ExtraConfigColumns"),Q4=Symbol.for("drizzle:OriginalName"),Y4=Symbol.for("drizzle:BaseName"),fw=Symbol.for("drizzle:IsAlias"),TY=Symbol.for("drizzle:ExtraConfigBuilder"),XRe=Symbol.for("drizzle:IsDrizzleTable"),Fr=class{static[j]="Table";static Symbol={Name:Yd,Schema:J4,OriginalName:Q4,Columns:RY,ExtraConfigColumns:IY,BaseName:Y4,IsAlias:fw,ExtraConfigBuilder:TY};[Yd];[Q4];[J4];[RY];[IY];[Y4];[fw]=!1;[XRe]=!0;[TY]=void 0;constructor(t,n,r){this[Yd]=this[Q4]=t,this[J4]=n,this[Y4]=r}};var NY=class{static[j]="FakePrimitiveParam"};function eIe(e){return e!=null&&typeof e.getSQL=="function"}function tIe(e){let t={sql:"",params:[]};for(let n of e)t.sql+=n.sql,t.params.push(...n.params),n.typings?.length&&(t.typings||(t.typings=[]),t.typings.push(...n.typings));return t}var Tl=class{static[j]="StringChunk";value;constructor(t){this.value=Array.isArray(t)?t:[t]}getSQL(){return new Hr([this])}},Hr=class e{constructor(t){this.queryChunks=t;for(let n of t)if(lo(n,Fr)){let r=n[Fr.Symbol.Schema];this.usedTables.push(r===void 0?n[Fr.Symbol.Name]:r+"."+n[Fr.Symbol.Name])}}static[j]="SQL";decoder=_Y;shouldInlineParams=!1;usedTables=[];append(t){return this.queryChunks.push(...t.queryChunks),this}toQuery(t){return kY.startActiveSpan("drizzle.buildSQL",n=>{let r=this.buildQueryFromSourceParams(this.queryChunks,t);return n?.setAttributes({"drizzle.query.text":r.sql,"drizzle.query.params":JSON.stringify(r.params)}),r})}buildQueryFromSourceParams(t,n){let r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:a,escapeName:o,escapeParam:i,prepareTyping:s,inlineParams:l,paramStartIndex:u}=r;return tIe(t.map(d=>{if(lo(d,Tl))return{sql:d.value.join(""),params:[]};if(lo(d,mw))return{sql:o(d.value),params:[]};if(d===void 0)return{sql:"",params:[]};if(Array.isArray(d)){let f=[new Tl("(")];for(let[m,h]of d.entries())f.push(h),m<d.length-1&&f.push(new Tl(", "));return f.push(new Tl(")")),this.buildQueryFromSourceParams(f,r)}if(lo(d,e))return this.buildQueryFromSourceParams(d.queryChunks,{...r,inlineParams:l||d.shouldInlineParams});if(lo(d,Fr)){let f=d[Fr.Symbol.Schema],m=d[Fr.Symbol.Name];return{sql:f===void 0||d[fw]?o(m):o(f)+"."+o(m),params:[]}}if(lo(d,Uh)){let f=a.getColumnCasing(d);if(n.invokeSource==="indexes")return{sql:o(f),params:[]};let m=d.table[Fr.Symbol.Schema];return{sql:d.table[fw]||m===void 0?o(d.table[Fr.Symbol.Name])+"."+o(f):o(m)+"."+o(d.table[Fr.Symbol.Name])+"."+o(f),params:[]}}if(lo(d,X4)){let f=d[Vy].schema,m=d[Vy].name;return{sql:f===void 0||d[Vy].isAlias?o(m):o(f)+"."+o(m),params:[]}}if(lo(d,PT)){if(lo(d.value,pw))return{sql:i(u.value++,d),params:[d],typings:["none"]};let f=d.value===null?null:d.encoder.mapToDriverValue(d.value);if(lo(f,e))return this.buildQueryFromSourceParams([f],r);if(l)return{sql:this.mapInlineParam(f,r),params:[]};let m=["none"];return s&&(m=[s(d.encoder)]),{sql:i(u.value++,f),params:[f],typings:m}}return lo(d,pw)?{sql:i(u.value++,d),params:[d],typings:["none"]}:lo(d,e.Aliased)&&d.fieldAlias!==void 0?{sql:o(d.fieldAlias),params:[]}:lo(d,Hy)?d._.isWith?{sql:o(d._.alias),params:[]}:this.buildQueryFromSourceParams([new Tl("("),d._.sql,new Tl(") "),new mw(d._.alias)],r):SY(d)?d.schema?{sql:o(d.schema)+"."+o(d.enumName),params:[]}:{sql:o(d.enumName),params:[]}:eIe(d)?d.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([d.getSQL()],r):this.buildQueryFromSourceParams([new Tl("("),d.getSQL(),new Tl(")")],r):l?{sql:this.mapInlineParam(d,r),params:[]}:{sql:i(u.value++,d),params:[d],typings:["none"]}}))}mapInlineParam(t,{escapeString:n}){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return t.toString();if(typeof t=="string")return n(t);if(typeof t=="object"){let r=t.toString();return n(r==="[object Object]"?JSON.stringify(t):r)}throw new Error("Unexpected param value: "+t)}getSQL(){return this}as(t){return t===void 0?this:new e.Aliased(this,t)}mapWith(t){return this.decoder=typeof t=="function"?{mapFromDriverValue:t}:t,this}inlineParams(){return this.shouldInlineParams=!0,this}if(t){return t?this:void 0}},mw=class{constructor(t){this.value=t}static[j]="Name";brand;getSQL(){return new Hr([this])}};var _Y={mapFromDriverValue:e=>e},LY={mapToDriverValue:e=>e},qWe={..._Y,...LY},PT=class{constructor(t,n=LY){this.value=t,this.encoder=n}static[j]="Param";brand;getSQL(){return new Hr([this])}};function Uu(e,...t){let n=[];(t.length>0||e.length>0&&e[0]!=="")&&n.push(new Tl(e[0]));for(let[r,a]of t.entries())n.push(a,new Tl(e[r+1]));return new Hr(n)}(e=>{function t(){return new Hr([])}e.empty=t;function n(l){return new Hr(l)}e.fromList=n;function r(l){return new Hr([new Tl(l)])}e.raw=r;function a(l,u){let d=[];for(let[f,m]of l.entries())f>0&&u!==void 0&&d.push(u),d.push(m);return new Hr(d)}e.join=a;function o(l){return new mw(l)}e.identifier=o;function i(l){return new pw(l)}e.placeholder=i;function s(l,u){return new PT(l,u)}e.param=s})(Uu||(Uu={}));(e=>{class t{constructor(r,a){this.sql=r,this.fieldAlias=a}static[j]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(Hr||(Hr={}));var pw=class{constructor(t){this.name=t}static[j]="Placeholder";getSQL(){return new Hr([this])}};var nIe=Symbol.for("drizzle:IsDrizzleView"),X4=class{static[j]="View";[Vy];[nIe]=!0;constructor({name:t,schema:n,selectedFields:r,query:a}){this[Vy]={name:t,originalName:t,schema:n,selectedFields:r,query:a,isExisting:!a,isAlias:!1}}getSQL(){return new Hr([this])}};Uh.prototype.getSQL=function(){return new Hr([this])};Fr.prototype.getSQL=function(){return new Hr([this])};Hy.prototype.getSQL=function(){return new Hr([this])};function Rn(e,t){return{name:typeof e=="string"&&e.length>0?e:"",config:typeof e=="object"?e:t}}var ZWe=typeof TextDecoder>"u"?null:new TextDecoder;var Xd=class extends Ee{static[j]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(t){if(t){let{name:n,...r}=t;this.config.generatedIdentity={type:"always",sequenceName:n,sequenceOptions:r}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(t){if(t){let{name:n,...r}=t;this.config.generatedIdentity={type:"byDefault",sequenceName:n,sequenceOptions:r}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}};var e5=class extends Xd{static[j]="PgBigInt53Builder";constructor(t){super(t,"number","PgBigInt53")}build(t){return new t5(t,this.config)}},t5=class extends be{static[j]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}},n5=class extends Xd{static[j]="PgBigInt64Builder";constructor(t){super(t,"bigint","PgBigInt64")}build(t){return new a5(t,this.config)}},a5=class extends be{static[j]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(t){return BigInt(t)}};function AY(e,t){let{name:n,config:r}=Rn(e,t);return r.mode==="number"?new e5(n):new n5(n)}var r5=class extends Ee{static[j]="PgBigSerial53Builder";constructor(t){super(t,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new o5(t,this.config)}},o5=class extends be{static[j]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}},i5=class extends Ee{static[j]="PgBigSerial64Builder";constructor(t){super(t,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(t){return new s5(t,this.config)}},s5=class extends be{static[j]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(t){return BigInt(t)}};function EY(e,t){let{name:n,config:r}=Rn(e,t);return r.mode==="number"?new r5(n):new i5(n)}var l5=class extends Ee{static[j]="PgBooleanBuilder";constructor(t){super(t,"boolean","PgBoolean")}build(t){return new c5(t,this.config)}},c5=class extends be{static[j]="PgBoolean";getSQLType(){return"boolean"}};function hw(e){return new l5(e??"")}var u5=class extends Ee{static[j]="PgCharBuilder";constructor(t,n){super(t,"string","PgChar"),this.config.length=n.length,this.config.enumValues=n.enum}build(t){return new d5(t,this.config)}},d5=class extends be{static[j]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}};function PY(e,t={}){let{name:n,config:r}=Rn(e,t);return new u5(n,r)}var f5=class extends Ee{static[j]="PgCidrBuilder";constructor(t){super(t,"string","PgCidr")}build(t){return new m5(t,this.config)}},m5=class extends be{static[j]="PgCidr";getSQLType(){return"cidr"}};function DY(e){return new f5(e??"")}var p5=class extends Ee{static[j]="PgCustomColumnBuilder";constructor(t,n,r){super(t,"custom","PgCustomColumn"),this.config.fieldConfig=n,this.config.customTypeParams=r}build(t){return new h5(t,this.config)}},h5=class extends be{static[j]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(t,n){super(t,n),this.sqlName=n.customTypeParams.dataType(n.fieldConfig),this.mapTo=n.customTypeParams.toDriver,this.mapFrom=n.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(t){return typeof this.mapFrom=="function"?this.mapFrom(t):t}mapToDriverValue(t){return typeof this.mapTo=="function"?this.mapTo(t):t}};function $Y(e){return(t,n)=>{let{name:r,config:a}=Rn(t,n);return new p5(r,a,e)}}var ju=class extends Ee{static[j]="PgDateColumnBaseBuilder";defaultNow(){return this.default(Uu`now()`)}};var g5=class extends ju{static[j]="PgDateBuilder";constructor(t){super(t,"date","PgDate")}build(t){return new v5(t,this.config)}},v5=class extends be{static[j]="PgDate";getSQLType(){return"date"}mapFromDriverValue(t){return typeof t=="string"?new Date(t):t}mapToDriverValue(t){return t.toISOString()}},y5=class extends ju{static[j]="PgDateStringBuilder";constructor(t){super(t,"string","PgDateString")}build(t){return new b5(t,this.config)}},b5=class extends be{static[j]="PgDateString";getSQLType(){return"date"}mapFromDriverValue(t){return typeof t=="string"?t:t.toISOString().slice(0,-14)}};function MY(e,t){let{name:n,config:r}=Rn(e,t);return r?.mode==="date"?new g5(n):new y5(n)}var x5=class extends Ee{static[j]="PgDoublePrecisionBuilder";constructor(t){super(t,"number","PgDoublePrecision")}build(t){return new S5(t,this.config)}},S5=class extends be{static[j]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(t){return typeof t=="string"?Number.parseFloat(t):t}};function OY(e){return new x5(e??"")}var w5=class extends Ee{static[j]="PgInetBuilder";constructor(t){super(t,"string","PgInet")}build(t){return new C5(t,this.config)}},C5=class extends be{static[j]="PgInet";getSQLType(){return"inet"}};function zY(e){return new w5(e??"")}var k5=class extends Xd{static[j]="PgIntegerBuilder";constructor(t){super(t,"number","PgInteger")}build(t){return new R5(t,this.config)}},R5=class extends be{static[j]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(t){return typeof t=="string"?Number.parseInt(t):t}};function qy(e){return new k5(e??"")}var I5=class extends Ee{static[j]="PgIntervalBuilder";constructor(t,n){super(t,"string","PgInterval"),this.config.intervalConfig=n}build(t){return new T5(t,this.config)}},T5=class extends be{static[j]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let t=this.fields?` ${this.fields}`:"",n=this.precision?`(${this.precision})`:"";return`interval${t}${n}`}};function UY(e,t={}){let{name:n,config:r}=Rn(e,t);return new I5(n,r)}var N5=class extends Ee{static[j]="PgJsonBuilder";constructor(t){super(t,"json","PgJson")}build(t){return new _5(t,this.config)}},_5=class extends be{static[j]="PgJson";constructor(t,n){super(t,n)}getSQLType(){return"json"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}};function jY(e){return new N5(e??"")}var L5=class extends Ee{static[j]="PgJsonbBuilder";constructor(t){super(t,"json","PgJsonb")}build(t){return new A5(t,this.config)}},A5=class extends be{static[j]="PgJsonb";constructor(t,n){super(t,n)}getSQLType(){return"jsonb"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}};function as(e){return new L5(e??"")}var E5=class extends Ee{static[j]="PgLineBuilder";constructor(t){super(t,"array","PgLine")}build(t){return new P5(t,this.config)}},P5=class extends be{static[j]="PgLine";getSQLType(){return"line"}mapFromDriverValue(t){let[n,r,a]=t.slice(1,-1).split(",");return[Number.parseFloat(n),Number.parseFloat(r),Number.parseFloat(a)]}mapToDriverValue(t){return`{${t[0]},${t[1]},${t[2]}}`}},D5=class extends Ee{static[j]="PgLineABCBuilder";constructor(t){super(t,"json","PgLineABC")}build(t){return new $5(t,this.config)}},$5=class extends be{static[j]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(t){let[n,r,a]=t.slice(1,-1).split(",");return{a:Number.parseFloat(n),b:Number.parseFloat(r),c:Number.parseFloat(a)}}mapToDriverValue(t){return`{${t.a},${t.b},${t.c}}`}};function BY(e,t){let{name:n,config:r}=Rn(e,t);return!r?.mode||r.mode==="tuple"?new E5(n):new D5(n)}var M5=class extends Ee{static[j]="PgMacaddrBuilder";constructor(t){super(t,"string","PgMacaddr")}build(t){return new O5(t,this.config)}},O5=class extends be{static[j]="PgMacaddr";getSQLType(){return"macaddr"}};function FY(e){return new M5(e??"")}var z5=class extends Ee{static[j]="PgMacaddr8Builder";constructor(t){super(t,"string","PgMacaddr8")}build(t){return new U5(t,this.config)}},U5=class extends be{static[j]="PgMacaddr8";getSQLType(){return"macaddr8"}};function HY(e){return new z5(e??"")}var j5=class extends Ee{static[j]="PgNumericBuilder";constructor(t,n,r){super(t,"string","PgNumeric"),this.config.precision=n,this.config.scale=r}build(t){return new B5(t,this.config)}},B5=class extends be{static[j]="PgNumeric";precision;scale;constructor(t,n){super(t,n),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(t){return typeof t=="string"?t:String(t)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}},F5=class extends Ee{static[j]="PgNumericNumberBuilder";constructor(t,n,r){super(t,"number","PgNumericNumber"),this.config.precision=n,this.config.scale=r}build(t){return new H5(t,this.config)}},H5=class extends be{static[j]="PgNumericNumber";precision;scale;constructor(t,n){super(t,n),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}},V5=class extends Ee{static[j]="PgNumericBigIntBuilder";constructor(t,n,r){super(t,"bigint","PgNumericBigInt"),this.config.precision=n,this.config.scale=r}build(t){return new q5(t,this.config)}},q5=class extends be{static[j]="PgNumericBigInt";precision;scale;constructor(t,n){super(t,n),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}};function VY(e,t){let{name:n,config:r}=Rn(e,t),a=r?.mode;return a==="number"?new F5(n,r?.precision,r?.scale):a==="bigint"?new V5(n,r?.precision,r?.scale):new j5(n,r?.precision,r?.scale)}var G5=class extends Ee{static[j]="PgPointTupleBuilder";constructor(t){super(t,"array","PgPointTuple")}build(t){return new Z5(t,this.config)}},Z5=class extends be{static[j]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){let[n,r]=t.slice(1,-1).split(",");return[Number.parseFloat(n),Number.parseFloat(r)]}return[t.x,t.y]}mapToDriverValue(t){return`(${t[0]},${t[1]})`}},W5=class extends Ee{static[j]="PgPointObjectBuilder";constructor(t){super(t,"json","PgPointObject")}build(t){return new K5(t,this.config)}},K5=class extends be{static[j]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){let[n,r]=t.slice(1,-1).split(",");return{x:Number.parseFloat(n),y:Number.parseFloat(r)}}return t}mapToDriverValue(t){return`(${t.x},${t.y})`}};function qY(e,t){let{name:n,config:r}=Rn(e,t);return!r?.mode||r.mode==="tuple"?new G5(n):new W5(n)}function aIe(e){let t=[];for(let n=0;n<e.length;n+=2)t.push(Number.parseInt(e.slice(n,n+2),16));return new Uint8Array(t)}function GY(e,t){let n=new ArrayBuffer(8),r=new DataView(n);for(let a=0;a<8;a++)r.setUint8(a,e[t+a]);return r.getFloat64(0,!0)}function J5(e){let t=aIe(e),n=0,r=t[n];n+=1;let a=new DataView(t.buffer),o=a.getUint32(n,r===1);n+=4;let i;if(o&536870912&&(i=a.getUint32(n,r===1),n+=4),(o&65535)===1){let s=GY(t,n);n+=8;let l=GY(t,n);return n+=8,[s,l]}throw new Error("Unsupported geometry type")}var Q5=class extends Ee{static[j]="PgGeometryBuilder";constructor(t){super(t,"array","PgGeometry")}build(t){return new Y5(t,this.config)}},Y5=class extends be{static[j]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(t){return J5(t)}mapToDriverValue(t){return`point(${t[0]} ${t[1]})`}},X5=class extends Ee{static[j]="PgGeometryObjectBuilder";constructor(t){super(t,"json","PgGeometryObject")}build(t){return new e3(t,this.config)}},e3=class extends be{static[j]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(t){let n=J5(t);return{x:n[0],y:n[1]}}mapToDriverValue(t){return`point(${t.x} ${t.y})`}};function ZY(e,t){let{name:n,config:r}=Rn(e,t);return!r?.mode||r.mode==="tuple"?new Q5(n):new X5(n)}var t3=class extends Ee{static[j]="PgRealBuilder";constructor(t,n){super(t,"number","PgReal"),this.config.length=n}build(t){return new n3(t,this.config)}},n3=class extends be{static[j]="PgReal";constructor(t,n){super(t,n)}getSQLType(){return"real"}mapFromDriverValue=t=>typeof t=="string"?Number.parseFloat(t):t};function WY(e){return new t3(e??"")}var a3=class extends Ee{static[j]="PgSerialBuilder";constructor(t){super(t,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new r3(t,this.config)}},r3=class extends be{static[j]="PgSerial";getSQLType(){return"serial"}};function KY(e){return new a3(e??"")}var o3=class extends Xd{static[j]="PgSmallIntBuilder";constructor(t){super(t,"number","PgSmallInt")}build(t){return new i3(t,this.config)}},i3=class extends be{static[j]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=t=>typeof t=="string"?Number(t):t};function JY(e){return new o3(e??"")}var s3=class extends Ee{static[j]="PgSmallSerialBuilder";constructor(t){super(t,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new l3(t,this.config)}},l3=class extends be{static[j]="PgSmallSerial";getSQLType(){return"smallserial"}};function QY(e){return new s3(e??"")}var c3=class extends Ee{static[j]="PgTextBuilder";constructor(t,n){super(t,"string","PgText"),this.config.enumValues=n.enum}build(t){return new u3(t,this.config)}},u3=class extends be{static[j]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}};function We(e,t={}){let{name:n,config:r}=Rn(e,t);return new c3(n,r)}var d3=class extends ju{constructor(t,n,r){super(t,"string","PgTime"),this.withTimezone=n,this.precision=r,this.config.withTimezone=n,this.config.precision=r}static[j]="PgTimeBuilder";build(t){return new f3(t,this.config)}},f3=class extends be{static[j]="PgTime";withTimezone;precision;constructor(t,n){super(t,n),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}};function YY(e,t={}){let{name:n,config:r}=Rn(e,t);return new d3(n,r.withTimezone??!1,r.precision)}var m3=class extends ju{static[j]="PgTimestampBuilder";constructor(t,n,r){super(t,"date","PgTimestamp"),this.config.withTimezone=n,this.config.precision=r}build(t){return new p3(t,this.config)}},p3=class extends be{static[j]="PgTimestamp";withTimezone;precision;constructor(t,n){super(t,n),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(t){return typeof t=="string"?new Date(this.withTimezone?t:t+"+0000"):t}mapToDriverValue=t=>t.toISOString()},h3=class extends ju{static[j]="PgTimestampStringBuilder";constructor(t,n,r){super(t,"string","PgTimestampString"),this.config.withTimezone=n,this.config.precision=r}build(t){return new g3(t,this.config)}},g3=class extends be{static[j]="PgTimestampString";withTimezone;precision;constructor(t,n){super(t,n),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(t){if(typeof t=="string")return t;let n=t.toISOString().slice(0,-1).replace("T"," ");if(this.withTimezone){let r=t.getTimezoneOffset(),a=r<=0?"+":"-";return`${n}${a}${Math.floor(Math.abs(r)/60).toString().padStart(2,"0")}`}return n}};function DT(e,t={}){let{name:n,config:r}=Rn(e,t);return r?.mode==="string"?new h3(n,r.withTimezone??!1,r.precision):new m3(n,r?.withTimezone??!1,r?.precision)}var v3=class extends Ee{static[j]="PgUUIDBuilder";constructor(t){super(t,"string","PgUUID")}defaultRandom(){return this.default(Uu`gen_random_uuid()`)}build(t){return new y3(t,this.config)}},y3=class extends be{static[j]="PgUUID";getSQLType(){return"uuid"}};function XY(e){return new v3(e??"")}var b3=class extends Ee{static[j]="PgVarcharBuilder";constructor(t,n){super(t,"string","PgVarchar"),this.config.length=n.length,this.config.enumValues=n.enum}build(t){return new x3(t,this.config)}},x3=class extends be{static[j]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}};function eX(e,t={}){let{name:n,config:r}=Rn(e,t);return new b3(n,r)}var S3=class extends Ee{static[j]="PgBinaryVectorBuilder";constructor(t,n){super(t,"string","PgBinaryVector"),this.config.dimensions=n.dimensions}build(t){return new w3(t,this.config)}},w3=class extends be{static[j]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}};function tX(e,t){let{name:n,config:r}=Rn(e,t);return new S3(n,r)}var C3=class extends Ee{static[j]="PgHalfVectorBuilder";constructor(t,n){super(t,"array","PgHalfVector"),this.config.dimensions=n.dimensions}build(t){return new k3(t,this.config)}},k3=class extends be{static[j]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){return t.slice(1,-1).split(",").map(n=>Number.parseFloat(n))}};function nX(e,t){let{name:n,config:r}=Rn(e,t);return new C3(n,r)}var R3=class extends Ee{static[j]="PgSparseVectorBuilder";constructor(t,n){super(t,"string","PgSparseVector"),this.config.dimensions=n.dimensions}build(t){return new I3(t,this.config)}},I3=class extends be{static[j]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}};function aX(e,t){let{name:n,config:r}=Rn(e,t);return new R3(n,r)}var T3=class extends Ee{static[j]="PgVectorBuilder";constructor(t,n){super(t,"array","PgVector"),this.config.dimensions=n.dimensions}build(t){return new N3(t,this.config)}},N3=class extends be{static[j]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){return t.slice(1,-1).split(",").map(n=>Number.parseFloat(n))}};function rX(e,t){let{name:n,config:r}=Rn(e,t);return new T3(n,r)}function oX(){return{bigint:AY,bigserial:EY,boolean:hw,char:PY,cidr:DY,customType:$Y,date:MY,doublePrecision:OY,inet:zY,integer:qy,interval:UY,json:jY,jsonb:as,line:BY,macaddr:FY,macaddr8:HY,numeric:VY,point:qY,geometry:ZY,real:WY,serial:KY,smallint:JY,smallserial:QY,text:We,time:YY,timestamp:DT,uuid:XY,varchar:eX,bit:tX,halfvec:nX,sparsevec:aX,vector:rX}}var _3=Symbol.for("drizzle:PgInlineForeignKeys"),iX=Symbol.for("drizzle:EnableRLS"),jh=class extends Fr{static[j]="PgTable";static Symbol=Object.assign({},Fr.Symbol,{InlineForeignKeys:_3,EnableRLS:iX});[_3]=[];[iX]=!1;[Fr.Symbol.ExtraConfigBuilder]=void 0;[Fr.Symbol.ExtraConfigColumns]={}};function rIe(e,t,n,r,a=e){let o=new jh(e,r,a),i=typeof t=="function"?t(oX()):t,s=Object.fromEntries(Object.entries(i).map(([d,f])=>{let m=f;m.setName(d);let h=m.build(o);return o[_3].push(...m.buildForeignKeys(h,o)),[d,h]})),l=Object.fromEntries(Object.entries(i).map(([d,f])=>{let m=f;m.setName(d);let h=m.buildExtraConfigColumn(o);return[d,h]})),u=Object.assign(o,s);return u[Fr.Symbol.Columns]=s,u[Fr.Symbol.ExtraConfigColumns]=l,n&&(u[jh.Symbol.ExtraConfigBuilder]=n),Object.assign(u,{enableRLS:()=>(u[jh.Symbol.EnableRLS]=!0,u)})}var Bh=(e,t,n)=>rIe(e,t,n,void 0);function sX(...e){return e[0].columns?new $T(e[0].columns,e[0].name):new $T(e)}var $T=class{static[j]="PgPrimaryKeyBuilder";columns;name;constructor(t,n){this.columns=t,this.name=n}build(t){return new L3(t,this.columns,this.name)}},L3=class{constructor(t,n,r){this.table=t,this.columns=n,this.name=r}static[j]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[jh.Symbol.Name]}_${this.columns.map(t=>t.name).join("_")}_pk`}};var MT=class{constructor(t,n){this.unique=t,this.name=n}static[j]="PgIndexBuilderOn";on(...t){return new gw(t.map(n=>{if(lo(n,Hr))return n;n=n;let r=new Fy(n.name,!!n.keyAsName,n.columnType,n.indexConfig);return n.indexConfig=JSON.parse(JSON.stringify(n.defaultConfig)),r}),this.unique,!1,this.name)}onOnly(...t){return new gw(t.map(n=>{if(lo(n,Hr))return n;n=n;let r=new Fy(n.name,!!n.keyAsName,n.columnType,n.indexConfig);return n.indexConfig=n.defaultConfig,r}),this.unique,!0,this.name)}using(t,...n){return new gw(n.map(r=>{if(lo(r,Hr))return r;r=r;let a=new Fy(r.name,!!r.keyAsName,r.columnType,r.indexConfig);return r.indexConfig=JSON.parse(JSON.stringify(r.defaultConfig)),a}),this.unique,!0,this.name,t)}},gw=class{static[j]="PgIndexBuilder";config;constructor(t,n,r,a,o="btree"){this.config={name:a,columns:t,unique:n,only:r,method:o}}concurrently(){return this.config.concurrently=!0,this}with(t){return this.config.with=t,this}where(t){return this.config.where=t,this}build(t){return new A3(this.config,t)}},A3=class{static[j]="PgIndex";config;constructor(t,n){this.config={...t,table:n}}};function rs(e){return new MT(!1,e)}function vw(e){return new MT(!0,e)}var Io=e=>DT(e,{withTimezone:!0}),lX=c.enum(["channel","dm","group","local_conversation","thread","web_session"]),oIe=Bh("junior_destinations",{id:We("id").primaryKey(),provider:We("provider").notNull(),providerTenantId:We("provider_tenant_id").notNull().default(""),providerDestinationId:We("provider_destination_id").notNull(),kind:We("kind").$type().notNull(),parentDestinationId:We("parent_destination_id"),displayName:We("display_name"),visibility:We("visibility").$type().notNull().default("unknown"),metadata:as("metadata_json"),createdAt:Io("created_at").notNull(),updatedAt:Io("updated_at").notNull()},e=>[vw("junior_destinations_provider_destination_uidx").on(e.provider,e.providerTenantId,e.providerDestinationId),rs("junior_destinations_provider_kind_idx").on(e.provider,e.kind)]),iIe=Bh("junior_users",{id:We("id").primaryKey(),primaryEmail:We("primary_email").notNull(),primaryEmailNormalized:We("primary_email_normalized").notNull(),displayName:We("display_name"),timezone:We("timezone"),isAdmin:hw("is_admin").notNull().default(!1),createdAt:Io("created_at").notNull(),updatedAt:Io("updated_at").notNull()},e=>[vw("junior_users_primary_email_normalized_uidx").on(e.primaryEmailNormalized)]),E3=Bh("junior_identities",{id:We("id").primaryKey(),kind:We("kind").$type().notNull(),provider:We("provider").notNull(),providerTenantId:We("provider_tenant_id").notNull().default(""),providerSubjectId:We("provider_subject_id").notNull(),displayName:We("display_name"),handle:We("handle"),email:We("email"),avatarUrl:We("avatar_url"),metadata:as("metadata_json"),createdAt:Io("created_at").notNull(),updatedAt:Io("updated_at").notNull(),userId:We("user_id").references(()=>iIe.id),emailNormalized:We("email_normalized"),emailVerified:hw("email_verified").notNull().default(!1),signedInAt:Io("signed_in_at")},e=>[vw("junior_identities_provider_subject_uidx").on(e.provider,e.providerTenantId,e.providerSubjectId),rs("junior_identities_user_idx").on(e.userId),rs("junior_identities_verified_email_idx").on(e.emailNormalized).where(Uu`${e.emailVerified} = true AND ${e.emailNormalized} IS NOT NULL`),rs("junior_identities_kind_provider_idx").on(e.kind,e.provider)]),Fh=Bh("junior_conversations",{conversationId:We("conversation_id").primaryKey(),schemaVersion:qy("schema_version").notNull().default(1),source:We("source").$type(),sessionSource:as("source_json").$type(),location:as("location_json").$type(),destinationId:We("destination_id").references(()=>oIe.id),destination:as("destination_json").$type(),actorIdentityId:We("actor_identity_id").references(()=>E3.id),creatorIdentityId:We("creator_identity_id").references(()=>E3.id),credentialSubjectIdentityId:We("credential_subject_identity_id").references(()=>E3.id),actor:as("actor_json").$type(),channelName:We("channel_name"),title:We("title"),createdAt:Io("created_at").notNull(),lastActivityAt:Io("last_activity_at").notNull(),updatedAt:Io("updated_at").notNull(),executionUpdatedAt:Io("execution_updated_at"),executionStatus:We("execution_status").$type().notNull(),runId:We("run_id"),lastCheckpointAt:Io("last_checkpoint_at"),lastEnqueuedAt:Io("last_enqueued_at"),parentConversationId:We("parent_conversation_id").references(()=>Fh.conversationId),forkedFromConversationId:We("forked_from_conversation_id").references(()=>Fh.conversationId,{onDelete:"set null"}),rootConversationId:We("root_conversation_id").references(()=>Fh.conversationId),transcriptPurgedAt:Io("transcript_purged_at"),stoppedAt:Io("stopped_at"),durationMs:qy("duration_ms").notNull().default(0),usage:as("usage_json").$type(),executionDurationMs:qy("execution_duration_ms").notNull().default(0),executionUsage:as("execution_usage_json").$type(),metricRunId:We("metric_run_id"),legacyArchivedAt:Io("archived_at")},e=>[rs("junior_conversations_last_activity_idx").on(e.lastActivityAt.desc(),e.conversationId),rs("junior_conversations_active_idx").using("btree",Uu`coalesce(${e.executionUpdatedAt}, ${e.updatedAt})`,e.conversationId).where(Uu`${e.executionStatus} <> 'idle'`),rs("junior_conversations_destination_activity_idx").on(e.destinationId,e.lastActivityAt.desc()),rs("junior_conversations_actor_activity_idx").on(e.actorIdentityId,e.lastActivityAt.desc()),rs("junior_conversations_parent_idx").on(e.parentConversationId),rs("junior_conversations_forked_from_idx").on(e.forkedFromConversationId),rs("junior_conversations_root_idx").on(e.rootConversationId)]);var cX=["pending","running","paused","blocked","completed","failed","stopped"];var dYe=Bh("junior_agent_bindings",{parentConversationId:We("parent_conversation_id").notNull().references(()=>Fh.conversationId),name:We("name").notNull(),childConversationId:We("child_conversation_id").notNull().references(()=>Fh.conversationId)},e=>[sX({columns:[e.parentConversationId,e.name]}),vw("junior_agent_bindings_child_idx").on(e.childConversationId)]),fYe=Bh("junior_agent_invocations",{invocationId:We("invocation_id").primaryKey(),parentConversationId:We("parent_conversation_id").notNull().references(()=>Fh.conversationId),childConversationId:We("child_conversation_id").notNull().references(()=>Fh.conversationId),agentName:We("agent_name"),input:We("input").notNull(),title:We("title"),actor:as("actor_json").$type().notNull(),credentialContext:as("credential_context_json").$type(),source:as("source_json").$type().notNull(),destination:as("destination_json").$type().notNull(),destinationVisibility:We("destination_visibility").$type(),agentType:We("agent_type").$type(),modelProfile:We("model_profile").$type(),reasoningLevel:We("reasoning_level").$type(),parentToolCallId:We("parent_tool_call_id"),status:We("status").$type().notNull(),mailboxStatus:We("mailbox_status").$type().notNull(),parentMailboxStatus:We("parent_mailbox_status").$type(),result:We("result"),errorMessage:We("error_message"),createdAt:Io("created_at").notNull(),updatedAt:Io("updated_at").notNull(),terminalAt:Io("terminal_at")},e=>[rs("junior_agent_invocations_child_idx").on(e.childConversationId),rs("junior_agent_invocations_mailbox_idx").on(e.mailboxStatus,e.createdAt),rs("junior_agent_invocations_parent_mailbox_idx").on(e.parentMailboxStatus,e.terminalAt)]);var sIe=c.object({error:c.string().min(1)}).strict(),Gy=c.object({active:c.number(),conversations:c.number(),durationMs:c.number(),failed:c.number(),label:c.string(),costUsd:c.number().optional(),tokens:c.number().optional()}).strict(),dX=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),P3=c.object({cachedInputTokens:c.number().optional(),cacheCreationTokens:c.number().optional(),conversations:c.number(),costUsd:c.number().optional(),date:dX,durationMs:c.number(),inputTokens:c.number().optional(),tokens:c.number().optional()}).strict(),D3=c.object({allow:c.number(),ask:c.number(),costUsd:c.number().optional(),date:dX,deny:c.number(),requests:c.number()}).strict(),lIe=c.object({allow:c.number(),ask:c.number(),costUsd:c.number().optional(),deny:c.number(),metricDays:c.array(D3),metricHours:c.array(D3).optional(),metricSixHours:c.array(D3).optional(),requests:c.number()}).strict(),O3=c.object({active:c.number(),cachedInputTokens:c.number().optional(),cacheCreationTokens:c.number().optional(),conversations:c.number(),durationMs:c.number(),failed:c.number(),generatedAt:c.string(),guardian:lIe,metricDays:c.array(P3),metricHours:c.array(P3).optional(),metricSixHours:c.array(P3).optional(),locations:c.array(Gy),actors:c.array(Gy),source:c.literal("conversation_index"),costUsd:c.number().optional(),inputTokens:c.number().optional(),tokens:c.number().optional(),windowEnd:c.string(),windowStart:c.string()}).strict(),cIe=c.object({inboundMessageId:c.string().min(1),text:c.string().min(1)}).strict(),z3=c.object({conversationId:c.string().min(1),status:c.enum(["no_work","requested"]),stoppedInboundMessageIds:c.array(c.string().min(1)),stoppedMessages:c.array(cIe)}).strict(),fX=c.object({auxiliaryCosts:kT.optional(),childAgentTotals:CT.optional(),conversationId:c.string().min(1),cumulativeDurationMs:c.number(),cumulativeUsage:lw.optional(),error:c.string().min(1).optional(),name:c.string().min(1).optional(),redacted:c.literal(!0).optional(),status:c.enum(cX),task:c.string().optional(),title:c.string().min(1).optional(),updatedAt:c.string().datetime()}).strict().superRefine((e,t)=>{e.task===void 0==(e.redacted!==!0)&&t.addIssue({code:"custom",message:"child agent task must be text or explicitly redacted"}),e.redacted&&(e.name||e.title||e.error)&&t.addIssue({code:"custom",message:"redacted child agents must not expose a name, title, or error"})}),U3=c.object({agents:c.array(fX),conversationId:c.string().min(1)}).strict(),jT=c.object({closed:c.number().int().nonnegative(),costUsd:c.number().nonnegative().optional(),created:c.number().int().nonnegative(),medianCostUsd:c.number().nonnegative().optional(),medianMergeTimeMs:c.number().nonnegative().optional(),merged:c.number().int().nonnegative(),mergeRate:c.number().min(0).max(1).optional(),open:c.number().int().nonnegative()}).strict(),uIe=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),Bu=c.object({closed:c.number().int().nonnegative(),created:c.number().int().nonnegative(),date:uIe,merged:c.number().int().nonnegative()}).strict(),mX=c.object({closed:c.number().int().nonnegative(),created:c.number().int().nonnegative(),id:c.string().uuid(),medianCostUsd:c.number().nonnegative().optional(),merged:c.number().int().nonnegative(),mergeRate:c.number().min(0).max(1).optional(),name:c.string().min(1),open:c.number().int().nonnegative(),provider:c.string().min(1),url:c.string().url().optional()}).strict(),BT=c.object({closedAt:c.string().optional(),id:c.string().uuid(),mergedAt:c.string().optional(),number:c.number().int().positive(),openedAt:c.string(),provider:c.string().min(1),repository:c.string().min(1),state:rw,title:c.string().optional(),url:c.string().url().optional()}).strict(),j3=c.object({activityDays:c.array(Bu),activityHours:c.array(Bu).optional(),activitySixHours:c.array(Bu).optional(),changes:c.array(BT),generatedAt:c.string(),repositories:c.array(mX),summary:jT,windowEnd:c.string(),windowStart:c.string()}).strict(),dIe=c.object({repositoryId:c.string().uuid()}).strict(),B3=c.object({activityDays:c.array(Bu),activityHours:c.array(Bu).optional(),activitySixHours:c.array(Bu).optional(),changes:c.array(BT),generatedAt:c.string(),repository:c.object({id:c.string().uuid(),name:c.string().min(1),provider:c.string().min(1),url:c.string().url().optional()}).strict(),summary:jT,windowEnd:c.string(),windowStart:c.string(),workspaces:c.array(c.object({id:c.string().min(1),name:c.string().min(1)}).strict())}).strict(),F3=c.object({activityDays:c.array(Bu),activityHours:c.array(Bu).optional(),activitySixHours:c.array(Bu).optional(),changes:c.array(BT),generatedAt:c.string(),summary:jT,windowEnd:c.string(),windowStart:c.string()}).strict(),pX=c.object({provider:c.string(),displayName:c.string(),description:c.string(),account:c.object({label:c.string(),url:c.string().optional()}).strict().optional(),connected:c.boolean()}).strict(),H3=c.object({connections:c.array(pX)}).strict(),fIe=c.object({provider:c.string().regex(/^[a-z][a-z0-9-]*$/).max(64)}).strict(),V3=c.object({authorizationUrl:c.string().url()}).strict(),q3=c.object({disconnected:c.literal(!0)}).strict(),zT=c.object({active:c.number(),conversations:c.number(),date:c.string(),durationMs:c.number(),failed:c.number(),tokens:c.number().optional()}).strict();var mIe=c.object({locationId:c.string().min(1)}).strict(),hX=Gy.extend({id:c.string(),firstSeenAt:c.string(),kind:lX,lastSeenAt:c.string(),provider:c.string(),providerDestinationId:c.string(),visibility:c.literal("public")}).strict(),pIe=Gy.extend({actor:sc}).strict(),hIe=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),UT=c.object({date:hIe,privateConversations:c.number(),publicConversations:c.number()}).strict(),G3=c.object({activityDays:c.array(UT),activityHours:c.array(UT).optional(),activitySixHours:c.array(UT).optional(),generatedAt:c.string(),locations:c.array(hX),privateActivity:Gy,source:c.literal("conversation_index"),windowEnd:c.string(),windowStart:c.string()}).strict(),Z3=hX.extend({activityDays:c.array(zT),activityHours:c.array(zT).optional(),activitySixHours:c.array(zT).optional(),actors:c.array(pIe),generatedAt:c.string(),recentConversations:c.array(By),source:c.literal("conversation_index"),windowEnd:c.string(),windowStart:c.string()}).strict(),gIe=c.object({email:c.string().trim().min(1)}).strict(),uX=Gy.omit({costUsd:!0}),gX=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),$3=c.object({active:c.number(),conversations:c.number(),costUsd:c.number().optional(),date:gX,durationMs:c.number(),failed:c.number(),tokens:c.number().optional()}).strict(),M3=c.object({activePeople:c.number(),conversations:c.number(),date:gX}).strict(),vX=c.object({active:c.number(),activeDays:c.number(),conversations:c.number(),durationMs:c.number(),failed:c.number(),tokens:c.number().optional()}).strict(),OT=c.object({conversations:c.number().int().nonnegative(),costUsd:c.number().finite().nonnegative(),durationMs:c.number().finite().nonnegative(),priorCostUsd:c.number().finite().nonnegative()}).strict(),vIe=c.object({1:OT,7:OT,30:OT,90:OT}).strict(),yX=sc.extend({email:c.string().min(1)}).strict(),yIe=vX.extend({firstSeenAt:c.string(),lastSeenAt:c.string(),actor:yX,windows:vIe}).strict(),W3=c.object({activityDays:c.array(M3),activityHours:c.array(M3).optional(),activitySixHours:c.array(M3).optional(),generatedAt:c.string(),people:c.array(yIe),source:c.literal("conversation_index"),windowEnd:c.string(),windowStart:c.string()}).strict(),K3=c.object({activityDays:c.array($3),activityHours:c.array($3).optional(),activitySixHours:c.array($3).optional(),generatedAt:c.string(),locations:c.array(uX),recentConversations:c.array(By),actor:yX,source:c.literal("conversation_index"),surfaces:c.array(uX),totals:vX,windowEnd:c.string(),windowStart:c.string()}).strict(),J3=c.object({generatedAt:c.string(),sevenDaysUsd:c.number().finite().nonnegative(),source:c.literal("conversation_index"),thirtyDaysUsd:c.number().finite().nonnegative(),windowEnd:c.string(),windowStart:c.string()}).strict(),Q3=c.object({id:c.string().uuid(),name:c.string(),tokenSuffix:c.string(),createdAt:c.string().datetime(),expiresAt:c.string().datetime(),lastUsedAt:c.string().datetime().nullable()}).strict(),Y3=c.object({tokens:c.array(Q3)}).strict(),bIe=c.object({name:c.string().trim().min(1).max(80)}).strict(),X3=Q3.extend({token:c.string().startsWith("jr_pat_")}).strict(),xIe=c.object({id:c.string().uuid()}).strict(),SIe=c.object({revoked:c.literal(!0)}).strict(),bX=c.object({provider:c.string(),displayName:c.string(),userOAuth:c.boolean(),tools:c.array(c.string()),connected:c.boolean(),connectedAt:c.string().optional(),connectedBy:c.string().optional()}).strict(),ej=c.object({serviceAccounts:c.array(bX)}).strict(),wIe=c.object({provider:c.string().regex(/^[a-z][a-z0-9-]*$/).max(64)}).strict(),tj=c.object({authorizationUrl:c.string().url()}).strict(),nj=c.object({disconnected:c.literal(!0)}).strict(),CIe=c.object({provider:c.string(),repo:c.string()}).strict(),xX=c.object({provider:c.string(),repo:c.string(),checkoutPath:c.string()}).strict(),kIe=c.object({id:c.string(),generatedAt:c.iso.datetime(),buildDurationMs:c.number().int().nonnegative(),sizeBytes:c.number().int().nonnegative().nullable()}).strict(),SX=c.object({id:c.string(),generatedAt:c.iso.datetime(),buildDurationMs:c.number().int().nonnegative(),dependencyCount:c.number().int().nonnegative()}).strict(),Zy=c.object({id:c.string().uuid(),name:c.string(),setupScript:c.string(),vcpus:c.number().int().positive().nullable(),repos:c.array(xX),snapshot:kIe.nullable()}).strict(),yw=c.object({baselineSnapshot:SX.nullable(),defaultVcpus:c.number().int().positive().nullable(),workspaces:c.array(Zy)}).strict(),RIe=c.object({name:c.string(),setupScript:c.string().optional(),vcpus:c.number().int().positive().nullable().optional(),repos:c.array(CIe)}).strict(),IIe=c.object({id:c.string().uuid()}).strict(),TIe=c.object({deleted:c.literal(!0)}).strict(),wX=c.object({count:c.number().int().nonnegative(),date:c.string(),metric:c.string().min(1),name:c.string().min(1),namespace:c.string().min(1)}).strict(),aj=c.object({generatedAt:c.string().datetime(),stats:c.array(wX),windowEnd:c.string(),windowStart:c.string()}).strict();var os=c.string().trim().min(1).max(160),Wy=c.number().int().nonnegative(),NIe=c.discriminatedUnion("type",[c.strictObject({type:c.literal("code_change"),author:os.optional(),sourceBranch:os.optional(),targetBranch:os.optional(),reviewers:c.array(os).max(5).optional(),review:c.enum(["required","approved","changes_requested"]).optional(),checks:c.strictObject({passed:Wy,failed:Wy,pending:Wy}).optional(),mergeable:c.boolean().optional(),changedFiles:Wy.optional(),additions:Wy.optional(),deletions:Wy.optional()}),c.strictObject({type:c.literal("task"),assignees:c.array(os).max(5).optional(),priority:os.optional(),project:os.optional(),cycle:os.optional(),dueDate:c.iso.date().optional(),labels:c.array(os).max(5).optional()}),c.strictObject({type:c.literal("deployment"),project:os.optional(),environment:os.optional(),revision:os.optional(),branch:os.optional()}),c.strictObject({type:c.literal("calendar_event"),when:os.optional(),attendees:c.array(os).max(5).optional()})]);function kX(e){if(!e)return[];let t=[],n=a=>a?.length?`${a.join(", ")}${a.length===5?" (up to 5 shown)":""}`:void 0;function r(a,o,i){i!==void 0&&i!==""&&t.push({key:a,label:o,value:String(i)})}switch(e.type){case"code_change":r("sourceBranch","Branch",e.sourceBranch);break;case"task":r("assignees","Assignees",e.assignees?.length===0?"Unassigned":n(e.assignees)),r("priority","Priority",e.priority),r("project","Project",e.project),r("cycle","Cycle",e.cycle),r("dueDate","Due",e.dueDate),r("labels","Labels",n(e.labels));break;case"deployment":r("environment","Environment",e.environment),r("project","Project",e.project),r("revision","Revision",e.revision),r("branch","Branch",e.branch);break;case"calendar_event":r("when","When",e.when),r("attendees","Attendees",n(e.attendees))}return t.slice(0,4)}var HT=c.enum(["task","code_change","automation","deployment","calendar_event","item"]),_Ie={task:"Ticket",code_change:"Code change",automation:"Automation",deployment:"Deployment",calendar_event:"Calendar event",item:"Item"};function cc(e){let t=e.objectType==="item"&&e.facts?.type==="deployment"?"deployment":e.objectType,n=e.status?.toLowerCase(),r={task:"issue-opened",code_change:"git-pull-request",automation:"workflow",deployment:"rocket",calendar_event:"calendar",item:"package"}[t],a=t==="automation"?"info":"neutral";return t==="code_change"?(n==="draft"&&(r="git-pull-request-draft"),n==="closed"&&(r="git-pull-request-closed",a="danger"),n==="merged"&&(r="git-merge",a="accent"),n==="open"&&(a="success")):t==="task"?(n==="closed"&&(r="issue-closed",a="accent"),n==="open"&&(a="success")):t==="deployment"&&((n==="ready"||n==="succeeded")&&(a="success"),(n==="error"||n==="failed")&&(a="danger"),(n==="building"||n==="in_progress")&&(a="info")),(n==="warning"||n==="blocked")&&(a="warning"),{icon:r,tone:a,label:_Ie[t]}}function RX(e){return`/_junior/dashboard/object-icons/v1/${e}.png`}var oj=c.object({kind:c.literal("object"),key:c.string().trim().min(1).max(256),label:c.string().trim().min(1).max(256),objectType:HT,title:c.string().trim().min(1).max(512),url:c.url().max(2048).refine(e=>["http:","https:"].includes(new URL(e).protocol)).nullable(),description:c.string().max(4e3).optional(),status:c.string().trim().min(1).max(100).optional(),trigger:c.string().max(4e3).optional(),warning:c.string().max(1e3).optional(),displayType:c.string().trim().min(1).max(80).optional(),sourceUpdatedAt:c.iso.datetime({offset:!0}).optional(),facts:NIe.refine(e=>new TextEncoder().encode(JSON.stringify(e)).length<=4096,"Object facts must not exceed 4 KiB").optional()}).strict().refine(e=>!e.facts||(e.facts.type==="deployment"?e.objectType==="deployment"||e.objectType==="item":e.facts.type===e.objectType),"Object facts must match the object type"),AYe=oj.safeExtend({plugin:c.string().min(1)}),IX={"issue-opened":["M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z","M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"],"issue-closed":["M11.28 6.78a.75.75 0 0 0-1.06-1.06L7.25 8.69 5.78 7.22a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l3.5-3.5Z","M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 1 0-13 0 6.5 6.5 0 0 0 13 0Z"],"git-pull-request":["M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"],"git-pull-request-draft":["M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 14a2.25 2.25 0 1 1 0-4.5 2.25 2.25 0 0 1 0 4.5ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM14 7.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm0-4.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z"],"git-pull-request-closed":["M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75Zm-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"],"git-merge":["M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z"],workflow:["M0 1.75C0 .784.784 0 1.75 0h3.5C6.216 0 7 .784 7 1.75v3.5A1.75 1.75 0 0 1 5.25 7H4v4a1 1 0 0 0 1 1h4v-1.25C9 9.784 9.784 9 10.75 9h3.5c.966 0 1.75.784 1.75 1.75v3.5A1.75 1.75 0 0 1 14.25 16h-3.5A1.75 1.75 0 0 1 9 14.25v-.75H5A2.5 2.5 0 0 1 2.5 11V7h-.75A1.75 1.75 0 0 1 0 5.25Zm1.75-.25a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Zm9 9a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Z"],rocket:["M14.064 0h.186C15.216 0 16 .784 16 1.75v.186a8.752 8.752 0 0 1-2.564 6.186l-.458.459c-.314.314-.641.616-.979.904v3.207c0 .608-.315 1.172-.833 1.49l-2.774 1.707a.749.749 0 0 1-1.11-.418l-.954-3.102a1.214 1.214 0 0 1-.145-.125L3.754 9.816a1.218 1.218 0 0 1-.124-.145L.528 8.717a.749.749 0 0 1-.418-1.11l1.71-2.774A1.748 1.748 0 0 1 3.31 4h3.204c.288-.338.59-.665.904-.979l.459-.458A8.749 8.749 0 0 1 14.064 0ZM8.938 3.623h-.002l-.458.458c-.76.76-1.437 1.598-2.02 2.5l-1.5 2.317 2.143 2.143 2.317-1.5c.902-.583 1.74-1.26 2.499-2.02l.459-.458a7.25 7.25 0 0 0 2.123-5.127V1.75a.25.25 0 0 0-.25-.25h-.186a7.249 7.249 0 0 0-5.125 2.123ZM3.56 14.56c-.732.732-2.334 1.045-3.005 1.148a.234.234 0 0 1-.201-.064.234.234 0 0 1-.064-.201c.103-.671.416-2.273 1.15-3.003a1.502 1.502 0 1 1 2.12 2.12Zm6.94-3.935c-.088.06-.177.118-.266.175l-2.35 1.521.548 1.783 1.949-1.2a.25.25 0 0 0 .119-.213ZM3.678 8.116 5.2 5.766c.058-.09.117-.178.176-.266H3.309a.25.25 0 0 0-.213.119l-1.2 1.95ZM12 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"],calendar:["M4.75 0a.75.75 0 0 1 .75.75V2h5V.75a.75.75 0 0 1 1.5 0V2h1.25c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25V3.75C1 2.784 1.784 2 2.75 2H4V.75A.75.75 0 0 1 4.75 0ZM2.5 7.5v6.75c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25V7.5Zm10.75-4H2.75a.25.25 0 0 0-.25.25V6h11V3.75a.25.25 0 0 0-.25-.25Z"],package:["m8.878.392 5.25 3.045c.54.314.872.89.872 1.514v6.098a1.75 1.75 0 0 1-.872 1.514l-5.25 3.045a1.75 1.75 0 0 1-1.756 0l-5.25-3.045A1.75 1.75 0 0 1 1 11.049V4.951c0-.624.332-1.201.872-1.514L7.122.392a1.75 1.75 0 0 1 1.756 0ZM7.875 1.69l-4.63 2.685L8 7.133l4.755-2.758-4.63-2.685a.248.248 0 0 0-.25 0ZM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432Zm6.25 8.271 4.625-2.683a.25.25 0 0 0 .125-.216V5.677L8.75 8.432Z"]};function LIe(e){try{let t=new URL(e).protocol;return t==="http:"||t==="https:"}catch{return!1}}var AIe=c.object({kind:c.literal("resource_link"),objectType:HT.optional(),key:c.string().trim().min(1).max(256),label:c.string().trim().min(1).max(256),url:c.string().url().max(2048).refine(LIe,"URL must use HTTP or HTTPS."),description:c.string().trim().min(1).max(512).optional(),status:c.enum(["open","draft","closed","merged","warning"]).optional()}).strict(),EYe=c.discriminatedUnion("kind",[AIe,oj]),EIe=c.enum(["circle-dot","circle-dashed","circle-x","git-merge","git-pull-request","triangle-alert"]),PYe=c.object({icon:EIe.optional(),objectType:HT.optional(),status:c.string().trim().min(1).max(100).optional(),key:c.string().trim().min(1).max(256),label:c.string().trim().min(1).max(256)}).strict(),PIe=c.enum(["closed","merged","open"]),DYe=c.object({closedAt:c.date().optional(),conversationIds:c.array(c.string().min(1)).default([]),mergedAt:c.date().optional(),number:c.number().int().positive(),openedAt:c.date(),providerId:c.string().min(1),repository:c.object({name:c.string().min(1),providerId:c.string().min(1),url:c.string().url().optional()}).strict(),state:PIe,title:c.string().min(1).optional(),updatedAt:c.date(),url:c.string().url().optional()}).strict(),$Ye=c.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/),DIe=c.enum(["activity","brain","calendar","check","database","info","key","link","sparkles","warning"]),$Ie=c.object({content:c.string().min(1).max(32768).optional(),description:c.string().trim().min(1).max(2e3).optional(),metadata:c.array(c.string().trim().min(1).max(120)).max(8).optional(),title:c.string().trim().min(1).max(4e3)}).strict(),MYe=c.object({details:c.array($Ie).max(100).optional(),icon:DIe.optional(),preview:c.string().trim().min(1).max(500).optional(),title:c.string().trim().min(1).max(120)}).strict();var VT=c.string().regex(/^T[A-Z0-9]+$/),ij=c.string().regex(/^(C|G|D)[A-Z0-9]+$/),TX=c.string().regex(/^local:[a-z0-9_-]+:[a-z0-9][a-z0-9_-]*$/),MIe=c.string().min(1).refine(e=>e===e.trim()&&e.toLowerCase()!=="unknown"),FT=MIe,gt=c.string().refine(e=>e.trim().length>0),Zo=gt.refine(e=>e===e.trim()),OIe=c.object({id:gt,provider:Zo}).strict().extend({provider:c.literal("slack"),teamId:VT,channelId:ij,threadTs:Zo.optional()}).strict(),OYe=c.discriminatedUnion("provider",[OIe]),zYe=c.enum(["slack","local"]),NX=c.enum(["public","private"]),zIe=c.enum(["public","private"]),sj=c.object({platform:c.literal("slack"),teamId:VT,channelId:ij,threadTs:Zo.optional()}).strict(),UIe=c.object({platform:c.literal("local"),conversationId:TX}).strict(),jIe=c.discriminatedUnion("platform",[sj,UIe]),UYe=c.object({action:c.literal("send_message"),destination:sj}).strict(),BIe=c.object({kind:c.literal("slack"),teamId:VT,channelId:ij,visibility:NX,messageTs:gt.optional(),threadTs:gt.optional()}).strict(),FIe=c.object({kind:c.literal("local"),visibility:c.literal("private"),conversationId:TX}).strict(),HIe=c.object({kind:c.literal("web"),visibility:NX,conversationId:Zo}).strict(),VIe=c.object({kind:c.literal("event"),eventKey:Zo,eventType:Zo,identifier:Zo,namespace:Zo}).strict(),_X={automationId:Zo.optional(),automationRunId:Zo.optional()},qIe=c.object({kind:c.literal("scheduled_automation"),..._X}).strict(),GIe=c.object({kind:c.literal("event_automation"),..._X}).strict(),ZIe=c.object({kind:c.literal("plugin_dispatch")}).strict(),WIe=c.object({kind:c.literal("agent_invocation")}).strict(),KIe=c.discriminatedUnion("kind",[BIe,FIe,HIe,VIe,qIe,GIe,ZIe,WIe]);function JIe(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let t=e;if("kind"in t){let o=typeof t.kind=="string"?{event_task:"event_automation",resource_event:"event",scheduled_task:"scheduled_automation"}[t.kind]:void 0;return o?{...t,kind:o}:e}if(t.platform!=="slack"&&t.platform!=="local"&&t.platform!=="web")return e;let{location:n,platform:r,...a}=t;return{...a,kind:r}}var QIe=c.preprocess(JIe,KIe),YIe=c.discriminatedUnion("allowedWhen",[c.object({type:c.literal("user"),userId:FT,allowedWhen:c.literal("private-direct-conversation")}).strict(),c.object({type:c.literal("user"),userId:FT,allowedWhen:c.literal("scheduled-automation"),taskId:Zo}).strict()]),lj={email:gt.optional(),fullName:gt.optional(),userId:FT,userName:gt.optional()},XIe=c.object({...lj,platform:c.literal("slack"),teamId:VT}).strict(),eTe=c.object({...lj,platform:c.literal("local")}).strict(),tTe=c.object({...lj,platform:c.literal("web")}).strict(),nTe=c.object({platform:c.literal("system"),name:FT}).strict(),rj=c.discriminatedUnion("platform",[XIe,eTe,tTe,nTe]),aTe=c.object({displayName:gt.optional(),handle:gt.optional(),id:Zo,provider:Zo,providerSubjectId:Zo,providerTenantId:Zo.optional()}).strict(),jYe=c.object({displayName:gt.optional(),email:gt.max(320),id:Zo,identities:c.array(aTe).max(100),isAdmin:c.literal(!0).optional()}).strict(),rTe=c.record(c.string(),c.string()).superRefine((e,t)=>{let n=Object.entries(e);if(n.length>20){t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata has too many keys"});return}for(let[r,a]of n){if(!r.trim()){t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata values must be strings",path:[r]});continue}r.length>128&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata key exceeds the maximum length",path:[r]}),/[\r\n]/.test(r)&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata keys must be single-line strings",path:[r]}),/[\r\n]/.test(a)&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata values must be single-line strings",path:[r]}),a.length>512&&t.addIssue({code:c.ZodIssueCode.custom,message:"Dispatch metadata value exceeds the maximum length",path:[r]})}}),oTe=c.object({label:Zo.pipe(c.string().max(48)).refine(e=>!/[\r\n]/.test(e)),detail:Zo.pipe(c.string().max(128)).refine(e=>!/[\r\n]/.test(e)).optional()}).strict(),BYe=c.object({idempotencyKey:gt.pipe(c.string().max(512)),credentialSubject:YIe.optional(),destination:sj,destinationVisibility:zIe,input:gt.pipe(c.string().max(32e3)),metadata:rTe.optional(),replyAttribution:oTe.optional()}).strict();var iTe=c.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_-]*$/),FYe=c.object({text:c.string().trim().min(1).max(8e3)}).strict(),HYe=c.object({kind:iTe,version:c.number().int().positive(),content:c.record(c.string(),c.unknown())}).strict();var sTe=4e3,lTe=8e3;var cTe=4e3,uTe=1e3,dTe=c.record(c.string(),c.unknown()).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:"custom",message:"Event data may include at most 32 keys."}),new TextEncoder().encode(JSON.stringify(e)).byteLength>4e3&&t.addIssue({code:"custom",message:`Event data may be at most ${cTe} JSON bytes.`})}),Hh=c.string().regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/).describe("Canonical dotted event type, such as issue.closed or pull_request.review.changes_requested."),LX=c.string().regex(/^[a-z][a-z0-9_]*$/).describe("Canonical plugin-defined resource type, such as issue or pull_request."),AX=/^[a-z][a-zA-Z0-9]*$/,fTe=c.object({kind:c.enum(["boolean","string","number"]),description:c.string().trim().min(1).max(200),enum:c.array(c.string().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{e.enum&&e.kind!=="string"&&t.addIssue({code:"custom",message:'Event match field enum requires kind "string".',path:["enum"]})}),mTe=c.record(c.string().regex(AX),fTe).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:"custom",message:"Event match keys may include at most 32 keys."})}),VYe=c.record(c.string().regex(AX),c.union([c.boolean(),c.number().finite(),c.string().min(1),c.array(c.union([c.number().finite(),c.string().min(1)])).min(1)])).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:"custom",message:"Event match may include at most 32 keys."});for(let[n,r]of Object.entries(e))Array.isArray(r)&&r.some(a=>typeof a=="boolean")&&t.addIssue({code:"custom",message:`Event match field "${n}" cannot use a boolean list.`,path:[n]})});var pTe=c.object({format:c.string().trim().min(1).max(200),pattern:c.instanceof(RegExp)}).strict(),hTe=c.object({type:LX,identifier:pTe.optional(),supportedEvents:c.array(Hh).min(1),suggestedEvents:c.array(Hh).optional(),matchFields:mTe.optional(),guidance:c.record(Hh,c.string().trim().min(1).max(uTe)).optional()}).strict().superRefine((e,t)=>{let n=new Set;e.supportedEvents.forEach((a,o)=>{n.has(a)&&t.addIssue({code:"custom",message:`Duplicate supported event type "${a}".`,path:["supportedEvents",o]}),n.add(a)});for(let a of Object.keys(e.guidance??{}))n.has(a)||t.addIssue({code:"custom",message:`Guidance event type "${a}" is not supported.`,path:["guidance",a]});let r=new Set;e.suggestedEvents?.forEach((a,o)=>{r.has(a)&&t.addIssue({code:"custom",message:`Duplicate suggested event type "${a}".`,path:["suggestedEvents",o]}),n.has(a)||t.addIssue({code:"custom",message:`Suggested event type "${a}" is not supported.`,path:["suggestedEvents",o]}),r.add(a)})}),qYe=c.object({resourceTypes:c.array(hTe).min(1),isEnabled:c.function({input:[],output:c.boolean()}).optional(),normalizeIdentifier:c.function({input:[c.string()],output:c.string()}).optional()}).strict().superRefine((e,t)=>{let n=new Set;e.resourceTypes.forEach((r,a)=>{n.has(r.type)&&t.addIssue({code:"custom",message:`Duplicate resource type "${r.type}".`,path:["resourceTypes",a,"type"]}),n.add(r.type)})});var GYe=c.object({identifier:c.string().min(1),label:c.string().min(1),namespace:c.string().min(1),suggestedEvents:c.array(Hh).optional(),supportedEvents:c.array(Hh),type:LX}).strict(),ZYe=c.object({events:c.array(Hh).min(1),id:c.string().min(1)}).strict(),CX=c.union([c.object({provider:c.string().min(1),handle:c.string().min(1)}).strict(),c.object({email:c.string().trim().min(3)}).strict()]),gTe=c.object({objectType:HT.optional(),eventKey:c.string().min(1),eventType:Hh,identifier:c.string().min(1),occurredAtMs:c.number().finite(),terminal:c.boolean().optional(),trustedSummary:c.string().min(1).transform(e=>e.slice(0,sTe)),data:dTe.optional(),untrustedText:c.string().transform(e=>e.slice(0,lTe)).optional(),people:c.array(CX).max(20).optional(),doneBy:CX.optional()}).strict(),WYe=gTe.extend({namespace:c.string().min(1)}),vTe=c.object({authority:c.enum(["instruction","context"]),actor:rj.optional()}).strict(),yTe=c.discriminatedUnion("type",[c.object({type:c.literal("message"),role:c.enum(["user","assistant"]),text:c.string().min(1),provenance:vTe.optional(),isRunActor:c.boolean().optional()}).strict(),c.object({type:c.literal("toolResult"),toolName:c.string().min(1),isError:c.boolean(),text:c.string().min(1).optional()}).strict()]),KYe=c.object({actorUserId:c.string().min(1).optional(),completedAtMs:c.number().finite(),conversationId:c.string().min(1),destination:jIe,locationId:c.string().min(1).optional(),actors:c.array(rj),actor:rj.optional(),runId:c.string().min(1),source:QIe,transcript:c.array(yTe)}).strict();var JYe=c.discriminatedUnion("type",[c.object({type:c.literal("text"),text:c.string()}).strict(),c.object({type:c.literal("image"),data:c.string(),mimeType:c.string()}).strict()]),bTe=c.object({arguments:c.record(c.string(),c.unknown()),reason:c.string().min(1).optional()}).strict(),QYe=c.object({objectAnnotations:c.array(oj).optional(),target:c.string().min(1).optional(),truncated:c.boolean().optional(),continuation:bTe.optional()}).passthrough(),YYe=c.enum(["auto","review","approve"]);var XYe=c.object({auth:c.object({user:c.object({email:c.string().nullable().optional(),emailVerified:c.boolean().optional(),isAdmin:c.boolean(),name:c.string().nullable().optional()}).strict()}).strict(),pluginName:gt}).strict(),xTe=c.string().regex(/^[a-z][a-z0-9-]*$/),STe=c.string().regex(/^[a-z][a-z0-9.-]*$/),wTe=c.union([c.literal("read"),c.literal("write")]),EX=c.object({provider:xTe,scope:gt.optional(),type:c.literal("oauth")}).strict(),PX=c.object({displayName:gt.optional(),handle:gt.optional(),id:gt,label:gt.optional(),url:gt.optional(),verifiedEmails:c.array(gt).optional()}).strict(),eXe=c.object({account:PX.optional(),accessToken:gt,expiresAt:c.number().finite().optional(),refreshToken:gt,refreshTokenExpiresAt:c.number().finite().optional(),scope:gt.optional()}).strict(),tXe=c.object({access:wTe,leaseScope:gt.optional(),name:STe,reason:gt.optional(),requirements:c.array(gt).min(1).optional()}).strict(),CTe=c.object({domain:c.string().min(1),headers:c.record(c.string(),c.string()).refine(e=>Object.keys(e).length>0)}).strict(),kTe=c.object({account:PX.optional(),authorization:EX.optional(),expiresAt:c.string().refine(e=>Number.isFinite(Date.parse(e))),headerTransforms:c.array(CTe).min(1)}).strict(),nXe=c.discriminatedUnion("type",[c.object({lease:kTe,type:c.literal("lease")}).strict(),c.object({authorization:EX.optional(),message:gt,type:c.literal("needed")}).strict(),c.object({message:gt,type:c.literal("unavailable")}).strict()]);var RTe=gt.max(64).regex(/^[a-z][a-z0-9-]*$/),ITe=gt.max(80),TTe=gt.max(500),NTe=c.enum(["primary","profile","admin"]),_Te=c.object({detail:gt.max(500).optional(),label:gt.max(80),tone:c.enum(["good","neutral","warning"]).optional(),value:gt.max(120)}).strict(),LTe=c.object({label:gt.max(80),value:gt.max(500)}).strict(),ATe=c.object({confirmation:gt.max(500).optional(),href:gt.max(500).regex(/^\/api\/plugins\/[a-z][a-z0-9-]*(?:\/|$)/),label:gt.max(80),method:c.enum(["DELETE","GET"]),tone:c.enum(["danger","neutral"]).optional()}).strict(),ETe=c.object({actions:c.array(ATe).max(4).optional(),description:gt.max(1e3).optional(),id:gt.max(128),metadata:c.array(LTe).max(8).optional(),title:gt.max(4e3)}).strict(),DX=c.object({emptyText:gt.max(500).optional(),metrics:c.array(_Te).max(6).optional(),nextCursor:gt.max(1e3).optional(),records:c.array(ETe).max(100),searchPlaceholder:gt.max(120).optional(),type:c.literal("list")}).strict(),PTe=c.object({description:TTe,id:RTe,label:ITe,navigation:NTe,pluginDisplayName:gt.max(200),pluginName:gt.max(100)}).strict(),$X=c.array(PTe),DTe=gt.max(1e3).optional(),$Te=gt.max(64).optional(),MTe=c.string().trim().max(200).optional(),aXe=c.object({cursor:DTe,filter:$Te,limit:c.number().int().min(1).max(50),query:MTe}).strict();var MX=c.object({email:c.string().trim().email(),emailVerified:c.boolean().optional(),name:c.string().nullable().optional()}).strict(),iXe=c.object({user:MX}).strict(),qT=c.object({user:MX.extend({isAdmin:c.boolean()}).strict()}).strict(),sXe=c.object({displayName:c.string().trim().min(1).max(80)}).strict(),OX=c.object({allowedDomainCount:c.number(),authRequired:c.boolean(),authPath:c.string(),basePath:c.string(),componentGallery:c.boolean(),sentryConversationLinks:c.boolean(),timeZone:c.string().optional(),version:c.string().min(1)}).strict();var bw=b($(),1);var zX="x-junior-version";var cj="junior:dashboard-version";function UX(e){let t=e.headers.get(zX)?.trim();!t||typeof window>"u"||window.dispatchEvent(new CustomEvent(cj,{detail:t}))}function jX(e){let[t,n]=(0,bw.useState)(e);return(0,bw.useEffect)(()=>{e&&n(e)},[e]),(0,bw.useEffect)(()=>{let r=a=>{n(a.detail)};return window.addEventListener(cj,r),()=>window.removeEventListener(cj,r)},[]),t}var Ar=class extends Error{status;fields;code;apiError;constructor(t,n,r,a){super(`${t} returned ${n}`),this.status=n,this.fields=a?.fields,this.code=a?.code,r?.trim()&&(this.apiError=r.trim())}};async function Ky(e,t){let n,r,a;try{let o=await t.json();typeof o.error=="string"&&(n=o.error),typeof o.code=="string"&&(a=o.code),o.fields&&typeof o.fields=="object"&&(r=Object.fromEntries(Object.entries(o.fields).filter(i=>Array.isArray(i[1])&&i[1].every(s=>typeof s=="string"))))}catch{}throw new Ar(e,t.status,n,{fields:r,code:a})}function Jy(){if(typeof window>"u")return;let e=window.__JUNIOR_DASHBOARD_BASE_PATH__??"/",t=e==="/"?"/auth/login":`${e}/auth/login`;if(window.location.pathname!==t){let n=`${window.location.pathname}${window.location.search||""}`,r=new URLSearchParams;n!=="/"&&r.set("next",n);let a=r.toString();window.location.assign(a?`${t}?${a}`:t)}}async function Qy(e,t,n){let r=await Xy(t,{body:JSON.stringify(n),credentials:"same-origin",headers:{"content-type":"application/json"},method:"PATCH"});return r.status===401&&Jy(),r.ok||await Ky(t,r),e.parse(await r.json())}async function co(e,t,n){let r=await Xy(t,{body:JSON.stringify(n),credentials:"same-origin",headers:{"content-type":"application/json"},method:"POST"});return r.status===401&&Jy(),r.ok||await Ky(t,r),e.parse(await r.json())}async function BX(e,t,n){let r=await Xy(t,{body:JSON.stringify(n),credentials:"same-origin",headers:{"content-type":"application/json"},method:"PUT"});return r.status===401&&Jy(),r.ok||await Ky(t,r),e.parse(await r.json())}async function zm(e){let t=await Xy(e,{credentials:"same-origin",method:"DELETE"});t.status===401&&Jy(),t.ok||await Ky(e,t)}async function Yy(e,t,n={}){let r=await Xy(t,{body:JSON.stringify(n),credentials:"same-origin",headers:{"content-type":"application/json"},method:"DELETE"});return r.status===401&&Jy(),r.ok||await Ky(t,r),e.parse(await r.json())}async function Xy(e,t){let n=await fetch(e,t);return UX(n),n}async function Ke(e,t,n){let r=await uj(t,n);return e.parse(await r.json())}async function uj(e,t,n){let r=await Xy(e,{credentials:"same-origin",...t?{signal:t}:void 0,...n?{cache:"no-store",headers:{"if-none-match":n}}:void 0});return r.status===401&&Jy(),!r.ok&&!(n&&r.status===304)&&await Ky(e,r),r}var GT=5*6e4,dj=5*6e4,OTe=1e3;function zTe(e,t=Date.now()){if(!e)return dj;let n=Date.parse(e);if(!Number.isFinite(n))return dj;let r=Math.max(0,t-n);return Math.max(OTe,dj-r)}function FX(){return Qe({queryKey:["dashboard","core"],queryFn:async({signal:e})=>{let[t,n]=await Promise.all([Ke(qT,"/api/me",e),Ke(OX,"/api/config",e)]);return{config:n,me:t}},retry:!1,staleTime:GT})}function UTe(){return Qe({queryKey:["dashboard","plugins"],queryFn:({signal:e})=>Ke(P4,"/api/plugins",e),retry:!1,staleTime:GT})}function HX(){return Qe({queryKey:["dashboard","plugin-user-pages"],queryFn:({signal:e})=>Ke($X,"/api/user-pages",e),retry:!1,staleTime:GT})}function ZT(e=""){return Qe({queryKey:["dashboard","conversations","viewer",{search:e}],queryFn:({signal:t})=>Ke(RT,`/api/conversations${e?`?q=${encodeURIComponent(e)}`:""}`,t),placeholderData:Mp,retry:!1})}function VX(){return Qe({queryKey:["dashboard","code"],queryFn:({signal:e})=>Ke(j3,"/api/code",e),retry:!1})}function qX(e){return Qe({enabled:!!e,queryKey:["dashboard","code","repositories",e],queryFn:({signal:t})=>Ke(B3,`/api/code/repositories/${encodeURIComponent(e)}`,t),retry:!1})}function WT(e,t=""){return Qe({enabled:!!e,queryKey:["dashboard","conversations","code-repository",{repositoryId:e,search:t}],queryFn:({signal:n})=>{let r=new URLSearchParams({codeRepositoryId:e});return t&&r.set("q",t),Ke(RT,`/api/conversations?${r.toString()}`,n)},placeholderData:Mp,retry:!1})}function GX(e,t){return Qe({enabled:e,queryKey:["dashboard","automations",t],queryFn:({signal:n})=>Ke(k4,`/api/automations${t?`?${t}`:""}`,n),placeholderData:Mp,retry:!1})}function eb(e,t){return Qe({enabled:e&&!!t,queryKey:["dashboard","automations","detail",t],queryFn:({signal:n})=>Ke(dw,`/api/automations/${encodeURIComponent(t)}`,n),retry:!1})}function ZX(e){return Qe({enabled:e,queryKey:["dashboard","automations","runs"],queryFn:({signal:t})=>Ke(T4,"/api/automations/runs",t),retry:!1})}function WX(e,t){return Qe({enabled:e&&!!t,queryKey:["dashboard","automations",t,"executions"],queryFn:({signal:n})=>Ke(I4,`/api/automations/${encodeURIComponent(t)}/executions`,n),retry:!1})}function KX(e,t){return Qe({enabled:e&&!!t,queryKey:["dashboard","automations",t,"versions"],queryFn:({signal:n})=>Ke(N4,`/api/automations/${encodeURIComponent(t)}/versions`,n),retry:!1})}function JX(){return Qe({queryKey:["dashboard","people"],queryFn:({signal:e})=>Ke(W3,"/api/people",e),retry:!1})}function QX(e){return Qe({enabled:!!e,queryKey:["dashboard","people",e],queryFn:async({signal:t})=>Ke(K3,`/api/people/${encodeURIComponent(e)}`,t),retry:!1})}function YX(e){return Qe({enabled:!!e,queryKey:["dashboard","people",e,"plugin-reports"],queryFn:({signal:t})=>Ke(_T,`/api/people/${encodeURIComponent(e)}/plugin-reports`,t),retry:!1})}function XX(e){return Qe({enabled:!!e,queryKey:["dashboard","people",e,"code"],queryFn:({signal:t})=>Ke(F3,`/api/people/${encodeURIComponent(e)}/code`,t),retry:!1})}function eee(e){return Qe({enabled:e,queryKey:["dashboard","personal-spend"],queryFn:({signal:t})=>Ke(J3,"/api/people/me/spend",t),refetchInterval:t=>zTe(t.state.data?.generatedAt),retry:!1,staleTime:0})}function tee(){return Qe({queryKey:["dashboard","locations"],queryFn:({signal:e})=>Ke(G3,"/api/locations",e),retry:!1})}function nee(e){return Qe({enabled:!!e,queryKey:["dashboard","locations",e],queryFn:async({signal:t})=>Ke(Z3,`/api/locations/${encodeURIComponent(e)}`,t),retry:!1})}function jTe(){return Qe({queryKey:["dashboard","skills"],queryFn:({signal:e})=>Ke($4,"/api/skills",e),retry:!1,staleTime:GT})}function BTe(){return Qe({queryKey:["dashboard","plugin-reports"],queryFn:({signal:e})=>Ke(_T,"/api/plugin-reports",e),retry:!1})}function aee(){return Qe({queryKey:["dashboard","stats"],queryFn:({signal:e})=>Ke(aj,"/api/stats",e),retry:!1})}function ree(e){let t=UTe(),n=Qe({queryKey:["dashboard","conversation-stats"],queryFn:({signal:i})=>Ke(O3,"/api/conversations/stats",i),retry:!1}),r=jTe(),a=BTe();return{data:t.data&&r.data?{...e,conversationStatsError:!!n.error,...n.data?{conversationStats:n.data}:void 0,conversationStatsLoading:n.isPending,pluginReportsError:!!a.error,...a.data?{pluginReports:a.data}:void 0,pluginReportsLoading:a.isPending,plugins:t.data,skills:r.data}:void 0,error:t.error??r.error,isPending:t.isPending||r.isPending}}var lee=b($(),1);var oee="Junior";function ln(){return typeof window>"u"?oee:window.__JUNIOR_DASHBOARD_AGENT_NAME__?.trim()||oee}function iee(e=ln()){return e.endsWith("s")?`${e}'`:`${e}'s`}function see(e,t=ln()){let n=e?.trim();return n?`${n} - ${t}`:t}function Ws(e){(0,lee.useEffect)(()=>{if(e?.trim())return document.title=see(e),()=>{document.title=see(void 0)}},[e])}function T(...e){return e.filter(Boolean).join(" ")}var uo="mx-auto w-full min-w-0 max-w-screen-xl",Fu="text-dashboard-text underline decoration-dashboard-border-heavy underline-offset-2 transition-colors hover:decoration-dashboard-text-muted",Vh="text-dashboard-text-muted hover:text-dashboard-text",cee="rounded-xl border border-dashboard-border-emphasis bg-dashboard-surface-raised shadow-[0_8px_32px_rgba(0,0,0,0.35)] transition-colors";var KT=b(w(),1),uee="inline-flex h-9 max-w-full items-center justify-center gap-2 rounded-md border border-dashboard-border-emphasis bg-dashboard-surface-raised px-3 font-sans text-sm font-medium leading-none text-dashboard-text transition-colors hover:border-dashboard-border-heavy hover:bg-dashboard-surface-hover hover:text-dashboard-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus",FTe="inline-flex h-9 max-w-full items-center justify-center gap-2 rounded-md border border-dashboard-border-strong bg-transparent px-3 font-sans text-sm font-medium leading-none text-dashboard-text-muted transition-colors hover:border-rose-300/40 hover:text-rose-300 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-rose-300/55";function ye({className:e,size:t="default",tone:n="default",type:r="button",...a}){let o=n==="danger";return(0,KT.jsx)("button",{...a,className:T("font-sans transition-colors disabled:cursor-not-allowed disabled:opacity-50",t==="icon"?T("grid size-9 place-items-center rounded-md border-0 bg-transparent p-0 focus-visible:outline-2 focus-visible:outline-offset-1 disabled:hover:!bg-transparent",o?"text-dashboard-text-muted hover:!bg-rose-300/10 hover:!text-rose-300 focus-visible:outline-rose-300/55 disabled:hover:!text-dashboard-text-muted":"text-dashboard-text-muted hover:!bg-dashboard-fill-strong hover:!text-dashboard-text focus-visible:outline-dashboard-focus disabled:hover:!text-dashboard-text-muted"):n==="primary"?"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-dashboard-text-solid bg-dashboard-text-solid px-3 font-sans text-sm font-medium leading-none text-dashboard-text-inverse hover:border-dashboard-text-subtle hover:bg-dashboard-text-subtle disabled:hover:border-dashboard-text-solid disabled:hover:bg-dashboard-text-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus":o?T(FTe,"disabled:hover:border-dashboard-border-strong disabled:hover:text-dashboard-text-muted"):T(uee,"disabled:hover:border-dashboard-border-emphasis disabled:hover:bg-dashboard-surface-raised disabled:hover:text-dashboard-text"),a.disabled?"":"cursor-pointer",e),type:r})}function Hu({className:e,...t}){return(0,KT.jsx)(fe,{...t,className:T(uee,"no-underline",e)})}function mr({className:e,pressed:t,type:n="button",variant:r,...a}){return(0,KT.jsx)("button",{...a,"aria-pressed":t,className:T(HTe[r],t?VTe[r]:qTe[r],e),type:n})}var HTe={pill:"cursor-pointer rounded-md border px-2 py-1 font-sans text-xs font-medium leading-tight transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus",segment:"inline-flex h-7 min-w-10 cursor-pointer items-center justify-center rounded-md border px-2 font-sans text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus",text:"cursor-pointer rounded-sm border-0 bg-transparent px-1.5 py-1 font-sans font-medium underline-offset-4 transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dashboard-focus"},VTe={pill:"border-dashboard-border-heavy bg-dashboard-text-solid text-dashboard-text-inverse",segment:"border-dashboard-border-interactive bg-dashboard-surface-active text-dashboard-text",text:"text-dashboard-text underline decoration-dashboard-text-solid"},qTe={pill:"border-dashboard-border-strong bg-dashboard-surface-raised text-dashboard-text-muted hover:border-dashboard-border-interactive hover:bg-dashboard-surface-hover hover:text-dashboard-text",segment:"border-transparent bg-transparent text-dashboard-text-muted hover:bg-dashboard-fill-hover hover:text-dashboard-text",text:"text-dashboard-text-muted hover:text-dashboard-text"};var qh=b(w(),1);function Ei(e){let t=e.tone==="error";return(0,qh.jsxs)("div",{role:t?"alert":"status",className:T("flex min-w-0 gap-3 rounded-md border p-4",t?"border-rose-300/25 bg-rose-300/5":"border-amber-300/25 bg-amber-300/5"),children:[(0,qh.jsx)(Li,{"aria-hidden":!0,size:18,className:T("mt-0.5 shrink-0",t?"text-rose-300":"text-amber-300")}),(0,qh.jsxs)("div",{className:"min-w-0",children:[(0,qh.jsx)("p",{className:"m-0 text-sm font-medium",children:e.title}),e.children?(0,qh.jsx)("div",{className:"mt-1 text-sm leading-relaxed text-dashboard-text-muted",children:e.children}):null]})]})}var xw=b(w(),1),GTe={accent:"text-dashboard-accent",danger:"text-rose-300",info:"text-cyan-300",neutral:"text-dashboard-text-muted",success:"text-emerald-300",warning:"text-amber-300"},ZTe={compact:"text-xs",default:"text-sm"};function In(e){return(0,xw.jsxs)("span",{className:T("inline-flex w-fit items-center gap-1.5 font-sans font-medium normal-case leading-snug tracking-normal",ZTe[e.size??"default"],GTe[e.tone??"neutral"],e.className),children:[(0,xw.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-current"}),(0,xw.jsx)("span",{className:"block first-letter:uppercase",children:e.children})]})}var dee=b(w(),1);function Z(e){let t=e.as??"div",n={none:"",sm:"p-4",md:"p-5 sm:p-6"}[e.padding??"none"],r=e.variant==="section"?"mb-4 border-dashboard-border-subtle bg-dashboard-fill-faint shadow-[0_24px_80px_rgba(0,0,0,0.18)]":e.variant==="raised"?"border-dashboard-border-emphasis bg-dashboard-surface-raised":"border-dashboard-border-subtle bg-dashboard-fill-faint";return(0,dee.jsx)(t,{className:T("min-w-0 overflow-hidden rounded-lg border",r,n,e.className),children:e.children})}var fee=b(w(),1);function $t(e){let t=e.as??"div";return(0,fee.jsx)(t,{"aria-hidden":"true",className:T("animate-pulse rounded-md bg-dashboard-fill-soft motion-reduce:animate-none",e.className)})}var Kt=b(w(),1);function To(e){let t=e.variant??"panel";return(0,Kt.jsxs)("div",{"aria-busy":"true","aria-live":"polite",className:T("grid gap-4",e.className),role:"status",children:[(0,Kt.jsx)("span",{className:"sr-only",children:e.label}),WTe(t)]})}function WTe(e){switch(e){case"stats":return(0,Kt.jsx)(KTe,{});case"overview":return(0,Kt.jsx)(JTe,{});case"list":return(0,Kt.jsx)(QTe,{});case"library":return(0,Kt.jsx)(YTe,{});case"panel":return(0,Kt.jsx)(Vu,{className:"min-h-64"})}}function KTe(){return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:Array.from({length:4},(e,t)=>(0,Kt.jsx)(Vu,{className:"min-h-[7.5rem] p-4 sm:min-h-32 sm:p-5"},t))}),(0,Kt.jsx)(Vu,{className:"min-h-[17rem]"})]})}function JTe(){return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,Kt.jsx)(Vu,{className:"min-h-[17rem]"}),(0,Kt.jsx)(Vu,{className:"min-h-[17rem]"})]}),(0,Kt.jsx)(tb,{className:"h-24 border-y border-dashboard-border-subtle bg-dashboard-fill-faint"}),(0,Kt.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,Kt.jsx)(Vu,{className:"min-h-56"}),(0,Kt.jsx)(Vu,{className:"min-h-56"})]})]})}function QTe(){return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)(Vu,{className:"min-h-20 p-4"}),(0,Kt.jsx)(tb,{className:"h-10 border-b border-dashboard-border-subtle"}),(0,Kt.jsx)(Vu,{className:"min-h-80"})]})}function YTe(){return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[(0,Kt.jsx)(tb,{className:"h-7 w-56 rounded-md bg-dashboard-fill-soft"}),(0,Kt.jsx)(tb,{className:"h-10 w-full max-w-md rounded-lg border border-dashboard-border-subtle bg-dashboard-fill-faint sm:w-72"})]}),(0,Kt.jsx)("div",{"aria-hidden":"true",className:"grid min-w-0 grid-cols-3 gap-1 border-b border-dashboard-border-subtle sm:flex",children:Array.from({length:3},(e,t)=>(0,Kt.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2.5 sm:justify-start",children:[(0,Kt.jsx)(tb,{className:"h-3 w-12 rounded-md bg-dashboard-fill-soft"}),(0,Kt.jsx)(tb,{className:"h-5 w-8 rounded-sm border border-dashboard-border-subtle bg-dashboard-fill-faint"})]},t))}),(0,Kt.jsx)(Vu,{className:"min-h-80"})]})}function Vu(e){return(0,Kt.jsx)(Z,{className:T("animate-pulse motion-reduce:animate-none",e.className),children:(0,Kt.jsx)("span",{"aria-hidden":"true"})})}function tb(e){return(0,Kt.jsx)($t,{className:e.className})}var fj=b(w(),1),XTe=[1,7,30,90];function mj(e){return e===1?"24h":`${e}d`}function nb(e){return e===1?"last 24 hours":`last ${e} days`}function nr(e){return e===1?"hour":e===7?"6hour":"day"}function mee(e){return e===1}function eNe(e){return e===7}function Pi(e){return e==="hour"?"hour":e==="6hour"?"6h":"day"}function ab(e){return e==="hour"?"hour":e==="6hour"?"6 hours":"day"}function Sw(e){return e==="hour"?"Hourly":e==="6hour"?"6-hour":"Daily"}function pr(e){return mee(e.range)&&e.hours?.length?e.hours.slice(-24):mee(e.range)?e.days.slice(-1):eNe(e.range)?e.sixHours?.length?[...e.sixHours]:e.hours?.length&&e.emptySixHour?tNe({empty:e.emptySixHour,hours:e.hours}):e.days.slice(-e.range):e.days.slice(-e.range)}function tNe(e){let t=new Map;for(let n of e.hours){let r=Date.parse(`${n.date}:00:00.000Z`);if(Number.isNaN(r))continue;let a=new Date(r);a.setUTCMinutes(0,0,0),a.setUTCHours(Math.floor(a.getUTCHours()/6)*6,0,0,0);let o=a.toISOString().slice(0,13),s={...t.get(o)??e.empty(o),date:o};for(let[l,u]of Object.entries(n))if(l!=="date"&&typeof u=="number"){let d=s[l];s[l]=(typeof d=="number"?d:0)+u}t.set(o,s)}if(e.hours.length>=24){let n=e.hours[e.hours.length-1]?.date,r=n?Date.parse(`${n}:00:00.000Z`):Date.now(),a=new Date(r);a.setUTCMinutes(0,0,0),a.setUTCHours(Math.floor(a.getUTCHours()/6)*6,0,0,0);let o=new Date(a.getTime()-9720*60*1e3),i=[];for(let s=new Date(o);s.getTime()<=a.getTime();s.setTime(s.getTime()+360*60*1e3)){let l=s.toISOString().slice(0,13);i.push(t.get(l)??e.empty(l))}return i}return[...t.values()].sort((n,r)=>n.date.localeCompare(r.date))}function rb(e){return(0,fj.jsx)("div",{"aria-label":"Reporting period",className:"flex items-center gap-1",role:"group",children:(e.options??XTe).map(t=>(0,fj.jsx)(mr,{onClick:()=>e.onChange(t),pressed:e.value===t,variant:"segment",children:mj(t)},t))})}var Um=b(w(),1);function It(e){Ws(e.documentTitle??(typeof e.title=="string"?e.title:void 0));let t=e.range!==void 0&&e.onRangeChange?(0,Um.jsx)(rb,{onChange:e.onRangeChange,...e.rangeOptions?{options:e.rangeOptions}:{},value:e.range}):void 0,n=e.actions??t;return(0,Um.jsxs)("header",{className:"flex min-w-0 items-center justify-between gap-6 border-b border-dashboard-border-subtle pb-4 sm:pb-6 max-md:flex-col max-md:items-stretch",children:[(0,Um.jsxs)("div",{className:"min-w-0",children:[(0,Um.jsx)("h2",{className:"m-0 font-display text-3xl font-light leading-none tracking-[-0.03em] text-dashboard-text sm:text-4xl",children:e.title}),(0,Um.jsx)("div",{className:"mt-2 max-w-2xl font-sans text-xs leading-relaxed text-dashboard-text-muted sm:text-sm",children:e.description})]}),n?(0,Um.jsx)("div",{className:"shrink-0",children:n}):null]})}var pee=b(w(),1);function is(e){return(0,pee.jsx)("div",{className:T(uo,"grid min-w-0 content-start gap-4 px-4 py-4 pb-[max(1rem,env(safe-area-inset-bottom))] sm:gap-6 sm:px-8 sm:py-8 sm:pb-8",e.className),children:e.children})}var Zh=b($(),1);var Gh=b($(),1);function Nl(e,t){let n=typeof t=="string"?t.startsWith("?")?t.slice(1):t:t?.toString()??"",r=e.indexOf("?"),a=r===-1?e:e.slice(0,r),o=r===-1?"":e.slice(r+1).replace(/^\?+/,""),i=new URLSearchParams(n);for(let[l,u]of new URLSearchParams(o))i.set(l,u);let s=i.toString();return s?`${a}?${s}`:a}function nNe(e,t){let n=e?.trim();return n&&t.includes(n)?n:void 0}function qu(e="q",t={}){let n=t.delayMs??250,r=t.resetPage??!1,[a,o]=$s(),i=a.get(e)?.trim()??"",[s,l]=(0,Gh.useState)(i);return(0,Gh.useEffect)(()=>{l(u=>u.trim()===i?u:i)},[i]),(0,Gh.useEffect)(()=>{let u=window.setTimeout(()=>{let d=s.trim();d!==i&&o(f=>{let m=new URLSearchParams(f);return r&&m.delete("page"),d?m.set(e,d):m.delete(e),m},{replace:!0})},n);return()=>window.clearTimeout(u)},[i,n,e,r,o,s]),[s,l,i]}function ef(e,t,n){let[r,a]=$s(),o=nNe(r.get(e),n)??t,i=(0,Gh.useCallback)(s=>{a(l=>{let u=new URLSearchParams(l);return s===t?u.delete(e):u.set(e,s),u},{replace:!0})},[t,e,a]);return[o,i]}var ob=b(w(),1);function hj(e){let{className:t,item:n}=e,r=sn(),a=Nl(n.to,r.search);if(n.isActive){let o=n.isActive(r.pathname);return(0,ob.jsx)(fe,{"aria-current":o?"page":void 0,className:t({isActive:o}),to:a,children:n.label})}return(0,ob.jsx)(lh,{className:t,end:n.end,to:a,children:n.label})}var pj=24;function gee(e){let t=e.scrollWidth-e.clientWidth;return{end:e.scrollLeft<t-1,start:e.scrollLeft>1}}function hee(e){let t=e.querySelector('[aria-current="page"]');if(!t||e.clientWidth===0)return;let n=gee(e),r=e.scrollLeft+(n.start?pj:0),a=e.scrollLeft+e.clientWidth-(n.end?pj:0),o=t.offsetLeft,i=o+t.offsetWidth;o>=r&&i<=a||(e.scrollLeft=o-(e.clientWidth-t.offsetWidth)/2)}function aNe(e){if(!e.start&&!e.end)return;let t=`${pj}px`,n=e.start?`transparent, black ${t}`:"black",r=e.end?`black calc(100% - ${t}), transparent`:"black",a=`linear-gradient(to right, ${n}, ${r})`;return{maskImage:a,WebkitMaskImage:a}}function Wh(e){let{pathname:t}=sn(),n=(0,Zh.useRef)(null),[r,a]=(0,Zh.useState)({end:!1,start:!1});(0,Zh.useLayoutEffect)(()=>{let i=n.current;if(!i)return;let s=()=>{let{end:u,start:d}=gee(i);a(f=>f.start===d&&f.end===u?f:{end:u,start:d})},l=new ResizeObserver(()=>{i.scrollLeft=0,hee(i),s()});s(),i.addEventListener("scroll",s,{passive:!0}),l.observe(i);for(let u of i.children)l.observe(u);return()=>{i.removeEventListener("scroll",s),l.disconnect()}},[]),(0,Zh.useLayoutEffect)(()=>{n.current&&hee(n.current)},[t]);let o=({isActive:i})=>T("relative flex h-10 items-center justify-center whitespace-nowrap font-sans text-sm font-medium no-underline transition-colors after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-dashboard-focus",i?"text-dashboard-text after:bg-dashboard-text-solid":"text-dashboard-text-muted hover:text-dashboard-text",e.fill?"min-w-max flex-[1_0_0]":"shrink-0");return(0,ob.jsx)("nav",{"aria-label":e.ariaLabel,className:T("flex min-w-0 max-w-full",!e.fill&&"w-fit"),children:(0,ob.jsx)("div",{className:T("relative -mx-1 flex gap-5 px-1 min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"),ref:n,style:aNe(r),children:e.items.map(i=>(0,ob.jsx)(hj,{className:o,item:i},i.to))})})}var Qn=b($(),1),ww=b(Is(),1),uc=b(w(),1),Gu=(0,Qn.createContext)(null);function JT(e){let[t,n]=(0,Qn.useState)(null),[r,a]=(0,Qn.useState)(null),[o,i]=(0,Qn.useState)(null),[s,l]=(0,Qn.useState)(null),u=(0,Qn.useRef)(null),d=(0,Qn.useCallback)(y=>{n(y)},[]),f=(0,Qn.useCallback)(y=>{a(y)},[]),m=(0,Qn.useCallback)(y=>{i(y)},[]),h=(0,Qn.useCallback)(y=>{l(y)},[]),p=(0,Qn.useCallback)(y=>{u.current=y},[]),g=(0,Qn.useCallback)(()=>{u.current?.()},[]),x=(0,Qn.useMemo)(()=>({mobileHeaderActionsSlot:o,mobileHeaderActionsSlotRef:m,mobileHeaderLiveSlot:s,mobileHeaderLiveSlotRef:h,mobileSecondarySlot:r,mobileSecondarySlotRef:f,openMobileNavigation:g,registerOpenMobileNavigation:p,secondarySlot:t,secondarySlotRef:d}),[o,m,s,h,r,f,g,p,t,d]);return(0,uc.jsx)(Gu.Provider,{value:x,children:e.children})}function vee(e){let t=(0,Qn.useContext)(Gu);if(!t)throw new Error("DashboardChrome requires DashboardChromeProvider");return(0,uc.jsxs)("div",{className:"sticky top-0 z-30 bg-dashboard-bg/95 pt-[env(safe-area-inset-top)]",children:[(0,uc.jsxs)("div",{className:"border-b border-dashboard-border-strong",children:[e.header,(0,uc.jsx)("div",{className:"hidden md:block",ref:t.secondarySlotRef})]}),e.banner]})}function yee(){let e=(0,Qn.useContext)(Gu);if(!e)throw new Error("MobileSecondaryNavigationSlot requires DashboardChromeProvider");return(0,uc.jsx)("div",{ref:e.mobileSecondarySlotRef})}function bee(){let e=(0,Qn.useContext)(Gu);if(!e)throw new Error("MobileHeaderActionsSlot requires DashboardChromeProvider");return(0,uc.jsx)("div",{className:"col-start-3 row-start-1 flex min-w-0 items-center justify-self-end md:hidden",ref:e.mobileHeaderActionsSlotRef})}function xee(){let e=(0,Qn.useContext)(Gu);if(!e)throw new Error("MobileHeaderLiveSlot requires DashboardChromeProvider");return(0,uc.jsx)("div",{className:"flex shrink-0 items-center md:hidden",ref:e.mobileHeaderLiveSlotRef})}function See(e){let t=(0,Qn.useContext)(Gu);return t?.mobileHeaderActionsSlot?(0,ww.createPortal)(e.children,t.mobileHeaderActionsSlot):null}function wee(e){let t=(0,Qn.useContext)(Gu);return t?.mobileHeaderLiveSlot?(0,ww.createPortal)(e.children,t.mobileHeaderLiveSlot):null}function Cee(){let e=(0,Qn.useContext)(Gu);return e?e.openMobileNavigation:null}function kee(e){let t=(0,Qn.useContext)(Gu),n=(0,Qn.useRef)(e);n.current=e,(0,Qn.useEffect)(()=>{if(!t)return;let r=()=>{n.current?.()};return t.registerOpenMobileNavigation(e?r:null),()=>{t.registerOpenMobileNavigation(null)}},[t,e])}function Ree(e){let t=(0,Qn.useContext)(Gu);return t?t.secondarySlot?(0,uc.jsxs)(uc.Fragment,{children:[(0,ww.createPortal)(e.desktop,t.secondarySlot),t.mobileSecondarySlot?(0,ww.createPortal)(e.mobile,t.mobileSecondarySlot):null]}):null:e.desktop}var Zu=b(w(),1);function jm(e){let t=({isActive:n})=>T("rounded-lg px-3 py-3 pl-6 font-sans text-sm font-medium no-underline transition-colors",n?"bg-dashboard-accent/[0.1] text-dashboard-accent-text":T("hover:bg-dashboard-fill-faint",Vh));return(0,Zu.jsxs)("div",{className:"min-w-0",children:[(0,Zu.jsx)(Ree,{desktop:(0,Zu.jsx)("div",{className:T(uo,"min-w-0 px-4 md:px-8"),children:(0,Zu.jsx)(Wh,{ariaLabel:e.ariaLabel,items:e.items})}),mobile:(0,Zu.jsx)("nav",{"aria-label":e.ariaLabel,className:"mt-3 grid gap-1 border-t border-dashboard-border pt-3",children:e.items.map(n=>(0,Zu.jsx)(hj,{className:t,item:n},n.to))})}),(0,Zu.jsx)("div",{className:"border-b border-dashboard-border px-4 pt-2 sm:px-8 md:hidden",children:(0,Zu.jsx)(Wh,{ariaLabel:e.ariaLabel,fill:!0,items:e.items})}),e.children]})}var Wu=b(w(),1),rNe=new Set(["list","runs"]);function oNe(e){if(e==="/automations/list"||/^\/automations\/(scheduled|event)\/[^/]+\/edit$/.test(e))return!0;let t=e.match(/^\/automations\/([^/]+)$/);return!!(t?.[1]&&!rNe.has(t[1]))}var iNe=[{end:!0,label:"Overview",to:"/automations"},{isActive:oNe,label:"Automations",to:"/automations/list"},{label:"Runs",to:"/automations/runs"}];function gj(e){return(0,Wu.jsx)(jm,{ariaLabel:"Automations navigation",items:iNe,children:e.children})}function _l(e){return(0,Wu.jsx)(gj,{children:(0,Wu.jsx)(is,{children:e.children})})}function Kh(e){return(0,Wu.jsxs)(Wu.Fragment,{children:[(0,Wu.jsx)(It,{description:e.description,title:e.title}),(0,Wu.jsx)(To,{label:e.label,variant:e.variant})]})}var fc=b($(),1);var ib=b(w(),1),sNe={compact:"font-sans font-medium text-xs text-dashboard-text-muted",default:"text-sm font-semibold text-dashboard-text"},lNe={compact:"grid gap-1.5",default:"grid gap-2"};function cn(e){let t=e.size??"default";return(0,ib.jsxs)("div",{className:T(lNe[t],e.className),children:[(0,ib.jsx)("label",{className:sNe[t],htmlFor:e.htmlFor,children:e.label}),e.children,e.error?(0,ib.jsx)("p",{id:e.htmlFor?`${e.htmlFor}-error`:void 0,role:"alert",className:"m-0 text-xs leading-relaxed text-rose-300",children:e.error}):null,e.help?(0,ib.jsx)("p",{id:e.htmlFor?`${e.htmlFor}-help`:void 0,className:"m-0 text-xs leading-relaxed text-dashboard-text-muted sm:text-sm",children:e.help}):null]})}var vj=b(w(),1),Iee="block w-full rounded-md border border-dashboard-border-emphasis bg-dashboard-ink px-3 py-2 font-sans text-sm text-dashboard-text placeholder:text-dashboard-text-muted/70 focus:border-dashboard-focus focus:outline-none focus:ring-1 focus:ring-dashboard-focus/25 aria-invalid:border-rose-300 disabled:cursor-not-allowed disabled:opacity-50";function xa({className:e,type:t="text",size:n="default",...r}){return(0,vj.jsx)("input",{...r,className:T(Iee,n==="comfortable"&&"min-h-11 text-base sm:min-h-10 sm:text-sm",e),type:t})}function tf({className:e,prose:t=!1,...n}){return(0,vj.jsx)("textarea",{...n,className:T(Iee,"min-h-36",t?"font-sans leading-relaxed":"font-mono",e)})}var Jh=b(w(),1);function dc(e){return(0,Jh.jsxs)("section",{className:"grid min-w-0 gap-5 border-t border-dashboard-border-emphasis py-8 md:grid-cols-[12rem_minmax(0,1fr)] md:gap-10",children:[(0,Jh.jsxs)("div",{children:[(0,Jh.jsx)("h2",{className:"m-0 font-display text-lg font-medium",children:e.title}),e.detail?(0,Jh.jsx)("p",{className:"mt-2 mb-0 text-sm leading-relaxed text-dashboard-text-muted",children:e.detail}):null]}),(0,Jh.jsx)("div",{className:"grid min-w-0 content-start gap-5",children:e.children})]})}var eN=b($(),1);var Cw=b(w(),1),cNe={form:"min-h-11 rounded-md border border-dashboard-border-emphasis bg-dashboard-ink pl-3 py-2 text-base text-dashboard-text focus:border-dashboard-focus focus:outline-none aria-invalid:border-rose-300 sm:min-h-10 sm:text-sm",filter:"h-9 rounded-lg border border-dashboard-border-emphasis bg-dashboard-control pl-2 text-sm text-dashboard-text transition-colors hover:border-dashboard-border-interactive focus:border-dashboard-focus focus:outline-none focus:ring-1 focus:ring-dashboard-focus/25",sort:"h-full bg-dashboard-control pl-2 font-sans text-xs text-dashboard-text-muted outline-none"};function hr({className:e,variant:t="form",...n}){let r=!n.multiple&&(n.size??1)<=1;return(0,Cw.jsxs)("span",{className:T("relative block w-full min-w-0",t==="sort"&&"h-full"),children:[(0,Cw.jsx)("select",{...n,className:T("block w-full min-w-0 disabled:cursor-not-allowed disabled:opacity-60 [color-scheme:var(--dashboard-color-scheme,dark)]",cNe[t],r?"appearance-none pr-9 forced-colors:appearance-auto":"pr-3",e)}),r?(0,Cw.jsx)(dh,{"aria-hidden":"true",className:T("pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-dashboard-text-muted forced-colors:hidden",n.disabled&&"opacity-60"),size:16}):null]})}var QT=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function YT(e){return{title:e.title??"",instruction:e.instruction,credentialMode:e.credentialMode,outcomes:e.outcomes,trigger:e.kind==="event"?e.trigger:void 0}}function XT(e){let t=e.schedule.recurrence;if(e.schedule.kind==="recurring"&&t){let{time:n,weekdays:r,...a}=t;return{kind:"recurring",...a,timezone:e.schedule.timezone,time:`${String(n.hour).padStart(2,"0")}:${String(n.minute).padStart(2,"0")}`,weekdays:r?.flatMap(o=>QT[o]??[])}}if(e.nextRunAtMs){let n=new Intl.DateTimeFormat("en-CA",{timeZone:e.schedule.timezone,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(e.nextRunAtMs),r=a=>n.find(o=>o.type===a)?.value??"";return{kind:"one_off",timezone:e.schedule.timezone,timing:{type:"at",date:`${r("year")}-${r("month")}-${r("day")}`,time:`${r("hour")}:${r("minute")}`}}}return{kind:"recurring",frequency:"daily",time:"09:00",timezone:e.schedule.timezone}}function Tee(e,t){let n={};return t.title!==(e.title??"")&&(n.title=t.title),t.instruction!==e.instruction&&(n.instruction=t.instruction),t.credentialMode!==e.credentialMode&&(n.credentialMode=t.credentialMode),JSON.stringify(t.outcomes)!==JSON.stringify(e.outcomes)&&(n.outcomes=t.outcomes),e.kind==="scheduled"&&t.schedule&&(n.schedule=t.schedule),e.kind==="event"&&JSON.stringify(t.trigger)!==JSON.stringify(e.trigger)&&(n.trigger=t.trigger),n}var wt=b(w(),1);function Nee(e){let t=e.value??XT(e.automation),[n,r]=(0,eN.useState)(e.value);(0,eN.useEffect)(()=>{let f=setTimeout(()=>r(e.value),300);return()=>clearTimeout(f)},[e.value]);let a=A4.safeParse(n),o=Qe({queryKey:["dashboard","automation-schedule-preview",e.automation.id,n],enabled:!!n&&a.success,retry:!1,queryFn:()=>co(E4,`/api/automations/${encodeURIComponent(e.automation.id)}/preview`,n)}),i=t.kind==="recurring"?t.frequency:"once",s=t.kind==="recurring"?t.time:t.timing.time,l=e.value?o.data?.nextRunAtMs:e.automation.nextRunAtMs,u=e.value!==n||o.isFetching,d=o.error instanceof Ar?o.error.apiError:o.error?"Schedule preview could not be loaded. Try again.":e.value&&!a.success&&!u?a.error.issues[0]?.message:void 0;return(0,wt.jsxs)(wt.Fragment,{children:[(0,wt.jsxs)("div",{className:"grid grid-cols-1 items-start gap-4 sm:grid-cols-2",children:[(0,wt.jsx)(cn,{label:"Repeat",htmlFor:"schedule-frequency",children:(0,wt.jsxs)(hr,{id:"schedule-frequency",value:i,onChange:f=>{let m=f.target.value;m!=="once"&&m!=="daily"&&m!=="weekly"&&m!=="monthly"&&m!=="yearly"||e.onChange(m==="once"?{kind:"one_off",timezone:t.timezone??e.automation.schedule.timezone,timing:{type:"at",date:"",time:s}}:{kind:"recurring",timezone:t.timezone,time:s,frequency:m,interval:1,weekdays:m==="weekly"?["monday"]:void 0,dayOfMonth:["monthly","yearly"].includes(m)?1:void 0,month:m==="yearly"?1:void 0})},children:[(0,wt.jsx)("option",{value:"once",children:"Once"}),(0,wt.jsx)("option",{value:"daily",children:"Every day"}),(0,wt.jsx)("option",{value:"weekly",children:"Every week"}),(0,wt.jsx)("option",{value:"monthly",children:"Every month"}),(0,wt.jsx)("option",{value:"yearly",children:"Every year"})]})}),(0,wt.jsx)(cn,{label:"Time",htmlFor:"schedule-time",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-time",type:"time",value:s,onChange:f=>e.onChange(t.kind==="recurring"?{...t,time:f.target.value}:{...t,timing:{type:"at",date:t.timing.date,time:f.target.value}})})})]}),t.kind==="recurring"?(0,wt.jsxs)(wt.Fragment,{children:[t.frequency==="weekly"?(0,wt.jsxs)("fieldset",{children:[(0,wt.jsx)("legend",{className:"mb-2 text-sm font-semibold",children:"On"}),(0,wt.jsx)("div",{className:"grid grid-cols-7 gap-1.5",children:[...QT.slice(1),QT[0]].map(f=>(0,wt.jsx)("button",{type:"button","aria-label":f,"aria-pressed":t.weekdays?.includes(f)??!1,onClick:()=>e.onChange({...t,weekdays:t.weekdays?.includes(f)?t.weekdays.filter(m=>m!==f):[...t.weekdays??[],f]}),className:T("min-h-11 cursor-pointer rounded-md border px-1 text-xs font-medium capitalize focus-visible:outline-2 focus-visible:outline-dashboard-focus sm:min-h-10 sm:text-sm",t.weekdays?.includes(f)?"border-dashboard-focus/50 bg-dashboard-focus/10 text-dashboard-focus":"border-dashboard-border-emphasis text-dashboard-text-muted hover:bg-dashboard-fill-hover"),children:f.slice(0,3)},f))})]}):null,(0,wt.jsxs)("div",{className:"grid grid-cols-1 items-start gap-4 sm:grid-cols-2",children:[(0,wt.jsx)(cn,{label:"Interval",htmlFor:"schedule-interval",help:"Number of calendar periods between runs.",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-interval",type:"number",min:1,max:365,value:t.interval??1,onChange:f=>e.onChange({...t,interval:f.target.valueAsNumber})})}),(0,wt.jsx)(cn,{label:"Start date",htmlFor:"schedule-start",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-start",type:"date",value:t.startDate??"",onChange:f=>e.onChange({...t,startDate:f.target.value||void 0})})})]}),t.frequency==="monthly"||t.frequency==="yearly"?(0,wt.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,wt.jsx)(cn,{label:"Day of month",htmlFor:"schedule-day",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-day",type:"number",min:1,max:31,value:t.dayOfMonth??1,onChange:f=>e.onChange({...t,dayOfMonth:f.target.valueAsNumber})})}),t.frequency==="yearly"?(0,wt.jsx)(cn,{label:"Month",htmlFor:"schedule-month",children:(0,wt.jsx)(hr,{id:"schedule-month",value:t.month??1,onChange:f=>e.onChange({...t,month:Number(f.target.value)}),children:Array.from({length:12},(f,m)=>(0,wt.jsx)("option",{value:m+1,children:new Intl.DateTimeFormat("en",{month:"long",timeZone:"UTC"}).format(new Date(Date.UTC(2026,m,1)))},m))})}):null]}):null]}):(0,wt.jsx)(cn,{label:"Date",htmlFor:"schedule-date",children:(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-date",type:"date",value:t.timing.date,onChange:f=>e.onChange({...t,timing:{type:"at",time:s,date:f.target.value}})})}),(0,wt.jsxs)(cn,{label:"Timezone",htmlFor:"schedule-timezone",help:"Use an IANA timezone. The schedule follows local time, including daylight saving time.",children:[(0,wt.jsx)(xa,{size:"comfortable",id:"schedule-timezone",list:"automation-timezones",value:t.timezone??"",onChange:f=>e.onChange({...t,timezone:f.target.value})}),(0,wt.jsx)("datalist",{id:"automation-timezones",children:["UTC",...Intl.supportedValuesOf("timeZone")].map(f=>(0,wt.jsx)("option",{children:f},f))})]}),(0,wt.jsxs)("div",{role:"status",className:"flex gap-3 rounded-md bg-dashboard-fill-soft p-3 text-sm leading-relaxed",children:[(0,wt.jsx)(Bc,{"aria-hidden":!0,size:17,className:"mt-0.5 shrink-0 text-dashboard-text-muted"}),(0,wt.jsx)("div",{children:u?"Checking schedule\u2026":d?(0,wt.jsxs)(wt.Fragment,{children:[(0,wt.jsx)("span",{className:"text-rose-300",children:d}),o.error?(0,wt.jsx)(ye,{onClick:()=>{o.refetch()},children:"Try again"}):null]}):l?(0,wt.jsxs)(wt.Fragment,{children:["Next run"," ",new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short",timeZone:e.value?o.data?.schedule.timezone??"UTC":e.automation.schedule.timezone}).format(l)]}):"No next run."})]}),e.value?(0,wt.jsx)(ye,{className:"w-fit",onClick:()=>e.onChange(void 0),children:"Keep saved schedule"}):null]})}var rn=b(w(),1);function _ee(e){let t=Qe({queryKey:["dashboard","automation-event-catalog"],queryFn:({signal:o})=>Ke(L4,"/api/automations/event-catalog",o),retry:!1}),n=t.data?.find(o=>o.namespace===e.value.namespace&&o.type===e.value.resourceType),r=!n||e.value.events.some(o=>!n.supportedEvents.includes(o))||Object.entries(e.value.match??{}).some(([o,i])=>{let s=n.matchFields?.[o];return s?(Array.isArray(i)?i:[i]).some(l=>typeof l!==s.kind||s.enum&&!s.enum.includes(String(l))):!0}),a=(o,i)=>{let s={...e.value.match};i===void 0?delete s[o]:s[o]=i,e.onChange({...e.value,match:s})};return(0,rn.jsxs)(rn.Fragment,{children:[t.error?(0,rn.jsxs)(Ei,{title:"Event choices could not be loaded.",children:["Saved values are kept."," ",(0,rn.jsx)(ye,{onClick:()=>{t.refetch()},children:"Try again"})]}):t.isPending?(0,rn.jsx)("p",{role:"status",children:"Loading event choices\u2026"}):null,r&&t.data?(0,rn.jsxs)(Ei,{title:"Saved trigger \xB7 Kept unchanged",children:["Some saved values are not in the current catalog. You can edit other fields, or select a new resource type to replace the trigger.",(0,rn.jsx)("pre",{className:"whitespace-pre-wrap break-all text-xs",children:JSON.stringify(e.value,null,2)})]}):null,(0,rn.jsx)(cn,{label:r?"Replace trigger":"Resource type",htmlFor:"trigger-resource",children:(0,rn.jsxs)(hr,{id:"trigger-resource",value:r?"":`${e.value.namespace}:${e.value.resourceType}`,onChange:o=>{let i=t.data?.find(s=>`${s.namespace}:${s.type}`===o.target.value);i&&window.confirm("Replace the saved trigger? Its resource, events, and conditions will be cleared.")&&e.onChange({namespace:i.namespace,resourceType:i.type,identifier:"",label:"",events:[]})},children:[(0,rn.jsx)("option",{value:"",disabled:!0,children:"Keep saved trigger"}),t.data?.map(o=>(0,rn.jsxs)("option",{value:`${o.namespace}:${o.type}`,children:[o.namespace," \xB7 ",o.type.replaceAll("_"," ")]},`${o.namespace}:${o.type}`))]})}),!r&&n?(0,rn.jsxs)(rn.Fragment,{children:[(0,rn.jsx)(cn,{label:"Resource name",htmlFor:"trigger-label",children:(0,rn.jsx)(xa,{size:"comfortable",id:"trigger-label",value:e.value.label,onChange:o=>e.onChange({...e.value,label:o.target.value})})}),(0,rn.jsx)(cn,{label:"Resource identifier",htmlFor:"trigger-identifier",help:"Use the exact provider resource identifier, not its display name.",children:(0,rn.jsx)(xa,{size:"comfortable",id:"trigger-identifier",value:e.value.identifier,onChange:o=>e.onChange({...e.value,identifier:o.target.value})})}),(0,rn.jsxs)("fieldset",{children:[(0,rn.jsx)("legend",{className:"mb-2 text-sm font-semibold",children:"Run on these events"}),(0,rn.jsx)("div",{className:"divide-y divide-dashboard-border-subtle rounded-md border border-dashboard-border-emphasis",children:n.supportedEvents.map(o=>(0,rn.jsxs)("label",{className:"flex min-h-11 cursor-pointer items-start gap-3 px-3 py-3 text-sm",children:[(0,rn.jsx)("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0 accent-dashboard-focus",checked:e.value.events.includes(o),onChange:()=>e.onChange({...e.value,events:e.value.events.includes(o)?e.value.events.filter(i=>i!==o):[...e.value.events,o]})}),(0,rn.jsxs)("span",{className:"min-w-0 break-words",children:[o.replaceAll("_"," ").replaceAll("."," \xB7 "),n.guidance?.[o]?(0,rn.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-dashboard-text-muted",children:n.guidance[o]}):null]})]},o))})]}),Object.keys(n.matchFields??{}).length?(0,rn.jsxs)("fieldset",{className:"grid gap-4",children:[(0,rn.jsx)("legend",{className:"mb-3 text-sm font-semibold",children:"Only when"}),(0,rn.jsx)("p",{className:"m-0 text-xs leading-relaxed text-dashboard-text-muted",children:"All conditions must match. Leave a field blank to match any value. Existing lists match any one listed value."}),Object.entries(n.matchFields??{}).map(([o,i])=>{let s=e.value.match?.[o];return(0,rn.jsx)(cn,{label:o,htmlFor:`match-${o}`,help:i.description,children:Array.isArray(s)?(0,rn.jsxs)("div",{className:"text-sm",children:[(0,rn.jsx)("span",{className:"break-all",children:s.join(", ")})," ",(0,rn.jsx)(ye,{onClick:()=>a(o,void 0),children:"Remove condition"})]}):i.kind==="boolean"||i.enum?(0,rn.jsxs)(hr,{id:`match-${o}`,value:s===void 0?"":String(s),onChange:l=>a(o,l.target.value===""?void 0:i.kind==="boolean"?l.target.value==="true":l.target.value),children:[(0,rn.jsx)("option",{value:"",children:"Any value"}),(i.enum??["true","false"]).map(l=>(0,rn.jsx)("option",{children:l},l))]}):(0,rn.jsx)(xa,{size:"comfortable",id:`match-${o}`,type:i.kind==="number"?"number":"text",step:"any",value:s===void 0?"":String(s),onChange:l=>a(o,l.target.value===""?void 0:i.kind==="number"?l.target.valueAsNumber:l.target.value)})},o)})]}):null]}):null,JSON.stringify(e.value)!==JSON.stringify(e.original)?(0,rn.jsx)(ye,{className:"w-fit",onClick:()=>e.onChange(e.original),children:"Keep saved trigger"}):null]})}function Qh(e,t){return typeof e.destination=="string"?e.destination==="task_creator"?"Creator \xB7 Direct message":`${t.label} \xB7 ${t.visibility}`:e.destination.channelId===t.channelId&&e.destination.teamId===t.teamId?`${t.label} \xB7 ${t.visibility}`:`Saved destination \xB7 ${e.destination.channelId}`}var da=b(w(),1);function tN(e){return e.outcomes.length?(0,da.jsx)("ol",{className:"m-0 grid gap-2 pl-5 text-sm",children:e.outcomes.map((t,n)=>(0,da.jsx)("li",{children:Qh(t,e.destination)},n))}):(0,da.jsx)("p",{className:"m-0 text-sm",children:"No success message"})}function Lee(e){let t=e.original.length?e.original:[{action:"send_message",destination:"current_conversation"}],n=[...e.original.flatMap((r,a)=>typeof r.destination=="string"?[]:[{value:`saved:${a}`,label:Qh(r,e.destination),outcome:r}]),{value:"current_conversation",label:`${e.destination.label} \xB7 ${e.destination.visibility}`,outcome:{action:"send_message",destination:"current_conversation"}},{value:"task_creator",label:"Creator \xB7 Direct message",outcome:{action:"send_message",destination:"task_creator"}}];return(0,da.jsxs)(da.Fragment,{children:[(0,da.jsxs)("fieldset",{children:[(0,da.jsx)("legend",{className:"sr-only",children:"Success messages"}),(0,da.jsx)("div",{className:"flex flex-wrap gap-x-6 gap-y-3",children:[!0,!1].map(r=>(0,da.jsxs)("label",{className:"inline-flex min-h-8 cursor-pointer items-center gap-2 text-sm",children:[(0,da.jsx)("input",{type:"radio",name:"messages",className:"size-4 accent-dashboard-focus",checked:!!e.value.length===r,onChange:()=>e.onChange(r?t:[])}),r?"Send a message":"No success message"]},String(r)))})]}),e.value.length?(0,da.jsxs)("div",{className:"grid gap-4 sm:gap-2",children:[e.value.map((r,a)=>{let o=e.original.findIndex(i=>JSON.stringify(i)===JSON.stringify(r));return(0,da.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,da.jsxs)("span",{className:"w-4 text-xs text-dashboard-text-muted",children:[a+1,"."]}),(0,da.jsx)("div",{className:T("min-w-0 flex-1",e.value.length>1&&"order-last basis-full sm:order-none sm:basis-auto"),children:(0,da.jsx)(hr,{"aria-label":`Message ${a+1} destination`,value:typeof r.destination=="string"?r.destination:`saved:${o}`,onChange:i=>{let s=n.find(l=>l.value===i.target.value);s&&e.onChange(e.value.map((l,u)=>u===a?s.outcome:l))},children:n.map(i=>(0,da.jsx)("option",{value:i.value,children:i.label},i.value))})}),e.value.length>1?(0,da.jsxs)(da.Fragment,{children:[(0,da.jsx)(ye,{size:"icon",className:"ml-auto sm:ml-0","aria-label":`Move message ${a+1} up`,disabled:a===0,onClick:()=>{let i=[...e.value],s=i[a-1];s&&(i[a-1]=r,i[a]=s,e.onChange(i))},children:(0,da.jsx)(AS,{size:16})}),(0,da.jsx)(ye,{size:"icon","aria-label":`Remove message ${a+1}`,onClick:()=>e.onChange(e.value.filter((i,s)=>s!==a)),children:(0,da.jsx)(io,{size:16})})]}):null]},a)}),e.value.length<5?(0,da.jsxs)(ye,{className:"w-fit",onClick:()=>e.onChange([...e.value,{action:"send_message",destination:"task_creator"}]),children:[(0,da.jsx)(Wd,{size:15}),"Add message"]}):null]}):(0,da.jsx)("p",{className:"m-0 text-sm leading-relaxed text-dashboard-text-muted",children:"Junior still does the work. No message is sent after success."}),(0,da.jsxs)("p",{className:"m-0 text-xs leading-relaxed text-dashboard-text-muted",children:[e.value.length?"Messages are sent in this order. ":"","This does not limit actions in the instruction."]})]})}var Le=b(w(),1);function Eee(e){let[t,n]=(0,fc.useState)(e.automation),[r,a]=(0,fc.useState)(()=>YT(e.automation)),[o,i]=(0,fc.useState)({}),[s,l]=(0,fc.useState)(),u=(0,fc.useRef)(null),d=(0,fc.useRef)(!1),f=_r(),m=pn(),h=Tee(t,r),p=Object.keys(h).length>0,g={kind:t.kind,revision:t.revision,...h},x=I2(()=>p&&!d.current),y=(0,fc.useRef)(null);(0,fc.useEffect)(()=>{x.state==="blocked"&&y.current?.focus()},[x.state]);let v=`/api/automations/${encodeURIComponent(t.id)}`;(0,fc.useEffect)(()=>{let B=oe=>{p&&!d.current&&(oe.preventDefault(),oe.returnValue="")};return window.addEventListener("beforeunload",B),()=>window.removeEventListener("beforeunload",B)},[p]);let S=()=>requestAnimationFrame(()=>(u.current?.querySelector('[aria-invalid="true"]')??u.current?.querySelector("[data-save-error]"))?.focus()),C=zn({mutationFn:()=>Qy(lc,v,g),onSuccess:async()=>{d.current=!0,await m.invalidateQueries({queryKey:["dashboard","automations"]}),f(e.returnPath,{state:{automationSaved:!0}})},onError:B=>{i(B instanceof Ar?B.fields??{}:{}),S()}});function R(B){s&&(a(B?{...YT(s),...h}:YT(s)),n(s),l(void 0),C.reset(),i({}))}let I=zn({mutationFn:()=>Ke(lc,`${v}/edit`),onSuccess:l}),N=C.error instanceof Ar&&C.error.code==="conflict",k=B=>a(oe=>({...oe,...B})),z=B=>Object.entries(o).filter(([oe])=>oe===B||oe.startsWith(`${B}.`)).flatMap(([,oe])=>oe).join(" ")||void 0,L=t.kind==="scheduled"?"schedule":"trigger",q=t.ownedByViewer,P=e.summary.createdBy,V=!q&&t.credentialMode==="creator"&&(h.instruction!==void 0||t.kind==="event"&&h.trigger!==void 0),F=z(L),se=B=>({"aria-invalid":!!z(B)||void 0,"aria-describedby":z(B)?`${B}-error`:void 0});return(0,Le.jsxs)("form",{ref:u,noValidate:!0,onSubmit:B=>{if(B.preventDefault(),C.isPending||N||!p)return;let oe=_4.safeParse(g);if(!oe.success){let G={};for(let re of oe.error.issues)(G[re.path.join(".")]??=[]).push(re.message);i(G),S();return}i({}),C.mutate()},children:[x.state==="blocked"?(0,Le.jsx)("div",{tabIndex:-1,ref:y,className:"mb-6 outline-none",children:(0,Le.jsxs)(Ei,{title:"Discard unsaved changes?",children:[(0,Le.jsx)("p",{children:"Your changes have not been saved."}),(0,Le.jsxs)("div",{className:"flex gap-2",children:[(0,Le.jsx)(ye,{onClick:()=>x.reset(),children:"Keep editing"}),(0,Le.jsx)(ye,{onClick:()=>x.proceed(),children:"Discard changes"})]})]})}):null,C.error||Object.keys(o).length?(0,Le.jsx)("div",{tabIndex:-1,"data-save-error":!0,className:"mb-6 outline-none",children:(0,Le.jsxs)(Ei,{tone:N?"warning":"error",title:N?"This automation changed while you were editing.":"Changes could not be saved.",children:[(0,Le.jsxs)("p",{className:"mt-1",children:["Your edits are still here."," ",N?"Review the latest version before saving again.":C.error instanceof Ar?C.error.apiError:"Check the fields below, or try again."]}),N?(0,Le.jsx)(ye,{disabled:I.isPending,onClick:()=>I.mutate(),children:I.isPending?"Loading\u2026":"Review latest version"}):null,I.error?(0,Le.jsx)("p",{role:"alert",children:"The latest version could not be loaded. Try again."}):null]})}):null,s?(0,Le.jsx)("div",{className:"mb-6",children:(0,Le.jsxs)(Ei,{title:"Compare your edits with the latest saved version",children:[(0,Le.jsx)("p",{children:"Only the fields you changed are shown. Keeping your edits will replace these fields. Other saved fields stay unchanged."}),Object.entries(h).map(([B,oe])=>(0,Le.jsxs)("section",{className:"my-4",children:[(0,Le.jsx)("h3",{className:"text-sm font-semibold capitalize",children:B==="credentialMode"?"Credentials":B}),(0,Le.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,Le.jsxs)("div",{children:[(0,Le.jsx)("p",{children:"Latest saved"}),(0,Le.jsx)("pre",{className:"whitespace-pre-wrap break-words font-sans text-sm",children:Aee(B==="schedule"&&s.kind==="scheduled"?XT(s):s[B])})]}),(0,Le.jsxs)("div",{children:[(0,Le.jsx)("p",{children:"Your edit"}),(0,Le.jsx)("pre",{className:"whitespace-pre-wrap break-words font-sans text-sm",children:Aee(oe)})]})]})]},B)),(0,Le.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,Le.jsx)(ye,{onClick:()=>R(!0),children:"Keep my changed fields"}),(0,Le.jsx)(ye,{onClick:()=>R(!1),children:"Use latest saved version"})]})]})}):null,q?null:(0,Le.jsxs)("p",{className:"mt-0 mb-6 max-w-2xl text-sm leading-relaxed text-dashboard-text-muted",children:[P," created this automation. You can edit it because it is in a public channel. Only ",P," can change where results go or turn on their connected accounts. Version history keeps every saved change."]}),(0,Le.jsxs)("fieldset",{disabled:C.isPending,className:"min-w-0",children:[(0,Le.jsxs)(dc,{title:"What to do",detail:"Give Junior a clear instruction and a name you can find later.",children:[(0,Le.jsx)(cn,{label:"Title",htmlFor:"title",error:z("title"),children:(0,Le.jsx)(xa,{size:"comfortable",id:"title",value:r.title,placeholder:e.summary.title,onChange:B=>k({title:B.target.value}),...se("title")})}),(0,Le.jsxs)(cn,{label:"Instruction",htmlFor:"instruction",error:z("instruction"),children:[(0,Le.jsx)(tf,{prose:!0,id:"instruction",rows:8,value:r.instruction,onChange:B=>k({instruction:B.target.value}),...se("instruction"),className:"resize-y text-base sm:text-sm"}),(0,Le.jsxs)("p",{className:"m-0 text-right text-xs text-dashboard-text-muted",children:[r.instruction.length.toLocaleString()," / 4,000"]})]})]}),(0,Le.jsx)(dc,{title:"When to run",detail:t.kind==="scheduled"?"Choose a schedule in a specific timezone.":"Run when a matching event occurs.",children:(0,Le.jsxs)("div",{id:`${L}-error`,tabIndex:-1,"aria-invalid":!!F||void 0,className:"grid min-w-0 gap-5 outline-none",children:[F?(0,Le.jsx)("p",{role:"alert",className:"m-0 text-sm text-rose-300",children:F}):null,t.kind==="scheduled"?(0,Le.jsx)(Nee,{automation:t,value:r.schedule,onChange:B=>k({schedule:B})}):(0,Le.jsx)(_ee,{value:r.trigger??t.trigger,original:t.trigger,onChange:B=>k({trigger:B})})]})}),(0,Le.jsxs)(dc,{title:"Where results go",detail:"Choose who gets a message after successful work.",children:[z("outcomes")?(0,Le.jsx)("p",{role:"alert",className:"m-0 text-sm text-rose-300",children:z("outcomes")}):null,q?(0,Le.jsx)(Lee,{value:r.outcomes,original:t.outcomes,destination:e.summary.destination,onChange:B=>k({outcomes:B})}):(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(tN,{outcomes:t.outcomes,destination:e.summary.destination}),(0,Le.jsxs)("p",{className:"m-0 text-xs text-dashboard-text-muted",children:["Only ",P," can change where results go."]})]})]}),(0,Le.jsxs)(dc,{title:"Credentials",detail:"Choose which connected accounts Junior can use.",children:[(0,Le.jsxs)("fieldset",{className:"divide-y divide-dashboard-border-subtle rounded-md border border-dashboard-border-emphasis",children:[(0,Le.jsx)("legend",{className:"sr-only",children:"Credential mode"}),[["creator",q?"Your connected accounts":`${P}\u2019s connected accounts`,q?"Uses accounts connected by you, the creator.":`Uses accounts connected by ${P}. Only ${P} can turn this on.`],["system","System credentials only",q?"Does not use your connected accounts. Some work may not be possible.":"Does not use anyone\u2019s connected accounts. Some work may not be possible."]].map(([B,oe,G])=>(0,Le.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 px-4 py-4 has-checked:bg-dashboard-fill-soft has-disabled:cursor-not-allowed has-disabled:opacity-60",children:[(0,Le.jsx)("input",{type:"radio",name:"credentials",className:"mt-0.5 size-4 shrink-0 accent-dashboard-focus",checked:V?B==="system":r.credentialMode===B,disabled:B==="creator"&&!q&&(t.credentialMode!=="creator"||V),onChange:()=>k({credentialMode:B})}),(0,Le.jsxs)("span",{children:[(0,Le.jsx)("span",{className:"block text-sm font-medium",children:oe}),(0,Le.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-dashboard-text-muted",children:G})]})]},B))]}),V?(0,Le.jsxs)(Ei,{title:"Saving switches this automation to system credentials.",children:["Only ",P," can let a changed instruction",t.kind==="event"?" or trigger":""," use their connected accounts."]}):null,z("credentialMode")?(0,Le.jsx)("p",{role:"alert",children:z("credentialMode")}):null]})]}),(0,Le.jsx)("p",{className:"mb-5 text-xs leading-relaxed text-dashboard-text-muted sm:hidden",children:"Changes apply to future work. Saving does not run this automation."}),(0,Le.jsx)("div",{className:"sticky bottom-0 z-20 -mx-4 border-t border-dashboard-border-emphasis bg-dashboard-bg px-4 py-4 sm:-mx-8 sm:px-8",children:(0,Le.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,Le.jsxs)("div",{className:"min-w-0 flex-1",role:"status",children:[(0,Le.jsx)("p",{className:"m-0 text-xs font-medium sm:text-sm",children:C.isPending?"Saving\u2026":p?"Unsaved changes":"Unchanged"}),(0,Le.jsx)("p",{className:"mt-1 mb-0 hidden text-xs text-dashboard-text-muted sm:block",children:"Changes apply to future work. Saving does not run it."})]}),(0,Le.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,Le.jsx)(fe,{to:e.returnPath,className:"inline-flex min-h-11 items-center rounded-md border border-dashboard-border-emphasis px-3 text-sm text-dashboard-text no-underline sm:min-h-9",children:"Cancel"}),(0,Le.jsx)(ye,{type:"submit",tone:"primary",className:"min-h-11 sm:min-h-9",disabled:!p||C.isPending||N,children:"Save changes"})]})]})})]})}function Aee(e){return e==null?"Not set":typeof e=="string"?e:JSON.stringify(e,null,2)}var sb=b(w(),1);function Pee(){return(0,sb.jsx)("div",{role:"status","aria-label":"Loading automation editor",children:["What to do","When to run","Where results go","Credentials"].map((e,t)=>(0,sb.jsxs)(dc,{title:e,children:[(0,sb.jsx)($t,{className:"h-4 w-24"}),(0,sb.jsx)($t,{className:t===0?"h-48 w-full":"h-20 w-full"})]},e))})}var Un=b(w(),1);function Dee(e){let{automationId:t}=er(),n=sn(),r=eb(e.enabled,t),a=r.data&&!(r.data.kind==="scheduled"&&r.data.status==="completed"),o=Qe({queryKey:["dashboard","automations","edit",t],enabled:e.enabled&&!!a,retry:!1,queryFn:({signal:d})=>Ke(lc,`/api/automations/${encodeURIComponent(t)}/edit`,d)}),i=`/automations/list${n.search}`,s=r.data;Ws(s?a?`${s.title} \xB7 Edit`:s.title:"Edit automation");let l=s?.kind==="event"?s.status!=="active"?s.status:s.triggerAvailable?"active":"unavailable":s?.status,u=l==="active"?"success":l==="blocked"||l==="unavailable"?"warning":"neutral";return(0,Un.jsx)(gj,{children:(0,Un.jsxs)("div",{className:"mx-auto w-full min-w-0 max-w-5xl px-4 pt-7 sm:px-8 sm:pt-9",children:[(0,Un.jsxs)(fe,{to:i,className:"inline-flex min-h-8 items-center gap-2 text-sm text-dashboard-text-muted no-underline hover:text-dashboard-text",children:[(0,Un.jsx)(Ni,{"aria-hidden":!0,size:15}),"All automations"]}),(0,Un.jsxs)("div",{className:"mt-4 mb-8 flex flex-wrap items-start justify-between gap-4",children:[(0,Un.jsxs)("div",{className:"min-w-0",children:[(0,Un.jsx)("h1",{className:"m-0 break-words font-display text-3xl font-light tracking-tight",children:s&&!a?s.title:"Edit automation"}),s?(0,Un.jsxs)("p",{className:"mt-2 mb-0 text-sm text-dashboard-text-muted",children:["Created by ",s.ownedByViewer?"you":s.createdBy," \xB7"," ",s.destination.label]}):null]}),s?(0,Un.jsxs)("div",{className:"flex items-center gap-4",children:[(0,Un.jsx)(fe,{to:`/automations/${encodeURIComponent(s.id)}/versions${n.search}`,className:"text-sm text-dashboard-text-muted underline underline-offset-2 hover:text-dashboard-text",children:"Version history"}),(0,Un.jsx)(In,{tone:u,children:l==="unavailable"?"Trigger unavailable":l})]}):null]}),!s&&r.error||!o.data&&o.error?(0,Un.jsxs)(Ei,{tone:"error",title:"Automation could not be loaded.",children:["It may no longer be available, or you may not have access."," ",(0,Un.jsx)(ye,{onClick:()=>{r.refetch(),a&&o.refetch()},children:"Try again"})]}):!s||a&&!o.data?(0,Un.jsx)(Pee,{}):a&&o.data?(0,Un.jsx)(Eee,{automation:o.data,summary:s,returnPath:i},t):(0,Un.jsx)(uNe,{automation:s})]})})}function uNe({automation:e}){return(0,Un.jsxs)(Un.Fragment,{children:[(0,Un.jsx)("p",{className:"mb-6 text-sm text-dashboard-text-muted",children:"This automation has completed and cannot be edited. It will not run again."}),(0,Un.jsx)(dc,{title:"What to do",detail:"The saved instruction.",children:(0,Un.jsx)("p",{className:"m-0 whitespace-pre-wrap break-words text-sm leading-relaxed",children:e.instruction})}),(0,Un.jsx)(dc,{title:"When to run",detail:"The saved trigger.",children:e.kind==="scheduled"?(0,Un.jsxs)("p",{className:"m-0 text-sm",children:[e.schedule," \xB7 ",e.timezone]}):(0,Un.jsxs)("div",{className:"grid gap-3 text-sm",children:[(0,Un.jsx)("p",{className:"m-0 break-words",children:e.resource}),(0,Un.jsx)("p",{className:"m-0 break-words",children:e.events.join(", ")}),e.match?(0,Un.jsx)("pre",{className:"whitespace-pre-wrap break-words text-xs",children:JSON.stringify(e.match,null,2)}):null]})}),(0,Un.jsx)(dc,{title:"Where results go",detail:"Messages after successful work.",children:(0,Un.jsx)(tN,{outcomes:e.outcomes,destination:e.destination})}),(0,Un.jsx)(dc,{title:"Credentials",detail:"The accounts Junior can use.",children:(0,Un.jsx)("p",{className:"m-0 text-sm",children:e.credentialMode==="creator"?`Uses ${e.ownedByViewer?"your":`${e.createdBy}\u2019s`} connected accounts.`:"System credentials only."})})]})}var Gg=b($(),1);var $ee=b($(),1);function nN(){return(0,$ee.useSyncExternalStore)(e=>Cu.subscribe(e),()=>Cu.isOnline(),()=>!0)}var Oee=b(w(),1);function Mee(){return nN()?null:(0,Oee.jsx)("div",{"aria-live":"polite",className:"border-t border-amber-300/15 bg-amber-300/[0.07] px-3 py-1.5 text-center font-sans text-xs text-amber-100/80",role:"status",children:"You\u2019re offline. Drafts stay on this device."})}var yj=b(w(),1);function aN(){return(0,yj.jsx)("div",{className:"relative grid size-10 shrink-0 select-none place-items-center overflow-visible",children:(0,yj.jsx)("img",{alt:"",className:"relative size-11 max-w-none -translate-y-0.5 object-contain opacity-90 drop-shadow-[0_0_7px_rgba(255,255,255,0.16)]",draggable:!1,src:"/_junior/dashboard/avatar.png"})})}var zee=["relative","overflow-hidden","bg-white/15","before:absolute","before:inset-0","before:content-['']","before:bg-[linear-gradient(90deg,#ff4d6d,#ffb703,#56f39a,#4cc9f0,#9b5de5,#ff4d6d)]","before:bg-[length:200%_100%]","before:animate-[junior-rainbow-flow_1.2s_linear_infinite]","motion-reduce:before:animate-none"].join(" ");var Bm=b(w(),1);function Vr(e){return(0,Bm.jsx)("div",{className:T(uo,"grid min-h-[calc(100dvh-5rem)] place-items-center px-4 py-8 md:px-8"),children:(0,Bm.jsxs)("section",{className:"grid w-full max-w-lg grid-cols-[auto_minmax(0,1fr)] items-center gap-3 rounded-lg border border-dashboard-border-emphasis bg-dashboard-surface-raised p-4",children:[(0,Bm.jsx)(aN,{}),(0,Bm.jsxs)("div",{children:[(0,Bm.jsx)("div",{className:"font-bold",children:e.label}),(0,Bm.jsx)("div",{"aria-label":e.label,className:`${zee} mt-3 h-1.5 w-full`,role:"progressbar"})]})]})})}var bj="0.263.0",rN=typeof bj=="string"&&bj.trim()?bj:"unknown";var kw=b(w(),1);function Uee(e){return dNe(e.serverVersion)?(0,kw.jsxs)("div",{"aria-live":"polite",className:"flex flex-wrap items-center justify-center gap-x-3 gap-y-1 border-t border-dashboard-accent/15 bg-dashboard-accent/[0.07] px-3 py-1.5 text-center font-sans text-xs text-dashboard-accent-text/80",role:"status",children:[(0,kw.jsx)("span",{children:"The dashboard changed. Refresh to load the latest version."}),(0,kw.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0 font-sans font-semibold text-dashboard-accent-text underline decoration-dashboard-accent/40 underline-offset-2 hover:text-dashboard-text-solid",onClick:()=>window.location.reload(),type:"button",children:"Refresh"})]}):null}function dNe(e){return!!e&&rN!=="unknown"&&e!=="unknown"&&e!==rN}var Rw=b(w(),1);function Ku(e){return(0,Rw.jsxs)(is,{children:[(0,Rw.jsx)(It,{description:e.description,title:e.title}),(0,Rw.jsx)(To,{label:e.label,variant:e.variant})]})}var cd=b($(),1);var oN={"angular-html":()=>import("./chunks/angular-html-ZNDXTZDN.js"),"angular-ts":()=>import("./chunks/angular-ts-ON3WFVNV.js"),astro:()=>import("./chunks/astro-TCFNN3TA.js"),blade:()=>import("./chunks/blade-XRKVUGGE.js"),c:()=>import("./chunks/c-WHCDUHJR.js"),coffee:()=>import("./chunks/coffee-NWMA7ZVV.js"),coffeescript:()=>import("./chunks/coffee-NWMA7ZVV.js"),cpp:()=>import("./chunks/cpp-7ZDYJCCI.js"),"c++":()=>import("./chunks/cpp-7ZDYJCCI.js"),css:()=>import("./chunks/css-XF3SDJYW.js"),csv:()=>import("./chunks/csv-I2Y5BPVG.js"),glsl:()=>import("./chunks/glsl-SDKJ4MVB.js"),graphql:()=>import("./chunks/graphql-XJBKAS4G.js"),gql:()=>import("./chunks/graphql-XJBKAS4G.js"),haml:()=>import("./chunks/haml-QQIA6ZDV.js"),handlebars:()=>import("./chunks/handlebars-A4STSCQ6.js"),hbs:()=>import("./chunks/handlebars-A4STSCQ6.js"),html:()=>import("./chunks/html-T3MIDC6T.js"),"html-derivative":()=>import("./chunks/html-derivative-A5ABNIZH.js"),http:()=>import("./chunks/http-VGZ3EXS5.js"),hurl:()=>import("./chunks/hurl-TO4NQQLI.js"),imba:()=>import("./chunks/imba-P3ARIZRP.js"),java:()=>import("./chunks/java-WCBM5OUU.js"),javascript:()=>import("./chunks/javascript-TQH7GGAM.js"),js:()=>import("./chunks/javascript-TQH7GGAM.js"),cjs:()=>import("./chunks/javascript-TQH7GGAM.js"),mjs:()=>import("./chunks/javascript-TQH7GGAM.js"),jinja:()=>import("./chunks/jinja-UYMB4X6S.js"),jison:()=>import("./chunks/jison-ED4UFXGK.js"),json:()=>import("./chunks/json-XRHV7G5W.js"),json5:()=>import("./chunks/json5-2OA2ZMVI.js"),jsonc:()=>import("./chunks/jsonc-KO53QF6Y.js"),jsonl:()=>import("./chunks/jsonl-GHTNFMM6.js"),jsx:()=>import("./chunks/jsx-V5TSP3NI.js"),julia:()=>import("./chunks/julia-EI7BACOV.js"),jl:()=>import("./chunks/julia-EI7BACOV.js"),less:()=>import("./chunks/less-FPWZXUDW.js"),markdown:()=>import("./chunks/markdown-QWIM2DOI.js"),md:()=>import("./chunks/markdown-QWIM2DOI.js"),marko:()=>import("./chunks/marko-3POAQSZY.js"),mdc:()=>import("./chunks/mdc-KT6TTBUF.js"),mdx:()=>import("./chunks/mdx-CWS3UMSH.js"),php:()=>import("./chunks/php-3CK4FBZI.js"),postcss:()=>import("./chunks/postcss-7K34RN34.js"),pug:()=>import("./chunks/pug-IEW5PJRA.js"),jade:()=>import("./chunks/pug-IEW5PJRA.js"),python:()=>import("./chunks/python-GCPXLELR.js"),py:()=>import("./chunks/python-GCPXLELR.js"),r:()=>import("./chunks/r-XV5O7BSV.js"),regexp:()=>import("./chunks/regexp-655IUQFI.js"),regex:()=>import("./chunks/regexp-655IUQFI.js"),sass:()=>import("./chunks/sass-MSBN6O54.js"),scss:()=>import("./chunks/scss-N73GNFL4.js"),shellscript:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),bash:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),sh:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),shell:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),zsh:()=>import("./chunks/shellscript-OPDT4ZZ3.js"),sql:()=>import("./chunks/sql-ZR72I7RP.js"),stylus:()=>import("./chunks/stylus-NVEQWGLA.js"),styl:()=>import("./chunks/stylus-NVEQWGLA.js"),svelte:()=>import("./chunks/svelte-ZZAXFLSI.js"),"ts-tags":()=>import("./chunks/ts-tags-MCSPJMMM.js"),lit:()=>import("./chunks/ts-tags-MCSPJMMM.js"),tsx:()=>import("./chunks/tsx-ZTNB67YL.js"),typescript:()=>import("./chunks/typescript-HV6B525T.js"),ts:()=>import("./chunks/typescript-HV6B525T.js"),cts:()=>import("./chunks/typescript-HV6B525T.js"),mts:()=>import("./chunks/typescript-HV6B525T.js"),vue:()=>import("./chunks/vue-WXFFFGZ3.js"),"vue-html":()=>import("./chunks/vue-html-SKWAUQDE.js"),"vue-vine":()=>import("./chunks/vue-vine-V3A5HTCZ.js"),wasm:()=>import("./chunks/wasm-JWJ5BADC.js"),wgsl:()=>import("./chunks/wgsl-ZCQ7MKDM.js"),wit:()=>import("./chunks/wit-MLLAONFF.js"),xml:()=>import("./chunks/xml-VST5CLIL.js"),yaml:()=>import("./chunks/yaml-BX3BWN2A.js"),yml:()=>import("./chunks/yaml-BX3BWN2A.js")};var iN=b(w(),1);function Di(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=Math.max(0,Math.floor(e));if(t<1e3)return`${t}ms`;if(t<6e4){let a=t/1e3;return`${a.toFixed(a<10?1:0)}s`}let n=[],r=[["mo",2592e6],["d",864e5],["h",36e5],["m",6e4],["s",1e3]];for(let[a,o]of r){let i=Math.floor(t/o);if(i!==0){if(n.push(`${i}${a}`),n.length===2)break;t%=o}}return n.join(" ")}function nf(e){return(0,iN.jsx)(iN.Fragment,{children:Di(e.value)||e.fallback||null})}function lb(e){return Date.parse(e.createdAt)}function Fm(e,t,n){return{parts:n,role:t,sourceSeq:e.seq,timestamp:lb(e),...e.mentions?{mentions:e.mentions}:void 0}}function fNe(e){let t=new Set;for(let n of e){let r=n.data;r.type==="handoff"&&r.triggeringToolCallId&&t.add(r.triggeringToolCallId),r.type==="subagent"&&r.parentToolCallId&&t.add(r.parentToolCallId)}return t}function mNe(e){let t=new Set;for(let n of e)n.messageId&&t.add(n.messageId);return t}function pNe(e,t){return{delivery:e.delivery,messageId:e.messageId,parts:e.redacted?[{type:"text",redacted:!0}]:[{type:"text",text:e.text??""}],...e.attachments?{attachments:e.attachments}:void 0,pending:!0,role:"user",source:e.source,sourceSeq:Number.MAX_SAFE_INTEGER-1e6+t,timestamp:Date.parse(e.createdAt),...e.actorIdentity?{actorIdentity:e.actorIdentity}:void 0}}function hNe(e,t){if(!t?.length)return e;let n=gNe(e,t);return n.length===0?e:[...e,...n]}function gNe(e,t){if(!t?.length)return[];let n=mNe(e);return t.filter(r=>!n.has(r.messageId)).map((r,a)=>pNe(r,a))}function xj(e,t){return Sj(e.events,e.annotations,t)}function Sj(e,t,n){let r=fNe(e),a=new Map,o=new Map,i=new Map,s=[],l=new Map,u=new Map,d,f=(h,p)=>{if(r.has(p.toolCallId))return;let g="output"in p?p.output:void 0,x=a.get(p.toolCallId);if(x){x.name=p.name,x.status=p.status,p.input!==void 0&&(x.input=p.input),g!==void 0&&(x.output=g),x.startedTimestamp===void 0&&p.startedAt&&(x.startedTimestamp=Date.parse(p.startedAt)),p.status!=="running"&&(x.resultTimestamp=lb(h));return}let y={type:"tool_call",id:p.toolCallId,name:p.name,status:p.status,...p.input===void 0?void 0:{input:p.input},...g===void 0?void 0:{output:g},...p.status==="running"?void 0:{resultTimestamp:lb(h)}},v={...Fm(h,"tool",[y]),sourceSeq:p.startedSeq??h.seq,timestamp:p.startedAt?Date.parse(p.startedAt):lb(h)};a.set(p.toolCallId,y),o.set(p.toolCallId,v),s.push(v)};for(let h of e){let p=h.data;if(p.type==="message"){let g={...Fm(h,p.role,[p.redacted?{type:"text",redacted:!0}:{type:"text",text:p.text}]),messageId:p.messageId,...p.attachments?{attachments:p.attachments}:void 0,...p.cards?{cards:m4(p.cards,t??[])}:void 0,...p.actorIdentity?{actorIdentity:p.actorIdentity}:void 0,...p.agentInvocationId?{agentInvocationId:p.agentInvocationId}:void 0,...p.eventType?{eventType:p.eventType}:void 0,eventObjectType:p.eventObjectType,...p.trustedSummary?{trustedSummary:p.trustedSummary}:void 0,...p.events?{events:p.events}:void 0,...p.explicitMention!==void 0?{explicitMention:p.explicitMention}:void 0,...p.source?{source:p.source}:void 0};s.push(g),l.set(g.messageId,g),g.role==="user"&&(d=g);continue}if(p.type==="message_handled"){let g=l.get(p.messageId);g?.role==="user"&&g.explicitMention===!1&&!g.eventType&&(g.context=!0);continue}if(p.type==="assistant_message"){if(p.parts.length===0)continue;s.push(Fm(h,"assistant",p.parts.map(g=>g.redacted?{type:"reasoning",redacted:!0}:{type:"reasoning",text:g.text})));continue}if(p.type==="turn_lifecycle"&&p.state==="started"){let g=p.inputMessageIds?.map(y=>l.get(y)).filter(y=>y!==void 0),x=g?.slice().reverse().find(y=>y.role==="user");x?u.set(p.turnId,x):d&&u.set(p.turnId,d);for(let y of g??[])y.role==="user"&&y.explicitMention===!1&&!y.eventType&&(y.context=!0);continue}if(p.type==="turn_routed"){let g=u.get(p.turnId);g&&(g.route={modelProfile:p.modelProfile,modelId:p.modelId,reasoningLevel:p.reasoningLevel,...p.confidence!==void 0?{confidence:p.confidence}:void 0,source:p.source});continue}if(p.type==="turn_context"){let g=u.get(p.turnId);g&&(g.contexts??=[],g.contexts.push({content:p.content,kind:p.kind,loadedAt:h.createdAt,pluginName:p.pluginName,version:p.version}));continue}if(p.type==="tool_calls"){for(let g of p.calls)f(h,g);if(p.assistant){let g=[];for(let x of p.assistant.parts){if(x.type==="reasoning"){g.push(x.redacted?{type:"reasoning",redacted:!0}:{type:"reasoning",text:x.text});continue}if(r.has(x.toolCallId))continue;let y=a.get(x.toolCallId);if(!y)continue;let v=o.get(x.toolCallId);if(v){v.sourceSeq!==h.seq&&(y.startedTimestamp=v.timestamp);let S=s.indexOf(v);S>=0&&s.splice(S,1),o.delete(x.toolCallId)}g.push(y)}g.length>0&&s.push(Fm(h,"assistant",g))}continue}if(p.type==="subagent"){let g=`${p.childConversationId}:${p.startedSeq}`,x=i.get(g),y=p.status==="running"?void 0:lb(h);if(x){x.status=p.status,y===void 0?delete x.finishedTimestamp:x.finishedTimestamp=y;continue}let v={type:"subagent",id:g,childConversationId:p.childConversationId,subagentKind:p.subagentKind,status:p.status,...y===void 0?void 0:{finishedTimestamp:y},...p.agentName?{agentName:p.agentName}:void 0,...p.task?{task:p.task}:void 0,...p.title?{title:p.title}:void 0};i.set(g,v),s.push({...Fm(h,"tool",[v]),sourceSeq:p.startedSeq,timestamp:Date.parse(p.startedAt)});continue}if(p.type==="structured_event"){s.push(Fm(h,"system",[{type:"structured_event",...h.mentions?{mentions:h.mentions}:void 0,namespace:p.namespace,name:p.name,version:p.version,presentation:p.presentation}]));continue}if(p.type==="attachments_delivered"){s.push(Fm(h,"system",[{type:"attachments_delivered",attachments:p.attachments}]));continue}if(p.type==="compaction"||p.type==="handoff"){s.push(Fm(h,"system",[{type:"context_event",...h.mentions?{mentions:h.mentions}:void 0,event:p.type==="handoff"?{type:p.type,createdAt:h.createdAt,modelId:p.modelId,modelProfile:p.modelProfile,...p.summary?{summary:p.summary}:void 0,...p.reasoningLevel?{reasoningLevel:p.reasoningLevel}:void 0}:{type:p.type,createdAt:h.createdAt,...p.modelId?{modelId:p.modelId}:void 0,...p.modelProfile?{modelProfile:p.modelProfile}:void 0,...p.summary?{summary:p.summary}:void 0,...p.details?{details:p.details}:void 0}}]));continue}if(p.type==="turn_lifecycle"&&p.state==="failed"){s.push({role:p.failureCode==="delivery_failed"?"system":"assistant",failureCode:p.failureCode,...p.failureReason?{failureReason:p.failureReason}:void 0,...p.eventId?{eventId:p.eventId}:void 0,...p.sentryEventUrl?{sentryEventUrl:p.sentryEventUrl}:void 0,parts:[],sourceSeq:h.seq,timestamp:lb(h)});continue}}let m=s.filter(h=>h.role!=="user"||h.eventType!==void 0||h.explicitMention!==!1||h.context===!0).sort((h,p)=>h.sourceSeq-p.sourceSeq);return hNe(m,n)}function jee(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}}var Cj=jee();function Bee(e){Cj=e||jee()}function Vm(){return Cj}function lN(){return Cj}function vNe(e){return e.status==="active"}function yNe(e){return e.status==="failed"}function bNe(e){return e.status==="active"}function xNe(e){return e.status==="failed"}function cN(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Fa(e,t){let n=cN(e);return n==null?"none":new Date(n).toLocaleString(void 0,{...t,timeZone:lN()})}function ar(e){let t=cN(e);if(t==null)return"not updated yet";let n=Math.round((t-Date.now())/1e3),r=Math.abs(n),a=[["year",3600*24*365],["month",3600*24*30],["week",3600*24*7],["day",3600*24],["hour",3600],["minute",60]];for(let[o,i]of a)if(r>=i)return new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}).format(Math.round(n/i),o);return"just now"}function af(e){if(typeof e!="number"||!Number.isFinite(e))return"none";let t=Math.max(0,Math.floor(e));if(t<1e3)return`${t}ms`;let n=t/1e3;if(n<60)return`${n.toFixed(n<10?1:0)}s`;let r=Math.round(n),a=Math.floor(r/60),o=r%60;return`${a}m ${o}s`}function Fee(e){if(e===void 0)return;let t=typeof e=="string"?e:JSON.stringify(e);if(t===void 0)return;let n=new TextEncoder().encode(t).byteLength;return n<1e3?`${n}b`:`${Math.round(n/1e3)}kb`}function cb(e,t){if(!(typeof e!="number"||typeof t!="number"||t<e))return af(t-e)}function rf(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=Math.max(0,Math.floor(e));return t===0?"":Di(t)}function Pa(e,t=!1){if(typeof e!="number"||!Number.isFinite(e))return"no timestamp";let n=new Date(e);return t?n.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium",timeZone:lN()}):n.toLocaleTimeString(void 0,{timeZone:lN()})}function uN(e){if(typeof e!="number"||!Number.isFinite(e))return"no timestamp";let t=Math.round((e-Date.now())/1e3),n=Math.abs(t),r=[["year",3600*24*365],["month",3600*24*30],["week",3600*24*7],["day",3600*24],["hour",3600]],[a,o]=r.find(([,i])=>n>=i)??r.at(-1);return new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}).format(Math.round(t/o),a)}function Hee(e){let t=new Date(e),n={dateStyle:"medium",timeStyle:"long"};return{local:t.toLocaleString(void 0,{...n,timeZone:lN()}),utc:t.toLocaleString(void 0,{...n,timeZone:"UTC"})}}function Vee(e){if(typeof e!="number"||!Number.isFinite(e))return"0";let t=Math.max(0,Math.floor(e));if(t<1e3)return String(t);let n=[["t",1e12],["b",1e9],["m",1e6],["k",1e3]],[r,a]=n.find(([,s])=>t>=s)??n[1],o=t/a;return`${o>=100||Number.isInteger(o)||o>=10?Math.round(o).toString():(Math.floor(o*10)/10).toFixed(1).replace(/\.0$/,"")}${r}`}function Yh(e){return typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):void 0}function SNe(e){return[e.inputTokens,e.outputTokens,e.cachedInputTokens,e.cacheCreationTokens].reduce((t,n)=>{let r=Yh(n);return r===void 0?t:(t??0)+r},void 0)}function Xh(e){let t=e.toLowerCase();return t==="assistant"?"assistant":t==="user"?"user":t==="system"?"system":t.includes("tool")?"tool":"other"}function qm(e,t){let n=Xh(t.role);return n==="assistant"?ln():n==="user"?t.agentInvocationId?"Agent invocation":Hm(t.actorIdentity)??Hm(e.actorIdentity)??"User":n==="system"?"System":n==="tool"?"Tool":t.role||"Unknown"}function Se(e){return Vee(e)}function Ks(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?"0":e<10?(Math.round(e*10)/10).toFixed(1).replace(/\.0$/,""):Se(e)}function Wc(e){if(!e)return;let t={totalTokens:0};t.reasoningTokens=Yh(e.reasoningTokens);let n=SNe(e);if(n!==void 0)t.totalTokens=n,t.inputTokens=Yh(e.inputTokens),t.outputTokens=Yh(e.outputTokens),t.cachedInputTokens=Yh(e.cachedInputTokens),t.cacheCreationTokens=Yh(e.cacheCreationTokens);else{let r=Yh(e.totalTokens);r!==void 0&&(t.totalTokens=r,t.providerTotalTokens=r)}return t.totalTokens>0?t:void 0}function dN(e){if(!e?.length)return;let t={totalTokens:0};for(let n of e){let r=Wc(n.usage);if(r){t.totalTokens+=r.totalTokens;for(let a of["inputTokens","outputTokens","cachedInputTokens","cacheCreationTokens","reasoningTokens"]){let o=r[a];o!==void 0&&(t[a]=(t[a]??0)+o)}}}return t.totalTokens>0?t:void 0}function kj(e){return e?`${Vee(e.totalTokens)} tokens`:""}function fN(e){return kj(Wc(e))}function Iw(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function Rj(e,t){return Math.round((e+t)*1e12)/1e12}function ss(e){if(!e?.cost)return;let t={total:0},n=e.cost,r=Iw(n.total),a={input:Iw(n.input),output:Iw(n.output),cacheRead:Iw(n.cacheRead),cacheWrite:Iw(n.cacheWrite)},o=Object.values(a).reduce((i,s)=>i+(s??0),0);return t.total=Rj(t.total,r??o),t.input=a.input,t.output=a.output,t.cacheRead=a.cacheRead,t.cacheWrite=a.cacheWrite,r!==void 0||o>0?t:void 0}function mN(e){let t;for(let n of e??[]){let r=ss(n.usage);r&&(t=Rj(t??0,r.total))}return t===void 0?void 0:{total:t}}function vt(e){if(!e)return"";let t=e.total>0&&e.total<.01?4:2;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:t}).format(e.total)}function eg(e){return e?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:4}).format(e.total):""}function ub(e,t){if(!(!e&&!t))return{...e,total:Rj(e?.total??0,t?.costUsd??0)}}function pN(e,t){return vt(ub(ss(e),t))}function qee(e){return rf(e.cumulativeDurationMs)||"none"}function wNe(e,t){return(cN(t)??0)-(cN(e)??0)}function db(e){return e?.agentTree?.at(-1)?.label??(e?.displayTitle?.trim()||void 0)}function si(e){return e?.displayTitle??"Conversation"}function Hm(e){let t=e?.email?.trim()||void 0,n=e?.fullName?.trim()||void 0,r=e?.slackUserName?.trim()||void 0;return t??n??r??e?.slackUserId}function Kc(e,t={}){let n=e.channel;if(!n)return;let a=t.includeId??!0?` (${n})`:"";if(e.channelNameRedacted&&e.channelName)return`${e.channelName}${a}`;let o=e.channelName?.replace(/^#/,"");return n.startsWith("D")?`Direct Message${a}`:n.startsWith("C")?o?`#${o}${a}`:`Public Channel${a}`:n.startsWith("G")?o?.startsWith("mpdm-")?`Group DM${a}`:`Private Channel${a}`:o?`${o}${a}`:n}function CNe(e){return yNe(e)?"failed":vNe(e)?"active":"idle"}function Gm(e){return bNe(e)?"active":xNe(e)?"failed":"idle"}function Tw(e){return e.eventHistory.status==="redacted"?"Transcript hidden because this conversation is not public.":e.eventHistory.status==="expired"?"Transcript expired for this conversation.":CNe(e)==="active"?"Transcript pending while this conversation is active.":"Transcript unavailable for this conversation."}function Ll(e){return`/people/${encodeURIComponent(e)}`}function Gee(e){return`/system/locations/${encodeURIComponent(e)}`}function Al(e){return`/automations/${encodeURIComponent(e)}`}function kNe(e){let t=e?.trim().toLowerCase();if(!t)return"markdown";let r={console:"shellscript",htm:"html",js:"javascript",jsonl:"json",md:"markdown",ndjson:"json",sh:"shellscript",text:"markdown",txt:"markdown",xml:"xml",yml:"yaml"}[t]??t;return Object.hasOwn(oN,r)?r:"markdown"}function Zee(e){let t=e.trim();if(t)try{return JSON.stringify(JSON.parse(t),null,2)}catch{return}}function Wee(e){let t=e.trim().split(/\r?\n/).filter(r=>r.trim().length>0);if(t.length<2)return;let n=[];for(let r of t){let a=Zee(r);if(!a)return;n.push(a)}return n.join(`
|
|
71
71
|
`)}function Kee(e){return Zee(e)??Wee(e)}function sN(e,t){return t==="json"?Kee(e)??e:e}function wj(e){let t=e.trim();if(!t)return"markdown";try{return JSON.parse(t),"json"}catch{}return Wee(t)?"json":"markdown"}function Jee(e){let t=[],n=/```([A-Za-z0-9_-]+)?\n([\s\S]*?)```/g,r=0,a;for(;a=n.exec(e);){let s=e.slice(r,a.index).trim();if(s){let u=wj(s);t.push({code:sN(s,u),fenced:!1,language:u})}let l=kNe(a[1]);t.push({code:sN(a[2]??"",l),fenced:!0,language:l}),r=a.index+a[0].length}let o=e.slice(r).trim();if(o){let s=wj(o);t.push({code:sN(o,s),fenced:!1,language:s})}if(t.length>0)return t;let i=wj(e);return[{code:sN(e,i),fenced:!1,language:i}]}function El(e){return e.map(t=>({activityPreview:t.activityPreview,annotations:t.annotations,sidebarAnnotations:t.sidebarAnnotations,archivedAt:t.archivedAt,auxiliaryCosts:t.auxiliaryCosts,channel:t.channel,channelName:t.channelName,channelNameRedacted:t.channelNameRedacted,childAgentTotals:t.childAgentTotals,cumulativeDurationMs:t.cumulativeDurationMs,cumulativeUsage:t.cumulativeUsage,displayTitle:t.displayTitle,id:t.conversationId,lastProgressAt:t.lastProgressAt,lastSeenAt:t.lastSeenAt,locationId:t.locationId,locationUrl:t.locationUrl,actorIdentity:t.actorIdentity,participants:t.participants,sentryTraceUrl:t.sentryTraceUrl,startedAt:t.startedAt,status:t.status,surface:t.surface,traceId:t.traceId,isPriority:t.isPriority,unfinishedWork:t.unfinishedWork,visibility:t.visibility})).sort((t,n)=>wNe(t.lastSeenAt,n.lastSeenAt))}function Qee(e){if(!e)return;let t=El([e])[0];return t?{...t,displayTitle:e.displayTitle}:void 0}function Ju(e){return e==null||e===""?"":typeof e=="string"?Kee(e)??e:JSON.stringify(e,null,2)??""}var Yee=b(w(),1);function Na(e){return(0,Yee.jsx)("p",{className:T("m-0 text-sm text-rose-300",e.className),role:"alert",children:e.children})}var Jc=b(w(),1);function hN(e){return e.hasMore?(0,Jc.jsx)(ye,{className:T("justify-self-center",e.className),disabled:e.loading,onClick:e.onLoadMore,children:e.loading?"Loading\u2026":"Load more"}):null}function tg(e,t,n){let a=(Math.max(1,t)-1)*n;return e.slice(a,a+n)}function of(e,t){return e<=0?1:Math.max(1,Math.ceil(e/t))}function sf(e){if(e.total<=e.pageSize||e.pageCount<=1)return null;let t=Math.min(Math.max(1,e.page),e.pageCount),n=(t-1)*e.pageSize+1,r=Math.min(e.total,t*e.pageSize);return(0,Jc.jsxs)("div",{"aria-label":"Pagination",className:T("flex flex-wrap items-center justify-between gap-3",e.className),children:[(0,Jc.jsxs)("p",{className:"m-0 font-sans tabular-nums text-xs text-dashboard-text-muted",children:["Showing ",n.toLocaleString("en-US"),"-",r.toLocaleString("en-US")," of"," ",e.total.toLocaleString("en-US")]}),(0,Jc.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Jc.jsx)(ye,{"aria-label":"Previous page",disabled:t<=1,onClick:()=>e.onPageChange(t-1),size:"icon",children:(0,Jc.jsx)(DS,{"aria-hidden":"true",size:16})}),(0,Jc.jsxs)("span",{className:"min-w-16 text-center font-sans tabular-nums text-xs text-dashboard-text-muted",children:[t," / ",e.pageCount]}),(0,Jc.jsx)(ye,{"aria-label":"Next page",disabled:t>=e.pageCount,onClick:()=>e.onPageChange(t+1),size:"icon",children:(0,Jc.jsx)(ca,{"aria-hidden":"true",size:16})})]})]})}var ng=b(w(),1);function Ha(e){let t=e.size??"compact";return(0,ng.jsxs)("div",{className:T("relative min-w-0",e.className),children:[(0,ng.jsx)(Cm,{"aria-hidden":"true",className:T("pointer-events-none absolute top-1/2 -translate-y-1/2 text-dashboard-text-muted",RNe[t]),size:t==="compact"?13:14,strokeWidth:2.5}),(0,ng.jsx)("input",{"aria-label":e.label,className:T("w-full rounded-md border border-dashboard-border font-sans text-sm text-dashboard-text outline-none transition-colors placeholder:text-dashboard-text-muted/70 hover:border-dashboard-border-emphasis focus:border-dashboard-focus [&::-webkit-search-cancel-button]:appearance-none",TNe[t]),onChange:n=>e.onChange(n.currentTarget.value),placeholder:e.placeholder,ref:e.inputRef,type:"search",value:e.value}),e.value?(0,ng.jsx)("button",{"aria-label":"Clear search",className:T("absolute top-1/2 grid size-6 -translate-y-1/2 cursor-pointer place-items-center rounded-md text-dashboard-text-muted transition-colors hover:bg-dashboard-fill-strong hover:text-dashboard-text focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-dashboard-focus",INe[t]),onClick:n=>{e.onChange(""),n.currentTarget.parentElement?.querySelector("input")?.focus()},type:"button",children:(0,ng.jsx)(so,{"aria-hidden":"true",size:14,strokeWidth:2.5})}):null]})}var RNe={compact:"left-2.5",default:"left-3"},INe={compact:"right-1.5",default:"right-2"},TNe={compact:"h-9 bg-dashboard-overlay-soft pr-8 pl-8 focus:ring-1 focus:ring-dashboard-focus/25",default:"h-10 bg-dashboard-overlay-soft pr-9 pl-9 focus:ring-1 focus:ring-dashboard-focus/25"};var RL=b($(),1);var Qc=b(w(),1);function Xee(e){return(0,Qc.jsxs)(Z,{className:T("flex flex-wrap items-end gap-4 p-4",e.className),children:[e.children,e.search?(0,Qc.jsx)(Pl,{className:"min-w-[16rem] flex-1",label:"Search",children:(0,Qc.jsx)(Ha,{className:"w-full max-w-md",label:e.search.label,onChange:e.search.onChange,placeholder:e.search.placeholder,value:e.search.value})}):null]})}function Pl(e){return(0,Qc.jsxs)("div",{className:T("min-w-0",e.className),children:[(0,Qc.jsx)("div",{className:"mb-2 font-sans font-medium text-xs text-dashboard-text-muted",children:e.label}),(0,Qc.jsx)("div",{"aria-label":e.label,className:"flex flex-wrap gap-2",role:"group",children:e.children})]})}function gN(e){return(0,Qc.jsx)("div",{"aria-label":e.ariaLabel,className:"grid min-w-0 grid-cols-3 gap-1 border-b border-dashboard-border-subtle sm:flex sm:overflow-x-auto",role:"tablist",children:e.items.map(t=>{let n=e.value===t.value;return(0,Qc.jsxs)("button",{"aria-selected":n,className:T("relative flex min-w-0 cursor-pointer items-center justify-between gap-2 border-0 bg-transparent px-3 py-2.5 font-sans font-medium text-xs transition-colors after:absolute after:inset-x-2 after:bottom-0 after:h-px sm:shrink-0 sm:justify-start",n?"text-dashboard-accent-text after:bg-dashboard-accent":"text-dashboard-text-muted after:bg-transparent hover:text-dashboard-text"),onClick:()=>e.onChange(t.value),role:"tab",type:"button",children:[t.label,t.count!==void 0?(0,Qc.jsx)("span",{className:T("rounded-sm border px-1.5 py-0.5 text-xs",n?"border-dashboard-accent/20 bg-dashboard-accent/10 text-dashboard-accent-text":"border-dashboard-border bg-dashboard-fill-soft text-dashboard-text-muted"),children:t.count.toLocaleString("en-US")}):null]},t.value||"all")})})}var ete=b(w(),1),NNe="a, button, input, select, textarea, [role='button'], [role='link']";function fb(e){function t(n){n.target instanceof Element&&n.target.closest(NNe)||e.onSelect()}return(0,ete.jsx)("div",{className:T("group cursor-pointer transition-colors",e.selected?"bg-dashboard-accent/[0.045]":"hover:bg-dashboard-fill-soft focus-within:bg-dashboard-fill-soft",e.className),onClick:t,children:e.children})}var vN=b($(),1);function yN(e){let[t,n]=$s(),r=pn(),a=(0,vN.useRef)(!1),o=t.get("filter")?.trim()??"",[i,s,l]=qu(),u=hx({initialPageParam:void 0,queryKey:["dashboard","plugin-user-page",e.pluginName,e.id,o,l],queryFn:({pageParam:p,signal:g})=>{let x=new URLSearchParams;o&&x.set("filter",o),l&&x.set("q",l),p&&x.set("cursor",p);let y=x.toString();return Ke(DX,`/api/user-pages/${encodeURIComponent(e.pluginName)}/${encodeURIComponent(e.id)}${y?`?${y}`:""}`,g)},getNextPageParam:p=>p.nextCursor,placeholderData:p=>p,retry:!1}),d=(0,vN.useMemo)(()=>[...new Map((u.data?.pages??[]).flatMap(p=>p.records).map(p=>[p.id,p])).values()],[u.data?.pages]),f=zn({mutationFn:p=>zm(p.href),onMutate:()=>({pluginName:e.pluginName}),onSuccess:async(p,g,x)=>{r.removeQueries({queryKey:["dashboard","plugin-user-page",x.pluginName,"record"]}),await r.invalidateQueries({queryKey:["dashboard","plugin-user-page",x.pluginName]})},onSettled:()=>{a.current=!1}});function m(p){a.current||p.confirmation&&!window.confirm(p.confirmation)||(a.current=!0,f.mutate(p))}function h(p){let g=new URLSearchParams(t);p?g.set("filter",p):g.delete("filter"),n(g,{replace:!0})}return{action:f,content:u.data?.pages[0],filter:o,query:u,records:d,runAction:m,searchQuery:l,searchText:i,setFilter:h,setSearchText:s}}var nte=c.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),tte=c.object({date:nte,personal:c.number().int().min(0),public:c.number().int().min(0)}).strict(),bN=c.object({costUsd:c.number().finite().min(0),date:nte,events:c.number().int().min(0)}).strict(),_Ne=c.object({days:c.array(tte).length(90),extractionDays:c.array(bN).length(90),extractionHours:c.array(bN).min(24).optional(),generatedAt:c.iso.datetime(),hours:c.array(tte).min(24).optional(),recallDays:c.array(bN).length(90),recallHours:c.array(bN).min(24).optional(),stats:c.object({active:c.number().int().min(0),automatic:c.number().int().min(0),createdThirtyDays:c.number().int().min(0),embedded:c.number().int().min(0),explicit:c.number().int().min(0),knowledge:c.number().int().min(0),personal:c.number().int().min(0),preference:c.number().int().min(0),procedure:c.number().int().min(0),public:c.number().int().min(0)}).strict()}).strict();function Ij(){return Qe({queryFn:({signal:e})=>Ke(_Ne,"/api/plugins/memory/dashboard",e),queryKey:["dashboard","plugin-user-page","memory","summary"],retry:!1})}var LNe=c.object({active:c.number().int().min(0),personal:c.number().int().min(0),public:c.number().int().min(0)}).strict();function ate(e){return Qe({enabled:!!e,placeholderData:Mp,queryFn:({signal:t})=>Ke(LNe,`/api/plugins/memory/counts?${new URLSearchParams({q:e})}`,t),queryKey:["dashboard","plugin-user-page","memory","counts",e],retry:!1})}var Cse=b($(),1);var mb=b(w(),1);function ls(e){return(0,mb.jsx)("dl",{className:T("grid gap-px overflow-hidden rounded-md border border-dashboard-border-subtle bg-dashboard-fill-hover",e.className),children:e.children})}function ta(e){return(0,mb.jsxs)("div",{className:"min-w-0 bg-dashboard-bg-elevated px-3 py-3",children:[(0,mb.jsx)("dt",{className:"font-sans font-medium text-xs text-dashboard-text-muted",children:e.label}),(0,mb.jsx)("dd",{className:T("mt-1.5 ml-0 break-words text-sm leading-relaxed text-dashboard-text",e.valueClassName),children:e.children})]})}var Doe=b($(),1);var rd={};to(rd,{Backdrop:()=>Ite,Close:()=>Mte,Content:()=>zte,Description:()=>Hte,Handle:()=>tC,Indent:()=>Vte,IndentBackground:()=>Gte,Popup:()=>lre,Portal:()=>hre,Provider:()=>vre,Root:()=>Dre,SwipeArea:()=>qre,Title:()=>Wre,Trigger:()=>Xre,Viewport:()=>voe,VirtualKeyboardProvider:()=>Noe,createHandle:()=>Loe});var Rte=b($(),1);function ANe(e,t){return function(r,...a){let o=new URL(e);return o.searchParams.set("code",r.toString()),a.forEach(i=>o.searchParams.append("args[]",i)),`${t} error #${r}; visit ${o} for the full message.`}}var ENe=ANe("https://base-ui.com/production-error","Base UI"),mc=ENe;var xN=b($(),1),Tj=xN.createContext(void 0);function na(e){let t=xN.useContext(Tj);if(!e&&t===void 0)throw new Error(mc(27));return t}var Zm=b($(),1);var ote=b($(),1),rte={};function Wo(e,t){let n=ote.useRef(rte);return n.current===rte&&(n.current=e(t)),n}function pb(e,t,n,r){let a=Wo(ste).current;return PNe(a,e,t,n,r)&<e(a,[e,t,n,r]),a.callback}function ite(e){let t=Wo(ste).current;return DNe(t,e)&<e(t,e),t.callback}function ste(){return{callback:null,cleanup:null,refs:[]}}function PNe(e,t,n,r,a){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==a}function DNe(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function lte(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){let r=Array(t.length).fill(null);for(let a=0;a<t.length;a+=1){let o=t[a];if(o!=null)switch(typeof o){case"function":{let i=o(n);typeof i=="function"&&(r[a]=i);break}case"object":{o.current=n;break}default:}}e.cleanup=()=>{for(let a=0;a<t.length;a+=1){let o=t[a];if(o!=null)switch(typeof o){case"function":{let i=r[a];typeof i=="function"?i():o(null);break}case"object":{o.current=null;break}default:}}}}}}var ute=b($(),1);var cte=b($(),1),$Ne=parseInt(cte.version,10);function hb(e){return $Ne>=e}function Nj(e){if(!ute.isValidElement(e))return null;let t=e,n=t.props;return(hb(19)?n?.ref:t.ref)??null}function Nw(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Js(){}var dte=Object.freeze([]),Er=Object.freeze({});function fte(e,t){let n={};for(let r in e){let a=e[r];if(t?.hasOwnProperty(r)){let o=t[r](a);o!=null&&Object.assign(n,o);continue}a===!0?n[`data-${r.toLowerCase()}`]="":a&&(n[`data-${r.toLowerCase()}`]=a.toString())}return n}function mte(e,t){return typeof e=="function"?e(t):e}function pte(e,t){return typeof e=="function"?e(t):e}var hte={};function ag(e,t,n,r,a){if(!n&&!r&&!a&&!e)return SN(t);let o=SN(e);return t&&(o=_w(o,t)),n&&(o=_w(o,n)),r&&(o=_w(o,r)),a&&(o=_w(o,a)),o}function gte(e){if(e.length===0)return hte;if(e.length===1)return SN(e[0]);let t=SN(e[0]);for(let n=1;n<e.length;n+=1)t=_w(t,e[n]);return t}function SN(e){return yte(e)?{...e(hte)}:MNe(e)}function _w(e,t){return yte(t)?t(e):ONe(e,t)}function MNe(e){let t={...e};for(let n in t){let r=t[n];vte(n,r)&&(t[n]=bte(r))}return t}function ONe(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case"style":{e[n]=Nw(e.style,r);break}case"className":{e[n]=_j(e.className,r);break}default:vte(n,r)?e[n]=zNe(e[n],r):e[n]=r}}return e}function vte(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),a=e.charCodeAt(2);return n===111&&r===110&&a>=65&&a<=90&&(typeof t=="function"||typeof t>"u")}function yte(e){return typeof e=="function"}function zNe(e,t){return t?e?(...n)=>{let r=n[0];if(xte(r)){let o=r;Lw(o);let i=t(...n);return o.baseUIHandlerPrevented||e?.(...n),i}let a=t(...n);return e?.(...n),a}:bte(t):e}function bte(e){return e&&((...t)=>{let n=t[0];return xte(n)&&Lw(n),e(...t)})}function Lw(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function _j(e,t){return t?e?t+" "+e:t:e}function xte(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}var Lj=b($(),1);function rr(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=FNe(r));let a=UNe(t,n,r);if(n.enabled===!1)return null;let o=n.state??Er;return HNe(e,r,a,o)}function UNe(e,t,n){let{className:r,style:a}=e,{state:o=Er,ref:i,props:s,stateAttributesMapping:l,enabled:u=!0}=t,d=u?mte(r,o):void 0,f=u?pte(a,o):void 0,m=u?fte(o,l):Er,h=u&&s?jNe(s):void 0,p=u?Nw(m,h)??{}:Er;return typeof document<"u"&&(u?Array.isArray(i)?p.ref=ite([p.ref,Nj(n),...i]):p.ref=pb(p.ref,Nj(n),i):pb(null,null)),u?(d!==void 0&&(p.className=_j(p.className,d)),f!==void 0&&(p.style=Nw(p.style,f)),p):Er}function jNe(e){return Array.isArray(e)?gte(e):ag(void 0,e)}var BNe=Symbol.for("react.lazy");function FNe(e){if(e?.$$typeof!==BNe)return e;let t=Zm.Children.toArray(e)[0];return Zm.isValidElement(t)?t:e}function HNe(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);let a=ag(n,t.props);return a.ref=n.ref,Zm.cloneElement(t,a)}return VNe(e,n)}function VNe(e,t){return e==="button"?(0,Lj.createElement)("button",{type:"button",...t,key:t.key}):e==="img"?(0,Lj.createElement)("img",{alt:"",...t,key:t.key}):Zm.createElement(e,t)}var og={};to(og,{endingStyle:()=>Aw,startingStyle:()=>rg});var rg="data-starting-style",Aw="data-ending-style";var qNe={[rg]:""},GNe={[Aw]:""},wN={transitionStatus(e){return e==="starting"?qNe:e==="ending"?GNe:null}};var fo={};to(fo,{align:()=>JNe,anchorHidden:()=>Pj,closed:()=>Ej,endingStyle:()=>WNe,open:()=>Aj,side:()=>KNe,startingStyle:()=>ZNe});var Aj="data-open",Ej="data-closed",ZNe=rg,WNe=Aw,Pj="data-anchor-hidden",KNe="data-side",JNe="data-align";var Dj="data-popup-open",Ste="data-pressed";var YNe={[Dj]:""},nat={[Dj]:"",[Ste]:""},XNe={[Aj]:""},e_e={[Ej]:""},t_e={[Pj]:""},wte={open(e){return e?YNe:null}};var $j={open(e){return e?XNe:e_e},anchorHidden(e){return e?t_e:null}},CN={...$j,...wN};var Cte="--nested-drawers",Qs="--drawer-height",kte="--drawer-frontmost-height",Wm="--drawer-swipe-movement-x",Yc="--drawer-swipe-movement-y",Mj="--drawer-snap-point-offset",Ew="--drawer-swipe-strength";var No="--drawer-swipe-progress";var Ite=Rte.forwardRef(function(t,n){let{render:r,className:a,style:o,forceRender:i=!1,...s}=t,l=na(),u=l.useState("open"),d=l.useState("nested"),f=l.useState("mounted"),m=l.useState("transitionStatus");return rr("div",t,{state:{open:u,transitionStatus:m},ref:[l.context.backdropRef,n],stateAttributesMapping:CN,props:[{role:"presentation",hidden:!f,style:{pointerEvents:u?void 0:"none",userSelect:"none",WebkitUserSelect:"none",[No]:"0",[Ew]:"1"}},s],enabled:i||!d})});var Dte=b($(),1);var yb=b($(),1);function kN(){return typeof window<"u"}function qr(e){return RN(e)?(e.nodeName||"").toLowerCase():"#document"}function Tn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qu(e){var t;return(t=(RN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function RN(e){return kN()?e instanceof Node||e instanceof Tn(e).Node:!1}function fa(e){return kN()?e instanceof Element||e instanceof Tn(e).Element:!1}function En(e){return kN()?e instanceof HTMLElement||e instanceof Tn(e).HTMLElement:!1}function Xc(e){return!kN()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Tn(e).ShadowRoot}function lg(e){let{overflow:t,overflowX:n,overflowY:r,display:a}=Pr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function Tte(e){return/^(table|td|th)$/.test(qr(e))}function Pw(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var n_e=/transform|translate|scale|rotate|perspective|filter/,a_e=/paint|layout|strict|content/,ig=e=>!!e&&e!=="none",Oj;function IN(e){let t=fa(e)?Pr(e):e;return ig(t.transform)||ig(t.translate)||ig(t.scale)||ig(t.rotate)||ig(t.perspective)||!TN()&&(ig(t.backdropFilter)||ig(t.filter))||n_e.test(t.willChange||"")||a_e.test(t.contain||"")}function Nte(e){let t=Ys(e);for(;En(t)&&!pc(t);){if(IN(t))return t;if(Pw(t))return null;t=Ys(t)}return null}function TN(){return Oj==null&&(Oj=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Oj}function pc(e){return/^(html|body|#document)$/.test(qr(e))}function Pr(e){return Tn(e).getComputedStyle(e)}function Dw(e){return fa(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ys(e){if(qr(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Xc(e)&&e.host||Qu(e);return Xc(t)?t.host:t}function _te(e){let t=Ys(e);return pc(t)?(e.ownerDocument||e).body:En(t)&&lg(t)?t:_te(t)}function sg(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let a=_te(e),o=a===((r=e.ownerDocument)==null?void 0:r.body),i=Tn(a);if(o){let s=NN(i);return t.concat(i,i.visualViewport||[],lg(a)?a:[],s&&n?sg(s):[])}else return t.concat(a,sg(a,[],n))}function NN(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var r_e=b($(),1),$w={...r_e};var zj=$w.useInsertionEffect,o_e=zj&&zj!==$w.useLayoutEffect?zj:e=>e();function ke(e){let t=Wo(i_e).current;return t.next=e,o_e(t.effect),t.trampoline}function i_e(){let e={next:void 0,callback:s_e,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function s_e(){}var Lte=b($(),1),l_e=()=>{},ze=typeof document<"u"?Lte.useLayoutEffect:l_e;var _N=b($(),1),c_e=_N.createContext(void 0);function Ate(e=!1){let t=_N.useContext(c_e);if(t===void 0&&!e)throw new Error(mc(16));return t}var Ete=b($(),1);function Pte(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:a=0,isNativeButton:o}=e,i=r&&t!==!1,s=r&&t===!1;return{props:Ete.useMemo(()=>{let u={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(u.tabIndex=a,!o&&n&&(u.tabIndex=t?a:-1)),(o&&(t||i)||!o&&n)&&(u["aria-disabled"]=n),o&&(!t||s)&&(u.disabled=n),u},[r,n,t,i,s,o,a])}}function en(e){return e?.ownerDocument||document}function LN(e,t,{detail:n=0,pointerType:r=""}={}){e.dispatchEvent(new(Tn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Mw(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:a=!0,composite:o}=e,i=yb.useRef(null),s=Ate(!0),l=o??s!==void 0,{props:u}=Pte({focusableWhenDisabled:n,disabled:t,composite:l,tabIndex:r,isNativeButton:a}),d=yb.useCallback(()=>{let h=i.current;Uj(h)&&l&&t&&u.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,u.disabled,l]);ze(d,[d]);let f=yb.useCallback((h={})=>{let{onClick:p,onMouseDown:g,onKeyUp:x,onKeyDown:y,onPointerDown:v,...S}=h;return ag({onClick(C){if(t){C.preventDefault();return}p?.(C)},onMouseDown(C){t||g?.(C)},onKeyDown(C){if(t||(Lw(C),y?.(C),C.baseUIHandlerPrevented))return;let R=C.target===C.currentTarget,I=C.currentTarget,N=Uj(I),k=!a&&u_e(I),z=R&&(a?N:!k),L=C.key==="Enter",q=C.key===" ",P=I.getAttribute("role"),V=P?.startsWith("menuitem")||P==="option"||P==="gridcell";if(R&&l&&q){if(C.defaultPrevented&&V)return;C.preventDefault(),(!a||N)&&(C.preventBaseUIHandler(),LN(I,C));return}if(!z||a||!q&&!L){R&&k&&q&&C.preventDefault();return}C.defaultPrevented||(C.preventDefault(),L&&(C.preventBaseUIHandler(),LN(I,C)))},onKeyUp(C){if(!t){if(Lw(C),x?.(C),C.target===C.currentTarget&&a&&l&&Uj(C.currentTarget)&&C.key===" "){C.preventDefault();return}C.baseUIHandlerPrevented||C.target===C.currentTarget&&!a&&!l&&!C.defaultPrevented&&C.key===" "&&(C.preventBaseUIHandler(),LN(C.currentTarget,C))}},onPointerDown(C){if(t){C.preventDefault();return}v?.(C)}},a?{type:"button"}:{role:"button"},u,S)},[t,u,l,a]),m=ke(h=>{i.current=h,d()});return{getButtonProps:f,buttonRef:m}}function Uj(e){return En(e)&&e.tagName==="BUTTON"}function u_e(e){return En(e)&&e.tagName==="A"&&!!e.href}function qn(e,t,n,r){let a=!1,o=!1,i=r??Er;return{reason:e,event:t??new Event("base-ui"),cancel(){a=!0},allowPropagation(){o=!0},get isCanceled(){return a},get isPropagationAllowed(){return o},trigger:n,...i}}var yn={};to(yn,{cancelOpen:()=>U_e,chipRemovePress:()=>x_e,clearPress:()=>b_e,closePress:()=>v_e,closeWatcher:()=>A_e,decrementPress:()=>C_e,disabled:()=>B_e,drag:()=>$_e,escapeKey:()=>L_e,focusOut:()=>__e,imperativeAction:()=>V_e,incrementPress:()=>w_e,initial:()=>H_e,inputBlur:()=>I_e,inputChange:()=>k_e,inputClear:()=>R_e,inputPaste:()=>T_e,inputPress:()=>N_e,itemPress:()=>g_e,keyboard:()=>P_e,linkPress:()=>y_e,listNavigation:()=>E_e,missing:()=>F_e,none:()=>d_e,outsidePress:()=>h_e,pointer:()=>D_e,popupClose:()=>z_e,scrub:()=>O_e,siblingOpen:()=>j_e,swipe:()=>q_e,trackPress:()=>S_e,triggerFocus:()=>p_e,triggerHover:()=>m_e,triggerPress:()=>f_e,wheel:()=>M_e,windowResize:()=>G_e});var d_e="none",f_e="trigger-press",m_e="trigger-hover",p_e="trigger-focus",h_e="outside-press",g_e="item-press",v_e="close-press",y_e="link-press",b_e="clear-press",x_e="chip-remove-press",S_e="track-press",w_e="increment-press",C_e="decrement-press",k_e="input-change",R_e="input-clear",I_e="input-blur",T_e="input-paste",N_e="input-press",__e="focus-out",L_e="escape-key",A_e="close-watcher",E_e="list-navigation",P_e="keyboard",D_e="pointer",$_e="drag",M_e="wheel",O_e="scrub",z_e="popup-close",U_e="cancel-open",j_e="sibling-open",B_e="disabled",F_e="missing",H_e="initial",V_e="imperative-action",q_e="swipe",G_e="window-resize";var $te=Dte.forwardRef(function(t,n){let{render:r,className:a,style:o,disabled:i=!1,nativeButton:s=!0,...l}=t,u=na(),d=u.useState("open"),{getButtonProps:f,buttonRef:m}=Mw({disabled:i,native:s}),h={disabled:i};function p(g){d&&u.setOpen(!1,qn(yn.closePress,g.nativeEvent))}return rr("button",t,{state:h,ref:[n,m],props:[{onClick:p},l,f]})});var Mte=$te;var Ote=b($(),1);var AN="data-drawer-content";var zte=Ote.forwardRef(function(t,n){let{render:r,className:a,style:o,...i}=t;return na(),rr("div",t,{ref:n,props:[{[AN]:""},i]})});var Bte=b($(),1);var DN=b($(),1);var EN=b($(),1);function PN(){let[,e]=EN.useState({});return EN.useCallback(()=>{e({})},[])}var Ute=0;function Z_e(e,t="mui"){let n=DN.useRef(void 0),r=PN(),a=e??n.current;return DN.useEffect(()=>{n.current==null&&(Ute+=1,n.current=`${t}-${Ute}`,e==null&&r())},[e,t,r]),a}var jte=$w.useId;function bb(e,t){if(jte!==void 0){let n=jte();return e??(t?`${t}-${n}`:n)}return Z_e(e,t)}function Km(e){return bb(e,"base-ui")}var Fte=Bte.forwardRef(function(t,n){let{render:r,className:a,style:o,id:i,...s}=t,l=na(),u=Km(i);return l.useSyncedValueWithCleanup("descriptionElementId",u),rr("p",t,{ref:n,props:[{id:u},s]})});var Hte=Fte;var MN=b($(),1);var $N=b($(),1),jj=$N.createContext(void 0);function Yu(){return $N.useContext(jj)}var W_e={active(e){return e?{"data-active":""}:{"data-inactive":""}}},Vte=MN.forwardRef(function(t,n){let{render:r,className:a,style:o,...i}=t,s=Yu(),l=s?.active??!1,u=s?.visualStateStore,d=MN.useRef(null);return ze(()=>{let m=d.current;if(!m||!u)return;let h=()=>{let{swipeProgress:g,frontmostHeight:x}=u.getSnapshot();g<=0?m.style.setProperty(No,"0"):m.style.setProperty(No,`${g}`),x<=0?m.style.removeProperty(Qs):m.style.setProperty(Qs,`${x}px`)};h();let p=u.subscribe(h);return()=>{p(),m.style.setProperty(No,"0"),m.style.removeProperty(Qs)}},[u]),rr("div",t,{ref:[n,d],state:{active:l},props:[{style:{[No]:"0"}},i],stateAttributesMapping:W_e})});var qte=b($(),1);var K_e={active(e){return e?{"data-active":""}:{"data-inactive":""}}},Gte=qte.forwardRef(function(t,n){let{render:r,className:a,style:o,...i}=t,u={active:Yu()?.active??!1};return rr("div",t,{ref:n,state:u,props:i,stateAttributesMapping:K_e})});var bg=b($(),1);var Zte=b($(),1);function ON(e){Zte.useEffect(e,dte)}var Ow=0,Jm=class e{static create(){return new e}currentId=Ow;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ow,n()},t)}isStarted(){return this.currentId!==Ow}clear=()=>{this.currentId!==Ow&&(clearTimeout(this.currentId),this.currentId=Ow)};disposeEffect=()=>this.clear};function eu(){let e=Wo(Jm.create).current;return ON(e.disposeEffect),e}var Gr={};to(Gr,{engine:()=>qj,env:()=>Zj,mediaQuery:()=>Wj,os:()=>Hj,screenReader:()=>Gj});var Hj={};to(Hj,{android:()=>Jte,apple:()=>Fj,ios:()=>Bj,linux:()=>eLe,mac:()=>Qte,windows:()=>X_e});function J_e(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Q_e,platform:Y_e,maxTouchPoints:Wte}=J_e(),cg=Q_e.toLowerCase(),ug=Y_e.toLowerCase();var Bj=/^i(os$|p)/.test(ug)||ug==="macintel"&&Wte>1,Kte="android",Jte=ug===Kte||cg.includes(Kte),Qte=!Bj&&ug.startsWith("mac"),X_e=ug.startsWith("win"),eLe=!Jte&&/^(linux|chrome os)/.test(ug),Fj=Qte||Bj;var qj={};to(qj,{blink:()=>nLe,gecko:()=>tLe,webkit:()=>Vj});var Vj=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),tLe=!Vj&&cg.includes("firefox"),nLe=!Vj&&cg.includes("chrom");var Gj={};to(Gj,{voiceOver:()=>aLe});var aLe=Fj;var Zj={};to(Zj,{jsdom:()=>rLe});var rLe=/jsdom|happydom/.test(cg);var Wj={};to(Wj,{iOS:()=>oLe});var oLe="@supports (-webkit-touch-callout: none)";function Yte(e){e.preventDefault(),e.stopPropagation()}function Xte(e){return"nativeEvent"in e}function Qm(e){return e.pointerType===""&&e.isTrusted?!0:Gr.os.android&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function zN(e){return Gr.env.jsdom?!1:!Gr.os.android&&e.width===0&&e.height===0||e.type==="pointerdown"&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"&&(Gr.os.android||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function UN(e,t){let n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function ene(e){let t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function mo(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function yt(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Xc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Xs(e,t){let n=e;for(;n;){if(fa(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(Xc(n)?n.host:null)}return null}function gr(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}var zw="data-base-ui-focusable";var Kj="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function jN(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function tne(e){return e.matches("html,body")}function Uw(e){return En(e)&&e.matches(Kj)}function nne(e){return Xs(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Kj}`)!=null}function Jj(e){return e?e.getAttribute("role")==="combobox"&&Uw(e):!1}function Qj(e){return e?e.hasAttribute(zw)?e:e.querySelector(`[${zw}]`)||e:null}var li=b($(),1);function jt(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function lf(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function xb(e){let t=Wo(iLe,e).current;return t.next=e,ze(t.effect),t}function iLe(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var BN=null,jrt=globalThis.requestAnimationFrame,Yj=class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;let n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let a=0;a<n.length;a+=1)n[a]?.(t)};request(t){let n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){let n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}},FN=new Yj;var hc=class e{static create(){return new e}static request(t){return FN.request(t)}static cancel(t){return FN.cancel(t)}currentId=BN;request(t){this.cancel(),this.currentId=FN.request(()=>{this.currentId=BN,t()})}cancel=()=>{this.currentId!==BN&&(FN.cancel(this.currentId),this.currentId=BN)};disposeEffect=()=>this.cancel};function Xu(){let e=Wo(hc.create).current;return ON(e.disposeEffect),e}var HN=b($(),1);var ane={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},rne={...ane,position:"fixed",margin:0,top:0,left:0},Frt={...ane,position:"absolute"};var one=b(w(),1),Sb=HN.forwardRef(function(t,n){let[r,a]=HN.useState();return ze(()=>{Gr.screenReader.voiceOver&&Gr.engine.webkit&&a("button")},[]),(0,one.jsx)("span",{...t,ref:n,style:rne,"aria-hidden":r?void 0:!0,...{tabIndex:0,role:r},"data-base-ui-focus-guard":""})});var lne=["top","right","bottom","left"];var ed=Math.min,tu=Math.max,Bw=Math.round,Fw=Math.floor,td=e=>({x:e,y:e}),sLe={left:"right",right:"left",bottom:"top",top:"bottom"};function Xj(e,t,n){return tu(e,ed(t,n))}function nd(e,t){return typeof e=="function"?e(t):e}function cf(e){return e.split("-")[0]}function dg(e){return e.split("-")[1]}function qN(e){return e==="x"?"y":"x"}function GN(e){return e==="y"?"height":"width"}function nu(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function ZN(e){return qN(nu(e))}function cne(e,t,n){n===void 0&&(n=!1);let r=dg(e),a=ZN(e),o=GN(a),i=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=jw(i)),[i,jw(i)]}function une(e){let t=jw(e);return[VN(e),t,VN(t)]}function VN(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var ine=["left","right"],sne=["right","left"],lLe=["top","bottom"],cLe=["bottom","top"];function uLe(e,t,n){switch(e){case"top":case"bottom":return n?t?sne:ine:t?ine:sne;case"left":case"right":return t?lLe:cLe;default:return[]}}function dne(e,t,n,r){let a=dg(e),o=uLe(cf(e),n==="start",r);return a&&(o=o.map(i=>i+"-"+a),t&&(o=o.concat(o.map(VN)))),o}function jw(e){let t=cf(e);return sLe[t]+e.slice(t.length)}function dLe(e){var t,n,r,a;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(a=e.left)!=null?a:0}}function eB(e){return typeof e!="number"?dLe(e):{top:e,right:e,bottom:e,left:e}}function fg(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 fLe(e){return e.visibility==="hidden"||e.visibility==="collapse"}function WN(e,t=e?Pr(e):null){return!e||!e.isConnected||!t||fLe(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}var mLe='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function pLe(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return Xc(n)?n.host:null}function nB(e){for(let t of Array.from(e.children))if(qr(t)==="summary")return t;return null}function hLe(e,t){let n=nB(t);return!!n&&(e===n||yt(n,e))}function fne(e){let t=e?qr(e):"";return e!=null&&e.matches(mLe)&&(t!=="summary"||e.parentElement!=null&&qr(e.parentElement)==="details"&&nB(e.parentElement)===e)&&(t!=="details"||nB(e)==null)&&(t!=="input"||e.type!=="hidden")}function mne(e){if(!fne(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=pLe(t)){let n=t!==e,r=qr(t)==="slot";if(t.hasAttribute("inert")||n&&qr(t)==="details"&&!t.open&&!hLe(e,t)||t.hasAttribute("hidden")||!r&&!gLe(t,n))return!1}return!0}function gLe(e,t){let n=Pr(e);return t?n.display!=="none":WN(e,n)}function pne(e){let t=e.tabIndex;if(t<0){let n=qr(e);if(n==="details"||n==="audio"||n==="video"||En(e)&&e.isContentEditable)return 0}return t}function tB(e){if(qr(e)!=="input")return null;let t=e;return t.type==="radio"&&t.name!==""?t:null}function vLe(e,t){let n=tB(e);if(!n)return!0;let r=t.find(a=>{let o=tB(a);return o?.name===n.name&&o.form===n.form&&o.checked});return r?r===n:t.find(a=>{let o=tB(a);return o?.name===n.name&&o.form===n.form})===n}function hne(e){if(En(e)&&qr(e)==="slot"){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return En(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function gne(e,t){hne(e).forEach(n=>{fne(n)&&t.push(n),gne(n,t)})}function vne(e,t,n){hne(e).forEach(r=>{En(r)&&r.matches(t)&&n.push(r),vne(r,t,n)})}function KN(e){return mne(e)&&pne(e)>=0}function aB(e){let t=[];return gne(e,t),t.filter(mne)}function Hw(e){let t=aB(e);return t.filter(n=>pne(n)>=0&&vLe(n,t))}function yne(e,t){let n=Hw(e),r=n.length;if(r===0)return;let a=mo(en(e)),o=n.indexOf(a),i=o===-1?t===1?0:r-1:o+t;return n[i]}function JN(e){return yne(en(e).body,1)||e}function QN(e){return yne(en(e).body,-1)||e}function mg(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!yt(n,r)}function bne(e){Hw(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function rB(e){let t=[];vne(e,"[data-tabindex]",t),t.forEach(n=>{let r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function pg(e,t,n=!0){return e.filter(a=>a.parentId===t).flatMap(a=>[...!n||a.context?.open?[a]:[],...pg(e,a.id,n)])}function oB(e,t){let n=[],r=e.find(a=>a.id===t)?.parentId;for(;r;){let a=e.find(o=>o.id===r);r=a?.parentId,a&&(n=n.concat(a))}return n}function Ym(e){return`data-base-ui-${e}`}var YN=0;function XN(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:a}=t;cancelAnimationFrame(YN);function o(){a&&!a()||e?.focus({preventScroll:n})}if(r)return o(),Js;let i=requestAnimationFrame(o);return YN=i,()=>{YN===i&&(cancelAnimationFrame(i),YN=0)}}var xne="data-base-ui-inert",Vw=new WeakMap,e_=new WeakSet,qw=new WeakMap,iB=0;function kne(e){return e?Xc(e)?e.host:kne(e.parentNode):null}var Sne=(e,t)=>t.map(n=>{if(e.contains(n))return n;let r=kne(n);return e.contains(r)?r:null}).filter(n=>n!=null),wne=e=>{let t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},Cne=(e,t,n)=>{let r=[],a=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{qr(i)!=="script"&&(t.has(i)?a(i):r.push(i))})};return a(e),r};function yLe(e,t,n,{mark:r=!0}){let a=Sne(t,e),o=r?Cne(t,wne(a),new Set(a)):[],i=[],s=[];if(n){let l=Sne(t,Array.from(t.querySelectorAll("[aria-live]"))),u=a.concat(l);Cne(t,wne(u),new Set(u)).forEach(f=>{let m=f.getAttribute("aria-hidden"),h=m!==null&&m!=="false",p=(Vw.get(f)||0)+1;Vw.set(f,p),i.push(f),p===1&&h&&e_.add(f),h||f.setAttribute("aria-hidden","true")})}return r&&o.forEach(l=>{let u=(qw.get(l)||0)+1;qw.set(l,u),s.push(l),u===1&&l.setAttribute(xne,"")}),iB+=1,()=>{i.forEach(l=>{let u=(Vw.get(l)||0)-1;Vw.set(l,u),u||(e_.has(l)||l.removeAttribute("aria-hidden"),e_.delete(l))}),r&&s.forEach(l=>{let u=(qw.get(l)||0)-1;qw.set(l,u),u||l.removeAttribute(xne)}),iB-=1,iB||(Vw=new WeakMap,e_=new WeakSet,qw=new WeakMap)}}function sB(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,a=en(e[0]).body;return yLe(e,a,n,{mark:r})}var Va=b($(),1),cB=b(Is(),1);var t_="data-base-ui-click-trigger",n_="data-base-ui-swipe-ignore",bLe="data-swipe-ignore",lB=`[${n_}]`,cot=`[${bLe}]`;var Rne={clipPath:"inset(50%)",position:"fixed",top:0,left:0};var hg=b(w(),1),Ine=Va.createContext(null),uB=()=>Va.useContext(Ine),xLe=Ym("portal");function Tne(e={}){let{ref:t,container:n,componentProps:r=Er,elementProps:a}=e,o=bb(),s=uB()?.portalNode,[l,u]=Va.useState(null),[d,f]=Va.useState(null),m=ke(x=>{x!==null&&f(x)}),h=Va.useRef(null);ze(()=>{if(n===null){h.current&&(h.current=null,f(null),u(null));return}let x=(n&&(RN(n)?n:n.current))??s??document.body;if(x==null){h.current&&(h.current=null,f(null),u(null));return}h.current!==x&&(h.current=x,f(null),u(x))},[n,s]);let p=rr("div",r,{ref:[t,m],props:[{id:o,[xLe]:""},a]}),g=l&&p?cB.createPortal(p,l):null;return{node:d,nodeId:Va.isValidElement(p)?p.props.id:void 0,subtree:g}}var dB=Va.forwardRef(function(t,n){let{render:r,className:a,style:o,children:i,container:s,portalOwnerRole:l,...u}=t,{node:d,nodeId:f,subtree:m}=Tne({container:s,ref:n,componentProps:t,elementProps:u}),h=Va.useRef(null),p=Va.useRef(null),g=Va.useRef(null),x=Va.useRef(null),[y,v]=Va.useState(null),S=Va.useRef(!1),C=y?.modal,R=y?.open,I=!!y&&!y.modal&&y.open&&!!d;Va.useEffect(()=>{if(!d||C)return;function k(z){d&&z.relatedTarget&&mg(z)&&(z.type==="focusin"?S.current&&(rB(d),S.current=!1):(bne(d),S.current=!0))}return lf(jt(d,"focusin",k,!0),jt(d,"focusout",k,!0))},[d,C]),ze(()=>{!d||R!==!0||!S.current||(rB(d),S.current=!1)},[R,d]);let N=Va.useMemo(()=>({beforeOutsideRef:h,afterOutsideRef:p,beforeInsideRef:g,afterInsideRef:x,portalNode:d,setFocusManagerState:v}),[d]);return(0,hg.jsxs)(Va.Fragment,{children:[m,(0,hg.jsxs)(Ine.Provider,{value:N,children:[I&&d&&(0,hg.jsx)(Sb,{"data-type":"outside",ref:h,onFocus:k=>{if(mg(k,d))g.current?.focus();else{let z=y?y.domReference:null;QN(z)?.focus()}}}),I&&d&&(0,hg.jsx)("span",{role:l,"aria-owns":f,style:Rne}),d&&cB.createPortal(i,d),I&&d&&(0,hg.jsx)(Sb,{"data-type":"outside",ref:p,onFocus:k=>{if(mg(k,d))x.current?.focus();else{let z=y?y.domReference:null;JN(z)?.focus(),y?.closeOnFocusOut&&y?.onOpenChange(!1,qn(yn.focusOut,k.nativeEvent))}}})]})]})});var gg=b($(),1);function Nne(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var SLe=b(w(),1),wLe=gg.createContext(null),CLe=gg.createContext(null),_ne=()=>gg.useContext(wLe)?.id||null,a_=e=>{let t=gg.useContext(CLe);return e??t};function au(e){return e==null?e:"current"in e?e.current:e}var Gw=b(w(),1);function kLe(e,t){let n=Tn(gr(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||(Qm(e)?"keyboard":t||"mouse"):"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}var Lne=20,Xm=[];function fB(){Xm=Xm.filter(e=>e.deref()?.isConnected)}function Ane(e){fB(),e&&qr(e)!=="body"&&(Xm.push(new WeakRef(e)),Xm.length>Lne&&(Xm=Xm.slice(-Lne)))}function Ene(){return fB(),Xm[Xm.length-1]?.deref()}function RLe(e){return e?KN(e)?e:Hw(e)[0]||e:null}function Pne(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;let n=aB(e).filter(a=>{let o=a.getAttribute("data-tabindex")||"";return KN(a)||a.hasAttribute("data-tabindex")&&!o.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function mB(e){let{context:t,children:n,disabled:r=!1,initialFocus:a=!0,returnFocus:o=!0,explicitReturnFocus:i,restoreFocus:s=!1,modal:l=!0,closeOnFocusOut:u=!0,openInteractionType:d="",nextFocusableElement:f,previousFocusableElement:m,beforeContentFocusGuardRef:h,externalTree:p,getInsideElements:g}=e,x=t.useState("open"),y=t.useState("domReferenceElement"),v=t.useState("floatingElement"),{events:S,dataRef:C}=t.context,R=ke(()=>C.current.floatingContext?.nodeId),I=a===!1,N=Jj(y)&&I,k=xb(a),z=xb(o),L=xb(i),q=xb(d),P=xb(x),V=a_(p),F=uB(),se=li.useRef(!1),B=li.useRef(!1),oe=li.useRef(!1),G=li.useRef(null),re=li.useRef(""),ge=li.useRef(""),qe=li.useRef(null),bt=li.useRef(null),Xe=pb(qe,h,F?.beforeInsideRef),W=pb(bt,F?.afterInsideRef),ie=eu(),Ne=eu(),Ue=Xu(),Gt=F!=null,Ae=Qj(v),Lt=ke((J=Ae)=>J?Hw(J):[]),At=ke(()=>g?.().filter(J=>J!=null)??[]);li.useEffect(()=>{if(r||!l)return;function J(Ge){Ge.key==="Tab"&&yt(Ae,mo(en(Ae)))&&Lt().length===0&&!N&&Yte(Ge)}let ue=en(Ae);return jt(ue,"keydown",J)},[r,Ae,l,N,Lt]),li.useEffect(()=>{if(r||!x)return;let J=en(Ae);function ue(){oe.current=!1}function Ge(dt){let le=gr(dt),ve=At(),me=yt(v,le)||yt(y,le)||yt(F?.portalNode,le)||ve.some(ut=>ut===le||yt(ut,le));oe.current=!me,ge.current=dt.pointerType||"keyboard",Xs(le,`[${t_}]`)&&(B.current=!0,Ne.start(0,()=>{B.current=!1}))}function Et(){ge.current="keyboard"}return lf(jt(J,"pointerdown",Ge,!0),jt(J,"pointerup",ue,!0),jt(J,"pointercancel",ue,!0),jt(J,"keydown",Et,!0),ue)},[r,v,y,Ae,x,F,Ne,At]),li.useEffect(()=>{if(r||!u)return;let J=en(Ae);function ue(){B.current=!0,Ne.start(0,()=>{B.current=!1})}function Ge(ve){let me=gr(ve);KN(me)&&(G.current=me)}function Et(ve){let me=ve.relatedTarget,ut=ve.currentTarget,mn=gr(ve);l&&me==null&&mn!=null&&yt(v,mn)&&Ane(mn),queueMicrotask(()=>{let ra=R(),he=t.context.triggerElements,we=At(),Sn=me?.hasAttribute(Ym("focus-guard"))&&[qe.current,bt.current,F?.beforeInsideRef.current,F?.afterInsideRef.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,au(m),au(f)].includes(me),Vn=!(yt(y,me)||yt(v,me)||yt(me,v)||yt(F?.portalNode,me)||we.some(X=>X===me||yt(X,me))||he.hasMatchingElement(X=>yt(X,me))||Sn||V&&(pg(V.nodesRef.current,ra).find(X=>yt(X.context?.elements.floating,me)||yt(X.context?.elements.domReference,me))||oB(V.nodesRef.current,ra).find(X=>[X.context?.elements.floating,Qj(X.context?.elements.floating)].includes(me)||X.context?.elements.domReference===me)));if(ut===y&&Ae&&Pne(Ae),s&&ut!==y&&!WN(mn)&&mo(J)===J.body){if(En(Ae)&&(Ae.focus(),s==="popup")){Ue.request(()=>{Ae.focus()});return}let X=Lt(),_e=G.current,je=(_e&&X.includes(_e)?_e:null)||X[X.length-1]||Ae;En(je)&&je.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(N||!l)&&me&&Vn&&!B.current&&(N||me!==Ene())&&(se.current=!0,t.setOpen(!1,qn(yn.focusOut,ve)))})}function dt(){oe.current||(C.current.insideReactTree=!0,ie.start(0,()=>{C.current.insideReactTree=!1}))}let le=En(y)?y:null;if(!(!v&&!le))return lf(le&&jt(le,"focusout",Et),le&&jt(le,"pointerdown",ue),v&&jt(v,"focusin",Ge),v&&jt(v,"focusout",Et),v&&F&&jt(v,"focusout",dt,!0))},[r,y,v,Ae,l,V,F,t,u,s,Lt,N,R,C,ie,Ne,Ue,f,m,At]),li.useEffect(()=>{if(r||!v||!x)return;let J=Array.from(F?.portalNode?.querySelectorAll(`[${Ym("portal")}]`)||[]),Ge=(V?oB(V.nodesRef.current,R()):[]).find(ut=>Jj(ut.context?.elements.domReference||null))?.context?.elements.domReference,dt=[...[v,...J,qe.current,bt.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,...At()],Ge,au(m),au(f),N?y:null].filter(ut=>ut!=null),le=sB(dt,{ariaHidden:l||N,mark:!1}),ve=[v,...J].filter(ut=>ut!=null),me=sB(ve);return()=>{me(),le()}},[x,r,y,v,l,F,N,V,R,f,m,At]),ze(()=>{if(!x||r||!En(Ae))return;re.current="",ge.current="";let J=en(Ae),ue=mo(J);queueMicrotask(()=>{let Ge=k.current,Et=typeof Ge=="function"?Ge(q.current||""):Ge;if(Et===void 0||Et===!1||yt(Ae,ue))return;let le=null,ve=()=>(le==null&&(le=Lt(Ae)),le[0]||Ae),me;Et===!0||Et===null?me=ve():me=au(Et),me=me||ve();let ut=yt(Ae,mo(J)),mn=C.current.openEvent,ra=mn?.type==="mousedown"&&Qm(mn);XN(me,{sync:ra,preventScroll:me===Ae,shouldFocus(){if(!P.current)return!1;if(ut)return!0;let he=mo(J);return!(he!==me&&yt(Ae,he))}})})},[r,x,Ae,Lt,k,q,P,C]);let Hn=li.useRef(null);ze(()=>{if(r||!Ae){Hn.current=null;return}Hn.current&&(Hn.current.cancelled=!0,Hn.current=null);let J=en(Ae),ue=mo(J),Ge=q.current==null;Ane(ue);function Et(le){if(le.open||(re.current=kLe(le.nativeEvent,ge.current)),(le.reason===yn.focusOut&&le.triggerElement?.hasAttribute(Ym("focus-guard"))||le.reason===yn.triggerHover&&le.nativeEvent.type==="mouseleave")&&(se.current=!0),le.reason===yn.outsidePress)if(le.nested)se.current=!1;else if(Qm(le.nativeEvent)||zN(le.nativeEvent))se.current=!1;else{let ve=!1;en(Ae).createElement("div").focus({get preventScroll(){return ve=!0,!1}}),ve?se.current=!1:se.current=!0}}S.on("openchange",Et);function dt(le){let ve=z.current,me=typeof ve=="function"?ve(le):ve;if(me===void 0||me===!1)return null;me===null&&(me=!0);let ut=y?.isConnected?y:null,mn=ue?.isConnected&&qr(ue)!=="body"?ue:null,ra=Ge?mn||ut:ut||mn;return ra||(ra=Ene()||null),typeof me=="boolean"?ra:au(me)||ra||null}return()=>{S.off("openchange",Et);let le=mo(J),ve=At(),me=yt(v,le)||ve.some(we=>we===le||yt(we,le))||V&&pg(V.nodesRef.current,R(),!1).some(we=>yt(we.context?.elements.floating,le)),ut=z.current,mn=re.current,ra=dt(mn),he={cancelled:!1};Hn.current=he,queueMicrotask(()=>{Hn.current===he&&(Hn.current=null);let we=RLe(ra),Sn=L.current??typeof ut!="boolean";if(!he.cancelled&&ut&&!se.current&&En(we)&&(!(!Sn&&we!==le&&le!==J.body)||me)){let Vn={preventScroll:!0};mn==="keyboard"&&(Vn.focusVisible=!0),we.focus(Vn)}se.current=!1})}},[r,v,Ae,z,L,q,S,V,y,R,At]),ze(()=>{if(!Gr.engine.webkit||x||!v)return;let J=mo(en(v));!En(J)||!Uw(J)||yt(v,J)&&J.blur()},[x,v]),ze(()=>{if(!(r||!F))return F.setFocusManagerState({modal:l,closeOnFocusOut:u,open:x,onOpenChange:t.setOpen,domReference:y}),()=>{F.setFocusManagerState(null)}},[r,F,l,x,t,u,y]),ze(()=>{if(!(r||!Ae))return Pne(Ae),()=>{queueMicrotask(fB)}},[r,Ae]);let $e=!r&&(l?!N:!0)&&(Gt||l);return(0,Gw.jsxs)(li.Fragment,{children:[$e&&(0,Gw.jsx)(Sb,{"data-type":"inside",ref:Xe,onFocus:J=>{if(l){let ue=Lt();XN(ue[ue.length-1])}else F?.portalNode&&(se.current=!1,mg(J,F.portalNode)?JN(y)?.focus():au(m??F.beforeOutsideRef)?.focus())}}),n,$e&&(0,Gw.jsx)(Sb,{"data-type":"inside",ref:W,onFocus:J=>{l?XN(Lt()[0]):F?.portalNode&&(u&&(se.current=!0),mg(J,F.portalNode)?QN(y)?.focus():au(f??F.afterOutsideRef)?.focus())}})]})}var Zw=b($(),1);function pB(e,t={}){let{enabled:n=!0,event:r="click",toggle:a=!0,ignoreMouse:o=!1,stickIfOpen:i=!0,touchOpenDelay:s=0,reason:l=yn.triggerPress}=t,u=e.context.dataRef,d=Zw.useRef(void 0),f=Xu(),m=eu(),h=Zw.useMemo(()=>{function p(x,y,v,S){let C=qn(l,y,v);x&&S==="touch"&&s>0?m.start(s,()=>{e.setOpen(!0,C)}):e.setOpen(x,C)}function g(x,y,v){let S=u.current.openEvent,C=e.select("domReferenceElement")!==y;return x&&C||!x||!a?!0:S&&(typeof i=="function"?i():i)?!v(S.type):!1}return{onPointerDown(x){d.current=UN(x.pointerType,!0)&&zN(x.nativeEvent)?"virtual":x.pointerType},onMouseDown(x){let y=d.current,v=x.nativeEvent,S=e.select("open");if(x.button!==0||r==="click"||UN(y,!0)&&o)return;let C=g(S,x.currentTarget,k=>k==="click"||k==="mousedown"),R=gr(v),I=Uw(R);if(I||y==="virtual"){p(C,v,I?R:x.currentTarget,y);return}let N=x.currentTarget;f.request(()=>{p(C,v,N,y)})},onClick(x){if(r==="mousedown-only")return;let y=d.current;if(r==="mousedown"&&y){d.current=void 0;return}if(UN(y,!0)&&o)return;let v=e.select("open"),S=g(v,x.currentTarget,C=>C==="click"||C==="mousedown"||C==="keydown"||C==="keyup");p(S,x.nativeEvent,x.currentTarget,y)},onKeyDown(){d.current=void 0}}},[u,r,o,l,e,i,a,f,m,s]);return Zw.useMemo(()=>n?{reference:h}:Er,[n,h])}var $i=b($(),1);function ILe(){return!1}function TLe(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function hB(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:a=!0,outsidePressEvent:o="sloppy",referencePress:i=ILe,bubbles:s,externalTree:l}=t,u=e.useState("open"),d=e.useState("floatingElement"),{dataRef:f,events:m}=e.context,h=a_(l),p=ke(typeof a=="function"?a:()=>!1),g=typeof a=="function"?p:a,x=g!==!1,y=ke(()=>o),{escapeKey:v,outsidePress:S}=TLe(s),C=$i.useRef(!1),R=$i.useRef(!1),I=$i.useRef(!1),N=$i.useRef(!1),k=$i.useRef(!1),z=$i.useRef(""),L=$i.useRef(null),q=eu(),P=eu(),V=eu(),F=ke(()=>{P.clear(),f.current.insideReactTree=!1}),se=ke(W=>{let ie=f.current.floatingContext?.nodeId;return(h?pg(h.nodesRef.current,ie):[]).some(Ue=>Ue.context?.open&&!Ue.context.dataRef.current[W])}),B=ke(W=>jN(W,e.select("floatingElement"))||jN(W,e.select("domReferenceElement"))),oe=ke(W=>{i()&&e.setOpen(!1,qn(yn.triggerPress,W.nativeEvent))}),G=ke(W=>{if(!u||!n||!r||W.key!=="Escape")return;let ie=Xte(W)?W.nativeEvent:W;if(k.current||ie.isComposing||!v&&se("__escapeKeyBubbles"))return;let Ne=qn(yn.escapeKey,ie);e.setOpen(!1,Ne),Ne.isCanceled||W.preventDefault(),!v&&!Ne.isPropagationAllowed&&W.stopPropagation()}),re=ke(()=>{f.current.insideReactTree=!0,P.start(0,F)}),ge=ke(W=>{if(!u||!n||W.button!==0)return;let ie=gr(W.nativeEvent);yt(e.select("floatingElement"),ie)&&(C.current||(C.current=!0,R.current=!1))}),qe=ke(W=>{!u||!n||(W.defaultPrevented||W.nativeEvent.defaultPrevented)&&C.current&&(R.current=!0)});$i.useEffect(()=>{function W(ie){ie.open||(N.current=!1)}return m.on("openchange",W),()=>{m.off("openchange",W)}},[m]),$i.useEffect(()=>F,[F]),$i.useEffect(()=>{if(!u||!n)return u||(N.current=!1,k.current=!1,z.current="",L.current=null),F;f.current.__escapeKeyBubbles=v,f.current.__outsidePressBubbles=S;let W=new Jm,ie=en(d);function Ne(){V.clear(),k.current=!0}function Ue(){k.current=!0,V.start(Gr.engine.webkit?5:0,()=>{k.current=!1})}function Gt(){I.current=!0,W.start(0,()=>{I.current=!1})}function Ae(){C.current=!1,R.current=!1}function Lt(){let he=z.current,we=he==="pen"||!he?"mouse":he,Sn=y(),Vn=typeof Sn=="function"?Sn():Sn;return typeof Vn=="string"?Vn:Vn[we]}function At(he){let we=Lt();return we==="intentional"&&he.type!=="click"||we==="sloppy"&&he.type==="click"}function Hn(he){let we=f.current.floatingContext?.nodeId,Sn=h&&pg(h.nodesRef.current,we).some(Vn=>jN(he,Vn.context?.elements.floating));return B(he)||Sn}function $e(he){if(At(he)){he.type!=="click"&&!B(he)&&(W.clear(),I.current=!1),F();return}if(f.current.insideReactTree){F();return}let we=gr(he),Sn=`[${Ym("inert")}]`,Vn=fa(we)?we.getRootNode():null,X=Array.from((Xc(Vn)?Vn:en(e.select("floatingElement"))).querySelectorAll(Sn)),_e=e.context.triggerElements;if(we&&(_e.hasElement(we)||_e.hasMatchingElement(Ve=>yt(Ve,we))))return;let je=fa(we)?we:null;for(;je&&!pc(je);){let Ve=Ys(je);if(pc(Ve)||!fa(Ve))break;je=Ve}if(!(X.length&&fa(we)&&!tne(we)&&!yt(we,e.select("floatingElement"))&&X.every(Ve=>!yt(je,Ve)))){if(En(we)&&!("touches"in he)){let Ve=pc(we),xt=Pr(we),ot=/auto|scroll/,Mt=Ve||ot.test(xt.overflowX),$n=Ve||ot.test(xt.overflowY),ei=Mt&&we.clientWidth>0&&we.scrollWidth>we.clientWidth,cr=$n&&we.clientHeight>0&&we.scrollHeight>we.clientHeight,Rr=xt.direction==="rtl",Ci=cr&&(Rr?he.offsetX<=we.offsetWidth-we.clientWidth:he.offsetX>we.clientWidth),So=ei&&he.offsetY>we.clientHeight;if(Ci||So)return}if(!Hn(he)){if(Lt()==="intentional"){if(he.detail!==0&&!Qm(he)&&!N.current)return;if(I.current){W.clear(),I.current=!1;return}}typeof g=="function"&&!g(he)||se("__outsidePressBubbles")||(e.setOpen(!1,qn(yn.outsidePress,he)),F())}}}function J(he){Lt()!=="sloppy"||he.pointerType==="touch"||!e.select("open")||!n||B(he)||$e(he)}function ue(he){if(Lt()!=="sloppy"||!e.select("open")||!n||B(he))return;let we=he.touches[0];we&&(L.current={startTime:Date.now(),startX:we.clientX,startY:we.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},q.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}function Ge(he,we){let Sn=gr(he);if(!Sn)return;let Vn=jt(Sn,he.type,()=>{we(he),Vn()})}function Et(he){z.current="touch",Ge(he,ue)}function dt(he){q.clear(),he.type==="pointerdown"&&(he.button===0&&(N.current=!0),z.current=he.pointerType),!(he.type==="mousedown"&&L.current&&!L.current.dismissOnMouseDown)&&Ge(he,we=>{we.type==="pointerdown"?J(we):$e(we)})}function le(he){if(he.type==="pointercancel"&&(N.current=!1),!C.current)return;let we=R.current;if(Ae(),Lt()==="intentional"){if(he.type==="pointercancel"){we&&Gt();return}if(!Hn(he)){if(we){Gt();return}typeof g=="function"&&!g(he)||(W.clear(),I.current=!0,F())}}}function ve(he){if(Lt()!=="sloppy"||!L.current||B(he))return;let we=he.touches[0];if(!we)return;let Sn=Math.abs(we.clientX-L.current.startX),Vn=Math.abs(we.clientY-L.current.startY),X=Math.sqrt(Sn*Sn+Vn*Vn);X>5&&(L.current.dismissOnTouchEnd=!0),X>10&&($e(he),q.clear(),L.current=null)}function me(he){Ge(he,ve)}function ut(he){Lt()!=="sloppy"||!L.current||B(he)||(L.current.dismissOnTouchEnd&&$e(he),q.clear(),L.current=null)}function mn(he){Ge(he,ut)}let ra=lf(r&&lf(jt(ie,"keydown",G),jt(ie,"compositionstart",Ne),jt(ie,"compositionend",Ue)),x&&lf(jt(ie,"click",dt,!0),jt(ie,"pointerdown",dt,!0),jt(ie,"pointerup",le,!0),jt(ie,"pointercancel",le,!0),jt(ie,"mousedown",dt,!0),jt(ie,"mouseup",le,!0),jt(ie,"touchstart",Et,{capture:!0,passive:!0}),jt(ie,"touchmove",me,{capture:!0,passive:!0}),jt(ie,"touchend",mn,{capture:!0,passive:!0})));return()=>{ra(),W.clear(),Ae(),I.current=!1}},[f,d,r,x,g,u,n,v,S,G,F,y,se,B,h,e,q,V]);let bt=$i.useMemo(()=>({onKeyDown:G,onPointerDown:oe,onClick:oe}),[G,oe]),Xe=$i.useMemo(()=>({onKeyDown:G,onPointerDown:qe,onMouseDown:qe,onClickCapture:re,onMouseDownCapture(W){re(),ge(W)},onPointerDownCapture(W){re(),ge(W)},onMouseUpCapture:re,onTouchEndCapture:re,onTouchMoveCapture:re}),[G,re,ge,qe]);return $i.useMemo(()=>n?{reference:bt,floating:Xe,trigger:bt}:{},[n,bt,Xe])}var r_=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(t,n,r=!0){this.fallbackStore=t,this.componentName=n,this.throwOnMissingTrigger=r}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){return this.attachedStores.push(t),this.setActiveStore(t),()=>{let n=this.attachedStores.lastIndexOf(t);n!==-1&&this.attachedStores.splice(n,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(n=>{n()}))}openByTrigger(t){let n=this.attachedStore;if(n===null)return;let r;if(t){for(let a=this.attachedStores.length-1;a>=0&&!r;a-=1)r=this.attachedStores[a].context.triggerElements.getById(t);r??=this.fallbackStore.context.triggerElements.getById(t)}if(t&&!r&&this.throwOnMissingTrigger)throw new Error(mc(99,this.componentName,t,this.componentName));n.setOpen(!0,qn(yn.imperativeAction,void 0,r))}closePopup(){let t=this.attachedStore;t!==null&&t.setOpen(!1,qn(yn.imperativeAction))}};var xB=b($(),1),_Le=b(Is(),1);function Dne(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:a,nested:o,onOpenChange:i}=e,s=t.useState("open"),l=t.useState("activeTriggerElement"),u=t.useState(n?"popupElement":"positionerElement"),d=i;return t.useSyncedValue("floatingId",a),ze(()=>{let f={open:s,floatingId:a,referenceElement:l,floatingElement:u};fa(l)&&(f.domReferenceElement=l),r.state.positionReference===r.state.referenceElement&&(f.positionReference=l),r.update(f)},[s,a,l,u,r]),r.context.onOpenChange=d,r.context.nested=o,r}var bB=b($(),1);var gB=b($(),1);function $ne(e,t=!1,n=!1,r=!1){let[a,o]=gB.useState(e&&t?"idle":void 0),[i,s]=gB.useState(e&&!r);return e&&!i&&(s(!0),o("starting")),!e&&i&&a!=="ending"&&!n&&o("ending"),!e&&!i&&a==="ending"&&o(void 0),ze(()=>{if(!e&&i&&a!=="ending"&&n){let l=hc.request(()=>{o("ending")});return()=>{hc.cancel(l)}}},[e,i,a,n]),ze(()=>{if(!e||t||a===void 0)return;let l=hc.request(()=>{o(void 0)});return()=>{hc.cancel(l)}},[t,e,a]),ze(()=>{if(!e||!t)return;e&&i&&a!=="idle"&&o("starting");let l=hc.request(()=>{o("idle")});return()=>{hc.cancel(l)}},[t,e,i,a]),{mounted:i,setMounted:s,transitionStatus:a}}var One=b($(),1);var yB=b(Is(),1);function vB(e,t){return e.getAnimations(t).filter(n=>{let r=n.effect?.getTiming();return r?.duration!==1/0&&r?.iterations!==1/0})}var o_=null;function NLe(e){if(!o_){let t=[];o_=t,queueMicrotask(()=>{o_=null,yB.flushSync(()=>{for(let n of t)n()})})}o_.push(e)}function Mne(e,t=!1,n=!1){let r=Xu();return ke((a,o=null)=>{r.cancel();let i=au(e);if(i==null)return;let s=i,l=()=>{if(!n){yB.flushSync(a);return}NLe(()=>{o?.aborted||a()})};if(typeof s.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){a();return}function u(){Promise.all(vB(s).map(d=>d.finished.then(Js))).then(()=>{o?.aborted||l()},()=>{if(o?.aborted)return;if(vB(s).some(f=>f.pending||f.playState!=="finished")){u();return}l()})}if(t){let d=rg;if(!s.hasAttribute(d)){r.request(u);return}let f=new MutationObserver(()=>{s.hasAttribute(d)||(f.disconnect(),u())});f.observe(s,{attributes:!0,attributeFilter:[d]}),o?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}r.request(u)})}function i_(e){let{enabled:t=!0,open:n,ref:r,batch:a=!1,onComplete:o}=e,i=ke(o),s=Mne(r,n,a);One.useEffect(()=>{if(!t)return;let l=new AbortController;return s(i,l.signal),()=>{l.abort()}},[t,n,i,s])}function zne(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:a,onUnmount:o,animateInitialOpen:i}=e,s=ke(a),{mounted:l,setMounted:u,transitionStatus:d}=$ne(t,!1,!1,i),f=t?!1:r;ze(()=>{t&&s(!1)},[t,s]);let m=bB.useRef(l),h=bB.useRef(!1),p=PN(),g=()=>{m.current=!1,u(!1),o()};ze(()=>{m.current=l,h.current&&(h.current=!1,!t&&l&&g())});let x=ke(()=>{if(m.current){if(t){h.current=!0,p();return}g()}});return i_({enabled:l&&!t&&!f,open:t,ref:n,onComplete(){t||x()}}),{mounted:l,transitionStatus:d,preventUnmountingOnClose:f,forceUnmount:x}}var jne={tabIndex:-1,[zw]:""};function Bne(e,t=!1){let n=bb(),r=_ne()!=null,a=Wo(()=>e(n,r)).current;return Dne({popupStore:a,treatPopupAsFloatingElement:t,floatingRootContext:a.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:a.setOpen}),a}function Fne({handle:e,store:t}){return ze(()=>e.attachStore(t),[e,t]),null}function Une(e){let t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function SB(e,t){let n=xB.useRef(null);return ke(r=>{let a=n.current;if(a!==null){if(a.element===r&&a.store===t&&a.id===e)return;n.current=null;let o=a.store;o.context.triggerElements.getById(a.id)===a.element&&(o.context.triggerElements.delete(a.id),Une(o))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),Une(t))})}function Hne(e,t,n,r=!1){let a=e.preventUnmountingOnClose;t?a=!1:r&&(a=!0);let o=n?.id??null,i=e.activeTriggerId,s=e.activeTriggerElement;return(o||t)&&(i=o,s=n??null),{open:t,preventUnmountingOnClose:a,activeTriggerId:i,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function Vne(e,t,n,r){let a=n.useState("isMountedByTrigger",e),o=SB(e,n),i=ke(l=>{let u=n.select("open"),d=n.select("activeTriggerId");if(d===e){let f={activeTriggerElement:l,...u?r:null};n.update(f);return}if(d==null&&u&&!n.state.openedWithoutTrigger){let f={activeTriggerId:e??null,activeTriggerElement:l,...r};n.update(f)}}),s=ke(l=>{o(l),l&&i(l)});return ze(()=>(s(t.current),()=>s(null)),[s,t,n,e]),ze(()=>{if(a){let l={activeTriggerElement:t.current,...r};n.update(l)}},[a,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:a}}function qne(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=xB.useRef(null),a=e.useState("open"),o=e.useState("triggerCount"),i=e.useState("activeTriggerId"),s=e.useState("activeTriggerElement");ze(()=>{if(!a){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0),e.state.openedWithoutTrigger&&e.set("openedWithoutTrigger",!1);return}let l=e.context.triggerElements.size,u={};e.state.triggerCount!==l&&(u.triggerCount=l);let d=e.select("activeTriggerId"),f=null;if(d){let m=e.context.triggerElements.getById(d);if(m)r.current=d,m!==e.state.activeTriggerElement&&(u.activeTriggerElement=m);else{for(let[h,p]of e.context.triggerElements.entries())if(p===e.state.activeTriggerElement){u.activeTriggerId=h,u.activeTriggerElement=p,r.current=h;break}u.activeTriggerId===void 0&&(r.current===d?f=d:r.current=null)}}else r.current=null;if(!f&&!d&&!e.state.openedWithoutTrigger&&l===1){let m=e.context.triggerElements.entries().next();if(!m.done){let[h,p]=m.value;u.activeTriggerId=h,u.activeTriggerElement=p,r.current=h}}(u.triggerCount!==void 0||u.activeTriggerId!==void 0||u.activeTriggerElement!==void 0)&&e.update(u),f&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===f&&!e.context.triggerElements.getById(f)){let m=qn(yn.none);e.setOpen(!1,m),m.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[a,e,o,i,s,n])}function Gne(e,t,n,r){let{mounted:a,transitionStatus:o,forceUnmount:i}=zne({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState("preventUnmountingOnClose"),setPreventUnmountOnClose:s=>t.set("preventUnmountingOnClose",s),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return Wo(()=>(t.set("mounted",a),null)),t.useSyncedValues({mounted:a,transitionStatus:o}),{forceUnmount:i,transitionStatus:o}}function Zne(e,t){e.useSyncedValues(t),ze(()=>()=>{e.update({activeTriggerProps:Er,inactiveTriggerProps:Er,popupProps:Er})},[e])}function Wne(e,t){ze(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),ze(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}var Ww=class{idMap=new Map;add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(let n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(let n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};var iae=b($(),1),RB=b(s_(),1),sae=b(tae(),1);var nae=b($(),1);var CB=[],kB;function aae(){return kB}function rae(e){CB.push(e)}function ZLe(e){let t=(n,r)=>{let a=Wo(WLe).current,o;try{kB=a;for(let i of CB)i.before(a);o=e(n,r);for(let i of CB)i.after(a);a.didInitialize=!0}finally{kB=void 0}return o};return t.displayName=e.displayName||e.name,t}function oae(e){return nae.forwardRef(ZLe(e))}function WLe(){return{didInitialize:!1}}var KLe=hb(19),JLe=KLe?YLe:XLe;function c_(e,t,n,r,a){return JLe(e,t,n,r,a)}function QLe(e,t,n,r,a){let o=iae.useCallback(()=>t(e.getSnapshot(),n,r,a),[e,t,n,r,a]);return(0,RB.useSyncExternalStore)(e.subscribe,o,o)}rae({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],a=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,a)||(t=!0,r.value=a)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let a of e.syncHooks)n.add(a.store);let r=[];for(let a of n)r.push(a.subscribe(t));return()=>{for(let a of r)a()}}),(0,RB.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function YLe(e,t,n,r,a){let o=aae();if(!o)return QLe(e,t,n,r,a);let i=o.syncIndex;o.syncIndex+=1;let s;return o.didInitialize?(s=o.syncHooks[i],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,a))&&(s.store!==e&&(o.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=a,s.value=t(e.getSnapshot(),n,r,a))):(s={store:e,selector:t,a1:n,a2:r,a3:a,value:t(e.getSnapshot(),n,r,a)},o.syncHooks.push(s)),s.value}function XLe(e,t,n,r,a){return(0,sae.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,r,a))}var u_=class{static create(t){return new this(t)}constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;let n=this.updateTick;for(let r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(let n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){let t={...this.state};this.setState(t)}use(t,n,r,a){return c_(this,t,n,r,a)}};var vg=b($(),1);var ep=class extends u_{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){vg.useDebugValue(t);let r=this;ze(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){let r=this;ze(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){let n=this,r=Object.values(t);ze(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){vg.useDebugValue(t);let r=this,a=n!==void 0;ze(()=>{a&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,a])}select(t,n,r,a){let o=this.selectors[t];return o(this.state,n,r,a)}useState(t,n,r,a){return vg.useDebugValue(t),c_(this,this.selectors[t],n,r,a)}useContextCallback(t,n){vg.useDebugValue(t);let r=ke(n??Js);this.context[t]=r}useStateSetter(t){let n=vg.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let a=r(this.state);return n(a,a,this),this.subscribe(o=>{let i=r(o);if(!Object.is(a,i)){let s=a;a=i,n(i,s,this)}})}};var eAe={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},d_=class extends ep{constructor(t){let{syncOnly:n,nested:r,onOpenChange:a,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:a,dataRef:{current:{}},events:Nne(),nested:r,triggerElements:o},eAe),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&ene(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);let r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}};function cae(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new d_({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Er,inactiveTriggerProps:Er,popupProps:Er}}var Kw=e=>e.triggerIdProp??e.activeTriggerId,f_=e=>e.openProp??e.open,lae=e=>(e.popupElement?.id??e.floatingId)||void 0;function uae(e,t){return t!==void 0&&f_(e)&&Kw(e)===t}function tAe(e,t){return uae(e,t)?!0:t!==void 0&&f_(e)&&Kw(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var dae={open:f_,mounted:e=>e.mounted,transitionStatus:e=>f_(e)&&!e.mounted?"starting":e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Kw,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:lae,isTriggerActive:(e,t)=>t!==void 0&&Kw(e)===t,isOpenedByTrigger:(e,t)=>uae(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Kw(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>tAe(e,t)?lae(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};var IB=b($(),1),fae=b(s_(),1);function mae(e){let t=IB.useCallback(r=>e===void 0?Js:e.subscribeStore(r),[e]),n=IB.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,fae.useSyncExternalStore)(t,n,()=>e?.serverStore)}function pae(e,t,n){let{reference:r,floating:a}=e,o=nu(t),i=ZN(t),s=GN(i),l=cf(t),u=o==="y",d=r.x+r.width/2-a.width/2,f=r.y+r.height/2-a.height/2,m=r[s]/2-a[s]/2,h;switch(l){case"top":h={x:d,y:r.y-a.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-a.width,y:f};break;default:h={x:r.x,y:r.y}}let p=dg(t);return p&&(h[i]+=m*(p==="end"?1:-1)*(n&&u?-1:1)),h}async function vae(e,t){var n;t===void 0&&(t={});let{x:r,y:a,platform:o,rects:i,elements:s,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:h=0}=nd(t,e),p=eB(h),x=s[m?f==="floating"?"reference":"floating":f],y=fg(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:u,rootBoundary:d,strategy:l})),v=f==="floating"?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),C=await(o.isElement==null?void 0:o.isElement(S))&&await(o.getScale==null?void 0:o.getScale(S))||{x:1,y:1},R=fg(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:S,strategy:l}):v);return{top:(y.top-R.top+p.top)/C.y,bottom:(R.bottom-y.bottom+p.bottom)/C.y,left:(y.left-R.left+p.left)/C.x,right:(R.right-y.right+p.right)/C.x}}var nAe=50,yae=async(e,t,n)=>{let{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:i}=n,s=i.detectOverflow?i:{...i,detectOverflow:vae},l=await(i.isRTL==null?void 0:i.isRTL(t)),u=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:f}=pae(u,r,l),m=r,h=0,p={};for(let g=0;g<o.length;g++){let x=o[g];if(!x)continue;let{name:y,fn:v}=x,{x:S,y:C,data:R,reset:I}=await v({x:d,y:f,initialPlacement:r,placement:m,strategy:a,middlewareData:p,rects:u,platform:s,elements:{reference:e,floating:t}});d=S??d,f=C??f,p[y]={...p[y],...R},I&&h<nAe&&(h++,typeof I=="object"&&(I.placement&&(m=I.placement),I.rects&&(u=I.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):I.rects),{x:d,y:f}=pae(u,m,l)),g=-1)}return{x:d,y:f,placement:m,strategy:a,middlewareData:p}},bae=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:a,rects:o,platform:i,elements:s,middlewareData:l}=t,{element:u,padding:d=0}=nd(e,t)||{};if(u==null)return{};let f=eB(d),m={x:n,y:r},h=ZN(a),p=GN(h),g=await i.getDimensions(u),x=h==="y",y=x?"top":"left",v=x?"bottom":"right",S=x?"clientHeight":"clientWidth",C=o.reference[p]+o.reference[h]-m[h]-o.floating[p],R=m[h]-o.reference[h],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u)),N=I?I[S]:0;(!N||!await(i.isElement==null?void 0:i.isElement(I)))&&(N=s.floating[S]||o.floating[p]);let k=C/2-R/2,z=N/2-g[p]/2-1,L=ed(f[y],z),q=ed(f[v],z),P=N-g[p]-q,V=N/2-g[p]/2+k,F=Xj(L,V,P),se=!l.arrow&&dg(a)!=null&&V!==F&&o.reference[p]/2-(V<L?L:q)-g[p]/2<0,B=se?V<L?V-L:V-P:0;return{[h]:m[h]+B,data:{[h]:F,centerOffset:V-F-B,...se&&{alignmentOffset:B}},reset:se}}});var xae=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;let{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...x}=nd(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let y=cf(a),v=nu(s),S=cf(s)===s,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),R=m||(S||!g?[jw(s)]:une(s)),I=p!=="none";!m&&I&&R.push(...dne(s,g,p,C));let N=[s,...R],k=await l.detectOverflow(t,x),z=[],L=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&z.push(k[y]),f){let F=cne(a,i,C);z.push(k[F[0]],k[F[1]])}if(L=[...L,{placement:a,overflows:z}],!z.every(F=>F<=0)){var q,P;let F=(((q=o.flip)==null?void 0:q.index)||0)+1,se=N[F];if(se&&(!(f==="alignment"?v!==nu(se):!1)||L.every(G=>nu(G.placement)===v?G.overflows[0]>0:!0)))return{data:{index:F,overflows:L},reset:{placement:se}};let B=(P=L.filter(oe=>oe.overflows[0]<=0).sort((oe,G)=>oe.overflows[1]-G.overflows[1])[0])==null?void 0:P.placement;if(!B)switch(h){case"bestFit":{var V;let oe=(V=L.filter(G=>{if(I){let re=nu(G.placement);return re===v||re==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(re=>re>0).reduce((re,ge)=>re+ge,0)]).sort((G,re)=>G[1]-re[1])[0])==null?void 0:V[0];oe&&(B=oe);break}case"initialPlacement":B=s;break}if(a!==B)return{reset:{placement:B}}}return{}}}};function hae(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gae(e){return lne.some(t=>e[t]>=0)}var Sae=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:a="referenceHidden",...o}=nd(e,t);switch(a){case"referenceHidden":{let i=await r.detectOverflow(t,{...o,elementContext:"reference"}),s=hae(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:gae(s)}}}case"escaped":{let i=await r.detectOverflow(t,{...o,altBoundary:!0}),s=hae(i,n.floating);return{data:{escapedOffsets:s,escaped:gae(s)}}}default:return{}}}}};var wae=new Set(["left","top"]);async function aAe(e,t){let{placement:n,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),i=cf(n),s=dg(n),l=nu(n)==="y",u=wae.has(i)?-1:1,d=o&&l?-1:1,f=nd(t,e),{mainAxis:m,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof p=="number"&&(h=s==="end"?p*-1:p),l?{x:h*d,y:m*u}:{x:m*u,y:h*d}}var Cae=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:a,y:o,placement:i,middlewareData:s}=t,l=await aAe(t,e);return i===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:a+l.x,y:o+l.y,data:{...l,placement:i}}}}},kae=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:S,y:C}=v;return{x:S,y:C}}},...u}=nd(e,t),d={x:n,y:r},f=await o.detectOverflow(t,u),m=nu(a),h=qN(m),p=d[h],g=d[m],x=(v,S)=>Xj(S+f[v==="y"?"top":"left"],S,S-f[v==="y"?"bottom":"right"]);i&&(p=x(h,p)),s&&(g=x(m,g));let y=l.fn({...t,[h]:p,[m]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:i,[m]:s}}}}}},Rae=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;let{x:a,y:o,placement:i,rects:s,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=nd(e,t),m={x:a,y:o},h=nu(i),p=qN(h),g=m[p],x=m[h],y=nd(u,t),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(r=y.crossAxis)!=null?r:0};if(d){let R=p==="y"?"height":"width",I=s.reference[p]-s.floating[R]+v.mainAxis,N=s.reference[p]+s.reference[R]-v.mainAxis;g<I?g=I:g>N&&(g=N)}if(f){var S,C;let R=p==="y"?"width":"height",I=wae.has(cf(i)),N=s.reference[h]-s.floating[R]+(I&&((S=l.offset)==null?void 0:S[h])||0)+(I?0:v.crossAxis),k=s.reference[h]+s.reference[R]+(I?0:((C=l.offset)==null?void 0:C[h])||0)-(I?v.crossAxis:0);x<N?x=N:x>k&&(x=k)}return{[p]:g,[h]:x}}}},Iae=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:n,rects:r,platform:a,elements:o}=t,{apply:i=()=>{},...s}=nd(e,t),l=await a.detectOverflow(t,s),u=cf(n),d=dg(n),f=nu(n)==="y",{width:m,height:h}=r.floating,p,g;u==="top"||u==="bottom"?(p=u,g=d===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(g=u,p=d==="end"?"top":"bottom");let x=h-l.top-l.bottom,y=m-l.left-l.right,v=ed(h-l[p],x),S=ed(m-l[g],y),C=t.middlewareData.shift,R=!C,I=v,N=S;C!=null&&C.enabled.x&&(N=y),C!=null&&C.enabled.y&&(I=x),R&&!d&&(f?N=m-2*tu(l.left,l.right):I=h-2*tu(l.top,l.bottom)),await i({...t,availableWidth:N,availableHeight:I});let k=await a.getDimensions(o.floating);return m!==k.width||h!==k.height?{reset:{rects:!0}}:{}}}};function _ae(e){let t=Pr(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,a=En(e),o=a?e.offsetWidth:n,i=a?e.offsetHeight:r,s=Bw(n)!==o||Bw(r)!==i;return s&&(n=o,r=i),{width:n,height:r,$:s}}function NB(e){return fa(e)?e:e.contextElement}function Cb(e){let t=NB(e);if(!En(t))return td(1);let n=t.getBoundingClientRect(),{width:r,height:a,$:o}=_ae(t),i=(o?Bw(n.width):n.width)/r,s=(o?Bw(n.height):n.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}var rAe=td(0);function Lae(e){let t=Tn(e);return!TN()||!t.visualViewport?rAe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oAe(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Tn(e)}function yg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let a=e.getBoundingClientRect(),o=NB(e),i=td(1);t&&(r?fa(r)&&(i=Cb(r)):i=Cb(e));let s=oAe(o,n,r)?Lae(o):td(0),l=(a.left+s.x)/i.x,u=(a.top+s.y)/i.y,d=a.width/i.x,f=a.height/i.y;if(o&&r){let m=Tn(o),h=fa(r)?Tn(r):r,p=m,g=NN(p);for(;g&&h!==p;){let x=Cb(g),y=g.getBoundingClientRect(),v=Pr(g),S=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*x.x,C=y.top+(g.clientTop+parseFloat(v.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,f*=x.y,l+=S,u+=C,p=Tn(g),g=NN(p)}}return fg({width:d,height:f,x:l,y:u})}function m_(e,t){let n=Dw(e).scrollLeft;return t?t.left+n:yg(Qu(e)).left+n}function Aae(e,t){let n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-m_(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function iAe(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e,o=a==="fixed",i=Qu(r),s=t?Pw(t.floating):!1;if(r===i||s&&o)return n;let l={scrollLeft:0,scrollTop:0},u=td(1),d=td(0),f=En(r);if((f||!o)&&((qr(r)!=="body"||lg(i))&&(l=Dw(r)),f)){let h=yg(r);u=Cb(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}let m=i&&!f&&!o?Aae(i,l):td(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-l.scrollTop*u.y+d.y+m.y}}function sAe(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function lAe(e){let t=Dw(e),n=e.ownerDocument.body,r=tu(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),a=tu(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+m_(e),i=-t.scrollTop;return Pr(n).direction==="rtl"&&(o+=tu(e.clientWidth,n.clientWidth)-r),{width:r,height:a,x:o,y:i}}var cAe=25;function uAe(e,t,n){n===void 0&&(n="viewport");let r=n==="layoutViewport",a=Tn(e),o=Qu(e),i=a.visualViewport,s=o.clientWidth,l=o.clientHeight,u=0,d=0;if(i){let m=!TN()||t==="fixed";r?m||(u=-i.offsetLeft,d=-i.offsetTop):(s=i.width,l=i.height,m&&(u=i.offsetLeft,d=i.offsetTop))}if(m_(o)<=0){let m=o.ownerDocument,h=m.body,p=getComputedStyle(h),g=m.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,x=Math.abs(o.clientWidth-h.clientWidth-g),y=getComputedStyle(o).scrollbarGutter==="stable both-edges"?x/2:x;y<=cAe&&(s-=y)}return{width:s,height:l,x:u,y:d}}function dAe(e,t){let n=yg(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=Cb(e),i=e.clientWidth*o.x,s=e.clientHeight*o.y,l=a*o.x,u=r*o.y;return{width:i,height:s,x:l,y:u}}function Tae(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=uAe(e,n,t);else if(t==="document")r=lAe(Qu(e));else if(fa(t))r=dAe(t,n);else{let a=Lae(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return fg(r)}function fAe(e,t){let n=t.get(e);if(n)return n;let r=sg(e,[],!1).filter(s=>fa(s)&&qr(s)!=="body"),a=null,o=Pr(e).position==="fixed",i=o?Ys(e):e;for(;fa(i)&&!pc(i);){let s=Pr(i),l=IN(i),u=a?a.position:o?"fixed":"";!l&&(u==="fixed"||u==="absolute"&&s.position==="static")?r=r.filter(f=>f!==i):a=s,i=Ys(i)}return t.set(e,r),r}function mAe(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e,i=[...n==="clippingAncestors"?Pw(t)?[]:fAe(t,this._c):[].concat(n),r],s=Tae(t,i[0],a),l=s.top,u=s.right,d=s.bottom,f=s.left;for(let m=1;m<i.length;m++){let h=Tae(t,i[m],a);l=tu(h.top,l),u=ed(h.right,u),d=ed(h.bottom,d),f=tu(h.left,f)}return{width:u-f,height:d-l,x:f,y:l}}function pAe(e){let{width:t,height:n}=_ae(e);return{width:t,height:n}}function hAe(e,t,n){let r=En(t),a=Qu(t),o=n==="fixed",i=yg(e,!0,o,t),s={scrollLeft:0,scrollTop:0},l=td(0);if((r||!o)&&((qr(t)!=="body"||lg(a))&&(s=Dw(t)),r)){let m=yg(t,!0,o,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}!r&&a&&(l.x=m_(a));let u=a&&!r&&!o?Aae(a,s):td(0),d=i.left+s.scrollLeft-l.x-u.x,f=i.top+s.scrollTop-l.y-u.y;return{x:d,y:f,width:i.width,height:i.height}}function TB(e){return Pr(e).position==="static"}function Nae(e,t){if(!En(e)||Pr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qu(e)===n&&(n=n.ownerDocument.body),n}function Eae(e,t){let n=Tn(e);if(Pw(e))return n;if(!En(e)){let a=Ys(e);for(;a&&!pc(a);){if(fa(a)&&!TB(a))return a;a=Ys(a)}return n}let r=Nae(e,t);for(;r&&Tte(r)&&TB(r);)r=Nae(r,t);return r&&pc(r)&&TB(r)&&!IN(r)?n:r||Nte(e)||n}var gAe=async function(e){let t=this.getOffsetParent||Eae,n=this.getDimensions,r=await n(e.floating);return{reference:hAe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vAe(e){return Pr(e).direction==="rtl"}var Pae={convertOffsetParentRelativeRectToViewportRelativeRect:iAe,getDocumentElement:Qu,getClippingRect:mAe,getOffsetParent:Eae,getElementRects:gAe,getClientRects:sAe,getDimensions:pAe,getScale:Cb,isElement:fa,isRTL:vAe};function Dae(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yAe(e,t,n){let r=null,a,o=Qu(e);function i(){var d;clearTimeout(a),(d=r)==null||d.disconnect(),r=null}function s(d,f){d===void 0&&(d=!1),f===void 0&&(f=1),i();let m=e.getBoundingClientRect(),{left:h,top:p,width:g,height:x}=m;if(d||t(),!g||!x)return;let y=Fw(p),v=Fw(o.clientWidth-(h+g)),S=Fw(o.clientHeight-(p+x)),C=Fw(h),I={rootMargin:-y+"px "+-v+"px "+-S+"px "+-C+"px",threshold:tu(0,ed(1,f))||1},N=!0;function k(z){let L=z[0].intersectionRatio;if(!Dae(m,e.getBoundingClientRect()))return s();if(L!==f){if(!N)return s();L?s(!1,L):a=setTimeout(()=>{s(!1,1e-7)},1e3)}N=!1}try{r=new IntersectionObserver(k,{...I,root:o.ownerDocument})}catch{r=new IntersectionObserver(k,I)}r.observe(e)}let l=Tn(e),u=()=>s(n);return l.addEventListener("resize",u),s(!0),()=>{l.removeEventListener("resize",u),i()}}function _B(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=NB(e),d=a||o?[...u?sg(u):[],...t?sg(t):[]]:[];d.forEach(y=>{a&&y.addEventListener("scroll",n),o&&y.addEventListener("resize",n)});let f=u&&s?yAe(u,n,o):null,m=-1,h=null;i&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var S;(S=h)==null||S.observe(t)})),n()}),u&&!l&&h.observe(u),t&&h.observe(t));let p,g=l?yg(e):null;l&&x();function x(){let y=yg(e);g&&!Dae(g,y)&&n(),g=y,p=requestAnimationFrame(x)}return n(),()=>{var y;d.forEach(v=>{a&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),f?.(),(y=h)==null||y.disconnect(),h=null,l&&cancelAnimationFrame(p)}}var $ae=Cae;var Mae=kae,Oae=xae,zae=Iae,Uae=Sae,LB=bae;var jae=Rae,AB=(e,t,n)=>{let r=new Map,a=n??{},o={...Pae,...a.platform,_c:r};return yae(e,t,{...a,platform:o})};var po=b($(),1),Fae=b($(),1),Hae=b(Is(),1),bAe=typeof document<"u",xAe=function(){},p_=bAe?Fae.useLayoutEffect:xAe;function h_(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!h_(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){let o=a[r];if(!(o==="_owner"&&e.$$typeof)&&!h_(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Vae(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bae(e,t){let n=Vae(e);return Math.round(t*n)/n}function EB(e){let t=po.useRef(e);return p_(()=>{t.current=e}),t}function qae(e){e===void 0&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:i}={},transform:s=!0,whileElementsMounted:l,open:u}=e,[d,f]=po.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=po.useState(r);h_(m,r)||h(r);let[p,g]=po.useState(null),[x,y]=po.useState(null),v=po.useCallback(G=>{G!==I.current&&(I.current=G,g(G))},[]),S=po.useCallback(G=>{G!==N.current&&(N.current=G,y(G))},[]),C=o||p,R=i||x,I=po.useRef(null),N=po.useRef(null),k=po.useRef(d),z=l!=null,L=EB(l),q=EB(a),P=EB(u),V=po.useCallback(()=>{if(!I.current||!N.current)return;let G={placement:t,strategy:n,middleware:m};q.current&&(G.platform=q.current),AB(I.current,N.current,G).then(re=>{let ge={...re,isPositioned:P.current!==!1};F.current&&!h_(k.current,ge)&&(k.current=ge,Hae.flushSync(()=>{f(ge)}))})},[m,t,n,q,P]);p_(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(G=>({...G,isPositioned:!1})))},[u]);let F=po.useRef(!1);p_(()=>(F.current=!0,()=>{F.current=!1}),[]),p_(()=>{if(C&&(I.current=C),R&&(N.current=R),C&&R){if(L.current)return L.current(C,R,V);V()}},[C,R,V,L,z]);let se=po.useMemo(()=>({reference:I,floating:N,setReference:v,setFloating:S}),[v,S]),B=po.useMemo(()=>({reference:C,floating:R}),[C,R]),oe=po.useMemo(()=>{let G={position:n,left:0,top:0};if(!B.floating)return G;let re=Bae(B.floating,d.x),ge=Bae(B.floating,d.y);return s?{...G,transform:"translate("+re+"px, "+ge+"px)",...Vae(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:re,top:ge}},[n,s,B.floating,d.x,d.y]);return po.useMemo(()=>({...d,update:V,refs:se,elements:B,floatingStyles:oe}),[d,V,se,B,oe])}var SAe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){let{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?LB({element:r.current,padding:a}).fn(n):{}:r?LB({element:r,padding:a}).fn(n):{}}}},Gae=(e,t)=>{let n=$ae(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zae=(e,t)=>{let n=Mae(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wae=(e,t)=>({fn:jae(e).fn,options:[e,t]}),Kae=(e,t)=>{let n=Oae(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jae=(e,t)=>{let n=zae(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Qae=(e,t)=>{let n=Uae(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Yae=(e,t)=>{let n=SAe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var rlt=fo.open,olt=fo.closed,ilt=fo.startingStyle,slt=fo.endingStyle,Xae="data-expanded",ere="data-nested-drawer-open",tre="data-nested-drawer-swiping",PB="data-swipe-dismiss",nre="data-swipe-direction",uf="data-swiping";var v_=b($(),1),DB=v_.createContext(void 0);function y_(){let e=v_.useContext(DB);if(e===void 0)throw new Error(mc(26));return e}var wAe="ArrowUp",CAe="ArrowDown",kAe="ArrowLeft",RAe="ArrowRight",IAe="Home",TAe="End";var are=new Set([wAe,CAe,kAe,RAe,IAe,TAe]);var b_=b($(),1),$B=b_.createContext(void 0);function ad(e){let t=b_.useContext($B);if(e!==!0&&t===void 0)throw new Error(mc(90));return t}var kb=b($(),1);function Ko(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function x_(e,t){let n=e+t;return n>=0?t:-Math.sqrt(-n)-e}function rre(e,t,n){if(!Number.isFinite(t)||t<=0)return null;if(typeof e=="number")return Number.isFinite(e)?e<=1?Ko(e,0,1)*t:e:null;let r=e.trim();if(r.endsWith("px")){let a=Number.parseFloat(r);return Number.isFinite(a)?a:null}if(r.endsWith("rem")){let a=Number.parseFloat(r);return Number.isFinite(a)?a*n:null}return null}function Jw(e,t){let n=-1,r=1/0;for(let a=0;a<e.length;a+=1){let o=Math.abs(e[a]-t);o<r&&(r=o,n=a)}return n}function S_(){let e=na(),{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:a}=ad(),o=e.useState("viewportElement"),[i,s]=kb.useState(0),[l,u]=kb.useState(16),d=ke(()=>{let p=en(o).documentElement;s(o?o.offsetHeight:p.clientHeight);let g=parseFloat(getComputedStyle(p).fontSize);Number.isFinite(g)&&u(g)});ze(()=>{if(d(),!o||typeof ResizeObserver!="function")return;let h=new ResizeObserver(d);return h.observe(o),()=>{h.disconnect()}},[d,o]);let f=kb.useMemo(()=>{if(!t||t.length===0||i<=0||a<=0)return[];let h=Math.min(a,i),p=t.map(y=>{let v=rre(y,i,l);if(v===null)return null;let S=Ko(v,0,h);return{value:y,height:S,offset:Math.max(0,a-S)}}).filter(y=>!!y);if(p.length<=1)return p;let g=[],x=[];for(let y=p.length-1;y>=0;y-=1){let v=p[y];x.some(C=>Math.abs(C-v.height)<=1)||(x.push(v.height),g.push(v))}return g.reverse(),g},[a,l,t,i]),m=kb.useMemo(()=>{if(n===null)return;let h=f.find(y=>Object.is(y.value,n));if(h)return h;let p=Math.min(a,i),g=rre(n,i,l);if(g===null)return;let x=Ko(g,0,p);return f[Jw(f.map(y=>y.height),x)]},[n,a,f,l,i]);return{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:a,viewportHeight:i,resolvedSnapPoints:f,activeSnapPointOffset:m?.offset??null}}var w_=b($(),1),MB=w_.createContext(null);function ore(){return w_.useContext(MB)}var sre=b(w(),1),ire=!1;function NAe(){ire||(typeof CSS<"u"&&"registerProperty"in CSS&&([Wm,Yc,Mj].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),[{name:No,initialValue:"0"},{name:Ew,initialValue:"1"}].forEach(({name:e,initialValue:t})=>{try{CSS.registerProperty({name:e,syntax:"<number>",inherits:!1,initialValue:t})}catch{}})),ire=!0)}var _Ae={...CN,expanded(e){return e?{[Xae]:""}:null},nestedDrawerOpen(e){return e?{[ere]:""}:null},nestedDrawerSwiping(e){return e?{[tre]:""}:null},swipeDirection(e){return{[nre]:e}},swiping(e){return e?{[uf]:""}:null}},lre=bg.forwardRef(function(t,n){let{render:r,className:a,style:o,finalFocus:i,initialFocus:s,...l}=t,u=na(),d=u.context.popupRef,{swipeDirection:f,frontmostHeight:m,hasNestedDrawer:h,nestedSwiping:p,nestedSwipeProgressStore:g,onPopupHeightChange:x,notifyParentFrontmostHeight:y,notifyParentHasNestedDrawer:v}=ad(),S=u.useState("descriptionElementId"),C=u.useState("disablePointerDismissal"),R=u.useState("floatingRootContext"),I=u.useState("popupProps"),N=u.useState("modal"),k=u.useState("mounted"),z=u.useState("nested"),L=u.useState("nestedOpenDrawerCount"),q=u.useState("transitionStatus"),P=u.useState("open"),V=u.useState("openMethod"),F=u.useState("titleElementId"),se=u.useState("role"),B=R.useState("floatingId"),oe=l.id??B,G=ore();y_();let{snapPoints:re,activeSnapPoint:ge,activeSnapPointOffset:qe}=S_(),bt=L>0,Xe=G?.swiping??!1,W=G?.swipeStrength??null,[ie,Ne]=bg.useState(0),Ue=bg.useRef(0),Gt=ke(()=>{let dt=d.current;if(!dt)return;let le=dt.offsetHeight;if(Ue.current>0&&m>Ue.current&&le>Ue.current)return;if(Ue.current>0&&h){let ut=Ue.current;Ne(ut),x(ut);return}let me=le;me!==Ue.current&&(Ue.current=me,Ne(me),x(me))});ze(()=>{if(!k){Ue.current=0,Ne(0),x(0);return}let dt=d.current;if(!dt||(NAe(),Gt(),typeof ResizeObserver!="function"))return;let le=new ResizeObserver(Gt);return le.observe(dt),()=>{le.disconnect()}},[Gt,k,bt,x,d]),ze(()=>{let dt=()=>{let me=d.current;if(!me)return;let ut=g.getSnapshot();ut>0?me.style.setProperty(No,`${ut}`):me.style.setProperty(No,"0")};dt();let le=g.subscribe(dt),ve=d.current;return()=>{le(),ve&&ve.style.setProperty(No,"0")}},[g,d]),ze(()=>{if(P)return y?.(m),()=>{y?.(0)}},[m,P,y]),ze(()=>v?(v(P||q==="ending"),()=>{v(!1)}):void 0,[v,P,q]),i_({open:P,ref:d,onComplete(){P&&u.context.onOpenChangeComplete?.(!0)}});let Ae=s===void 0?d:s,Lt=u.useStateSetter("popupElement"),At={open:P,nested:z,transitionStatus:q,expanded:ge===1,nestedDrawerOpen:bt,nestedDrawerSwiping:p,swipeDirection:f,swiping:Xe},Hn;ie&&!(!h&&q!=="ending")&&(Hn=`${ie}px`);let J=re&&re.length>0&&(f==="down"||f==="up"),ue=null;J&&qe!==null&&(ue=f==="up"?-qe:qe);let Ge=G?G.getDragStyles():Er;if(J&&f==="down"){let dt=qe??0,le=Number.parseFloat(String(Ge[Yc]));Xe&&Number.isFinite(le)?Ge={...Ge,transform:void 0,[Yc]:`${x_(dt,le)}px`}:Ge={...Ge,transform:void 0}}let Et=rr("div",t,{state:At,props:[I,{id:oe,"aria-labelledby":F,"aria-describedby":S,role:se,...jne,hidden:!k,onKeyDown(dt){are.has(dt.key)&&dt.stopPropagation()},style:{...Ge,[No]:"0",[Cte]:L,[Qs]:Hn,[Mj]:typeof ue=="number"?`${ue}px`:"0px",[kte]:m?`${m}px`:void 0,[Ew]:typeof W=="number"&&Number.isFinite(W)&&W>0?`${W}`:"1"}},l],ref:[n,d,Lt],stateAttributesMapping:_Ae});return(0,sre.jsx)(mB,{context:R,openInteractionType:V,disabled:!k,closeOnFocusOut:!C,initialFocus:Ae,returnFocus:i,modal:N!==!1,restoreFocus:"popup",children:Et})});var mre=b($(),1);function cre(e){return hb(19)?e:e?"true":void 0}var ure=b($(),1),dre=b(w(),1),fre=ure.forwardRef(function(t,n){let{cutout:r,...a}=t,o;if(r){let i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return(0,dre.jsx)("div",{ref:n,role:"presentation","data-base-ui-inert":"",...a,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})});var Qw=b(w(),1),pre=mre.forwardRef(function(t,n){let{keepMounted:r=!1,...a}=t,o=na(),i=o.useState("mounted"),s=o.useState("modal"),l=o.useState("open");return i||r?(0,Qw.jsx)(DB.Provider,{value:r,children:(0,Qw.jsxs)(dB,{ref:n,...a,children:[i&&s===!0&&(0,Qw.jsx)(fre,{ref:o.context.internalBackdropRef,inert:cre(!l)}),t.children]})}):null});var hre=pre;var Yw=b($(),1);var gre=b(w(),1);function vre(e){let{children:t}=e,n=Wo(()=>new Set),[r,a]=Yw.useState(!1),[o]=Yw.useState(LAe),i=ke((u,d)=>{let f=n.current;if(f.has(u)===d)return;let m=f.size>0;d?f.add(u):f.delete(u);let h=f.size>0;h!==m&&a(h)}),s=ke(u=>{i(u,!1)}),l=Yw.useMemo(()=>({setDrawerOpen:i,removeDrawer:s,active:r,visualStateStore:o}),[r,s,i,o]);return(0,gre.jsx)(jj.Provider,{value:l,children:t})}function LAe(){let e={swipeProgress:0,frontmostHeight:0},t=new Set;return{getSnapshot:()=>e,set(n){let r=e.swipeProgress;n.swipeProgress!==void 0&&(r=Number.isFinite(n.swipeProgress)?n.swipeProgress:0);let a=e.frontmostHeight;n.frontmostHeight!==void 0&&(a=Number.isFinite(n.frontmostHeight)?n.frontmostHeight:0),!(r===e.swipeProgress&&a===e.frontmostHeight)&&(e={swipeProgress:r,frontmostHeight:a},t.forEach(o=>{o()}))},subscribe(n){return t.add(n),()=>{t.delete(n)}}}}var ci=b($(),1);var xg=b($(),1);function yre({controlled:e,default:t,name:n,state:r="value"}){let{current:a}=xg.useRef(e!==void 0),[o,i]=xg.useState(()=>t),s=a&&e!==void 0?e:o,l=xg.useCallback(u=>{a||i(u)},[]);return[s,l]}var _re=b($(),1);var zB=b($(),1);var bre={},xre={},Sre="";function C_(e,t){return lg(e)?e:t}function wre(e,t,n){return/hidden|clip/.test(e.getComputedStyle(C_(t,n)).overflowY)}function AAe(e){if(typeof document>"u")return!1;let t=en(e);return Tn(t).innerWidth-t.documentElement.clientWidth>0}function EAe(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;let n=en(e),r=n.documentElement,a=n.body,o=C_(r,a),i=o.style.overflowY,s=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";let l=o.offsetWidth;o.style.overflowY="hidden";let u=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=s,l===u}function PAe(e){let t=en(e),n=t.documentElement,r=t.body,a=C_(n,r),o={overflowY:a.style.overflowY,overflowX:a.style.overflowX};return Object.assign(a.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(a.style,o)}}function DAe(e){let t=en(e),n=t.documentElement,r=t.body,a=Tn(n),o=0,i=0,s=!1,l=hc.create();if(Gr.engine.webkit&&(a.visualViewport?.scale??1)!==1)return()=>{};function u(){let h=a.getComputedStyle(n),p=a.getComputedStyle(r),y=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,bre={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Sre=n.style.scrollBehavior,xre={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let v=n.scrollHeight>n.clientHeight,S=n.scrollWidth>n.clientWidth,C=h.overflowY==="scroll"||p.overflowY==="scroll",R=h.overflowX==="scroll"||p.overflowX==="scroll",I=Math.max(0,a.innerWidth-r.clientWidth),N=Math.max(0,a.innerHeight-r.clientHeight),k=parseFloat(p.marginTop)+parseFloat(p.marginBottom),z=parseFloat(p.marginLeft)+parseFloat(p.marginRight),L=C_(n,r);if(s=EAe(e),s){n.style.scrollbarGutter=y,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(v||C)&&(n.style.overflowY="scroll"),(S||R)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:k||N?`calc(100dvh - ${k+N}px)`:"100dvh",width:z||I?`calc(100vw - ${z+I}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,bre),Object.assign(r.style,xre),s||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Sre)}function f(){d(),l.request(u)}u();let m=jt(a,"resize",f);return()=>{l.cancel(),d(),typeof a.removeEventListener=="function"&&m()}}var OB=class{lockCount=0;restore=null;timeoutLock=Jm.create();timeoutUnlock=Jm.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;let n=en(t),r=n.documentElement,a=n.body,o=Tn(r);if(wre(o,r,a)){let s=new o.MutationObserver(()=>{wre(o,r,a)||(s.disconnect(),this.restore=null,this.lock(t))}),l={attributes:!0};s.observe(r,l),s.observe(a,l),this.restore=()=>s.disconnect();return}let i=Gr.os.ios||!AAe(t);this.restore=i?PAe(t):DAe(t)}},$Ae=new OB;function Cre(e=!0,t=null){ze(()=>{if(e)return $Ae.acquire(t)},[e,t])}function kre({store:e,parentContext:t,isDrawer:n}){let r=e.useState("open"),a=e.useState("mounted"),o=e.useState("disablePointerDismissal"),i=e.useState("modal"),s=e.useState("popupElement"),l=e.useState("floatingRootContext"),[u,d]=zB.useState(0),[f,m]=zB.useState(0),h=u===0,p=hB(l,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0)return!1;if("touches"in g){if(g.type==="touchend"){if(g.changedTouches.length!==1||g.touches.length!==0)return!1}else if(g.touches.length!==1)return!1}let x=gr(g);if(h&&!o){if(i){let y=e.context.internalBackdropRef.current,v=e.context.backdropRef.current;return y||v?y===x||v===x||yt(x,s)&&!x?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:h});return Cre(r&&i===!0,s),e.useContextCallback("onNestedDialogOpen",(g,x)=>{!e.select("open")&&!e.select("mounted")||(d(g),m(x))}),ze(()=>{!r&&!a&&(d(0),m(0))},[r,a]),ze(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(u+1,f+(n?1:0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,u,f,t]),Zne(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:u,nestedOpenDrawerCount:f}),null}var R_=b($(),1);var k_=class extends ep{setState(t){}update(t){}set(t,n){}notifyAll(){}};var Rre={...dae,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},I_=class extends ep{constructor(t,n,r){let a=new Ww,o=Tre(t,a,n,r);super(o,Nre(a),Rre)}setOpen=(t,n)=>{n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),!n.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(t,n),this.update(Hne(this.state,t,n.trigger)))}};function Ire(){let e=new Ww;return new k_(Object.freeze(Tre(void 0,e)),Object.freeze(Nre(e)),Rre)}function Tre(e,t,n,r=!1){return{...cae(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function Nre(e){return{popupRef:R_.createRef(),backdropRef:R_.createRef(),internalBackdropRef:R_.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}var Xw=b(w(),1);function Lre(e,t){let{children:n,open:r,defaultOpen:a=!1,onOpenChange:o,onOpenChangeComplete:i,disablePointerDismissal:s=!1,modal:l=!0,actionsRef:u,handle:d,triggerId:f,defaultTriggerId:m=null}=t,h=e==="drawer",p=e==="alert-dialog",g=p?!0:l,x=p||s,y=p?"alertdialog":"dialog",v=na(!0),S=v!=null,C={modal:g,disablePointerDismissal:x,nested:S,role:y},R=Bne((q,P)=>new I_({open:a,openProp:r,activeTriggerId:m,triggerIdProp:f,...C},q,P),!0);R.useControlledProp("openProp",r),R.useControlledProp("triggerIdProp",f),R.useSyncedValues(C),R.useContextCallback("onOpenChange",o),R.useContextCallback("onOpenChangeComplete",i);let I=R.useState("open"),N=R.useState("mounted"),k=R.useState("payload");Wne(R,I),qne(R);let{forceUnmount:z}=Gne(I,R);_re.useImperativeHandle(u,()=>({unmount:z,close:()=>R.setOpen(!1,qn(yn.imperativeAction))}),[z,R]);let L=I||N||d!=null;return(0,Xw.jsxs)(Tj.Provider,{value:R,children:[d&&(0,Xw.jsx)(Fne,{handle:d,store:R}),L&&(0,Xw.jsx)(kre,{store:R,parentContext:v?.context,isDrawer:h}),typeof n=="function"?n({payload:k}):n]})}var Sg=b(w(),1),Are,Ere;function Dre(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:i=!1,modal:s=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null,swipeDirection:m="down",snapToSequentialPoints:h=!1,snapPoints:p,snapPoint:g,defaultSnapPoint:x,onSnapPointChange:y}=e,v=ad(!0),S=v?.onNestedSwipeProgressChange,C=v?.onNestedFrontmostHeightChange,R=v?.onNestedSwipingChange,I=v?.onNestedDrawerPresenceChange,[N,k]=ci.useState(0),[z,L]=ci.useState(0),[q,P]=ci.useState(!1),[V,F]=ci.useState(!1),[se]=ci.useState(MAe),B=x!==void 0?x:p?.[0]??null,oe=g!==void 0,[G,re]=yre({controlled:g,default:B,name:"Drawer",state:"snapPoint"}),ge=ci.useRef(!1),qe=ci.useRef(!1),bt=ke(($e,J)=>{let ue=J??qn(yn.none);y?.($e,ue),!ue.isCanceled&&re($e)}),Xe=ci.useMemo(()=>oe||!p||p.length===0?G:G===null||!p.some($e=>Object.is($e,G))?B:G,[G,oe,B,p]),W=ke($e=>{k($e),!ge.current&&$e>0&&L($e)}),ie=ke($e=>{if($e>0){ge.current=!0,L($e);return}ge.current=!1,N>0&&L(N)}),Ne=ke($e=>{P($e)}),Ue=ke($e=>{se.set($e),S?.($e)}),Gt=ke($e=>{F($e),R?.($e)}),Ae=ke(($e,J)=>{a?.($e,J),!J.isCanceled&&!$e&&p&&p.length>0&&bt(B,qn(J.reason,J.event,J.trigger))}),Lt=ci.useMemo(()=>({swipeDirection:m,swipeAreaActiveRef:qe,snapToSequentialPoints:h,snapPoints:p,activeSnapPoint:Xe,setActiveSnapPoint:bt,frontmostHeight:z,popupHeight:N,hasNestedDrawer:q,nestedSwiping:V,nestedSwipeProgressStore:se,onNestedDrawerPresenceChange:Ne,onPopupHeightChange:W,onNestedFrontmostHeightChange:ie,onNestedSwipingChange:Gt,onNestedSwipeProgressChange:Ue,notifyParentFrontmostHeight:C,notifyParentSwipingChange:R,notifyParentSwipeProgressChange:S,notifyParentHasNestedDrawer:I}),[Xe,z,q,V,se,I,S,R,C,Ne,ie,Ue,Gt,W,N,bt,p,h,qe,m]),At=typeof t=="function"?$e=>(0,Sg.jsxs)(ci.Fragment,{children:[Are||(Are=(0,Sg.jsx)(Pre,{})),t($e)]}):(0,Sg.jsxs)(ci.Fragment,{children:[Ere||(Ere=(0,Sg.jsx)(Pre,{})),t]}),Hn=Lre("drawer",{open:n,defaultOpen:r,onOpenChange:Ae,onOpenChangeComplete:o,disablePointerDismissal:i,modal:s,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f,children:At});return(0,Sg.jsx)($B.Provider,{value:Lt,children:Hn})}function MAe(){let e=0,t=new Set;return{getSnapshot:()=>e,set(n){let r=Number.isFinite(n)?n:0;r!==e&&(e=r,t.forEach(a=>{a()}))},subscribe(n){return t.add(n),()=>{t.delete(n)}}}}function Pre(){let e=Yu(),t=na(!1),n=e?.setDrawerOpen,r=e?.removeDrawer,a=t.useState("open"),o=t.useState("nestedOpenDialogCount"),i=t.useState("popupElement"),s=o===0;return ze(()=>{if(r)return()=>{r(t)}},[r,t]),ze(()=>{n?.(t,a)},[a,n,t]),ci.useEffect(()=>{if(!a||!s||!Gr.os.android)return;let u=Tn(i).CloseWatcher;if(!u)return;function d(h){if(!t.select("open"))return;let p=qn(yn.closeWatcher,h);h.cancelable||(p.cancel=Js),t.setOpen(!1,p),p.isCanceled&&h.preventDefault()}let f=new u,m=jt(f,"cancel",d);return()=>{m(),f.destroy()}},[t,s,a,i]),null}var ui=b($(),1);var jn=b($(),1);function OAe(e,t=!1){let{overflowY:n}=Pr(e);return n!=="auto"&&n!=="scroll"?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}function zAe(e,t=!1){let{overflowX:n}=Pr(e);return n!=="auto"&&n!=="scroll"?!1:t?e.clientWidth>0:e.scrollWidth>e.clientWidth}function $re(e,t,n=!1){return t==="vertical"?OAe(e,n):zAe(e,n)}function UB(e,t,n,r=!1){let a=e;for(;fa(a)&&a!==t&&!pc(a);){if(En(a)&&$re(a,n,r))return a;a=Ys(a)}return null}function tp(e,t,n="vertical",r=!1){return UB(e,t,n,r)??($re(t,n,r)?t:null)}function df(e,t,n){return typeof e?.elementFromPoint=="function"?e.elementFromPoint(t,n):null}function T_(e,t){let n=(t??Tn(e).getComputedStyle(e)).transform,r=0,a=0,o=1;if(n&&n!=="none"){let i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){let s=i[1].split(", ").map(parseFloat);s.length===6?(r=s[4],a=s[5],o=Math.sqrt(s[0]*s[0]+s[1]*s[1])):s.length===16&&(r=s[12],a=s[13],o=s[0])}}return{x:r,y:a,scale:o}}var UAe=40,jAe=10,BAe=50,Mre=4,FAe=80,N_=1,HAe='button,a,input,select,textarea,label,[role="button"]';function Mi(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function __(e){return Number.isFinite(e)&&e>0?e:null}function Ore(e,t){return`translate3d(${e.x}px,${e.y}px,0) scale(${t})`}function VAe(e){return e%2===1}function jB(e,t,n){let r=e[n];if(typeof r=="function")try{r.call(e,t)}catch(a){if(a&&typeof a=="object"&&"name"in a&&a.name==="NotFoundError")return;throw a}}function L_(e){let{enabled:t,directions:n,elementRef:r,movementCssVars:a,canStart:o,ignoreSelectorWhenTouch:i=!0,ignoreScrollableAncestors:s=!1,swipeThreshold:l,onDismiss:u,onProgress:d,onCancel:f,onSwipeStart:m,onRelease:h,onSwipingChange:p,trackDrag:g=!0}=e,x=HAe,y=n.length===1?n[0]:void 0,v=Math.max(0,typeof l=="number"?l:UAe),S=n.includes("left"),C=n.includes("right"),R=n.includes("up"),I=n.includes("down"),N=S||C,k=R||I,z=N?"horizontal":"vertical",[L,q]=jn.useState(void 0),[P,V]=jn.useState(!1),[F,se]=jn.useState(!1),B=jn.useRef({x:0,y:0}),oe=jn.useRef({x:0,y:0}),G=jn.useRef(null),re=jn.useRef({x:0,y:0,scale:1}),ge=jn.useRef(void 0),qe=jn.useRef(0),bt=jn.useRef(!1),Xe=jn.useRef({x:0,y:0}),W=jn.useRef(!1),ie=jn.useRef(!1),Ne=jn.useRef(null),Ue=jn.useRef(!1),Gt=jn.useRef(!1),Ae=jn.useRef({width:0,height:0}),Lt=jn.useRef(0),At=jn.useRef(v),Hn=jn.useRef(null),$e=jn.useRef(null),J=jn.useRef(null),ue=jn.useRef(!1),Ge=jn.useRef({x:0,y:0}),Et=jn.useRef(null),dt=jn.useRef(!1),le=jn.useRef(null),ve=ke(ee=>{dt.current!==ee&&(dt.current=ee,V(ee),p?.(ee))});function me(ee){if(!ee)return;let xe=r.current,Be=Hn.current;if(!xe||!Be)return;let Xt=Be({element:xe,direction:ee});At.current=Math.max(0,Xt)}let ut=ke((ee,xe)=>{let Be=Number.isFinite(ee)?Ko(ee,0,1):0,Xt=Be!==Lt.current,ft=!1;if(xe){let Ot=Et.current;ft=!Ot||Ot.deltaX!==xe.deltaX||Ot.deltaY!==xe.deltaY||Ot.direction!==xe.direction}!Xt&&!ft||(Lt.current=Be,xe?Et.current=xe:Xt&&(Et.current=null),d?.(Be,xe))}),mn=ke(ee=>{let xe=r.current;if(!g||!xe){ee||(le.current=null);return}let Be=xe.style,Xt=le.current;ee?(Xt||(le.current=[Be.transition,Be.transform]),Be.transition="none"):Xt&&([Be.transition,Be.transform]=Xt,le.current=null);let ft=oe.current,Ot=re.current,Mn=ft.x-Ot.x,Aa=ft.y-Ot.y;ee&&(Be.transform=Ore(ft,Ot.scale)),Be.setProperty(a.x,`${Mn}px`),Be.setProperty(a.y,`${Aa}px`)});function ra(ee,xe){if(xe===null)return;let Be=J.current;if(Be&&xe>Be.time){let Xt=Math.abs(ee.x-Be.x)<N_&&Math.abs(ee.y-Be.y)<N_,ft=Xt&&!ue.current;if(ue.current=Xt,ft)return;let Ot=Math.max(xe-Be.time,Mre);Ge.current={x:(ee.x-Be.x)/Ot,y:(ee.y-Be.y)/Ot}}J.current={x:ee.x,y:ee.y,time:xe}}let he=jn.useCallback(()=>{q(void 0),ve(!1),se(!1),ut(0),At.current=v,Hn.current=null,B.current={x:0,y:0},oe.current={x:0,y:0},re.current={x:0,y:0,scale:1},ge.current=void 0,qe.current=0,bt.current=!1,Xe.current={x:0,y:0},W.current=!1,G.current=null,ie.current=!1,Ne.current=null,Ue.current=!1,Gt.current=!1,Ae.current={width:0,height:0},$e.current=null,J.current=null,ue.current=!1,Ge.current={x:0,y:0},Et.current=null,mn(!1)},[ve,v,mn,ut]);function we(ee){if("touches"in ee){let xe=ee.touches[0];return xe?{x:xe.clientX,y:xe.clientY}:null}return{x:ee.clientX,y:ee.clientY}}function Sn(ee){return"touches"in ee?!0:ee.pointerType==="touch"}function Vn(ee,xe){let Be=r.current?.getRootNode();return df(Be,ee.x,ee.y)??gr(xe)}function X(ee,xe){return(Xt=>{let ft=tp(ee,xe,Xt),Ot=en(ft);return ft===Ot.body||ft===Ot.documentElement?null:ft})(z)}function _e(ee,xe,Be){Ue.current=!1;let Xt=Sn(ee),ft=Vn(xe,ee.nativeEvent),Mn=en(r.current).body,Aa=Xt&&Mn?X(ft,Mn):null,ur=Be?.ignoreScrollableTarget??!1;if(Aa&&!ur||(Ue.current=!!(Aa&&ur),Xs(ft,x)&&(!Xt||i)))return!1;let A=r.current;if(s&&A&&ft&&!(Be?.ignoreScrollableAncestors??!1)&&UB(ft,A,z)!=null)return!1;if(bt.current=!1,ge.current=void 0,qe.current=0,B.current=xe,$e.current=__(ee.timeStamp),J.current=null,ue.current=!1,Ge.current={x:0,y:0},Xe.current=xe,G.current=xe,At.current=v,Hn.current=typeof l=="function"?l:null,A){Ae.current={width:A.offsetWidth,height:A.offsetHeight},me(y);let D=T_(A);re.current=D,oe.current={x:D.x,y:D.y},ra({x:D.x,y:D.y},$e.current),"touches"in ee||jB(A,ee.pointerId,"setPointerCapture")}return m?.(ee.nativeEvent),ve(!0),W.current=!0,ut(0),mn(!0),!0}function je(){Ve(),Ue.current=!1,G.current=null}function Ve(){ie.current=!1,Ne.current=null}function xt(ee){if(je(),!dt.current)return;ve(!1);let xe=re.current;oe.current={x:xe.x,y:xe.y},q(void 0),Gt.current=!1,mn(!1);let Be=r.current;Be&&jB(Be,ee.pointerId,"releasePointerCapture"),ut(0,{deltaX:0,deltaY:0,direction:void 0}),f?.(ee.nativeEvent)}function ot(ee,xe){let Be=Mn=>Math.sign(Mn)*Math.abs(Mn)**.5,Xt=(Mn,Aa,ur)=>!Aa&&Mn<0||!ur&&Mn>0?Be(Mn):Mn,ft=N?Xt(ee,S,C):Be(ee),Ot=k?Xt(xe,R,I):Be(xe);return{x:ft,y:Ot}}function Mt(ee,xe,Be){let Xt=(ft,Ot,Mn,Aa,ur)=>ft>0&&Ot<=0&&Aa||ft<0&&Ot>=Math.max(0,Mn)&&ur;return k&&Be!==0?Xt(Be,ee.scrollTop,ee.scrollHeight-ee.clientHeight,I,R):N&&xe!==0?Xt(xe,ee.scrollLeft,ee.scrollWidth-ee.clientWidth,C,S):null}let $n=ke(ee=>{if(!t||ee.defaultPrevented||ee.nativeEvent.defaultPrevented||!("touches"in ee)&&ee.button!==0)return;let xe=we(ee);!xe||(ie.current=!0,Ne.current=xe,Ue.current=!1,Gt.current=!("touches"in ee),!(o?o(xe,{nativeEvent:ee.nativeEvent,direction:y}):!0))||_e(ee,xe)&&Ve()});function ei(ee,xe,Be){if(!t||!dt.current)return;let Xt=gr(ee.nativeEvent);if(Sn(ee)&&!Ue.current){let zt=ee.currentTarget;if(X(Xt,zt))return}if("touches"in ee||ee.preventDefault(),W.current&&(W.current=!1,g)){B.current=xe;let zt=__(ee.timeStamp);zt!==null&&($e.current=zt),J.current=null,ue.current=!1}let ft=xe.x,Ot=xe.y,Mn=Be.x,Aa=Be.y;(Aa<0&&Ot>Xe.current.y||Aa>0&&Ot<Xe.current.y)&&(Xe.current={x:Xe.current.x,y:Ot}),(Mn<0&&ft>Xe.current.x||Mn>0&&ft<Xe.current.x)&&(Xe.current={x:ft,y:Xe.current.y});let ur=ft-B.current.x,_=Ot-B.current.y,A=Ot-Xe.current.y,D=ft-Xe.current.x,K;if(!ge.current)Math.abs(ur)>=Math.abs(_)?K=ur>0?"right":"left":K=_>0?"down":"up",K&&(K==="left"&&S||K==="right"&&C||K==="up"&&R||K==="down"&&I)&&(ge.current=K,qe.current=Mi(K,ur,_),q(K),me(K));else{let zt=ge.current,Ra=Mi(zt,D,A);Ra>At.current?(bt.current=!1,q(zt)):!(S&&C)&&!(R&&I)&&qe.current-Ra>=jAe&&(bt.current=!0)}let ae=ot(ur,_),Re=re.current.x,Ie=re.current.y;N&&(Re+=ae.x),k&&(Ie+=ae.y);let Pe=oe.current,Ce=Re!==Pe.x||Ie!==Pe.y;oe.current={x:Re,y:Ie},Ce&&mn(!0),ra({x:Re,y:Ie},__(ee.timeStamp));let Je=Re-re.current.x,Ze=Ie-re.current.y,lt={deltaX:Je,deltaY:Ze,direction:ge.current},Fe=0,Pt=y??ge.current;if(Pt){let zt=Pt==="left"||Pt==="right"?Ae.current.width:Ae.current.height,Ra=re.current.scale||1,oa=Mi(Pt,Je,Ze);zt>0&&Ra>0&&oa>0&&(Fe=oa/(zt*Ra))}ut(Fe,lt)}let cr=ke(ee=>{if(!t)return;let xe=oe.current,Be=re.current,Xt=xe.x-Be.x,ft=xe.y-Be.y,Ot={deltaX:Xt,deltaY:ft,direction:ge.current};if(!dt.current){je(),ut(0,Ot);return}ve(!1),je(),Gt.current=!1;let Mn=r.current;Mn&&("touches"in ee||jB(Mn,ee.pointerId,"releasePointerCapture"));let Aa=Xt,ur=ft,_=$e.current,A=__(ee.timeStamp),D=_!==null&&A!==null&&A>_?A-_:0,K=D>0?Math.max(D,BAe):0,ae=K>0?Aa/K:0,Re=K>0?ur/K:0,Ie=Ge.current.x,Pe=Ge.current.y,Ce=J.current;if(Ce&&A!==null&&A>=Ce.time){let Pt=A-Ce.time;if(Pt<=FAe){let zt=Math.max(Pt,Mre),Ra=xe.x-Ce.x,oa=xe.y-Ce.y,ia=Ra/zt,ki=oa/zt;Math.abs(Ra)>=N_&&(Ie=ia),Math.abs(oa)>=N_&&(Pe=ki)}else Ie=0,Pe=0}let Je=h?.({event:ee.nativeEvent,direction:ge.current,deltaX:Aa,deltaY:ur,velocityX:ae,velocityY:Re,releaseVelocityX:Ie,releaseVelocityY:Pe}),Ze=typeof Je=="boolean";if(bt.current&&!Ze){oe.current={x:Be.x,y:Be.y},q(void 0),mn(!1),ut(0,Ot);return}let lt=!1,Fe;if(Ze)lt=Je,Fe=ge.current??y;else for(let Pt of n)if(Mi(Pt,Aa,ur)>At.current){lt=!0,Fe=Pt;break}lt&&Fe?(q(Fe),se(!0),mn(!1),u?.(ee.nativeEvent,{direction:Fe})):(oe.current={x:Be.x,y:Be.y},q(void 0),mn(!1),ut(0,Ot))}),Rr=ke(ee=>{let xe=we(ee);if(!xe)return;let Be=!1;if(!("touches"in ee)){let Ot=VAe(ee.buttons);if(Ot&&(Gt.current=!0),ee.buttons!==0&&!Ot){xt(ee);return}if(ee.buttons===0&&Gt.current){if(!dt.current){cr(ee);return}Be=!0}}if(!P&&ie.current){if(!Sn(ee)&&(ee.defaultPrevented||ee.nativeEvent.defaultPrevented)){je();return}if(o?o(xe,{nativeEvent:ee.nativeEvent,direction:y}):!0){let Mn=Ne.current,Aa=!1;if(Sn(ee)){let _=r.current;if(Mn&&_){let A=Vn(xe,ee.nativeEvent),K=en(_).body,ae=K?X(A,K):null;if(ae&&(yt(_,ae)||yt(ae,_))){let Re=xe.x-Mn.x,Ie=xe.y-Mn.y,Pe=Mt(ae,Re,Ie);if(Pe===!1)return;Pe===!0&&(Aa=!0)}}}_e(ee,xe,{ignoreScrollableTarget:Aa,ignoreScrollableAncestors:Aa})&&(Mn&&Aa?(Ve(),B.current=Mn,Xe.current=Mn,G.current=Mn,W.current=!1):(Ve(),Ue.current=!1))}}let Xt=G.current,ft=Xt===null?{x:0,y:0}:{x:xe.x-Xt.x,y:xe.y-Xt.y};G.current=xe,ei(ee,xe,ft),Be&&!("touches"in ee)&&cr(ee)}),Ci=ke((ee,xe)=>{Rr({touches:ee.touches,currentTarget:xe,nativeEvent:ee,defaultPrevented:ee.defaultPrevented,timeStamp:ee.timeStamp})}),So=jn.useCallback(()=>{let ee=dt.current,xe=oe.current,Be=re.current,Xt=xe.x-Be.x,ft=xe.y-Be.y;return!ee&&Xt===0&&ft===0&&!F?{[a.x]:"0px",[a.y]:"0px"}:{transition:ee?"none":void 0,transform:ee?Ore(xe,Be.scale):void 0,[a.x]:`${Xt}px`,[a.y]:`${ft}px`}},[F,a]),yd=jn.useCallback(()=>t?{onPointerDown:$n,onPointerMove:Rr,onPointerUp:cr,onPointerCancel:cr}:{},[t,cr,Rr,$n]),bd=jn.useCallback(()=>t?{onTouchStart:$n,onTouchMove:Rr,onTouchEnd:cr,onTouchCancel:cr}:{},[t,cr,Rr,$n]);return{swiping:P,swipeDirection:L,dragDismissed:F,getPointerProps:yd,getTouchProps:bd,moveNative:Ci,getDragStyles:So,reset:he}}var zre=fo.open,Ure=fo.closed,jre="data-disabled",Bre="data-swipe-direction",Fre="data-swiping";var qAe=.5,GAe=1,ZAe=.1,WAe=40,KAe={[zre]:""},JAe={[Ure]:""},QAe={[Fre]:""},YAe={[jre]:""},XAe={open(e){return e?KAe:JAe},swiping(e){return e?QAe:null},swipeDirection(e){return{[Bre]:e}},disabled(e){return e?YAe:null}},Vre={up:"down",down:"up",left:"right",right:"left"};function eEe(e){return e==="left"||e==="right"?"pan-y":"pan-x"}var qre=ui.forwardRef(function(t,n){let{render:r,className:a,style:o,disabled:i=!1,swipeDirection:s,...l}=t,u=na(),{swipeDirection:d,frontmostHeight:f,swipeAreaActiveRef:m}=ad(),h=Yu(),[p,g]=ui.useState(!1),x=ui.useRef(null),y=ui.useRef(null),v=ui.useRef(!1),S=ui.useRef({x:0,y:0}),C=ui.useRef(null),R=ui.useRef(!1),I=ui.useRef(null),N=ui.useRef(null),k=ui.useRef(null),z=ui.useRef(Js),L=Km(t.id),q=SB(L,u);ze(()=>(q(x.current),()=>q(null)),[q,L,u]);let P=u.useState("open"),V=ke(()=>{S.current.x=0,S.current.y=0}),F=s??Vre[d],se=Vre[F],B=!i&&(!P||p);function oe(){z.current(),u.context.outsidePressEnabledRef.current=!1}let G=ke(()=>{z.current();let J=en(x.current);function ue(Ge){Ge?.type==="click"&&Ge.detail!==0&&!Qm(Ge)||(z.current=Js,J.removeEventListener("pointerdown",ue,!0),J.removeEventListener("click",ue,!0),u.context.outsidePressEnabledRef.current=!0)}z.current=ue,J.addEventListener("pointerdown",ue,!0),J.addEventListener("click",ue,!0)});function re(J){let Ge=se==="left"||se==="right"?J.offsetWidth:J.offsetHeight;return Ge<=0?null:Ge}function ge(){let J=u.context.popupRef.current;return J?re(J):null}function qe(J){let ue=re(J);if(ue==null)return null;let Ge=se==="left"||se==="right",Et=T_(J),dt=Ge?Et.x:Et.y;return Number.isFinite(dt)&&Math.abs(dt)>.5?Math.min(ue,Math.abs(dt)):ue}function bt(){let J=ge();return J==null?WAe:J*qAe}function Xe(){let J=u.context.popupRef.current;if(!J||!u.select("open")||!u.select("mounted"))return;C.current==null&&(C.current=qe(J));let ue=C.current;if(ue===null)return;let{x:Ge,y:Et}=S.current,dt=Mi(F,Ge,Et),le=Math.max(0,dt),ve=le>ue?ue+Math.sqrt(le-ue):le,mn=(ue-ve)*(se==="left"||se==="up"?-1:1),ra=se==="left"||se==="right",he=ra?mn:0,we=ra?0:mn,Sn=Math.max(0,Math.min(1,le/ue)),Vn=Math.max(0,Math.min(1,1-Sn));J.style.setProperty(Wm,`${he}px`),J.style.setProperty(Yc,`${we}px`),J.setAttribute(uf,""),I.current=J,k.current===null&&(k.current=J.style.transition),J.style.transition="none";let X=u.context.backdropRef.current;X&&(X.setAttribute(uf,""),N.current=X,X.style.setProperty(No,`${Vn}`),Sn>0&&f>0?X.style.setProperty(Qs,`${f}px`):X.style.removeProperty(Qs)),h?.visualStateStore.set({swipeProgress:Sn,frontmostHeight:Sn>0?f:0}),R.current=!0,m.current=!0}let W=ke(()=>{let J=I.current;J&&(J.style.removeProperty(Wm),J.style.removeProperty(Yc),J.removeAttribute(uf)),J&&k.current!==null&&(J.style.transition=k.current,k.current=null);let ue=N.current;ue&&(ue.removeAttribute(uf),ue.style.setProperty(No,"0"),ue.style.removeProperty(Qs)),h?.visualStateStore.set({swipeProgress:0,frontmostHeight:0}),R.current=!1,I.current=null,N.current=null,m.current=!1});function ie(J){v.current=!0,u.setOpen(!0,qn(yn.swipe,J,x.current))}function Ne(J){u.setOpen(!1,qn(yn.swipe,J,x.current))}function Ue(){y.current=null,v.current=!1,C.current=null,g(!1)}function Gt(){Ue(),G(),V(),W()}let Ae=L_({enabled:B,directions:[F],elementRef:x,trackDrag:!1,movementCssVars:{x:Wm,y:Yc},onSwipeStart(J){oe(),y.current=J,v.current=!1,g(!0),V()},onProgress(J,ue){if(!ue||!y.current||(S.current.x=ue.deltaX,S.current.y=ue.deltaY,ue.direction!==F))return;let Ge=Mi(F,ue.deltaX,ue.deltaY);!v.current&&Ge<GAe||(!v.current&&!u.select("open")&&ie(y.current),Xe())},onRelease({event:J,direction:ue,deltaX:Ge,deltaY:Et,releaseVelocityX:dt,releaseVelocityY:le}){let ve=Mi(F,Ge,Et),me=Mi(F,dt,le),ut=bt(),mn=ve>=ut,ra=me>=ZAe;return ue===F&&(mn||ra)&&!i?u.select("open")||ie(J):v.current&&u.select("open")&&Ne(J),Gt(),!1},onCancel:Gt}),Lt=Ae.getPointerProps(),At=Ae.getTouchProps(),Hn=Ae.reset;ze(()=>{p&&R.current&&Xe()}),ze(()=>{B||(p&&G(),Hn(),V(),W(),Ue())},[W,G,B,V,Hn,p]),ui.useEffect(()=>()=>{z.current(),u.context.outsidePressEnabledRef.current=!0},[u]);let $e={open:P,swiping:Ae.swiping,swipeDirection:F,disabled:i};return rr("div",t,{state:$e,ref:[n,x,q],stateAttributesMapping:XAe,props:[{role:"presentation","aria-hidden":!0,style:{pointerEvents:B?void 0:"none",touchAction:eEe(F)},onPointerDown(J){J.pointerType!=="touch"&&(Lt.onPointerDown?.(J),J.cancelable&&J.preventDefault())},onPointerMove(J){J.pointerType!=="touch"&&Lt.onPointerMove?.(J)},onPointerUp(J){J.pointerType!=="touch"&&Lt.onPointerUp?.(J)},onPointerCancel(J){J.pointerType!=="touch"&&Lt.onPointerCancel?.(J)}},At,L?{id:L}:void 0,l]})});var Gre=b($(),1);var Zre=Gre.forwardRef(function(t,n){let{render:r,className:a,style:o,id:i,...s}=t,l=na(),u=Km(i);return l.useSyncedValueWithCleanup("titleElementId",u),rr("h2",t,{ref:n,props:[{id:u},s]})});var Wre=Zre;var Qre=b($(),1);var BB=b($(),1);var eC=b($(),1);function Kre(e){let t=eC.useRef(""),n=eC.useCallback(a=>{a.defaultPrevented||(t.current=a.pointerType,e(a,a.pointerType))},[e]);return{onClick:eC.useCallback(a=>{if(a.detail===0){e(a,"keyboard");return}"pointerType"in a?e(a,a.pointerType):e(a,t.current),t.current=""},[e]),onPointerDown:n}}function Jre(e,t){let n=ke((o,i)=>{(typeof e=="function"?e():e)||t(i||(Gr.os.ios?"touch":""))}),{onClick:r,onPointerDown:a}=Kre(n);return BB.useMemo(()=>({onClick:r,onPointerDown:a}),[r,a])}var Yre=oae(function(t,n){let{render:r,className:a,style:o,disabled:i=!1,nativeButton:s=!0,id:l,payload:u,handle:d,...f}=t,m=na(!0),p=mae(d)??m;if(!p)throw new Error(mc(79));let g=Km(l),x=p.useState("floatingRootContext"),y=p.useState("isOpenedByTrigger",g),v=p.useState("triggerPopupId",g),S=Qre.useRef(null),{registerTrigger:C,isMountedByThisTrigger:R}=Vne(g,S,p,{payload:u}),{getButtonProps:I,buttonRef:N}=Mw({disabled:i,native:s}),k=pB(x),z=Jre(()=>p.select("open"),P=>{p.set("openMethod",P)}),L={disabled:i,open:y},q=p.useState("triggerProps",R);return rr("button",t,{state:L,ref:[N,n,C,S],props:[k.reference,q,z,{[t_]:"",id:g,"aria-haspopup":"dialog","aria-expanded":y,"aria-controls":v},f,I],stateAttributesMapping:wte})});var Xre=Yre;var ho=b($(),1),goe=b(Is(),1);var noe=b($(),1);var Vut=fo.open,qut=fo.closed,Gut=fo.startingStyle,Zut=fo.endingStyle;var eoe="data-nested-dialog-open";var toe={...$j,...wN,nestedDialogOpen(e){return e?{[eoe]:""}:null}};var aoe=noe.forwardRef(function(t,n){let{render:r,className:a,style:o,children:i,...s}=t,l=y_(),u=na(),d=u.useState("open"),f=u.useState("nested"),m=u.useState("transitionStatus"),h=u.useState("nestedOpenDialogCount"),p=u.useState("mounted"),g=u.useStateSetter("viewportElement"),x=h>0;return rr("div",t,{enabled:l||p,state:{open:d,nested:f,transitionStatus:m,nestedDialogOpen:x},ref:[n,g],stateAttributesMapping:toe,props:[{role:"presentation",hidden:!p,style:{pointerEvents:d?void 0:"none"},children:i},s]})});var adt=fo.open,rdt=fo.closed,odt=fo.startingStyle,idt=fo.endingStyle;var roe="data-nested-dialog-open";var A_=b($(),1),FB=A_.createContext(void 0);function ooe(){return A_.useContext(FB)}var qB=b(w(),1),GB=10,ioe=.5,soe=.5,aEe=300,loe=4,coe=.2,rEe=4,HB=80,uoe=360,doe=.1,oEe=1,foe=6,iEe=2,sEe=`[${AN}]`,moe={horizontal:`[${n_}="x"]`,vertical:`[${n_}="y"]`},voe=ho.forwardRef(function(t,n){let{render:r,className:a,style:o,children:i,...s}=t,l=na(),u=l.context.popupRef,d=l.context.backdropRef,{swipeDirection:f,notifyParentSwipingChange:m,notifyParentSwipeProgressChange:h,frontmostHeight:p,snapToSequentialPoints:g,swipeAreaActiveRef:x}=ad(),y=Yu(),{snapPoints:v,resolvedSnapPoints:S,activeSnapPoint:C,activeSnapPointOffset:R,setActiveSnapPoint:I,popupHeight:N}=S_(),k=l.useState("open"),z=l.useState("mounted"),L=l.useState("nested"),q=l.useState("nestedOpenDrawerCount"),P=l.useState("viewportElement"),V=l.useState("popupElement"),F=y?.visualStateStore,se=q>0,B=f==="left"||f==="right"?"horizontal":"vertical",oe=B==="vertical",G=oe?"horizontal":"vertical",[re,ge]=ho.useState(null),qe=ho.useRef(void 0),bt=ho.useRef(null),Xe=Xu(),W=ho.useRef(!1),ie=ho.useRef(!1),Ne=ho.useRef(""),Ue=ho.useRef(!1),Gt=ho.useRef(!1),Ae=ho.useRef(null),Lt=ooe(),At=ho.useMemo(()=>{if(!v||v.length<2||S.length<2||f!=="down"&&f!=="up")return null;let X=S.map(xt=>xt.offset).sort((xt,ot)=>xt-ot),_e=X[0],Ve=X[1]-_e;return{minOffset:_e,range:Ve}},[S,v,f]),Hn=ho.useMemo(()=>!At||R===null?null:Ko((R-At.minOffset)/At.range,0,1),[R,At]),$e=ho.useMemo(()=>v&&v.length>0&&(f==="down"||f==="up")?f==="down"?["down","up"]:["up","down"]:[f],[v,f]),J=ke(X=>{u.current?.toggleAttribute(PB,X),d.current?.toggleAttribute(PB,X)}),ue=ke(()=>{J(!1),u.current?.removeAttribute(og.endingStyle),ge(null)}),Ge=ke(()=>{ie.current&&(ie.current=!1,m?.(!1))}),Et=ke((X,_e,je)=>{let Ve=k&&!L&&_e,xt=Ve?X:0,ot=k&&_e?X:0;je&&h&&(h(ot),ot<=0&&Ge()),F?.set({swipeProgress:xt,frontmostHeight:xt>0?p:0});let Mt=d.current;if(!Mt)return;let $n=Ve&&xt>0;Mt.style.setProperty(No,$n?`${xt}`:"0"),$n&&p>0?Mt.style.setProperty(Qs,`${p}px`):Mt.style.removeProperty(Qs)});function dt(X,_e,je,Ve,xt,ot,Mt,$n){let ei=yoe(X,_e);if(ei<=0)return null;let Rr=((_e==="down"||_e==="up")&&v&&v.length>0?R??0:0)+Mi(_e,je,Ve),Ci=Math.max(0,ei-Rr);if(Ci<=0)return null;let So=Mi(_e,Mt,$n),yd=Math.abs(So)>0?So:Mi(_e,xt,ot);if(yd<=coe)return null;let bd=Ko(yd,coe,rEe),xe=(Ko(Ci/bd,HB,uoe)-HB)/(uoe-HB);return doe+xe*(oEe-doe)}function le(X){if(ie.current||!X)return;let _e=X.direction??f,je=Mi(_e,X.deltaX,X.deltaY);Math.abs(je)<GB||(ie.current=!0,m?.(!0))}let ve=L_({enabled:z&&!se,directions:$e,elementRef:l.context.popupRef,ignoreSelectorWhenTouch:!1,ignoreScrollableAncestors:!0,movementCssVars:{x:Wm,y:Yc},onSwipeStart(X){if("touches"in X||X.pointerType==="touch")return;let _e=u.current,Ve=en(_e).getSelection?.();if(!Ve||Ve.isCollapsed)return;let xt=fa(Ve.anchorNode)?Ve.anchorNode:Ve.anchorNode?.parentElement,ot=fa(Ve.focusNode)?Ve.focusNode:Ve.focusNode?.parentElement;!yt(_e,xt)&&!yt(_e,ot)||Ve.removeAllRanges()},onSwipingChange(X){W.current=X,VB(l.context.backdropRef.current,X),!X&&!h&&Ge()},swipeThreshold({element:X,direction:_e}){return poe(X,_e)},canStart(X,_e){let je=l.context.popupRef.current;if(!je)return!1;let Ve=_e.nativeEvent,xt="touches"in Ve||Ve.pointerType==="touch",ot=xt?Ae.current:null,Mt=je.ownerDocument,$n=df(je.getRootNode(),X.x,X.y);return!(!ot?.startedInPopup&&!yt(je,$n)||xt&&hoe(Mt,je)||ot?.hasCrossAxisGestureTarget&&!ot.drawerAxisAttributed&&ot.allowSwipe!==!0)},onProgress(X,_e){let je=W.current;je&&le(_e);let Ve=!!(v&&v.length>0);if(je&&f==="down"&&Ve&&_e){let ot=l.context.popupRef.current;ot&&(ot.style.removeProperty("transform"),ot.style.setProperty(Yc,`${x_(R??0,_e.deltaY)}px`))}let xt=X;if(At&&N>0){let ot=R??At.minOffset,Mt=$n=>Ko(($n-At.minOffset)/At.range,0,1);je&&_e&&Number.isFinite(_e.deltaY)?xt=Mt(Ko(ot+_e.deltaY,0,N)):Hn!==null&&(xt=Hn)}je||(h?.(0),Ge()),Et(xt,!0,je)},onRelease({event:X,deltaX:_e,deltaY:je,direction:Ve,velocityX:xt,velocityY:ot,releaseVelocityX:Mt,releaseVelocityY:$n}){let ei=l.context.popupRef.current;if(!ei){ue();return}let cr=ei;function Rr(D){Ge(),J(!0),cr.style.removeProperty("transition"),cr.setAttribute(og.endingStyle,""),goe.flushSync(()=>{ge(dt(cr,D,_e,je,xt,ot,Mt,$n))})}if(!v||v.length===0){if(!Ve){ue();return}let D=Mi(Ve,_e,je);if(D<=0)return ue(),!1;if(Mi(Ve,xt,ot)>=ioe)return Rr(Ve),!0;let K=D>poe(cr,Ve);return K?Rr(Ve):ue(),K}if(f!=="down"&&f!=="up"){ue();return}if(!N)return ue(),!1;if(S.length===0){ue();return}let Ci=f==="down"?je:-je,So=Math.sign(Ci),yd=f==="down"?$n:-$n,bd=f==="down"?ot:-ot,ee=yd;if(So!==0&&Math.abs(Ci)>=GB){let D=Math.sign(ee);D!==0&&D!==So&&(ee=bd)}let xe=R??0,Be=Ko(xe+Ci,0,N),Xt=Math.abs(ee)>=soe?Ko(ee,-loe,loe)*aEe:0,ft=g?Be:Ko(Be+Xt,0,N),Ot=qn(yn.swipe,X),Mn=()=>(Et(0,!0,!0),ue(),!1),Aa=D=>(I(D.value,Ot),Mn()),ur=D=>Ve?(I(null,Ot),Ot.isCanceled?Mn():(qe.current=C,Rr(f),!0)):Aa(D);if(g){let D=[...S].sort((lt,Fe)=>lt.offset-Fe.offset),K=D.map(lt=>lt.offset),ae=Jw(K,xe),Re=D[Jw(K,ft)],Ie=Math.sign(ee),Pe=So!==0&&Ie!==0&&Ie===So&&Math.abs(ee)>=soe,Ce=ft;if(Pe){let lt=Ko(ae+So,0,D.length-1);if(lt!==ae){let Fe=D[lt];(So>0?ft<Fe.offset:ft>Fe.offset)&&(Re=Fe,Ce=Fe.offset)}else if(So>0)return ur(Re)}let Je=Math.abs(Ce-N),Ze=Math.abs(Ce-Re.offset);return Je<Ze?ur(Re):Aa(Re)}let _=S[Jw(S.map(D=>D.offset),ft)];return ee>=ioe&&Ci>0||Math.abs(ft-N)<Math.abs(ft-_.offset)?ur(_):Aa(_)},onDismiss(X){F?.set({swipeProgress:0,frontmostHeight:0});let _e=l.context.backdropRef.current;_e&&(_e.style.setProperty(No,"0"),_e.style.removeProperty(Qs));let je=qn(yn.swipe,X);if(l.setOpen(!1,je),je.isCanceled){let Ve=qe.current;Ve!==void 0&&I(Ve,qn(yn.swipe,X)),qe.current=void 0,bt.current?.(),ue();return}if(l.select("open")){let Ve=X;Xe.request(()=>{if(l.select("open")){let xt=qe.current;xt!==void 0&&I(xt,qn(yn.swipe,Ve)),qe.current=void 0,ue(),bt.current?.()}else qe.current=void 0});return}qe.current=void 0,J(!0)}}),me=ve.getPointerProps(),ut=ve.getTouchProps(),{moveNative:mn,reset:ra}=ve;bt.current=ra,ho.useEffect(()=>{let X=P??V;if(!X||!k||!z)return;let _e=X,je=en(_e);function Ve(ot,Mt,$n){let ei=oe?$n.clientY-Mt.lastY:$n.clientX-Mt.lastX;if(ot.touches.length===2||hoe(je,_e)||se||gEe(Mt,ot,$n,oe))return;let Rr=Mt.scrollTarget;if(!Rr||Rr===je.documentElement||Rr===je.body){ot.cancelable&&ot.preventDefault(),ot.stopPropagation(),mn(ot,_e);return}if(!vEe(Rr,B)){ot.cancelable&&ot.preventDefault(),ot.stopPropagation();return}if(ei!==0){let Ci=yEe(Rr,B,f,ei);Mt.allowSwipe?ot.cancelable&&ot.preventDefault():ot.cancelable&&Ci?(Mt.allowSwipe=!0,ot.preventDefault()):Mt.allowSwipe=!1}Mt.allowSwipe===!0&&(ot.stopPropagation(),mn(ot,_e))}function xt(ot){if(Lt?.onTouchMove(ot),Gt.current)return;let Mt=Ae.current,$n=ot.touches[0];!$n||!Mt||(Ve(ot,Mt,$n),hEe(Mt,$n))}return jt(je,"touchmove",xt,{passive:!1,capture:!0})},[z,se,k,V,oe,B,f,mn,P,Lt]),ze(()=>{!At||ve.swiping||Et(!k||L?0:Hn??0,!0,!1)},[Et,p,L,h,k,Hn,At,ve.swiping,l,F]),ze(()=>{if(h)return k||h(0),()=>{h(0)}},[h,k]),ze(()=>{k&&(x.current||ra(),ue())},[ue,k,ra,x]),ze(()=>{let X=d.current;return()=>{F?.set({swipeProgress:0,frontmostHeight:0}),VB(X,!1);let _e=d.current;_e!==X&&VB(_e,!1),Ge()}},[d,Ge,F]);let he=ho.useMemo(()=>({swiping:ve.swiping,getDragStyles:ve.getDragStyles,swipeStrength:re??null,setSwipeDismissed:J}),[J,ve.getDragStyles,ve.swiping,re]);function we(X){Gt.current=X,Ae.current=null}function Sn(){we(!1),Ne.current="",Ue.current=!1}function Vn(X){return Ne.current="",X.pointerType!=="touch"}return(0,qB.jsx)(aoe,{ref:n,className:a,style:o,render:r,...ag(s,{onPointerDown(X){if(Ne.current=X.pointerType,Ue.current=X.pointerType==="pen",!k||!z||se)return;let _e=df(X.currentTarget.getRootNode(),X.clientX,X.clientY);lEe(_e)||cEe(_e)||X.pointerType!=="touch"&&me.onPointerDown?.(X)},onPointerMove(X){X.pointerType!=="touch"&&me.onPointerMove?.(X)},onPointerUp(X){Vn(X)&&me.onPointerUp?.(X)},onPointerCancel(X){Vn(X)&&me.onPointerCancel?.(X)},onTouchStart(X){if(Ne.current==="pen"&&Ue.current){Ue.current=!1,we(!1);return}if(!k||!z||se){we(!1);return}let je=X.touches[0];if(!je)return;if(pEe(X)){we(!1);return}let Ve=X.currentTarget,xt=df(Ve.getRootNode(),je.clientX,je.clientY),ot=gr(X.nativeEvent),Mt=fa(ot)?ot:Ve;if(!yt(Ve,Mt)){we(!0);return}if(Lt?.onTouchStart(X),Xs(xt,`${lB}:not(${moe[G]})`)){we(!0);return}Gt.current=!1;let $n=tp(Mt,Ve,B),ei=tp(Mt,Ve,G)!=null||Xs(xt,moe[G])!=null,cr=null;$n&&(cr=xoe($n,B,f)?null:!1),Ae.current={startX:je.clientX,startY:je.clientY,lastX:je.clientX,lastY:je.clientY,startedInPopup:yt(u.current,xt),scrollTarget:$n,hasCrossAxisGestureTarget:ei,allowSwipe:cr,preserveNativeCrossAxisScroll:!1,drawerAxisAttributed:!1},ut.onTouchStart?.(X)},onTouchEnd(X){Lt?.onTouchEnd(X),Sn(),ut.onTouchEnd?.(X)},onTouchCancel(X){Lt?.onTouchCancel(),Sn(),ut.onTouchCancel?.(X)},[roe]:void 0}),children:(0,qB.jsx)(MB.Provider,{value:he,children:i})})});function VB(e,t){e?.toggleAttribute(uf,t)}function lEe(e){return!!Xs(e,lB)}function cEe(e){return!!Xs(e,sEe)}function yoe(e,t){return t==="left"||t==="right"?e.offsetWidth:e.offsetHeight}function poe(e,t){return Math.max(yoe(e,t)*.5,GB)}function uEe(e,t){return e instanceof t.HTMLInputElement&&e.type==="range"}function dEe(e){return e.tagName==="INPUT"||e.tagName==="TEXTAREA"}function fEe(e,t){let n=fa(e.anchorNode)?e.anchorNode:e.anchorNode?.parentElement,r=fa(e.focusNode)?e.focusNode:e.focusNode?.parentElement;return e.containsNode(t,!0)||yt(t,n)||yt(t,r)}function hoe(e,t){let n=mo(e);if(n&&yt(t,n)&&dEe(n)){let{selectionStart:a,selectionEnd:o}=n;if(a!=null&&o!=null&&a<o)return!0}let r=e.getSelection?.();return!r||r.isCollapsed?!1:fEe(r,t)}function mEe(e,t){return e.composedPath().some(n=>uEe(n,t))}function pEe(e){return mEe(e.nativeEvent,Tn(e.currentTarget))}function hEe(e,t){e.lastX=t.clientX,e.lastY=t.clientY}function gEe(e,t,n,r){if(e.preserveNativeCrossAxisScroll)return!0;if(e.drawerAxisAttributed||e.allowSwipe===!0||!e.hasCrossAxisGestureTarget)return!1;if(!t.cancelable)return e.preserveNativeCrossAxisScroll=!0,!0;let a=r?n.clientY-e.startY:n.clientX-e.startX,o=r?n.clientX-e.startX:n.clientY-e.startY,i=Math.abs(a),s=Math.abs(o);return s>=foe&&s>i+iEe?(e.preserveNativeCrossAxisScroll=!0,!0):i>=foe?(e.drawerAxisAttributed=!0,!1):!0}function vEe(e,t){return boe(e,t).max>0}function boe(e,t){if(t==="vertical"){let r=Math.max(0,e.scrollHeight-e.clientHeight);return{offset:e.scrollTop,max:r}}let n=Math.max(0,e.scrollWidth-e.clientWidth);return{offset:e.scrollLeft,max:n}}function xoe(e,t,n){let r=Soe(n,t),{offset:a,max:o}=boe(e,t);return r?a<=0:a>=o}function yEe(e,t,n,r){return(Soe(n,t)?r>0:r<0)?xoe(e,t,n):!1}function Soe(e,t){return t==="vertical"?e==="down":e==="right"}var ru=b($(),1);var ZB="--drawer-keyboard-inset";var Ioe=b(w(),1),WB=60,E_=16,Coe=150,bEe=4,xEe=60,koe=10,P_=16,SEe=new Set(["email","number","password","search","tel","text","url"]),Toe=Symbol("KeyboardTapBlocked");function Noe(e){let{children:t}=e,n=na(),r=n.useState("open"),a=n.useState("mounted"),o=n.useState("modal"),i=n.useState("nestedOpenDialogCount"),l=n.useState("viewportElement"),u=i>0,d=ru.useRef(!1),f=ru.useRef(null),m=ru.useRef(null),h=ru.useRef(null),p=ru.useRef(!1),g=ru.useRef(null),x=Xu(),y=eu(),v=ke(()=>{let L=h.current;L&&(L.element.style.overflowAnchor=L.overflowAnchor,L.element.style.paddingBottom=L.paddingBottom,L.element.style.scrollPaddingBottom=L.scrollPaddingBottom,h.current=null)}),S=ke((L,q)=>{let P=Math.max(0,Math.ceil(q)),V=h.current;if(V&&!V.element.isConnected&&(v(),V=null),P===0){v();return}if(V&&V.element!==L&&(v(),V=null),!V){let F=Pr(L);V={element:L,overflowAnchor:L.style.overflowAnchor,paddingBottom:L.style.paddingBottom,scrollPaddingBottom:L.style.scrollPaddingBottom,computedPaddingBottom:Number.parseFloat(F.paddingBottom)||0,computedScrollPaddingBottom:Number.parseFloat(F.scrollPaddingBottom)||0},h.current=V}L.style.overflowAnchor="none",L.style.paddingBottom=`${P+Math.max(V.computedPaddingBottom,E_)}px`,L.style.scrollPaddingBottom=`${V.computedScrollPaddingBottom+E_}px`}),C=ke((L,q)=>{let V=Tn(L).matchMedia?.("(prefers-reduced-motion: reduce)")?.matches?"auto":"smooth";L.scrollTo({top:q,behavior:V})}),R=ke(()=>{d.current=!1,f.current=null});ru.useEffect(()=>{if(!a||!r){m.current=null,v(),x.cancel();return}if(!l){v();return}let L=en(l),q=Tn(l),P=q.visualViewport,V=null,F=0,se=0,B=-1,oe=-1,G=null,re=()=>{if(!P||P.scale!==1)return null;let le=q.innerHeight,ve=P.height;if(le-ve>WB)oe=ve;else if(Math.abs(ve-oe)>WB)return oe=-1,null;G||(G=L.createElement("div"),G.style.cssText="position:fixed;top:0;height:100svh;visibility:hidden",L.body.appendChild(G));let me=G.offsetHeight-ve<=WB,ut=Math.max(0,P.offsetTop);return{top:ut,bottom:me?le:Math.min(le,ut+ve),resizing:me&&Math.abs(le-ve)>=1}};g.current=re;let ge=le=>{l.style.setProperty(ZB,`${Math.max(0,Math.ceil(le))}px`)},qe=q.scrollX,bt=q.scrollY,Xe=()=>o!==!0||u||!m.current||q.scrollX===qe&&q.scrollY===bt||re()==null?!1:(q.scrollTo({left:qe,top:bt,behavior:"instant"}),!0),W=null,ie=()=>{W?.(),W=null},Ne=(le,ve)=>{ie();let me=le.getBoundingClientRect();W=_oe(le,(ve.top+ve.bottom-me.top-me.bottom)/2)},Ue=()=>{ie();let le=m.current;if(u||!le||!yt(l,le)){ge(0),v();return}Xe();let ve=re();if(!ve){ge(0),v();return}ge(Math.max(0,q.innerHeight-ve.bottom));let me=TEe(le,l);if(!me){v();return}let ut=me.getBoundingClientRect(),mn=Math.min(ut.bottom,ve.bottom),ra=Math.max(0,ut.bottom-ve.bottom);S(me,ra);let he=Math.max(0,me.scrollHeight-me.clientHeight);if(he<=0)return;let Sn=Math.max(ut.top,ve.top)+E_,Vn=mn-E_;if(Vn<=Sn)return;let X=le.getBoundingClientRect(),_e=me.scrollTop+(X.top+X.bottom-Sn-Vn)/2,je=Math.round(Ko(_e,0,he));if(V===me&&!ve.resizing&&Math.abs(F-je)<=1){if(B>=0){let xt=me.scrollTop;if(Math.abs(xt-je)<=1)return;if(xt!==B){B=xt;return}}}else{let xt=V===me?se+1:1;if(V=me,F=je,se=xt,B=-1,xt<=xEe){x.request(Ue);return}}V=me,F=je,se=0,B=me.scrollTop,C(me,je)},Gt=()=>{x.request(Ue)},Ae=()=>{let le=bEe,ve=()=>{Ue(),le-=1,le>0&&y.start(Coe,ve)};y.start(Coe,ve)},Lt=()=>{m.current=null,oe=-1,y.clear(),Gt()},At=le=>{if(u)return!1;let ve=D_(le);return!ve||!yt(l,ve)?!1:(m.current!==ve&&(V=null),m.current=ve,!0)},Hn=le=>{let ve=m.current;W&&ve&&ve===gr(le)&&ve.focus({preventScroll:!0})},$e=le=>{if(p.current=!1,ie(),!At(gr(le))){Lt();return}re()!=null&&Ae(),Gt()},J=le=>{if(!p.current){if(At(le.relatedTarget)){let ve=m.current,me=re();ve&&me&&Ne(ve,me),Gt();return}Lt()}},ue=()=>{(m.current||At(mo(L)))&&Gt()},Ge=[];P&&Ge.push(jt(P,"resize",ue),jt(P,"scroll",ue),jt(q,"resize",ue));let Et=()=>{Xe()&&Gt()},dt=()=>{m.current&&x.cancel(),y.clear(),V=null};return Ge.push(jt(L,"focus",Hn,!0),jt(L,"focusin",$e,!0),jt(L,"focusout",J,!0),jt(q,"scroll",Et),jt(L,"pointerdown",dt,!0)),At(mo(L))&&Gt(),()=>{Ge.forEach(le=>le()),ie(),m.current=null,v(),x.cancel(),y.clear(),g.current=null,G?.remove(),l.style.removeProperty(ZB)}},[C,x,y,o,a,u,r,v,l,S]);let I=ke(L=>{let q=L.touches[0];d.current=!1,f.current={x:q.clientX,y:q.clientY}}),N=ke(L=>{let q=L.touches[0],P=f.current;!q||!P||d.current||(Math.abs(q.clientX-P.x)>koe||Math.abs(q.clientY-P.y)>koe)&&(d.current=!0)}),k=ke(L=>{if(!r||!a||u||!l||!f.current||d.current){R();return}let q=L.changedTouches[0]??L.touches[0],P=l.getRootNode(),V=gr(L.nativeEvent),F=q?kEe(P,q.clientX,q.clientY):null;if(F===Toe){R();return}let se=q&&(F??wEe(V));if(se&&(!yt(l,se.focusTarget)||!yt(l,se.clickTarget))){R();return}if(se){let{clickTarget:B,focusTarget:oe}=se,G=Tn(oe);if(G.visualViewport&&G.visualViewport.scale!==1){R();return}if(mo(en(oe))===oe&&(!G.visualViewport||g.current?.()!=null)){R();return}L.preventDefault(),p.current=!0;try{IEe(oe)}finally{p.current=!1}REe(B,q),B!==oe&&mo(en(oe))===oe&&oe.focus({preventScroll:!0}),R();return}R()}),z=ru.useMemo(()=>({onTouchStart:I,onTouchMove:N,onTouchEnd:k,onTouchCancel:R}),[k,N,I,R]);return(0,Ioe.jsx)(FB.Provider,{value:z,children:t})}function Roe(e){if(e.isContentEditable)return!0;let t=Tn(e);return e instanceof t.HTMLTextAreaElement||e instanceof t.HTMLInputElement&&SEe.has(e.type)?!e.matches(":disabled"):!1}function D_(e){if(!En(e))return null;if(Roe(e))return e.isContentEditable?CEe(e):e;let n=Xs(e,"label")?.control??null;return En(n)&&Roe(n)?n:null}function wEe(e){if(!En(e))return null;let t=D_(e);return t?{focusTarget:t,clickTarget:e}:null}function CEe(e){let t=e;for(;t.parentElement?.isContentEditable;)t=t.parentElement;return t}function kEe(e,t,n){let r=df(e,t,n);if(En(r)){let a=D_(r);if(a)return{focusTarget:a,clickTarget:r}}if(nne(r)||Xs(r,"label")!=null)return Toe;for(let[a,o]of[[0,P_],[0,-P_],[P_,0],[-P_,0]]){let i=D_(df(e,t+a,n+o));if(i)return{focusTarget:i,clickTarget:i}}return null}function REe(e,t){let n=Tn(e),r=n.PointerEvent??n.MouseEvent;e.dispatchEvent(new r("click",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY,detail:1,view:n}))}function IEe(e){let t=mo(en(e))===e,n=_oe(e,-2e3);try{t&&e.blur(),e.focus({preventScroll:!0})}finally{n()}}function _oe(e,t){let n=e.style.opacity,r=e.style.transform,a=e.style.transition;return e.style.transition="none",e.style.opacity="0",e.style.transform=`translateY(${t}px)`,()=>{e.style.opacity=n,e.style.transform=r,e.style.transition=a}}function TEe(e,t){let n=Ys(e);return tp(n,t,"vertical")??tp(n,t,"vertical",!0)}var $_=class extends r_{constructor(){super(Ire(),"Dialog",!1)}open(t){this.openByTrigger(t)}openWithPayload(t){let n=this.attachedStore;n!==null&&(n.set("payload",t),n.setOpen(!0,qn(yn.imperativeAction)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}};var tC=class extends $_{};function Loe(){return new tC}var el=b($(),1);function NEe(){let e=0,t;return{acquire(){if(!(typeof document>"u")){if(e===0){let n=document.documentElement,r=document.body,a=typeof window>"u"?0:window.scrollX||window.pageXOffset||0,o=typeof window>"u"?0:window.scrollY||window.pageYOffset||0;t={bodyHeight:r.style.height,bodyLeft:r.style.left,bodyOverflow:r.style.overflow,bodyOverscroll:r.style.overscrollBehavior,bodyPosition:r.style.position,bodyRight:r.style.right,bodyTop:r.style.top,bodyWidth:r.style.width,htmlHeight:n.style.height,htmlOverflow:n.style.overflow,htmlOverscroll:n.style.overscrollBehavior,scrollX:a,scrollY:o},n.style.overflow="hidden",n.style.overscrollBehavior="none",n.style.height="100%",r.style.overflow="hidden",r.style.overscrollBehavior="none",r.style.position="fixed",r.style.top=`-${o}px`,r.style.left=`-${a}px`,r.style.right="0",r.style.width="100%",r.style.height="100%"}e+=1}},release(){if(typeof document>"u"||e===0||(e=Math.max(0,e-1),e>0||t===void 0))return;let n=document.documentElement,r=document.body;n.style.overflow=t.htmlOverflow,n.style.overscrollBehavior=t.htmlOverscroll,n.style.height=t.htmlHeight,r.style.overflow=t.bodyOverflow,r.style.overscrollBehavior=t.bodyOverscroll,r.style.position=t.bodyPosition,r.style.top=t.bodyTop,r.style.left=t.bodyLeft,r.style.right=t.bodyRight,r.style.width=t.bodyWidth,r.style.height=t.bodyHeight;let{scrollX:a,scrollY:o}=t;t=void 0,typeof window<"u"&&window.scrollTo(a,o)}}}var Aoe=NEe();function np(){Aoe.acquire()}function ap(){Aoe.release()}var gc=b(w(),1),Eoe=(0,el.createContext)(null);function _Ee(e){let t=new MutationObserver(e);return t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()}function M_(e){let[t,n]=(0,el.useState)(!1),r=(0,el.useRef)(!1),a=(0,el.useRef)(null),o=(0,el.useSyncExternalStore)(_Ee,()=>{let i=document.querySelectorAll("[data-dashboard-modal]"),s=i[i.length-1];return a.current?s===a.current:!s},()=>!0);return(0,el.useEffect)(()=>(np(),n(!0),ap),[]),(0,gc.jsx)(Eoe,{value:{closingRef:r,popupRef:a,topmost:o},children:(0,gc.jsx)(rd.Root,{open:t,modal:o?"trap-focus":!1,disablePointerDismissal:!o,swipeDirection:e.side==="bottom"?"down":"right",onOpenChange:(i,s)=>{if(!i&&!o){s.cancel();return}r.current=!i,n(i)},onOpenChangeComplete:i=>{!i&&r.current&&e.onClose()},children:e.children})})}var Poe=rd.Close;function O_(e){let t=(0,el.useContext)(Eoe),n=t?.popupRef,r=(0,el.useRef)(null);return(0,gc.jsxs)(gc.Fragment,{children:[(0,gc.jsx)("div",{ref:r,className:"contents"}),(0,gc.jsxs)(rd.Portal,{container:r,children:[(0,gc.jsx)(rd.Backdrop,{className:"fixed inset-0 z-50 bg-dashboard-overlay opacity-[calc(1-var(--drawer-swipe-progress,0))] transition-opacity duration-180 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 data-[swiping]:transition-none motion-reduce:transition-none"}),(0,gc.jsx)(rd.Viewport,{className:"pointer-events-none fixed inset-0 z-50",children:(0,gc.jsx)(rd.Popup,{ref:n,"aria-modal":t?.topmost?!0:void 0,"aria-label":e.label,"aria-labelledby":e.titleId,"data-dashboard-modal":"","data-base-ui-swipe-ignore":e.side==="right"?"":void 0,finalFocus:()=>!!(t?.closingRef.current&&t.topmost),initialFocus:()=>{let a=document.querySelectorAll("[data-dashboard-modal]");return a[a.length-1]!==n?.current?!1:e.initialFocusRef?.current??!0},className:T("pointer-events-auto grid min-h-0 min-w-0 grid-rows-[auto_minmax(0,1fr)] bg-dashboard-bg-elevated outline-none transition-[opacity,transform] duration-180 ease-[cubic-bezier(0.2,0.8,0.2,1)] data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 data-[swiping]:transition-none motion-reduce:transition-none",e.side==="bottom"?"absolute inset-x-0 bottom-0 mx-auto h-[85dvh] max-h-full w-full max-w-2xl [transform:translateY(var(--drawer-swipe-movement-y,0px))] rounded-t-2xl border border-b-0 border-dashboard-border-strong shadow-[0_-12px_40px_rgba(0,0,0,0.25)] data-[ending-style]:[transform:translateY(100%)] data-[starting-style]:[transform:translateY(2.5rem)]":"absolute right-0 top-0 h-full w-full shadow-[-12px_0_40px_rgba(0,0,0,0.25)] data-[ending-style]:[transform:translateX(2.5rem)] data-[starting-style]:[transform:translateX(2.5rem)] md:border-l md:border-dashboard-border-strong",e.className),children:e.children})})]})]})}var z_=rd.Content;var ou=b(w(),1);function cs(e){let t=(0,Doe.useRef)(null);return(0,ou.jsx)(M_,{onClose:e.onClose,side:"right",children:(0,ou.jsxs)(O_,{initialFocusRef:t,titleId:e.titleId,side:"right",className:T(e.width==="wide"?"md:w-[min(760px,94vw)]":e.width==="narrow"?"md:w-[min(440px,94vw)]":"md:w-[min(560px,94vw)]"),children:[(0,ou.jsxs)("header",{className:"relative grid grid-cols-[minmax(0,1fr)_auto] gap-3 border-b border-dashboard-border bg-dashboard-bg-elevated px-4 py-3 pt-[max(0.75rem,env(safe-area-inset-top))] md:px-5",children:[(0,ou.jsx)("div",{className:"min-w-0",children:e.header}),(0,ou.jsxs)("div",{className:"flex items-start gap-1.5",children:[e.actions,(0,ou.jsx)(Poe,{render:(0,ou.jsx)(ye,{ref:t,"aria-label":e.closeLabel,size:"icon",title:"Close"}),children:(0,ou.jsx)(so,{"aria-hidden":"true",size:15,strokeWidth:2.25})})]})]}),(0,ou.jsx)(z_,{className:"min-h-0 overflow-auto px-4 py-4 pb-[max(1rem,env(safe-area-inset-bottom))] md:px-5",children:e.children})]})},e.openKey)}var Sse=b($(),1);var ma=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function LEe(e){return r6(e)}function r6(e){return Array.isArray(e)?AEe(e):e instanceof RegExp?e:typeof e=="object"?EEe(e):e}function AEe(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=r6(e[n]);return t}function EEe(e){let t={};for(let n in e)t[n]=r6(e[n]);return t}function Hoe(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function Voe(e){let t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Voe(e.substring(0,e.length-1)):e.substr(~t+1)}var KB=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,U_=class{static hasCaptures(e){return e===null?!1:(KB.lastIndex=0,KB.test(e))}static replaceCaptures(e,t,n){return e.replace(KB,(r,a,o,i)=>{let s=n[parseInt(a||o,10)];if(s){let l=t.substring(s.start,s.end);for(;l[0]===".";)l=l.substring(1);switch(i){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function qoe(e,t){return e<t?-1:e>t?1:0}function Goe(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let a=0;a<n;a++){let o=qoe(e[a],t[a]);if(o!==0)return o}return 0}return n-r}function $oe(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Zoe(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Woe=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},rC=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme($Ee(e),t)}static createFromParsedTheme(e,t){return OEe(e,t)}_cachedMatchRoot=new Woe(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,r=this._cachedMatchRoot.get(t).find(a=>PEe(e.parent,a.parentScopes));return r?new Koe(r.fontStyle,r.foreground,r.background):null}},JB=class j_{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(let r of n)t=new j_(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new j_(n,t[r]);return n}push(t){return new j_(this,t)}getSegments(){let t=this,n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){let n=[],r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function PEe(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],a=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],a=!0}for(;e&&!DEe(e.scopeName,r);){if(a)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function DEe(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Koe=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function $Ee(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let a=0,o=t.length;a<o;a++){let i=t[a];if(!i.settings)continue;let s;if(typeof i.scope=="string"){let f=i.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),s=f.split(",")}else Array.isArray(i.scope)?s=i.scope:s=[""];let l=-1;if(typeof i.settings.fontStyle=="string"){l=0;let f=i.settings.fontStyle.split(" ");for(let m=0,h=f.length;m<h;m++)switch(f[m]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let u=null;typeof i.settings.foreground=="string"&&$oe(i.settings.foreground)&&(u=i.settings.foreground);let d=null;typeof i.settings.background=="string"&&$oe(i.settings.background)&&(d=i.settings.background);for(let f=0,m=s.length;f<m;f++){let p=s[f].trim().split(" "),g=p[p.length-1],x=null;p.length>1&&(x=p.slice(0,p.length-1),x.reverse()),n[r++]=new MEe(g,x,a,l,u,d)}}return n}var MEe=class{constructor(e,t,n,r,a,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=a,this.background=o}},di=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(di||{});function OEe(e,t){e.sort((l,u)=>{let d=qoe(l.scope,u.scope);return d!==0||(d=Goe(l.parentScopes,u.parentScopes),d!==0)?d:l.index-u.index});let n=0,r="#000000",a="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(a=l.background)}let o=new zEe(t),i=new Koe(n,o.getId(r),o.getId(a)),s=new jEe(new YB(0,null,-1,0,0),[]);for(let l=0,u=e.length;l<u;l++){let d=e[l];s.insert(0,d.scope,d.parentScopes,d.fontStyle,o.getId(d.foreground),o.getId(d.background))}return new rC(o,i,s)}var zEe=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},UEe=Object.freeze([]),YB=class Joe{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,a,o){this.scopeDepth=t,this.parentScopes=n||UEe,this.fontStyle=r,this.foreground=a,this.background=o}clone(){return new Joe(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,a=t.length;r<a;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,a){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),a!==0&&(this.background=a)}},jEe=class XB{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,a=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[a]===">"&&a++,!(r>=t.parentScopes.length||a>=n.parentScopes.length);){let o=n.parentScopes[a].length-t.parentScopes[r].length;if(o!==0)return o;r++,a++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),a,o;if(r===-1?(a=t,o=""):(a=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(a))return this._children[a].match(o)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(XB._cmpBySpecificity),n}insert(t,n,r,a,o,i){if(n===""){this._doInsertHere(t,r,a,o,i);return}let s=n.indexOf("."),l,u;s===-1?(l=n,u=""):(l=n.substring(0,s),u=n.substring(s+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new XB(this._mainRule.clone(),YB.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(t+1,u,r,a,o,i)}_doInsertHere(t,n,r,a,o){if(n===null){this._mainRule.acceptOverwrite(t,r,a,o);return}for(let i=0,s=this._rulesWithParentScopes.length;i<s;i++){let l=this._rulesWithParentScopes[i];if(Goe(l.parentScopes,n)===0){l.acceptOverwrite(t,r,a,o);return}}r===-1&&(r=this._mainRule.fontStyle),a===0&&(a=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new YB(t,n,r,a,o))}},Cg=class vc{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){let n=vc.getLanguageId(t),r=vc.getTokenType(t),a=vc.getFontStyle(t),o=vc.getForeground(t),i=vc.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:a,foreground:o,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,a,o,i,s){let l=vc.getLanguageId(t),u=vc.getTokenType(t),d=vc.containsBalancedBrackets(t)?1:0,f=vc.getFontStyle(t),m=vc.getForeground(t),h=vc.getBackground(t);return n!==0&&(l=n),r!==8&&(u=r),a!==null&&(d=a?1:0),o!==-1&&(f=o),i!==0&&(m=i),s!==0&&(h=s),(l<<0|u<<8|d<<10|f<<11|m<<15|h<<24)>>>0}};function F_(e,t){let n=[],r=BEe(e),a=r.next();for(;a!==null;){let l=0;if(a.length===2&&a.charAt(1)===":"){switch(a.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${a} in scope selector`)}a=r.next()}let u=i();if(n.push({matcher:u,priority:l}),a!==",")break;a=r.next()}return n;function o(){if(a==="-"){a=r.next();let l=o();return u=>!!l&&!l(u)}if(a==="("){a=r.next();let l=s();return a===")"&&(a=r.next()),l}if(Moe(a)){let l=[];do l.push(a),a=r.next();while(Moe(a));return u=>t(l,u)}return null}function i(){let l=[],u=o();for(;u;)l.push(u),u=o();return d=>l.every(f=>f(d))}function s(){let l=[],u=i();for(;u&&(l.push(u),a==="|"||a===",");){do a=r.next();while(a==="|"||a===",");u=i()}return d=>l.some(f=>f(d))}}function Moe(e){return!!e&&!!e.match(/[\w\.:]+/)}function BEe(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Qoe(e){typeof e.dispose=="function"&&e.dispose()}var oC=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},FEe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},HEe=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},VEe=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new oC(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new HEe;for(let n of e)qEe(n,this.initialScopeName,this.repo,t);for(let n of t.references)if(n instanceof oC){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function qEe(e,t,n,r){let a=n.lookup(e.scopeName);if(!a){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}let o=n.lookup(t);e instanceof oC?B_({baseGrammar:o,selfGrammar:a},r):e6(e.ruleName,{baseGrammar:o,selfGrammar:a,repository:a.repository},r);let i=n.injections(e.scopeName);if(i)for(let s of i)r.add(new oC(s))}function e6(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];H_([r],t,n)}}function B_(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&H_(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&H_(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function H_(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let a=r.repository?Hoe({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&H_(r.patterns,{...t,repository:a},n);let o=r.include;if(!o)continue;let i=Yoe(o);switch(i.kind){case 0:B_({...t,selfGrammar:t.baseGrammar},n);break;case 1:B_(t,n);break;case 2:e6(i.ruleName,{...t,repository:a},n);break;case 3:case 4:let s=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){let l={baseGrammar:t.baseGrammar,selfGrammar:s,repository:a};i.kind===4?e6(i.ruleName,l,n):B_(l,n)}else i.kind===4?n.add(new FEe(i.scopeName,i.ruleName)):n.add(new oC(i.scopeName));break}}}var GEe=class{kind=0},ZEe=class{kind=1},WEe=class{constructor(e){this.ruleName=e}kind=2},KEe=class{constructor(e){this.scopeName=e}kind=3},JEe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Yoe(e){if(e==="$base")return new GEe;if(e==="$self")return new ZEe;let t=e.indexOf("#");if(t===-1)return new KEe(e);if(t===0)return new WEe(e.substring(1));{let n=e.substring(0,t),r=e.substring(t+1);return new JEe(n,r)}}var QEe=/\\(\d+)/,Ooe=/\\(\d+)/g;var YEe=-1,Xoe=-2;var lC=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=U_.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=U_.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Voe(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:U_.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:U_.replaceCaptures(this._contentName,e,t)}},XEe=class extends lC{retokenizeCapturedWithRuleId;constructor(e,t,n,r,a){super(e,t,n,r),this.retokenizeCapturedWithRuleId=a}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},ePe=class extends lC{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,a){super(e,t,n,null),this._match=new iC(r,this.id),this.captures=a,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new sC,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},zoe=class extends lC{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,a){super(e,t,n,r),this.patterns=a.patterns,this.hasMissingPatterns=a.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new sC,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},t6=class extends lC{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,a,o,i,s,l,u){super(e,t,n,r),this._begin=new iC(a,this.id),this.beginCaptures=o,this._end=new iC(i||"\uFFFF",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new sC;for(let n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},V_=class extends lC{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,a,o,i,s,l){super(e,t,n,r),this._begin=new iC(a,this.id),this.beginCaptures=o,this.whileCaptures=s,this._while=new iC(i,Xoe),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new sC;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new sC,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"\uFFFF"),this._cachedCompiledWhilePatterns}},eie=class Oi{static createCaptureRule(t,n,r,a,o){return t.registerRule(i=>new XEe(n,i,r,a,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(a=>{if(t.id=a,t.match)return new ePe(t.$vscodeTextmateLocation,t.id,t.name,t.match,Oi._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Hoe({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new zoe(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Oi._compilePatterns(o,n,r))}return t.while?new V_(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Oi._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,Oi._compileCaptures(t.whileCaptures||t.captures,n,r),Oi._compilePatterns(t.patterns,n,r)):new t6(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Oi._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,Oi._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,Oi._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let a=[];if(t){let o=0;for(let i in t){if(i==="$vscodeTextmateLocation")continue;let s=parseInt(i,10);s>o&&(o=s)}for(let i=0;i<=o;i++)a[i]=null;for(let i in t){if(i==="$vscodeTextmateLocation")continue;let s=parseInt(i,10),l=0;t[i].patterns&&(l=Oi.getCompiledRuleId(t[i],n,r)),a[s]=Oi.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,l)}}return a}static _compilePatterns(t,n,r){let a=[];if(t)for(let o=0,i=t.length;o<i;o++){let s=t[o],l=-1;if(s.include){let u=Yoe(s.include);switch(u.kind){case 0:case 1:l=Oi.getCompiledRuleId(r[s.include],n,r);break;case 2:let d=r[u.ruleName];d&&(l=Oi.getCompiledRuleId(d,n,r));break;case 3:case 4:let f=u.scopeName,m=u.kind===4?u.ruleName:null,h=n.getExternalGrammar(f,r);if(h)if(m){let p=h.repository[m];p&&(l=Oi.getCompiledRuleId(p,n,h.repository))}else l=Oi.getCompiledRuleId(h.repository.$self,n,h.repository);break}}else l=Oi.getCompiledRuleId(s,n,r);if(l!==-1){let u=n.getRule(l),d=!1;if((u instanceof zoe||u instanceof t6||u instanceof V_)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;a.push(l)}}return{patterns:a,hasMissingPatterns:(t?t.length:0)!==a.length}}},iC=class tie{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t=="string"){let r=t.length,a=0,o=[],i=!1;for(let s=0;s<r;s++)if(t.charAt(s)==="\\"&&s+1<r){let u=t.charAt(s+1);u==="z"?(o.push(t.substring(a,s)),o.push("$(?!\\n)(?<!\\n)"),a=s+2):(u==="A"||u==="G")&&(i=!0),s++}this.hasAnchor=i,a===0?this.source=t:(o.push(t.substring(a,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=QEe.test(this.source):this.hasBackReferences=!1}clone(){return new tie(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(a=>t.substring(a.start,a.end));return Ooe.lastIndex=0,this.source.replace(Ooe,(a,o)=>Zoe(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],a=[],o,i,s,l;for(o=0,i=this.source.length;o<i;o++)s=this.source.charAt(o),t[o]=s,n[o]=s,r[o]=s,a[o]=s,s==="\\"&&o+1<i&&(l=this.source.charAt(o+1),l==="A"?(t[o+1]="\uFFFF",n[o+1]="\uFFFF",r[o+1]="A",a[o+1]="A"):l==="G"?(t[o+1]="\uFFFF",n[o+1]="G",r[o+1]="\uFFFF",a[o+1]="G"):(t[o+1]=l,n[o+1]=l,r[o+1]=l,a[o+1]=l),o++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:a.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},sC=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Uoe(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(a=>a.resolveAnchors(t,n));return new Uoe(e,r,this._items.map(a=>a.ruleId))}},Uoe=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
72
72
|
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},QB=class{constructor(e,t){this.languageId=e,this.tokenType=t}},tPe=class n6{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new QB(t,8),this._embeddedLanguagesMatcher=new nPe(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?n6._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new QB(0,0);_getBasicScopeAttributes=new Woe(t=>{let n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new QB(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){let n=t.match(n6.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},nPe=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([n,r])=>Zoe(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Eft={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},nie=!1,joe=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function aie(e,t,n,r,a,o,i,s){let l=t.content.length,u=!1,d=-1;if(i){let h=aPe(e,t,n,r,a,o);a=h.stack,r=h.linePos,n=h.isFirstLine,d=h.anchorPosition}let f=Date.now();for(;!u;){if(s!==0&&Date.now()-f>s)return new joe(a,!0);m()}return new joe(a,!1);function m(){let h=rPe(e,t,n,r,a,d);if(!h){o.produce(a,l),u=!0;return}let p=h.captureIndices,g=h.matchedRuleId,x=p&&p.length>0?p[0].end>r:!1;if(g===YEe){let y=a.getRule(e);o.produce(a,p[0].start),a=a.withContentNameScopesList(a.nameScopesList),nC(e,t,n,a,o,y.endCaptures,p),o.produce(a,p[0].end);let v=a;if(a=a.parent,d=v.getAnchorPos(),!x&&v.getEnterPos()===r){a=v,o.produce(a,l),u=!0;return}}else{let y=e.getRule(g);o.produce(a,p[0].start);let v=a,S=y.getName(t.content,p),C=a.contentNameScopesList.pushAttributed(S,e);if(a=a.push(g,r,d,p[0].end===l,null,C,C),y instanceof t6){let R=y;nC(e,t,n,a,o,R.beginCaptures,p),o.produce(a,p[0].end),d=p[0].end;let I=R.getContentName(t.content,p),N=C.pushAttributed(I,e);if(a=a.withContentNameScopesList(N),R.endHasBackReferences&&(a=a.withEndRule(R.getEndWithResolvedBackReferences(t.content,p))),!x&&v.hasSameRuleAs(a)){a=a.pop(),o.produce(a,l),u=!0;return}}else if(y instanceof V_){let R=y;nC(e,t,n,a,o,R.beginCaptures,p),o.produce(a,p[0].end),d=p[0].end;let I=R.getContentName(t.content,p),N=C.pushAttributed(I,e);if(a=a.withContentNameScopesList(N),R.whileHasBackReferences&&(a=a.withEndRule(R.getWhileWithResolvedBackReferences(t.content,p))),!x&&v.hasSameRuleAs(a)){a=a.pop(),o.produce(a,l),u=!0;return}}else if(nC(e,t,n,a,o,y.captures,p),o.produce(a,p[0].end),a=a.pop(),!x){a=a.safePop(),o.produce(a,l),u=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function aPe(e,t,n,r,a,o){let i=a.beginRuleCapturedEOL?0:-1,s=[];for(let l=a;l;l=l.pop()){let u=l.getRule(e);u instanceof V_&&s.push({rule:u,stack:l})}for(let l=s.pop();l;l=s.pop()){let{ruleScanner:u,findOptions:d}=sPe(l.rule,e,l.stack.endRule,n,r===i),f=u.findNextMatchSync(t,r,d);if(f){if(f.ruleId!==Xoe){a=l.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(o.produce(l.stack,f.captureIndices[0].start),nC(e,t,n,l.stack,o,l.rule.whileCaptures,f.captureIndices),o.produce(l.stack,f.captureIndices[0].end),i=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{a=l.stack.pop();break}}return{stack:a,linePos:r,anchorPosition:i,isFirstLine:n}}function rPe(e,t,n,r,a,o){let i=oPe(e,t,n,r,a,o),s=e.getInjections();if(s.length===0)return i;let l=iPe(s,e,t,n,r,a,o);if(!l)return i;if(!i)return l;let u=i.captureIndices[0].start,d=l.captureIndices[0].start;return d<u||l.priorityMatch&&d===u?l:i}function oPe(e,t,n,r,a,o){let i=a.getRule(e),{ruleScanner:s,findOptions:l}=rie(i,e,a.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function iPe(e,t,n,r,a,o,i){let s=Number.MAX_VALUE,l=null,u,d=0,f=o.contentNameScopesList.getScopeNames();for(let m=0,h=e.length;m<h;m++){let p=e[m];if(!p.matcher(f))continue;let g=t.getRule(p.ruleId),{ruleScanner:x,findOptions:y}=rie(g,t,null,r,a===i),v=x.findNextMatchSync(n,a,y);if(!v)continue;let S=v.captureIndices[0].start;if(!(S>=s)&&(s=S,l=v.captureIndices,u=v.ruleId,d=p.priority,s===a))break}return l?{priorityMatch:d===-1,captureIndices:l,matchedRuleId:u}:null}function rie(e,t,n,r,a){if(nie){let i=e.compile(t,n),s=oie(r,a);return{ruleScanner:i,findOptions:s}}return{ruleScanner:e.compileAG(t,n,r,a),findOptions:0}}function sPe(e,t,n,r,a){if(nie){let i=e.compileWhile(t,n),s=oie(r,a);return{ruleScanner:i,findOptions:s}}return{ruleScanner:e.compileWhileAG(t,n,r,a),findOptions:0}}function oie(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function nC(e,t,n,r,a,o,i){if(o.length===0)return;let s=t.content,l=Math.min(o.length,i.length),u=[],d=i[0].end;for(let f=0;f<l;f++){let m=o[f];if(m===null)continue;let h=i[f];if(h.length===0)continue;if(h.start>d)break;for(;u.length>0&&u[u.length-1].endPos<=h.start;)a.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?a.produceFromScopes(u[u.length-1].scopes,h.start):a.produce(r,h.start),m.retokenizeCapturedWithRuleId){let g=m.getName(s,i),x=r.contentNameScopesList.pushAttributed(g,e),y=m.getContentName(s,i),v=x.pushAttributed(y,e),S=r.push(m.retokenizeCapturedWithRuleId,h.start,-1,!1,null,x,v),C=e.createOnigString(s.substring(0,h.end));aie(e,C,n&&h.start===0,h.start,S,a,!1,0),Qoe(C);continue}let p=m.getName(s,i);if(p!==null){let x=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);u.push(new lPe(x,h.end))}}for(;u.length>0;)a.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var lPe=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function cPe(e,t,n,r,a,o,i,s){return new dPe(e,t,n,r,a,o,i,s)}function Boe(e,t,n,r,a){let o=F_(t,q_),i=eie.getCompiledRuleId(n,r,a.repository);for(let s of o)e.push({debugSelector:t,matcher:s.matcher,ruleId:i,grammar:a,priority:s.priority})}function q_(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let a=n;a<t.length;a++)if(uPe(t[a],r))return n=a+1,!0;return!1})}function uPe(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var dPe=class{constructor(e,t,n,r,a,o,i,s){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=s,this._basicScopeAttributesProvider=new tPe(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Foe(t,null),this._injections=null,this._tokenTypeMatchers=[],a)for(let l of Object.keys(a)){let u=F_(l,q_);for(let d of u)this._tokenTypeMatchers.push({matcher:d.matcher,type:a[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:a=>a===this._rootScopeName?this._grammar:this.getExternalGrammar(a),injections:a=>this._grammarRepository.injections(a)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let a=r.injections;if(a)for(let i in a)Boe(t,i,a[i],this,r);let o=this._grammarRepository.injections(n);o&&o.forEach(i=>{let s=this.getExternalGrammar(i);if(s){let l=s.injectionSelector;l&&Boe(t,l,s,this,s)}})}return t.sort((a,o)=>a.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Foe(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=eie.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let a;if(!t||t===a6.NULL){a=!0;let u=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),f=Cg.set(0,u.languageId,u.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),m=this.getRule(this._rootId).getName(null,null),h;m?h=aC.createRootAndLookUpScopeName(m,f,this):h=aC.createRoot("unknown",f),t=new a6(null,this._rootId,-1,-1,!1,null,h,h)}else a=!1,t.reset();e=e+`
|
|
73
73
|
`;let o=this.createOnigString(e),i=o.content.length,s=new mPe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=aie(this,o,a,0,t,s,!0,r);return Qoe(o),{lineLength:i,lineTokens:s,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Foe(e,t){return e=LEe(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var aC=class od{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,a=t?.scopePath??null;for(let o of n)a=JB.push(a,o.scopeNames),r=new od(r,a,o.encodedTokenAttributes);return r}static createRoot(t,n){return new od(null,new JB(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let a=r.getMetadataForScope(t),o=new JB(null,t),i=r.themeProvider.themeMatch(o),s=od.mergeAttributes(n,a,i);return new od(null,o,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return od.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let a=-1,o=0,i=0;return r!==null&&(a=r.fontStyle,o=r.foregroundId,i=r.backgroundId),Cg.set(t,n.languageId,n.tokenType,null,a,o,i)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return od._pushAttributed(this,t,n);let r=t.split(/ /g),a=this;for(let o of r)a=od._pushAttributed(a,o,n);return a}static _pushAttributed(t,n,r){let a=r.getMetadataForScope(n),o=t.scopePath.push(n),i=r.themeProvider.themeMatch(o),s=od.mergeAttributes(t.tokenAttributes,a,i);return new od(t,o,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){let n=[],r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},a6=class wg{constructor(t,n,r,a,o,i,s,l){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=s,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=a}_stackElementBrand=void 0;static NULL=new wg(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:wg._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?aC.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){wg._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,a,o,i,s){return new wg(this,t,n,r,a,o,i,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){let t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new wg(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=aC.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new wg(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,aC.fromExtension(r,n.contentNameScopesList))}},fPe=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):F_(n,q_).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>F_(n,q_).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},mPe=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,a=!1;if(this.balancedBracketSelectors?.matchesAlways&&(a=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let o=e?.getScopeNames()??[];for(let i of this._tokenTypeOverrides)i.matcher(o)&&(r=Cg.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(a=this.balancedBracketSelectors.match(o))}if(a&&(r=Cg.set(r,0,8,a,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let r=0,a=this._binaryTokens.length;r<a;r++)n[r]=this._binaryTokens[r];return n}},pPe=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,a){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,cPe(e,o,t,n,r,a,this,this._onigLib))}return this._grammars.get(e)}},iie=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new pPe(rC.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(rC.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new fPe(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,a){let o=new VEe(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(i=>this._loadSingleGrammar(i.scopeName)),o.processQueue();return this._grammarForScopeName(e,t,n,r,a)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,a=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,a)}},G_=a6.NULL;function uC(e,t){let n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(let[a,o]of Object.entries(t?.colorReplacements||{}))typeof o=="string"?n[a]=o:a===r&&Object.assign(n,o);return n}function ff(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function die(e){return Array.isArray(e)?e:[e]}async function o6(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function dC(e){return!e||["plaintext","txt","text","plain"].includes(e)}function i6(e){return e==="ansi"||dC(e)}function fC(e){return e==="none"}function s6(e){return fC(e)}var hPe=/(\r?\n)/g;function Rb(e,t=!1){if(e.length===0)return[["",0]];let n=e.split(hPe),r=0,a=[];for(let o=0;o<n.length;o+=2){let i=t?n[o]+(n[o+1]||""):n[o];a.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return a}var sie={light:"#333333",dark:"#bbbbbb"},lie={light:"#fffffe",dark:"#1e1e1e"},cie="__shiki_resolved";function Z_(e){if(e?.[cie])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let s=t.settings?t.settings.find(l=>!l.name&&!l.scope):void 0;s?.settings?.foreground&&(r=s.settings.foreground),s?.settings?.background&&(n=s.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?sie.light:sie.dark),n||(n=t.type==="light"?lie.light:lie.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let a=0,o=new Map;function i(s){if(o.has(s))return o.get(s);a+=1;let l=`#${a.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?i(s):(o.set(s,l),l)}t.settings=t.settings.map(s=>{let l=s.settings?.foreground&&!s.settings.foreground.startsWith("#"),u=s.settings?.background&&!s.settings.background.startsWith("#");if(!l&&!u)return s;let d={...s,settings:{...s.settings}};if(l){let f=i(s.settings.foreground);t.colorReplacements[f]=s.settings.foreground,d.settings.foreground=f}if(u){let f=i(s.settings.background);t.colorReplacements[f]=s.settings.background,d.settings.background=f}return d});for(let s of Object.keys(t.colors||{}))if((s==="editor.foreground"||s==="editor.background"||s.startsWith("terminal.ansi"))&&!t.colors[s]?.startsWith("#")){let l=i(t.colors[s]);t.colorReplacements[l]=t.colors[s],t.colors[s]=l}return Object.defineProperty(t,cie,{enumerable:!1,writable:!1,value:!0}),t}async function fie(e){return[...new Set((await Promise.all(e.filter(t=>!i6(t)).map(async t=>await o6(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function mie(e){return(await Promise.all(e.map(async t=>s6(t)?null:Z_(await o6(t))))).filter(t=>!!t)}function pie(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new ma(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var gPe=class extends iie{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(a=>this.loadTheme(a)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=Z_(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=rC.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=pie(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(a=>a.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(a=>{this._alias[a]=e.name}),this._loadedLanguagesCache=null,t.size)for(let a of t)this._resolvedGrammars.delete(a.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(a.scopeName),this._syncRegistry?._grammars?.delete(a.scopeName),this.loadLanguage(this._langMap.get(a.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let r of e)this.resolveEmbeddedLanguages(r);let t=[...this._langGraph.entries()],n=t.filter(([r,a])=>!a);if(n.length){let r=t.filter(([a,o])=>o?(o.embeddedLanguages||o.embeddedLangs)?.some(i=>n.map(([s])=>s).includes(i)):!1).filter(a=>!n.includes(a));throw new ma(`Missing languages ${n.map(([a])=>`\`${a}\``).join(", ")}, required by ${r.map(([a])=>`\`${a}\``).join(", ")}`)}for(let[r,a]of t)this._resolver.addLanguage(a);for(let[r,a]of t)this.loadLanguage(a)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let n of t)this._langGraph.set(n,this._langMap.get(n))}},vPe=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split("."),n=[];for(let r=1;r<=t.length;r++){let a=t.slice(0,r).join(".");n=[...n,...this._injections.get(a)||[]]}return n}},cC=0;function l6(e){cC+=1,e.warnings!==!1&&cC>=10&&cC%10===0&&console.warn(`[Shiki] ${cC} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new ma("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Z_),a=new gPe(new vPe(e.engine,n),r,n,e.langAlias),o;function i(v){return pie(v,e.langAlias)}function s(v){x();let S=a.getGrammar(typeof v=="string"?v:v.name);if(!S)throw new ma(`Language \`${v}\` not found, you may need to load it first`);return S}function l(v){if(v==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};x();let S=a.getTheme(v);if(!S)throw new ma(`Theme \`${v}\` not found, you may need to load it first`);return S}function u(v){x();let S=l(v);return o!==v&&(a.setTheme(S),o=v),{theme:S,colorMap:a.getColorMap()}}function d(){return x(),a.getLoadedThemes()}function f(){return x(),a.getLoadedLanguages()}function m(...v){x(),a.loadLanguages(v.flat(1))}async function h(...v){return m(await fie(v))}function p(...v){x();for(let S of v.flat(1))a.loadTheme(S)}async function g(...v){return x(),p(await mie(v))}function x(){if(t)throw new ma("Shiki instance has been disposed")}function y(){t||(t=!0,a.dispose(),cC-=1)}return{setTheme:u,getTheme:l,getLanguage:s,getLoadedThemes:d,getLoadedLanguages:f,resolveLangAlias:i,loadLanguage:h,loadLanguageSync:m,loadTheme:g,loadThemeSync:p,dispose:y,[Symbol.dispose]:y}}async function c6(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([mie(e.themes||[]),fie(e.langs||[]),e.engine]);return l6({...e,themes:t,langs:n,engine:r})}var hie=new WeakMap;function mC(e,t){hie.set(e,t)}function Ib(e){return hie.get(e)}var W_=class gie{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new gie(Object.fromEntries(die(n).map(r=>[r,G_])),t)}constructor(...t){if(t.length===2){let[n,r]=t;this.lang=r,this._stacks=n}else{let[n,r,a]=t;this.lang=r,this._stacks={[a]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return yPe(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function yPe(e){let t=[],n=new Set;function r(a){if(n.has(a))return;n.add(a);let o=a?.nameScopesList?.scopeName;o&&t.push(o),a.parent&&r(a.parent)}return r(e),t}function bPe(e,t){if(!(e instanceof W_))throw new ma("Invalid grammar state");return e.getInternalStack(t)}var xPe=/,/,SPe=/ /;function u6(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(dC(e.resolveLangAlias(n.lang||"text"))||fC(r))return Rb(t).map(s=>[{content:s[0],offset:s[1]}]);let{theme:a,colorMap:o}=e.setTheme(r),i=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new ma(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(a.name))throw new ma(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return yie(t,i,a,o,n)}function vie(...e){if(e.length===2)return Ib(e[1]);let[t,n,r={}]=e,{lang:a="text",theme:o=t.getLoadedThemes()[0]}=r;if(dC(a)||fC(o))throw new ma("Plain language does not have grammar state");if(a==="ansi")throw new ma("ANSI language does not have grammar state");let{theme:i,colorMap:s}=t.setTheme(o),l=t.getLanguage(a);return new W_(d6(n,l,i,s,r).stateStack,l.name,i.name)}function yie(e,t,n,r,a){let o=d6(e,t,n,r,a),i=new W_(o.stateStack,t.name,n.name);return mC(o.tokens,i),o.tokens}function d6(e,t,n,r,a){let o=uC(n,a),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:s=500}=a,l=Rb(e),u=a.grammarState?bPe(a.grammarState,n.name)??G_:a.grammarContextCode!=null?d6(a.grammarContextCode,t,n,r,{...a,grammarState:void 0,grammarContextCode:void 0}).stateStack:G_,d=[],f=[];for(let m=0,h=l.length;m<h;m++){let[p,g]=l[m];if(p===""){d=[],f.push([]);continue}if(i>0&&p.length>=i){d=[],f.push([{content:p,offset:g,color:"",fontStyle:0}]);continue}let x,y,v;a.includeExplanation&&(x=t.tokenizeLine(p,u,s),y=x.tokens,v=0);let S=t.tokenizeLine2(p,u,s),C=S.tokens.length/2;for(let R=0;R<C;R++){let I=S.tokens[2*R],N=R+1<C?S.tokens[2*R+2]:p.length;if(I===N)continue;let k=S.tokens[2*R+1],z=ff(r[Cg.getForeground(k)],o),L=Cg.getFontStyle(k),q={content:p.substring(I,N),offset:g+I,color:z,fontStyle:L};if(a.includeExplanation){let P=[];if(a.includeExplanation!=="scopeName")for(let F of n.settings){let se;switch(typeof F.scope){case"string":se=F.scope.split(xPe).map(B=>B.trim());break;case"object":se=F.scope;break;default:continue}P.push({settings:F,selectors:se.map(B=>B.split(SPe))})}q.explanation=[];let V=0;for(;I+V<N;){let F=y[v],se=p.substring(F.startIndex,F.endIndex);V+=se.length,q.explanation.push({content:se,scopes:a.includeExplanation==="scopeName"?wPe(F.scopes):CPe(P,F.scopes)}),v+=1}}d.push(q)}f.push(d),d=[],u=S.ruleStack}return{tokens:f,stateStack:u}}function wPe(e){return e.map(t=>({scopeName:t}))}function CPe(e,t){let n=[];for(let r=0,a=t.length;r<a;r++){let o=t[r];n[r]={scopeName:o,themeMatches:RPe(e,o,t.slice(0,r))}}return n}function uie(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function kPe(e,t,n){if(!uie(e.at(-1),t))return!1;let r=e.length-2,a=n.length-1;for(;r>=0&&a>=0;)uie(e[r],n[a])&&(r-=1),a-=1;return r===-1}function RPe(e,t,n){let r=[];for(let{selectors:a,settings:o}of e)for(let i of a)if(kPe(i,t,n)){r.push(o);break}return r}function K_(e,t,n,r=u6){let a=Object.entries(n.themes).filter(u=>u[1]).map(u=>({color:u[0],theme:u[1]})),o=a.map(u=>{let d=r(e,t,{...n,theme:u.theme});return{tokens:d,state:Ib(d),theme:typeof u.theme=="string"?u.theme:u.theme.name}}),i=IPe(...o.map(u=>u.tokens)),s=i[0].map((u,d)=>u.map((f,m)=>{let h={content:f.content,variants:{},offset:f.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=f.explanation),i.forEach((p,g)=>{let{content:x,explanation:y,offset:v,...S}=p[d][m];h.variants[a[g].color]=S}),h})),l=o[0].state?new W_(Object.fromEntries(o.map(u=>[u.theme,u.state?.getInternalStack(u.theme)])),o[0].state.lang):void 0;return l&&mC(s,l),s}function IPe(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let a=e.map(l=>l[r]),o=t.map(()=>[]);t.forEach((l,u)=>l.push(o[u]));let i=a.map(()=>0),s=a.map(l=>l[0]);for(;s.every(l=>l);){let l=Math.min(...s.map(u=>u.content.length));for(let u=0;u<n;u++){let d=s[u];d.content.length===l?(o[u].push(d),i[u]+=1,s[u]=a[u][i[u]]):(o[u].push({...d,content:d.content.slice(0,l)}),s[u]={...d,content:d.content.slice(l),offset:d.offset+l})}}}return t}var bie=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var mf=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};mf.prototype.normal={};mf.prototype.property={};mf.prototype.space=void 0;function f6(e,t){let n={},r={};for(let a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new mf(n,r,t)}function pC(e){return e.toLowerCase()}var Jo=class{constructor(t,n){this.attribute=n,this.property=t}};Jo.prototype.attribute="";Jo.prototype.booleanish=!1;Jo.prototype.boolean=!1;Jo.prototype.commaOrSpaceSeparated=!1;Jo.prototype.commaSeparated=!1;Jo.prototype.defined=!1;Jo.prototype.mustUseProperty=!1;Jo.prototype.number=!1;Jo.prototype.overloadedBoolean=!1;Jo.prototype.property="";Jo.prototype.spaceSeparated=!1;Jo.prototype.space=void 0;var hC={};to(hC,{boolean:()=>Bt,booleanish:()=>Dr,commaOrSpaceSeparated:()=>tl,commaSeparated:()=>rp,number:()=>ce,overloadedBoolean:()=>J_,spaceSeparated:()=>pa});var TPe=0,Bt=kg(),Dr=kg(),J_=kg(),ce=kg(),pa=kg(),rp=kg(),tl=kg();function kg(){return 2**++TPe}var m6=Object.keys(hC),Rg=class extends Jo{constructor(t,n,r,a){let o=-1;if(super(t,n),xie(this,"space",a),typeof r=="number")for(;++o<m6.length;){let i=m6[o];xie(this,m6[o],(r&hC[i])===hC[i])}}};Rg.prototype.defined=!0;function xie(e,t,n){n&&(e[t]=n)}function yc(e){let t={},n={};for(let[r,a]of Object.entries(e.properties)){let o=new Rg(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[pC(r)]=r,n[pC(o.attribute)]=r}return new mf(t,n,e.space)}var p6=yc({properties:{ariaActiveDescendant:null,ariaAtomic:Dr,ariaAutoComplete:null,ariaBusy:Dr,ariaChecked:Dr,ariaColCount:ce,ariaColIndex:ce,ariaColSpan:ce,ariaControls:pa,ariaCurrent:null,ariaDescribedBy:pa,ariaDetails:null,ariaDisabled:Dr,ariaDropEffect:pa,ariaErrorMessage:null,ariaExpanded:Dr,ariaFlowTo:pa,ariaGrabbed:Dr,ariaHasPopup:null,ariaHidden:Dr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:pa,ariaLevel:ce,ariaLive:null,ariaModal:Dr,ariaMultiLine:Dr,ariaMultiSelectable:Dr,ariaOrientation:null,ariaOwns:pa,ariaPlaceholder:null,ariaPosInSet:ce,ariaPressed:Dr,ariaReadOnly:Dr,ariaRelevant:null,ariaRequired:Dr,ariaRoleDescription:pa,ariaRowCount:ce,ariaRowIndex:ce,ariaRowSpan:ce,ariaSelected:Dr,ariaSetSize:ce,ariaSort:null,ariaValueMax:ce,ariaValueMin:ce,ariaValueNow:ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Q_(e,t){return t in e?e[t]:t}function Y_(e,t){return Q_(e,t.toLowerCase())}var Sie=yc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:rp,acceptCharset:pa,accessKey:pa,action:null,allow:null,allowFullScreen:Bt,allowPaymentRequest:Bt,allowUserMedia:Bt,alt:null,as:null,async:Bt,autoCapitalize:null,autoComplete:pa,autoFocus:Bt,autoPlay:Bt,blocking:pa,capture:null,charSet:null,checked:Bt,cite:null,className:pa,cols:ce,colSpan:null,content:null,contentEditable:Dr,controls:Bt,controlsList:pa,coords:ce|rp,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Bt,defer:Bt,dir:null,dirName:null,disabled:Bt,download:J_,draggable:Dr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Bt,formTarget:null,headers:pa,height:ce,hidden:J_,high:ce,href:null,hrefLang:null,htmlFor:pa,httpEquiv:pa,id:null,imageSizes:null,imageSrcSet:null,inert:Bt,inputMode:null,integrity:null,is:null,isMap:Bt,itemId:null,itemProp:pa,itemRef:pa,itemScope:Bt,itemType:pa,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Bt,low:ce,manifest:null,max:null,maxLength:ce,media:null,method:null,min:null,minLength:ce,multiple:Bt,muted:Bt,name:null,nonce:null,noModule:Bt,noValidate:Bt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Bt,optimum:ce,pattern:null,ping:pa,placeholder:null,playsInline:Bt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Bt,referrerPolicy:null,rel:pa,required:Bt,reversed:Bt,rows:ce,rowSpan:ce,sandbox:pa,scope:null,scoped:Bt,seamless:Bt,selected:Bt,shadowRootClonable:Bt,shadowRootDelegatesFocus:Bt,shadowRootMode:null,shape:null,size:ce,sizes:null,slot:null,span:ce,spellCheck:Dr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ce,step:null,style:null,tabIndex:ce,target:null,title:null,translate:null,type:null,typeMustMatch:Bt,useMap:null,value:Dr,width:ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:pa,axis:null,background:null,bgColor:null,border:ce,borderColor:null,bottomMargin:ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Bt,declare:Bt,event:null,face:null,frame:null,frameBorder:null,hSpace:ce,leftMargin:ce,link:null,longDesc:null,lowSrc:null,marginHeight:ce,marginWidth:ce,noResize:Bt,noHref:Bt,noShade:Bt,noWrap:Bt,object:null,profile:null,prompt:null,rev:null,rightMargin:ce,rules:null,scheme:null,scrolling:Dr,standby:null,summary:null,text:null,topMargin:ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Bt,disableRemotePlayback:Bt,prefix:null,property:null,results:ce,security:null,unselectable:null},space:"html",transform:Y_});var wie=yc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:tl,accentHeight:ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ce,amplitude:ce,arabicForm:null,ascent:ce,attributeName:null,attributeType:null,azimuth:ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ce,by:null,calcMode:null,capHeight:ce,className:pa,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ce,diffuseConstant:ce,direction:null,display:null,dur:null,divisor:ce,dominantBaseline:null,download:Bt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ce,enableBackground:null,end:null,event:null,exponent:ce,externalResourcesRequired:null,fill:null,fillOpacity:ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:rp,g2:rp,glyphName:rp,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ce,horizOriginX:ce,horizOriginY:ce,id:null,ideographic:ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ce,k:ce,k1:ce,k2:ce,k3:ce,k4:ce,kernelMatrix:tl,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ce,overlineThickness:ce,paintOrder:null,panose1:null,path:null,pathLength:ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:pa,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ce,pointsAtY:ce,pointsAtZ:ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tl,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tl,rev:tl,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tl,requiredFeatures:tl,requiredFonts:tl,requiredFormats:tl,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ce,specularExponent:ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ce,strikethroughThickness:ce,string:null,stroke:null,strokeDashArray:tl,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ce,strokeOpacity:ce,strokeWidth:null,style:null,surfaceScale:ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tl,tabIndex:ce,tableValues:null,target:null,targetX:ce,targetY:ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tl,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ce,underlineThickness:ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ce,values:null,vAlphabetic:ce,vMathematical:ce,vectorEffect:null,vHanging:ce,vIdeographic:ce,version:null,vertAdvY:ce,vertOriginX:ce,vertOriginY:ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Q_});var h6=yc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});var g6=yc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Y_});var v6=yc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var NPe=/[A-Z]/g,Cie=/-[a-z]/g,_Pe=/^data[-\w.:]+$/i;function y6(e,t){let n=pC(t),r=t,a=Jo;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&_Pe.test(t)){if(t.charAt(4)==="-"){let o=t.slice(5).replace(Cie,APe);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=t.slice(4);if(!Cie.test(o)){let i=o.replace(NPe,LPe);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}a=Rg}return new a(r,t)}function LPe(e){return"-"+e.toLowerCase()}function APe(e){return e.charAt(1).toUpperCase()}var kie=f6([p6,Sie,h6,g6,v6],"html"),X_=f6([p6,wie,h6,g6,v6],"svg");var Rie={}.hasOwnProperty;function Iie(e,t){let n=t||{};function r(a,...o){let i=r.invalid,s=r.handlers;if(a&&Rie.call(a,e)){let l=String(a[e]);i=Rie.call(s,l)?s[l]:r.unknown}if(i)return i.call(this,a,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var EPe=/["&'<>`]/g,PPe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,DPe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,$Pe=/[|\\{}()[\]^$+*?.]/g,Tie=new WeakMap;function Nie(e,t){if(e=e.replace(t.subset?MPe(t.subset):EPe,r),t.subset||t.escapeOnly)return e;return e.replace(PPe,n).replace(DPe,r);function n(a,o,i){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),t)}function r(a,o,i){return t.format(a.charCodeAt(0),i.charCodeAt(o+1),t)}}function MPe(e){let t=Tie.get(e);return t||(t=OPe(e),Tie.set(e,t)),t}function OPe(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace($Pe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}var zPe=/[\dA-Fa-f]/;function _ie(e,t,n){let r="&#x"+e.toString(16).toUpperCase();return n&&t&&!zPe.test(String.fromCharCode(t))?r:r+";"}var UPe=/\d/;function Lie(e,t,n){let r="&#"+String(e);return n&&t&&!UPe.test(String.fromCharCode(t))?r:r+";"}var Aie=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var eL={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var Eie=["cent","copy","divide","gt","lt","not","para","times"];var Pie={}.hasOwnProperty,b6={},tL;for(tL in eL)Pie.call(eL,tL)&&(b6[eL[tL]]=tL);var jPe=/[^\dA-Za-z]/;function Die(e,t,n,r){let a=String.fromCharCode(e);if(Pie.call(b6,a)){let o=b6[a],i="&"+o;return n&&Aie.includes(o)&&!Eie.includes(o)&&(!r||t&&t!==61&&jPe.test(String.fromCharCode(t)))?i:i+";"}return""}function $ie(e,t,n){let r=_ie(e,t,n.omitOptionalSemicolons),a;if((n.useNamedReferences||n.useShortestReferences)&&(a=Die(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!a)&&n.useShortestReferences){let o=Lie(e,t,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return a&&(!n.useShortestReferences||a.length<r.length)?a:r}function pf(e,t){return Nie(e,Object.assign({format:$ie},t))}var BPe=/^>|^->|<!--|-->|--!>|<!-$/g,FPe=[">"],HPe=["<",">"];function Mie(e,t,n,r){return r.settings.bogusComments?"<?"+pf(e.value,Object.assign({},r.settings.characterReferences,{subset:FPe}))+">":"<!--"+e.value.replace(BPe,a)+"-->";function a(o){return pf(o,Object.assign({},r.settings.characterReferences,{subset:HPe}))}}function Oie(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function x6(e,t){let n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function zie(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Uie(e){return e.join(" ").trim()}var VPe=/[ \t\n\f\r]/g;function Ig(e){return typeof e=="object"?e.type==="text"?jie(e.value):!1:jie(e)}function jie(e){return e.replace(VPe,"")===""}var Zr=Bie(1),S6=Bie(-1),qPe=[];function Bie(e){return t;function t(n,r,a){let o=n?n.children:qPe,i=(r||0)+e,s=o[i];if(!a)for(;s&&Ig(s);)i+=e,s=o[i];return s}}var GPe={}.hasOwnProperty;function nL(e){return t;function t(n,r,a){return GPe.call(e,n.tagName)&&e[n.tagName](n,r,a)}}var gC=nL({body:WPe,caption:w6,colgroup:w6,dd:YPe,dt:QPe,head:w6,html:ZPe,li:JPe,optgroup:XPe,option:eDe,p:KPe,rp:Fie,rt:Fie,tbody:nDe,td:Hie,tfoot:aDe,th:Hie,thead:tDe,tr:rDe});function w6(e,t,n){let r=Zr(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Ig(r.value.charAt(0)))}function ZPe(e,t,n){let r=Zr(n,t);return!r||r.type!=="comment"}function WPe(e,t,n){let r=Zr(n,t);return!r||r.type!=="comment"}function KPe(e,t,n){let r=Zr(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function JPe(e,t,n){let r=Zr(n,t);return!r||r.type==="element"&&r.tagName==="li"}function QPe(e,t,n){let r=Zr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function YPe(e,t,n){let r=Zr(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Fie(e,t,n){let r=Zr(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function XPe(e,t,n){let r=Zr(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function eDe(e,t,n){let r=Zr(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function tDe(e,t,n){let r=Zr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function nDe(e,t,n){let r=Zr(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function aDe(e,t,n){return!Zr(n,t)}function rDe(e,t,n){let r=Zr(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function Hie(e,t,n){let r=Zr(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}var Vie=nL({body:sDe,colgroup:lDe,head:iDe,html:oDe,tbody:cDe});function oDe(e){let t=Zr(e,-1);return!t||t.type!=="comment"}function iDe(e){let t=new Set;for(let r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}let n=e.children[0];return!n||n.type==="element"}function sDe(e){let t=Zr(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Ig(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function lDe(e,t,n){let r=S6(n,t),a=Zr(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&gC(r,n.children.indexOf(r),n)?!1:!!(a&&a.type==="element"&&a.tagName==="col")}function cDe(e,t,n){let r=S6(n,t),a=Zr(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&gC(r,n.children.indexOf(r),n)?!1:!!(a&&a.type==="element"&&a.tagName==="tr")}var aL={name:[[`
|