jobtrack 1.3.0 → 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jobtrack",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Runs the JobTrack API + web UI as one background process with a Windows tray icon",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@fastify/static": "^10.1.3",
33
- "@jobtrack/api": "^1.3.0",
33
+ "@jobtrack/api": "^1.4.0",
34
34
  "fastify": "^5.12.1",
35
35
  "systray": "^1.0.5",
36
36
  "tsx": "^4.23.12"
@@ -431,7 +431,7 @@ html body {
431
431
 
432
432
  `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=H$,c=!B1.jitless,l=c&&U$.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?p4([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function g4(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!l1(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>m1(e,r,V1())))}),t)}var _4=L1(`$ZodUnion`,(e,t)=>{h2.init(e,t),k1(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),k1(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),k1(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),k1(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>k$(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>g4(t,r,e,i)):g4(o,r,e,i)}}),v4=L1(`$ZodIntersection`,(e,t)=>{h2.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>b4(e,t,n)):b4(e,i,a)}});function y4(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(W$(e)&&W$(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=y4(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=y4(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function b4(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=y4(t.value,n.value);if(!c.valid){if(l1(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var x4=L1(`$ZodEnum`,(e,t)=>{h2.init(e,t);let n=C$(t.entries),r=new Set(n);e._zod.values=r,k1(e,`pattern`,e=>{let t=C$(e.def.entries).filter(e=>K$.has(typeof e));return RegExp(t.length?`^(${t.map(e=>q$(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),S4=L1(`$ZodTransform`,(e,t)=>{h2.init(e,t),e._zod.optin=`optional`,B1.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new z1(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new R1;return n.value=i,n}});function C4(e,t){return e.value=t.issues.length?void 0:t.value,e}var w4=L1(`$ZodOptional`,(e,t)=>{h2.init(e,t),k1(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,k1(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),k1(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${k$(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>C4(e,t)):C4(e,r)}return t.innerType._zod.run(e,n)}}),T4=L1(`$ZodExactOptional`,(e,t)=>{w4.init(e,t),k1(e,`values`,e=>e.def.innerType._zod.values),k1(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),E4=L1(`$ZodNullable`,(e,t)=>{h2.init(e,t),k1(e,`optin`,e=>e.def.innerType._zod.optin),k1(e,`optout`,e=>e.def.innerType._zod.optout),k1(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${k$(t.source)}|null)$`):void 0}),k1(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),D4=L1(`$ZodDefault`,(e,t)=>{h2.init(e,t),e._zod.optin=`defaulted`,k1(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>O4(e,t)):O4(r,t)}});function O4(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var k4=L1(`$ZodPrefault`,(e,t)=>{h2.init(e,t),e._zod.optin=`defaulted`,k1(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),A4=L1(`$ZodNonOptional`,(e,t)=>{h2.init(e,t),k1(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>j4(t,e)):j4(i,e)}});function j4(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function M4(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>m1(e,r,V1()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var N4=L1(`$ZodCatch`,(e,t)=>{h2.init(e,t),k1(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),k1(e,`optout`,e=>e.def.innerType._zod.optout),k1(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>M4(e,r,t,n)):M4(e,r,t,n)}}),P4=L1(`$ZodPipe`,(e,t)=>{h2.init(e,t),k1(e,`values`,e=>e.def.in._zod.values),k1(e,`optin`,e=>e.def.in._zod.optin),k1(e,`optout`,e=>e.def.out._zod.optout),k1(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>F4(e,t.in,n)):F4(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>F4(e,t.out,n)):F4(r,t.out,n)}});function F4(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var I4=L1(`$ZodPreprocess`,(e,t)=>{P4.init(e,t)}),L4=L1(`$ZodReadonly`,(e,t)=>{h2.init(e,t),k1(e,`propValues`,e=>e.def.innerType._zod.propValues),k1(e,`values`,e=>e.def.innerType._zod.values),k1(e,`optin`,e=>e.def.innerType?._zod?.optin),k1(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(R4):R4(r)}});function R4(e){return e.memo||(e.value=Object.freeze(e.value)),e}var z4=L1(`$ZodCustom`,(e,t)=>{Y0.init(e,t),h2.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>B4(t,n,r,e));B4(i,n,r,e)}});function B4(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(y1(e))}}var V4=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},H4=`~memo`,U4=[];function W4(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function G4(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var K4=new WeakMap,q4=0,J4=1,Y4=2;function X4(e,t,n){let r=K4.get(e);if(r!==void 0)return r?Y4:q4;if(t.has(e))return Y4;t.add(e);let i=q4,a=e=>{if(i!==Y4&&e?._zod){let r=X4(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=q4;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?J4:o.value?._zod?X4(o.value,t,n):q4;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=M$(c);s(e?o(e,!0):J4),a(c.catchall);break}case`properties`:s(o(c.shape,!1));break;case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?X4(r,t,!1):J4);break}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`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Z4(e,i)}function Z4(e,t){return t!==J4&&K4.set(e,t===Y4),t}function Q4(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var $4,e3=[],t3={alloc(e,t,n){let r=$4;if(!r)return n;$4=void 0;let i={value:n,issues:null};return r.set(t.value,i),e3.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&r3(n,e.value))throw new V4;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=X4(e,new Set,!1);if(i===q4)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Y4||r?n=!0:r=!0}let l=s.value;if(!W4(l))return t(s,c);let u=c[H4];u||(u={buckets:new WeakMap,backEdges:void 0},c[H4]=u);let d;i===c?d=a:(d=Q4(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...G4(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;$4=d;let p=e3.length,m=t(s,c);$4=void 0;let h=e3.length>p?e3.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?G4(e.issues):U4),e)):(h&&(h.issues=m.issues.length?G4(m.issues):U4),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function n3(){return t3}function r3(e,t){let n=e[H4]?.backEdges;return n!==void 0&&W4(t)&&n.has(t)}var i3=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(v1(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${X$(e.values[0])}`:`Invalid option: expected one of ${w$(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${w$(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function a3(){return{localeError:i3()}}var o3,s3=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function c3(){return new s3}(o3=globalThis).__zod_globalRegistry??(o3.__zod_globalRegistry=c3());var l3=globalThis.__zod_globalRegistry;function u3(e,t){return new e({type:`string`,...Y$(t)})}function d3(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Y$(t)})}function f3(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Y$(t)})}function p3(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Y$(t)})}function m3(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Y$(t)})}function h3(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Y$(t)})}function g3(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Y$(t)})}function _3(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Y$(t)})}function v3(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Y$(t)})}function y3(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Y$(t)})}function b3(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Y$(t)})}function x3(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Y$(t)})}function S3(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Y$(t)})}function C3(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Y$(t)})}function w3(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Y$(t)})}function T3(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Y$(t)})}function E3(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Y$(t)})}function D3(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Y$(t)})}function O3(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Y$(t)})}function k3(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Y$(t)})}function A3(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Y$(t)})}function j3(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Y$(t)})}function M3(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Y$(t)})}function N3(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Y$(t)})}function P3(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Y$(t)})}function F3(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Y$(t)})}function I3(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Y$(t)})}function L3(e,t){return new e({type:`number`,checks:[],...Y$(t)})}function R3(e,t){return new e({type:`number`,coerce:!0,checks:[],...Y$(t)})}function z3(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Y$(t)})}function B3(e,t){return new e({type:`boolean`,...Y$(t)})}function V3(e){return new e({type:`unknown`})}function H3(e,t){return new e({type:`never`,...Y$(t)})}function U3(e,t){return new Q0({check:`less_than`,...Y$(t),value:e,inclusive:!1})}function W3(e,t){return new Q0({check:`less_than`,...Y$(t),value:e,inclusive:!0})}function G3(e,t){return new $0({check:`greater_than`,...Y$(t),value:e,inclusive:!1})}function K3(e,t){return new $0({check:`greater_than`,...Y$(t),value:e,inclusive:!0})}function q3(e,t){return new e2({check:`multiple_of`,...Y$(t),value:e})}function J3(e,t){return new n2({check:`max_length`,...Y$(t),maximum:e})}function Y3(e,t){return new r2({check:`min_length`,...Y$(t),minimum:e})}function X3(e,t){return new i2({check:`length_equals`,...Y$(t),length:e})}function Z3(e,t){return new o2({check:`string_format`,format:`regex`,...Y$(t),pattern:e})}function Q3(e){return new s2({check:`string_format`,format:`lowercase`,...Y$(e)})}function $3(e){return new c2({check:`string_format`,format:`uppercase`,...Y$(e)})}function e6(e,t){return new l2({check:`string_format`,format:`includes`,...Y$(t),includes:e})}function t6(e,t){return new u2({check:`string_format`,format:`starts_with`,...Y$(t),prefix:e})}function n6(e,t){return new d2({check:`string_format`,format:`ends_with`,...Y$(t),suffix:e})}function r6(e){return new f2({check:`overwrite`,tx:e})}function i6(e){return r6(t=>t.normalize(e))}function a6(){return r6(e=>e.trim())}function o6(){return r6(e=>e.toLowerCase())}function s6(){return r6(e=>e.toUpperCase())}function c6(){return r6(e=>B$(e))}function l6(e,t,n){return new e({type:`array`,element:t,...Y$(n)})}function u6(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Y$(n)})}function d6(e,t){let n=f6(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(y1(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(y1(r))}},e(t.value,t)),t);return n}function f6(e,t){let n=new Y0({check:`custom`,...Y$(t)});return n._zod.check=e,n}function p6(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&j$(e,t,n[t]);return e}function m6(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??l3,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function h6(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function g6(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,g6(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&p6(o.schema,c),t.io===`input`&&E6(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function _6(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function v6(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${_6(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+_6(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
433
433
 
434
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function y6(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;y6(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var b6=new Set([`type`,`properties`,`required`,`additionalProperties`]),x6=[`oneOf`,`anyOf`];function S6(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function C6(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!b6.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??S6(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}j$(n,r,e.length===1?e[0]:C6(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=S6(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function w6(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of b6)if(t in e)return;let n=t.filter(e=>x6.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=C6(t);else{let e=n[0],i=x6.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>C6([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,p6(e,r))}function T6(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):p6(i,s),p6(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())y6(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])w6(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}p6(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,j$(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:O6(t,`input`,e.processors),output:O6(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function E6(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 E6(r.element,n);if(r.type===`set`)return E6(r.valueType,n);if(r.type===`lazy`)return E6(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 E6(r.innerType,n);if(r.type===`intersection`)return E6(r.left,n)||E6(r.right,n);if(r.type===`record`||r.type===`map`)return E6(r.keyType,n)||E6(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:E6(r.in,n)||E6(r.out,n);if(r.type===`object`){for(let e in r.shape)if(E6(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(E6(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(E6(e,n))return!0;return!!(r.rest&&E6(r.rest,n))}return!1}var D6=(e,t={})=>n=>{let r=m6({...n,processors:t});return g6(e,r),v6(r,e),T6(r,e)},O6=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=m6({...i??{},target:a,io:t,processors:n});return g6(e,o),v6(o,e),T6(o,e)},k6=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},A6=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},j6=(e,t)=>{k6(e,`minimum`,t),A6(e,`maximum`,t)},M6=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},N6=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},P6=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},F6=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},I6=(e,t)=>k6(e,`minimum`,t.minimum),L6=(e,t)=>A6(e,`maximum`,t.maximum),R6=e=>(t,n)=>{F6(t,n.format);let[r,i]=e[n.format];k6(t,`minimum`,r),A6(t,`maximum`,i)},z6={greater_than:(e,t)=>k6(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>A6(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>M6(e,t.value),number_format:R6(Q$),bigint_format:R6($$),min_length:I6,max_length:L6,length_equals:(e,t)=>j6(e,t.length),min_size:I6,max_size:L6,size_equals:(e,t)=>j6(e,t.size),string_format:(e,t)=>{F6(e,t.format),t.pattern&&N6(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>P6(e,t.mime)};function B6(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)z6[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&k6(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&k6(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&A6(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&A6(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&M6(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&P6(t,i.mime);for(let e of i.patterns??[])N6(t,e);return t}var V6={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},H6=new Map([[Y2,P0],[Z2,F0]]),U6=e=>H6.get(e)??e,W6=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=B6(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=V6[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(U6);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},G6=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=B6(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):h6(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},K6=(e,t,n,r)=>{n.type=`boolean`},q6=(e,t,n,r)=>{n.not={}},J6=(e,t,n,r)=>{let i=e._zod.def,a=C$(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Y6=(e,t,n,r)=>{h6(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},X6=(e,t,n,r)=>{h6(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Z6=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=B6(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=g6(a.element,t,{...r,path:[...r.path,`items`]})};function Q6(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Q6(t.out):t.type===`catch`?Q6(t.innerType):e._zod.optin}var $6=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&h6(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)j$(i.properties,e,g6(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?Q6(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=g6(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},e8=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>g6(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},t8=(e,t,n,r)=>{let i=e._zod.def,a=g6(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=g6(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},n8=(e,t,n,r)=>{let i=e._zod.def,a=g6(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},r8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},i8=Symbol();function a8(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(h6(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),i8):JSON.parse(o)}var o8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=a8(i.defaultValue,e,t,n,r);o!==i8&&(n.default=o)},s8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=a8(i.defaultValue,e,t,n,r);o!==i8&&(n._prefault=o)},c8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{h6(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},l8=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;g6(o,t,r);let s=t.seen.get(e);s.ref=o},u8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},d8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},f8=new WeakSet([Object.prototype,Error.prototype]);function p8(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var m8=L1(`ZodError`,(e,t)=>{J1.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);f8.has(n)||(f8.add(n),p8(n,`format`,e=>t=>Z1(e,t)),p8(n,`flatten`,e=>t=>X1(e,t)),p8(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,T$,2)}),p8(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,T$,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),h8=$1(m8),g8=e0(m8),_8=t0(m8),v8=r0(m8),y8=l0(m8),b8=u0(m8),x8=d0(m8),S8=f0(m8),C8=p0(m8),w8=m0(m8),T8=h0(m8),E8=g0(m8);function D8(){B1.localeError||V1(a3())}function O8(){B1.memoizer||V1({memoizer:n3()})}var k8=L1(`ZodType`,(e,t)=>(D8(),h2.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(R$(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return J$(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(K5(e,t))},superRefine(e,t){return this.check(q5(e,t))},overwrite(e){return this.check(r6(e))},optional(){return D5(this)},exactOptional(){return k5(this)},nullable(){return j5(this)},nullish(){return D5(j5(this))},nonoptional(e){return L5(this,e)},array(){return h5(this)},or(e){return y5([this,e])},and(e){return x5(this,e)},transform(e){return V5(this,T5(e))},default(e){return N5(this,e)},prefault(e){return F5(this,e)},catch(e){return z5(this,e)},pipe(e){return V5(this,e)},readonly(){return W5(this)},describe(e){let t=this.clone();return l3.add(t,{description:e}),t},meta(...e){if(e.length===0)return l3.get(this);let t=this.clone();return l3.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 S1(this,`~standard`,{...v2(this),jsonSchema:{input:O6(this,`input`),output:O6(this,`output`)}})},set"~standard"(e){x1(this,`~standard`,e)},parse:function e(t,n){return h8(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await g8(this,t,n,{callee:e})},safeParse(e,t){return _8(this,e,t)},async safeParseAsync(e,t){return v8(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){x1(this,`spa`,e)},validate(e,t){return o0(this,e,t)},validateAsync(e,t){return c0(this,e,t)},encode:function e(t,n){return y8(this,t,n,{callee:e})},decode:function e(t,n){return b8(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await x8(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await S8(this,t,n,{callee:e})},safeEncode(e,t){return C8(this,e,t)},safeDecode(e,t){return w8(this,e,t)},async safeEncodeAsync(e,t){return T8(this,e,t)},async safeDecodeAsync(e,t){return E8(this,e,t)},toJSONSchema(e){return D6(this,{})(e)},get description(){return l3.get(this)?.description},get _def(){return this._zod.def}}),A8=L1(`_ZodString`,(e,t)=>{y2.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>W6(e,t,n,r)},C1({format:e=>B6(e).format??null,minLength:e=>B6(e).minimum??null,maxLength:e=>B6(e).maximum??null},{regex(...e){return this.check(Z3(...e))},includes(...e){return this.check(e6(...e))},startsWith(...e){return this.check(t6(...e))},endsWith(...e){return this.check(n6(...e))},min(...e){return this.check(Y3(...e))},max(...e){return this.check(J3(...e))},length(...e){return this.check(X3(...e))},nonempty(...e){return this.check(Y3(1,...e))},lowercase(e){return this.check(Q3(e))},uppercase(e){return this.check($3(e))},trim(){return this.check(a6())},normalize(...e){return this.check(i6(...e))},toLowerCase(){return this.check(o6())},toUpperCase(){return this.check(s6())},slugify(){return this.check(c6())}})),j8=L1(`ZodString`,(e,t)=>{y2.init(e,t),A8.init(e,t)},{email(e){return this.check(d3(R8,e))},url(e){return this.check(_3(H8,e))},jwt(e){return this.check(M3(r5,e))},emoji(e){return this.check(v3(U8,e))},guid(e){return this.check(f3(z8,e))},uuid(e){return this.check(p3(B8,e))},uuidv4(e){return this.check(m3(B8,e))},uuidv6(e){return this.check(h3(B8,e))},uuidv7(e){return this.check(g3(B8,e))},nanoid(e){return this.check(y3(W8,e))},cuid(e){return this.check(b3(G8,e))},cuid2(e){return this.check(x3(K8,e))},ulid(e){return this.check(S3(q8,e))},base64(e){return this.check(k3(e5,e))},base64url(e){return this.check(A3(t5,e))},xid(e){return this.check(C3(J8,e))},ksuid(e){return this.check(w3(Y8,e))},ipv4(e){return this.check(T3(X8,e))},ipv6(e){return this.check(E3(Z8,e))},cidrv4(e){return this.check(D3(Q8,e))},cidrv6(e){return this.check(O3($8,e))},e164(e){return this.check(j3(n5,e))},datetime(e){return this.check(N3(P8,e))},date(e){return this.check(P3(F8,e))},time(e){return this.check(F3(I8,e))},duration(e){return this.check(I3(L8,e))}});function M8(e){return u3(j8,e)}var N8=L1(`ZodStringFormat`,(e,t)=>{b2.init(e,t),A8.init(e,t)}),P8=L1(`ZodISODateTime`,(e,t)=>{L2.init(e,t),N8.init(e,t)}),F8=L1(`ZodISODate`,(e,t)=>{R2.init(e,t),N8.init(e,t)}),I8=L1(`ZodISOTime`,(e,t)=>{z2.init(e,t),N8.init(e,t)}),L8=L1(`ZodISODuration`,(e,t)=>{B2.init(e,t),N8.init(e,t)}),R8=L1(`ZodEmail`,(e,t)=>{C2.init(e,t),N8.init(e,t)}),z8=L1(`ZodGUID`,(e,t)=>{x2.init(e,t),N8.init(e,t)}),B8=L1(`ZodUUID`,(e,t)=>{S2.init(e,t),N8.init(e,t)});function V8(e){return p3(B8,e)}var H8=L1(`ZodURL`,(e,t)=>{k2.init(e,t),N8.init(e,t)}),U8=L1(`ZodEmoji`,(e,t)=>{A2.init(e,t),N8.init(e,t)}),W8=L1(`ZodNanoID`,(e,t)=>{j2.init(e,t),N8.init(e,t)}),G8=L1(`ZodCUID`,(e,t)=>{M2.init(e,t),N8.init(e,t)}),K8=L1(`ZodCUID2`,(e,t)=>{N2.init(e,t),N8.init(e,t)}),q8=L1(`ZodULID`,(e,t)=>{P2.init(e,t),N8.init(e,t)}),J8=L1(`ZodXID`,(e,t)=>{F2.init(e,t),N8.init(e,t)}),Y8=L1(`ZodKSUID`,(e,t)=>{I2.init(e,t),N8.init(e,t)}),X8=L1(`ZodIPv4`,(e,t)=>{V2.init(e,t),N8.init(e,t)}),Z8=L1(`ZodIPv6`,(e,t)=>{W2.init(e,t),N8.init(e,t)}),Q8=L1(`ZodCIDRv4`,(e,t)=>{G2.init(e,t),N8.init(e,t)}),$8=L1(`ZodCIDRv6`,(e,t)=>{q2.init(e,t),N8.init(e,t)}),e5=L1(`ZodBase64`,(e,t)=>{X2.init(e,t),N8.init(e,t)}),t5=L1(`ZodBase64URL`,(e,t)=>{$2.init(e,t),N8.init(e,t)}),n5=L1(`ZodE164`,(e,t)=>{e4.init(e,t),N8.init(e,t)}),r5=L1(`ZodJWT`,(e,t)=>{n4.init(e,t),N8.init(e,t)}),i5=L1(`ZodNumber`,(e,t)=>{r4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G6(e,t,n,r),e.isFinite=!0},C1({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=B6(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=B6(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=B6(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>B6(e).format??null},{gt(e,t){return this.check(G3(e,t))},gte(e,t){return this.check(K3(e,t))},min(e,t){return this.check(K3(e,t))},lt(e,t){return this.check(U3(e,t))},lte(e,t){return this.check(W3(e,t))},max(e,t){return this.check(W3(e,t))},int(e){return this.check(s5(e))},safe(e){return this.check(s5(e))},positive(e){return this.check(G3(0,e))},nonnegative(e){return this.check(K3(0,e))},negative(e){return this.check(U3(0,e))},nonpositive(e){return this.check(W3(0,e))},multipleOf(e,t){return this.check(q3(e,t))},step(e,t){return this.check(q3(e,t))},finite(){return this}}));function a5(e){return L3(i5,e)}var o5=L1(`ZodNumberFormat`,(e,t)=>{i4.init(e,t),i5.init(e,t)});function s5(e){return z3(o5,e)}var c5=L1(`ZodBoolean`,(e,t)=>{a4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K6(e,t,n,r)});function l5(e){return B3(c5,e)}var u5=L1(`ZodUnknown`,(e,t)=>{o4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function d5(){return V3(u5)}var f5=L1(`ZodNever`,(e,t)=>{s4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q6(e,t,n,r)});function p5(e){return H3(f5,e)}var m5=L1(`ZodArray`,(e,t)=>{O8(),l4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Z6(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Y3(e,t))},nonempty(e){return this.check(Y3(1,e))},max(e,t){return this.check(J3(e,t))},length(e,t){return this.check(X3(e,t))},unwrap(){return this.element}});function h5(e,t){return l6(m5,e,t)}var g5=L1(`ZodObject`,(e,t)=>{O8(),h4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$6(e,t,n,r),A1(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return C5(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(R$(this._zod.def,{catchall:e}))},passthrough(){return this.clone(R$(this._zod.def,{catchall:d5()}))},loose(){return this.clone(R$(this._zod.def,{catchall:d5()}))},strict(){return this.clone(R$(this._zod.def,{catchall:p5()}))},strip(){return this.clone(R$(this._zod.def,{catchall:void 0}))},extend(e){return r1(this,e)},safeExtend(e){return a1(this,e)},merge(e){return o1(this,e)},pick(e){return e1(this,e)},omit(e){return n1(this,e)},partial(...e){return s1(E5,this,e[0])},exactPartial(...e){return s1(O5,this,e[0],`exactPartial`)},required(...e){return c1(I5,this,e[0])}});function _5(e,t){return new g5({type:`object`,shape:e??{},...Y$(t)})}var v5=L1(`ZodUnion`,(e,t)=>{_4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e8(e,t,n,r),e.options=t.options});function y5(e,t){return new v5({type:`union`,options:e,...Y$(t)})}var b5=L1(`ZodIntersection`,(e,t)=>{v4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t8(e,t,n,r)});function x5(e,t){return new b5({type:`intersection`,left:e,right:t})}var S5=L1(`ZodEnum`,(e,t)=>{x4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J6(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new S5({...t,checks:[],...Y$(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new S5({...t,checks:[],...Y$(r),entries:i})}});function C5(e,t){return new S5({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Y$(t)})}var w5=L1(`ZodTransform`,(e,t)=>{O8(),S4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>X6(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new z1(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(y1(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(y1(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function T5(e){return new w5({type:`transform`,transform:e})}var E5=L1(`ZodOptional`,(e,t)=>{w4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>d8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function D5(e){return new E5({type:`optional`,innerType:e})}var O5=L1(`ZodExactOptional`,(e,t)=>{T4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>d8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function k5(e){return new O5({type:`optional`,innerType:e})}var A5=L1(`ZodNullable`,(e,t)=>{E4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function j5(e){return new A5({type:`nullable`,innerType:e})}var M5=L1(`ZodDefault`,(e,t)=>{D4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function N5(e,t){return new M5({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():G$(t)}})}var P5=L1(`ZodPrefault`,(e,t)=>{k4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function F5(e,t){return new P5({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():G$(t)}})}var I5=L1(`ZodNonOptional`,(e,t)=>{A4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function L5(e,t){return new I5({type:`nonoptional`,innerType:e,...Y$(t)})}var R5=L1(`ZodCatch`,(e,t)=>{N4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>c8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function z5(e,t){return new R5({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:M1(t)})}var B5=L1(`ZodPipe`,(e,t)=>{P4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>l8(e,t,n,r),e.in=t.in,e.out=t.out});function V5(e,t){return new B5({type:`pipe`,in:e,out:t})}var H5=L1(`ZodPreprocess`,(e,t)=>{B5.init(e,t),I4.init(e,t)}),U5=L1(`ZodReadonly`,(e,t)=>{L4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>u8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function W5(e){return new U5({type:`readonly`,innerType:e})}var G5=L1(`ZodCustom`,(e,t)=>{z4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y6(e,t,n,r)});function K5(e,t={}){return u6(G5,e,t)}function q5(e,t){return d6(e,t)}function J5(e,t){return new H5({type:`pipe`,in:T5(e),out:t})}function Y5(e){return R3(i5,e)}var X5=M8().regex(/^\d{4}-\d{2}-\d{2}$/,`Expected a YYYY-MM-DD date`),Z5=e=>M8().trim().max(e).nullish().transform(e=>e==null||e===``?null:e),Q5=C5(XQ),$5=C5(t$),e7=C5(i$),t7=C5(a$);C5(r$);var n7=h5(M8().trim().min(1).max(60)).max(30);_5({companyName:M8().trim().min(1,`Company is required`).max(200),jobTitle:M8().trim().min(1,`Job title is required`).max(200),appliedOn:X5,status:Q5.default(`applied`),jobUrl:Z5(2e3),location:Z5(200),workMode:$5.default(`unspecified`),sourceName:Z5(120),salaryMin:a5().int().nonnegative().nullish().transform(e=>e??null),salaryMax:a5().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:Z5(8),followUpOn:X5.nullish().transform(e=>e??null),tags:n7.default([]),notes:Z5(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),_5({companyName:M8().trim().min(1).max(200).optional(),jobTitle:M8().trim().min(1).max(200).optional(),appliedOn:X5.optional(),status:Q5.optional(),statusComment:M8().trim().max(2e3).nullish(),jobUrl:Z5(2e3).optional(),location:Z5(200).optional(),workMode:$5.optional(),sourceName:Z5(120).optional(),salaryMin:a5().int().nonnegative().nullish(),salaryMax:a5().int().nonnegative().nullish(),salaryCurrency:Z5(8).optional(),followUpOn:X5.nullish(),archived:l5().optional(),tags:n7.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({status:Q5,occurredOn:X5.optional(),comment:M8().trim().max(2e3).nullish().transform(e=>e??null)});var r7=e=>J5(e=>{if(e==null)return;let t=(Array.isArray(e)?e.map(String):String(e).split(`,`)).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},h5(e).optional()),i7=e=>J5(e=>{if(e==null)return;let t=(Array.isArray(e)?e.map(String):String(e).split(`|`)).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},h5(e).optional()),a7=_5({q:M8().trim().max(300).optional(),year:Y5().int().min(1970).max(2200).optional(),month:Y5().int().min(1).max(12).optional(),status:r7(Q5),workMode:r7($5),tags:r7(M8()),location:i7(M8().max(200)),companyId:V8().optional(),source:M8().trim().max(120).optional(),from:X5.optional(),to:X5.optional(),archived:C5([`true`,`false`,`all`]).default(`false`).transform(e=>e===`all`?`all`:e===`true`),followUpDue:C5([`true`,`false`]).optional().transform(e=>e===`true`),sort:C5([`appliedOn`,`company`,`jobTitle`,`status`,`createdAt`]).default(`appliedOn`),direction:C5([`asc`,`desc`]).default(`desc`),limit:Y5().int().min(1).max(200).default(50),cursor:M8().optional()});_5({ids:h5(V8()).min(1).max(500)}),_5({ids:h5(V8()).min(1).max(100),status:Q5,occurredOn:X5.optional(),comment:M8().trim().max(2e3).nullish().transform(e=>e??null)});var o7=y5([l5(),C5([`true`,`false`]).transform(e=>e===`true`)]).optional();_5({includeArchived:o7,q:M8().trim().max(300).optional(),location:i7(M8().max(200)),source:M8().trim().max(120).optional(),sort:C5([`savedOn`,`fit`]).optional(),minFit:Y5().int().min(0).max(100).optional()}),_5({company:M8().trim().min(1).max(200),title:M8().trim().max(200).optional().default(``),excludeId:V8().optional()}),_5({q:M8().trim().min(1).max(300),limit:Y5().int().min(1).max(100).default(25),types:r7(C5([`application`,`company`,`note`,`contact`]))}),a7.extend({format:C5([`csv`,`xlsx`]).default(`csv`)}),_5({name:M8().trim().min(1).max(200),website:Z5(2e3),location:Z5(200),tags:n7.default([])}),_5({name:M8().trim().min(1).max(200).optional(),website:Z5(2e3).optional(),location:Z5(200).optional(),archived:l5().optional(),tags:n7.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({title:M8().trim().min(1).max(200),body:M8().max(5e4).default(``),targetType:e7.default(`standalone`),targetId:V8().nullish().transform(e=>e??null),pinned:l5().default(!1)}),_5({title:M8().trim().min(1).max(200).optional(),body:M8().max(5e4).optional(),targetType:e7.optional(),targetId:V8().nullish(),pinned:l5().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({name:M8().trim().min(1).max(60),color:Z5(30),scope:t7.default(`both`)}),_5({companyName:M8().trim().min(1,`Company is required`).max(200),jobTitle:M8().trim().min(1,`Job title is required`).max(200),jobUrl:Z5(2e3),location:Z5(200),workMode:$5.default(`unspecified`),sourceName:Z5(120),salaryMin:a5().int().nonnegative().nullish().transform(e=>e??null),salaryMax:a5().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:Z5(8),notes:Z5(2e4),savedOn:X5.optional()}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),_5({companyName:M8().trim().min(1).max(200).optional(),jobTitle:M8().trim().min(1).max(200).optional(),jobUrl:Z5(2e3).optional(),location:Z5(200).optional(),workMode:$5.optional(),sourceName:Z5(120).optional(),salaryMin:a5().int().nonnegative().nullish(),salaryMax:a5().int().nonnegative().nullish(),salaryCurrency:Z5(8).optional(),notes:Z5(2e4).optional(),savedOn:X5.optional(),archived:l5().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({appliedOn:X5.optional(),status:Q5.optional(),tags:n7.optional()}),_5({url:M8().trim().min(1).max(2e3)}),_5({text:M8().min(1).max(2e5),url:Z5(2e3).optional()}),_5({url:M8().trim().min(1).max(2e3).optional(),text:M8().min(1).max(2e5).optional(),save:l5().default(!1)}).refine(e=>e.url!==void 0||e.text!==void 0,{message:`Give a url to read, or the posting text`}),_5({companyName:M8().trim().min(1,`Company is required`).max(200),jobTitle:M8().trim().min(1,`Job title is required`).max(200),jobUrl:Z5(2e3),location:Z5(200),workMode:$5.default(`unspecified`),sourceName:Z5(120),salaryMin:a5().int().nonnegative().nullish().transform(e=>e??null),salaryMax:a5().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:Z5(8),notes:Z5(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),_5({target:M8().min(1)});var s7=C5(o$),c7=C5(c$),l7=C5(u$),u7=C5(d$),d7=C5(f$);_5({name:M8().trim().min(1,`Name is required`).max(200),companyName:Z5(200),headline:Z5(300),email:Z5(320),phone:Z5(60),linkedinUrl:Z5(2e3),relationship:s7.default(`connection`),about:Z5(2e4),reconnectOn:X5.nullish().transform(e=>e??null)}),_5({name:M8().trim().min(1).max(200).optional(),companyName:Z5(200).optional(),headline:Z5(300).optional(),email:Z5(320).optional(),phone:Z5(60).optional(),linkedinUrl:Z5(2e3).optional(),relationship:s7.optional(),about:Z5(2e4).optional(),reconnectOn:X5.nullish(),archived:l5().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({q:M8().trim().max(300).optional(),company:M8().trim().max(200).optional(),relationship:r7(s7),reconnectDue:o7,includeArchived:o7,limit:Y5().int().min(1).max(5e3).default(500)}),_5({occurredOn:X5.optional(),channel:c7.default(`linkedin`),direction:l7.default(`outbound`),summary:M8().trim().min(1,`Say what happened`).max(5e3),applicationId:V8().nullish().transform(e=>e??null),reconnectOn:X5.nullish()}),_5({targetType:u7,targetId:V8(),role:d7.default(`contact`)});var f7=e=>h5(M8().trim().min(1).max(200)).max(e);_5({summary:Z5(5e4),targetTitles:f7(20).default([]),locations:f7(20).default([]),workModes:h5($5).max(4).default([]),salaryFloor:a5().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:Z5(8),includeKeywords:f7(30).default([]),excludeKeywords:f7(30).default([])}),_5({summary:Z5(5e4).optional(),targetTitles:f7(20).optional(),locations:f7(20).optional(),workModes:h5($5).max(4).optional(),salaryFloor:a5().int().nonnegative().nullish(),salaryCurrency:Z5(8).optional(),includeKeywords:f7(30).optional(),excludeKeywords:f7(30).optional()}),_5({defaultFollowUpDays:a5().int().min(1).max(90).nullish().transform(e=>e??null),autoGhostAfterDays:a5().int().min(14).max(365).nullish().transform(e=>e??null)}).partial(),_5({csv:M8().min(1).max(2e7)});function p7(e){return e===`exact`}var m7=class extends Error{status;code;details;constructor(e,t,n,r){super(n),this.name=`ApiError`,this.status=e,this.code=t,this.details=r}get fieldErrors(){return Array.isArray(this.details)?this.details:[]}};async function h7(e,t){let n=await fetch(e,{...t,headers:{...t?.body?{"Content-Type":`application/json`}:{},...t?.headers}});if(n.status===204)return;let r=await n.text(),i=r?JSON.parse(r):null;if(!n.ok)throw new m7(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}function g7(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!=null&&r!==``){if(Array.isArray(r)){if(r.length===0)continue;t.set(n,r.join(`,`))}else t.set(n,String(r))}let n=t.toString();return n?`?${n}`:``}var _7={csv:`text/csv`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};async function v7(e,t,n){let r=await fetch(`/api/import${g7({format:t,mode:n})}`,{method:`POST`,headers:{"Content-Type":_7[t]},body:e}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok)throw new m7(r.status,a?.error??`unknown`,a?.message??r.statusText,a?.details);return a}async function y7(e,t){let n=await fetch(`/api/backup/import${g7({mode:t})}`,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e}),r=await n.text(),i=r?JSON.parse(r):null;if(!n.ok)throw new m7(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}var b7={listApplications:e=>h7(`/api/applications${g7(e)}`),getApplication:e=>h7(`/api/applications/${e}`),periods:()=>h7(`/api/applications/periods`),applicationLocations:()=>h7(`/api/applications/locations`),checkDuplicates:e=>h7(`/api/applications/check${g7(e)}`),duplicateGroups:()=>h7(`/api/applications/duplicates`),createApplication:e=>h7(`/api/applications`,{method:`POST`,body:JSON.stringify(e)}),updateApplication:(e,t)=>h7(`/api/applications/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),changeStatus:(e,t)=>h7(`/api/applications/${e}/status`,{method:`POST`,body:JSON.stringify(t)}),deleteApplication:e=>h7(`/api/applications/${e}`,{method:`DELETE`}),deleteApplications:e=>h7(`/api/applications/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:e})}),listCompanies:(e={})=>h7(`/api/companies${g7(e)}`),suggestCompanies:e=>h7(`/api/companies/suggest${g7({q:e})}`),getCompany:e=>h7(`/api/companies/${e}`),updateCompany:(e,t)=>h7(`/api/companies/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),listTags:()=>h7(`/api/tags`),listNotes:(e={})=>h7(`/api/notes${g7(e)}`),createNote:e=>h7(`/api/notes`,{method:`POST`,body:JSON.stringify(e)}),updateNote:(e,t)=>h7(`/api/notes/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteNote:e=>h7(`/api/notes/${e}`,{method:`DELETE`}),dashboard:()=>h7(`/api/dashboard`),listContacts:(e={})=>h7(`/api/contacts${g7(e)}`),getContact:e=>h7(`/api/contacts/${e}`),createContact:e=>h7(`/api/contacts`,{method:`POST`,body:JSON.stringify(e)}),updateContact:(e,t)=>h7(`/api/contacts/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteContact:e=>h7(`/api/contacts/${e}`,{method:`DELETE`}),logInteraction:(e,t)=>h7(`/api/contacts/${e}/interactions`,{method:`POST`,body:JSON.stringify(t)}),deleteInteraction:e=>h7(`/api/interactions/${e}`,{method:`DELETE`}),linkedContacts:(e,t)=>h7(`/api/contacts/linked/${e}/${t}`),linkContact:(e,t)=>h7(`/api/contacts/${e}/links`,{method:`POST`,body:JSON.stringify(t)}),unlinkContact:e=>h7(`/api/contact-links/${e}`,{method:`DELETE`}),previewLinkedInImport:e=>h7(`/api/contacts/import/linkedin?mode=preview`,{method:`POST`,body:JSON.stringify({csv:e})}),commitLinkedInImport:e=>h7(`/api/contacts/import/linkedin?mode=commit`,{method:`POST`,body:JSON.stringify({csv:e})}),search:(e,t)=>h7(`/api/search${g7({q:e,types:t,limit:25})}`),exportUrl:(e,t)=>`/api/export${g7({...e,format:t})}`,previewImport:(e,t)=>v7(e,t,`preview`),commitImport:(e,t)=>v7(e,t,`commit`),listOpenings:(e={})=>h7(`/api/openings${g7(e)}`),getProfile:()=>h7(`/api/profile`),updateProfile:e=>h7(`/api/profile`,{method:`PUT`,body:JSON.stringify(e)}),getRules:()=>h7(`/api/rules`),updateRules:e=>h7(`/api/rules`,{method:`PUT`,body:JSON.stringify(e)}),previewAutoGhost:()=>h7(`/api/rules/auto-ghost`),runAutoGhost:()=>h7(`/api/rules/auto-ghost/run`,{method:`POST`}),getOpening:e=>h7(`/api/openings/${e}`),createOpening:e=>h7(`/api/openings`,{method:`POST`,body:JSON.stringify(e)}),updateOpening:(e,t)=>h7(`/api/openings/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteOpening:e=>h7(`/api/openings/${e}`,{method:`DELETE`}),convertOpening:(e,t)=>h7(`/api/openings/${e}/convert`,{method:`POST`,body:JSON.stringify(t)}),ingestUrl:e=>h7(`/api/ingest/url`,{method:`POST`,body:JSON.stringify({url:e})}),ingestText:(e,t)=>h7(`/api/ingest/text`,{method:`POST`,body:JSON.stringify({text:e,url:t??null})}),clipPosting:e=>h7(`/api/ingest/clip`,{method:`POST`,body:JSON.stringify(e)}),getDbTargets:()=>h7(`/api/db/targets`),switchDb:e=>h7(`/api/db/switch`,{method:`POST`,body:JSON.stringify({target:e})}),backupExportUrl:`/api/backup/export`,previewBackup:e=>y7(e,`preview`),commitBackup:e=>y7(e,`commit`),getDataStatus:()=>h7(`/api/backup/status`),clearDatabase:()=>h7(`/api/backup/clear`,{method:`POST`}),seedDatabase:()=>h7(`/api/backup/seed`,{method:`POST`}),getMeta:()=>h7(`/api/meta`)},x7=class extends Error{name=`RepoError`;cause;constructor(e,t){super(e),t?.cause!==void 0&&(this.cause=t.cause)}},S7=class extends x7{name=`SchemaError`},C7=new Set([`string`,`number`,`integer`,`boolean`,`date`,`json`,`binary`]);function w7(e){let t=Object.keys(e);if(t.length===0)throw new S7(`A schema must define at least one field`);let n={},r={},i={},a;for(let o of t){let t=e[o];if(!C7.has(t.type))throw new S7(`Field "${o}" has unknown type ${JSON.stringify(t.type)}. Expected one of: ${[...C7].join(`, `)}`);let s=t.column??o;if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(s))throw new S7(`Field "${o}" maps to column ${JSON.stringify(s)}, which is not a plain identifier. Column names must match /^[A-Za-z_][A-Za-z0-9_]*$/ because repolayer never quotes-and-interpolates arbitrary text into SQL.`);if(s in r)throw new S7(`Fields "${r[s]}" and "${o}" both map to column "${s}"`);if(t.primaryKey){if(a!==void 0)throw new S7(`Schema declares two primary keys ("${a}" and "${o}"). repolayer supports single-column primary keys only.`);if(t.nullable)throw new S7(`Primary key "${o}" cannot be nullable`);if(t.type===`binary`)throw new S7(`Primary key "${o}" cannot be binary. MySQL cannot key a BLOB, and a page cursor has no portable encoding for one. Use a string key, such as the hex of the bytes.`);a=o}if(t.type===`binary`&&t.default!==void 0)throw new S7(`Field "${o}" is binary and declares a default. Every engine spells a byte literal differently and MySQL gives a BLOB no literal default at all, so set the value on create instead.`);n[o]=s,r[s]=o,i[o]=t.type}if(a===void 0)throw new S7("Schema has no primary key. Mark exactly one field with `primaryKey: true`.");return Object.freeze({fields:e,primaryKey:a,columns:Object.freeze(n),fieldsByColumn:Object.freeze(r),fieldNames:Object.freeze(t),types:Object.freeze(i)})}var T7=[`gt`,`gte`,`lt`,`lte`],E7=[`eq`,`ne`,`in`,`nin`,`isNull`],D7=[`like`,`ilike`];[...E7,...T7],[...E7,...T7,...D7],new Set(E7),new Set(E7);var O7={createdAt:{type:`date`,column:`created_at`},updatedAt:{type:`date`,column:`updated_at`}};w7({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},website:{type:`string`,nullable:!0},location:{type:`string`,nullable:!0},archived:{type:`boolean`},...O7}),w7({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},titleKey:{type:`string`,column:`title_key`},appliedOn:{type:`date`,column:`applied_on`},periodYear:{type:`integer`,column:`period_year`},periodMonth:{type:`integer`,column:`period_month`},status:{type:`string`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},followUpOn:{type:`date`,nullable:!0,column:`follow_up_on`},archived:{type:`boolean`},...O7}),w7({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},color:{type:`string`,nullable:!0},scope:{type:`string`},...O7}),w7({id:{type:`string`,primaryKey:!0},tagId:{type:`string`,column:`tag_id`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},...O7}),w7({id:{type:`string`,primaryKey:!0},title:{type:`string`},body:{type:`string`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,nullable:!0,column:`target_id`},pinned:{type:`boolean`},...O7}),w7({id:{type:`string`,primaryKey:!0},applicationId:{type:`string`,column:`application_id`},fromStatus:{type:`string`,nullable:!0,column:`from_status`},toStatus:{type:`string`,column:`to_status`},occurredOn:{type:`date`,column:`occurred_on`},commentText:{type:`string`,nullable:!0,column:`comment_text`},...O7}),w7({id:{type:`string`,primaryKey:!0},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},model:{type:`string`},dim:{type:`integer`},embedding:{type:`json`},textHash:{type:`string`,column:`text_hash`},...O7}),w7({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},notes:{type:`string`,nullable:!0},savedOn:{type:`date`,column:`saved_on`},archived:{type:`boolean`},convertedApplicationId:{type:`string`,nullable:!0,column:`converted_application_id`},...O7}),w7({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,column:`name_key`},companyName:{type:`string`,nullable:!0,column:`company_name`},companyKey:{type:`string`,nullable:!0,column:`company_key`},headline:{type:`string`,nullable:!0},email:{type:`string`,nullable:!0},phone:{type:`string`,nullable:!0},linkedinUrl:{type:`string`,nullable:!0,column:`linkedin_url`},relationship:{type:`string`},about:{type:`string`,nullable:!0},reconnectOn:{type:`date`,nullable:!0,column:`reconnect_on`},connectedOn:{type:`date`,nullable:!0,column:`connected_on`},archived:{type:`boolean`},...O7}),w7({id:{type:`string`,primaryKey:!0},contactId:{type:`string`,column:`contact_id`},occurredOn:{type:`date`,column:`occurred_on`},channel:{type:`string`,column:`channel_name`},direction:{type:`string`},summary:{type:`string`,column:`summary_text`},applicationId:{type:`string`,nullable:!0,column:`application_id`},...O7}),w7({id:{type:`string`,primaryKey:!0},contactId:{type:`string`,column:`contact_id`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},role:{type:`string`,column:`link_role`},...O7}),w7({id:{type:`string`,primaryKey:!0},settingKey:{type:`string`,unique:!0,column:`setting_key`},value:{type:`json`},...O7}),[{header:`Position`,value:e=>e.jobTitle,width:34},{header:`Company`,value:e=>e.company.name,width:28},{header:`Location`,value:e=>e.location??``,width:22},{header:`Date`,value:e=>e.appliedOn,width:13},{header:`Status`,value:e=>e$[e.status],width:13},{header:`Notes`,value:e=>e.notesText,width:70,wrap:!0}].map(e=>e.header).filter(e=>e!==`Location`),new Map(Object.entries(e$).map(([e,t])=>[t.toLowerCase(),e]));var k7=b7,A7={applications:e=>[`applications`,e],application:e=>[`application`,e],periods:()=>[`periods`],applicationLocations:()=>[`applications`,`locations`],companies:e=>[`companies`,e],company:e=>[`company`,e],companySuggest:e=>[`company-suggest`,e],tags:()=>[`tags`],notes:e=>[`notes`,e],dashboard:()=>[`dashboard`],duplicates:e=>[`duplicates`,e],duplicateGroups:()=>[`duplicates`,`groups`],search:e=>[`search`,e],openings:e=>[`openings`,e],contacts:e=>[`contacts`,e],profile:()=>[`profile`],rules:()=>[`rules`],autoGhostPreview:()=>[`rules`,`auto-ghost`],contact:e=>[`contact`,e],linkedContacts:(e,t)=>[`contacts`,`linked`,e,t],opening:e=>[`opening`,e],dbTargets:()=>[`db-targets`],dataStatus:()=>[`data-status`],meta:()=>[`meta`]};function j7(e){e.invalidateQueries({queryKey:[`applications`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`periods`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`companies`]}),e.invalidateQueries({queryKey:[`company`]}),e.invalidateQueries({queryKey:[`tags`]}),e.invalidateQueries({queryKey:[`duplicates`]}),e.invalidateQueries({queryKey:[`search`]})}function M7(e){return ei({queryKey:A7.applications(e),queryFn:()=>k7.listApplications(e),placeholderData:e=>e})}function N7(e){return ni({queryKey:A7.applications(e),queryFn:({pageParam:t})=>k7.listApplications(t?{...e,cursor:t}:e),initialPageParam:null,getNextPageParam:e=>e.hasMore?e.cursor:null,placeholderData:e=>e})}function P7(e){return ei({queryKey:A7.application(e??``),queryFn:()=>k7.getApplication(e),enabled:!!e})}function F7(){return ei({queryKey:A7.periods(),queryFn:()=>k7.periods()})}function I7(){return ei({queryKey:A7.applicationLocations(),queryFn:()=>k7.applicationLocations()})}function L7(){return ei({queryKey:A7.dashboard(),queryFn:()=>k7.dashboard()})}function R7(){return ei({queryKey:A7.tags(),queryFn:()=>k7.listTags()})}function z7(e={}){return ei({queryKey:A7.companies(e),queryFn:()=>k7.listCompanies(e)})}function B7(e){return ei({queryKey:A7.company(e??``),queryFn:()=>k7.getCompany(e),enabled:!!e})}function V7(e={}){return ei({queryKey:A7.notes(e),queryFn:()=>k7.listNotes(e)})}function H7(e){let{enabled:t=!0,...n}=e;return ei({queryKey:A7.duplicates(n),queryFn:()=>k7.checkDuplicates(n),enabled:t&&n.company.trim().length>1,staleTime:5e3})}function U7(){return ei({queryKey:A7.duplicateGroups(),queryFn:()=>k7.duplicateGroups()})}function W7(e){return ei({queryKey:A7.companySuggest(e),queryFn:()=>k7.suggestCompanies(e),enabled:e.trim().length>0,staleTime:3e4})}function G7(){let e=An();return ti({mutationFn:e=>k7.createApplication(e),onSuccess:()=>j7(e)})}function K7(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.updateApplication(e,t),onSuccess:()=>j7(e)})}function q7(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.changeStatus(e,t),onSuccess:()=>j7(e)})}function J7(){let e=An();return ti({mutationFn:e=>k7.deleteApplication(e),onSuccess:()=>j7(e)})}function Y7(){let e=An();return ti({mutationFn:e=>k7.deleteApplications(e),onSuccess:()=>j7(e)})}function X7(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.updateCompany(e,t),onSuccess:()=>j7(e)})}function Z7(){let e=An();return ti({mutationFn:({id:e,body:t})=>e?k7.updateNote(e,t):k7.createNote(t),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`search`]})}})}function Q7(){let e=An();return ti({mutationFn:e=>k7.deleteNote(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]})}})}function $7(e={}){return ei({queryKey:A7.openings(e),queryFn:()=>k7.listOpenings(e)})}function e9(e){e.invalidateQueries({queryKey:[`openings`]}),e.invalidateQueries({queryKey:[`opening`]})}function t9(){let e=An();return ti({mutationFn:e=>k7.createOpening(e),onSuccess:()=>e9(e)})}function n9(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.updateOpening(e,t),onSuccess:()=>e9(e)})}function r9(){let e=An();return ti({mutationFn:e=>k7.deleteOpening(e),onSuccess:()=>e9(e)})}function i9(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.convertOpening(e,t),onSuccess:()=>{e9(e),e.invalidateQueries({queryKey:[`applications`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`periods`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`companies`]}),e.invalidateQueries({queryKey:[`search`]})}})}function a9(){return ei({queryKey:A7.dbTargets(),queryFn:()=>k7.getDbTargets()})}function o9(){return ti({mutationFn:e=>k7.switchDb(e)})}function s9(){return ei({queryKey:A7.dataStatus(),queryFn:()=>k7.getDataStatus()})}function c9(){let e=An();return ti({mutationFn:()=>k7.clearDatabase(),onSuccess:()=>void e.invalidateQueries()})}function l9(){let e=An();return ti({mutationFn:()=>k7.seedDatabase(),onSuccess:()=>void e.invalidateQueries()})}function u9(){return ei({queryKey:A7.meta(),queryFn:()=>k7.getMeta(),staleTime:1/0})}function d9(e={}){return ei({queryKey:A7.contacts(e),queryFn:()=>k7.listContacts(e),placeholderData:e=>e})}function f9(e){return ei({queryKey:A7.contact(e??``),queryFn:()=>k7.getContact(e),enabled:!!e})}function p9(e){e.invalidateQueries({queryKey:[`contacts`]}),e.invalidateQueries({queryKey:[`contact`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`duplicates`]}),e.invalidateQueries({queryKey:[`search`]})}function m9(e,t){return ei({queryKey:A7.linkedContacts(e,t??``),queryFn:()=>k7.linkedContacts(e,t),enabled:!!t})}function h9(){let e=An();return ti({mutationFn:({id:e,body:t})=>e?k7.updateContact(e,t):k7.createContact(t),onSuccess:()=>p9(e)})}function g9(){let e=An();return ti({mutationFn:e=>k7.deleteContact(e),onSuccess:()=>p9(e)})}function _9(){let e=An();return ti({mutationFn:({contactId:e,body:t})=>k7.logInteraction(e,t),onSuccess:()=>p9(e)})}function v9(){let e=An();return ti({mutationFn:e=>k7.deleteInteraction(e),onSuccess:()=>p9(e)})}function y9(){let e=An();return ti({mutationFn:({contactId:e,body:t})=>k7.linkContact(e,t),onSuccess:()=>p9(e)})}function b9(){let e=An();return ti({mutationFn:e=>k7.unlinkContact(e),onSuccess:()=>p9(e)})}function x9(){return ei({queryKey:A7.profile(),queryFn:()=>k7.getProfile()})}function S9(){let e=An();return ti({mutationFn:e=>k7.updateProfile(e),onSuccess:t=>{e.setQueryData(A7.profile(),t),e.invalidateQueries({queryKey:[`openings`]})}})}function C9(){return ei({queryKey:A7.rules(),queryFn:()=>k7.getRules()})}function w9(){let e=An();return ti({mutationFn:e=>k7.updateRules(e),onSuccess:()=>void e.invalidateQueries({queryKey:[`rules`]})})}function T9(e){return ei({queryKey:A7.autoGhostPreview(),queryFn:()=>k7.previewAutoGhost(),enabled:e})}function E9(){let e=An();return ti({mutationFn:()=>k7.runAutoGhost(),onSuccess:()=>{j7(e),e.invalidateQueries({queryKey:[`rules`]})}})}function D9({status:e}){return(0,Z.jsx)(lY,{color:$Q[e],children:e$[e]})}function O9(e,t=300){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var k9={exact:`error`,similar:`warning`,company:`info`,none:`success`};function A9({check:e,loading:t}){if(t&&!e)return(0,Z.jsx)(Rp,{type:`info`,showIcon:!0,message:`Checking your history…`,style:{marginBottom:16}});if(!e)return null;let n=e.contacts??[];if(e.verdict===`none`)return(0,Z.jsx)(Rp,{type:`success`,showIcon:!0,message:`No history with this company`,description:(0,Z.jsxs)(vz,{direction:`vertical`,size:6,style:{width:`100%`},children:[(0,Z.jsx)(`span`,{children:`This looks like a company you haven't applied to before.`}),(0,Z.jsx)(j9,{people:n})]}),style:{marginBottom:16}});let r=e.company?.name??`this company`;return(0,Z.jsx)(Rp,{type:k9[e.verdict],showIcon:!0,style:{marginBottom:16},message:Eee(e.verdict,r,e.priorCount),description:(0,Z.jsxs)(vz,{direction:`vertical`,size:6,style:{width:`100%`},children:[e.matches.length>0?e.matches.slice(0,5).map(e=>(0,Z.jsx)(Dee,{match:e},e.id)):(0,Z.jsx)(AX.Text,{type:`secondary`,children:`None of them were for this role, but it is worth a look before you apply again.`}),(0,Z.jsx)(j9,{people:n}),!e.semanticUsed&&e.matches.length>0&&(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Matched on wording only. Semantic matching is still warming up.`})]})})}function j9({people:e}){if(e.length===0)return null;let t=e.slice(0,3);return(0,Z.jsxs)(vz,{direction:`vertical`,size:2,children:[(0,Z.jsxs)(AX.Text,{strong:!0,children:[`You know `,e.length===1?`1 person`:`${e.length} people`,` here. Worth asking for a referral?`]}),t.map(e=>(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/people/${e.id}`,children:e.name}),e.headline&&(0,Z.jsx)(AX.Text,{type:`secondary`,children:e.headline}),(0,Z.jsx)(lY,{children:s$[e.relationship]})]},e.id))]})}function Eee(e,t,n){let r=n===1?`once`:`${n} times`;switch(e){case`exact`:return`You have already applied for this exact role at ${t}`;case`similar`:return`You have applied for a very similar role at ${t}`;default:return`You have applied to ${t} ${r} before`}}function Dee({match:e}){let t=Math.round(Math.max(e.titleSimilarity,e.semanticSimilarity??0)*100);return(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/applications/${e.id}`,children:e.jobTitle}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:e.appliedOn}),(0,Z.jsx)(lY,{color:$Q[e.status],children:e$[e.status]}),e.matchKind===`exact`?(0,Z.jsx)(lY,{color:`red`,children:`exact title`}):(0,Z.jsxs)(lY,{children:[t,`% similar`]})]})}function Oee({onStartApplication:e}){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(``),a=O9(t,350),{data:o,isFetching:s}=H7({company:a,title:O9(r,350)}),c=a.trim().length>1;return(0,Z.jsx)(_F,{title:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(jQ,{}),(0,Z.jsx)(`span`,{children:`Check before you apply`})]}),extra:e&&(0,Z.jsx)(Rk,{type:`link`,onClick:e,children:`New application`}),children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{xs:24,sm:12,children:(0,Z.jsx)(tV,{placeholder:`Company`,value:t,onChange:e=>n(e.target.value),allowClear:!0})}),(0,Z.jsx)(NI,{xs:24,sm:12,children:(0,Z.jsx)(tV,{placeholder:`Job title (optional)`,value:r,onChange:e=>i(e.target.value),allowClear:!0})})]}),c?(0,Z.jsx)(A9,{check:o,loading:s}):(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Type a company name to see whether you have been here before.`})]})})}function M9({open:e,onClose:t,application:n}){let[r]=OB.useForm(),{message:i,modal:a}=FC.useApp(),o=!!n,s=G7(),c=K7(),{data:l}=R7(),u=OB.useWatch(`companyName`,r)??``,d=OB.useWatch(`jobTitle`,r)??``,f=O9(u,300),p=O9(d,300),m=o&&u.trim()===(n?.company.name??``).trim()&&d.trim()===(n?.jobTitle??``).trim(),{data:h}=W7(f),{data:g,isFetching:v}=H7({company:f,title:p,...n?{excludeId:n.id}:{},enabled:e&&!m});(0,_.useEffect)(()=>{e&&(n?r.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,appliedOn:(0,Kk.default)(n.appliedOn),status:n.status,jobUrl:n.jobUrl??void 0,location:n.location??void 0,workMode:n.workMode,sourceName:n.sourceName??void 0,salaryMin:n.salaryMin,salaryMax:n.salaryMax,salaryCurrency:n.salaryCurrency??void 0,followUpOn:n.followUpOn?(0,Kk.default)(n.followUpOn):null,tags:n.tags.map(e=>e.name)}):(r.resetFields(),r.setFieldsValue({appliedOn:(0,Kk.default)(),status:`applied`,workMode:`unspecified`,tags:[]})))},[e,n,r]);let y=(0,_.useMemo)(()=>(h?.companies??[]).map(e=>({value:e.name,label:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(`span`,{children:e.name}),e.applicationCount>0&&(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[e.applicationCount,` application`,e.applicationCount===1?``:`s`]})]})})),[h]),b=(0,_.useMemo)(()=>(l?.tags??[]).map(e=>({value:e.name,label:e.name})),[l]),[x,S]=(0,_.useState)(!1);async function C(e){if(g&&p7(g.verdict)&&!o&&!await new Promise(e=>{a.confirm({title:`You have applied for this exact role before`,content:(0,Z.jsxs)(vz,{direction:`vertical`,children:[(0,Z.jsxs)(AX.Text,{children:[g.matches[0]?.jobTitle,` at `,g.company?.name,` on`,` `,g.matches[0]?.appliedOn,`.`]}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Save this as a new application anyway?`})]}),okText:`Save anyway`,cancelText:`Go back`,onOk:()=>e(!0),onCancel:()=>e(!1)})}))return;let l={companyName:e.companyName,jobTitle:e.jobTitle,appliedOn:e.appliedOn.format(`YYYY-MM-DD`),status:e.status,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,followUpOn:e.followUpOn?e.followUpOn.format(`YYYY-MM-DD`):null,tags:e.tags??[],...o?{}:{notes:e.notes??null}};S(!0);try{n?(await c.mutateAsync({id:n.id,body:l}),i.success(`Application updated`)):(await s.mutateAsync(l),i.success(`Application saved`)),t()}catch(e){e instanceof m7&&e.fieldErrors.length>0?(r.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),i.error(`Please check the highlighted fields`)):i.error(e instanceof Error?e.message:`Could not save`)}finally{S(!1)}}return(0,Z.jsxs)(lz,{title:o?`Edit application`:`New application`,open:e,onClose:t,width:640,destroyOnHidden:!0,extra:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Rk,{type:`primary`,loading:x,onClick:()=>r.submit(),children:o?`Save changes`:`Save application`})]}),children:[!m&&(0,Z.jsx)(A9,{check:g,loading:v}),(0,Z.jsxs)(OB,{form:r,layout:`vertical`,onFinish:C,requiredMark:`optional`,children:[(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(PE,{options:y,placeholder:`Start typing to see existing companies`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(tV,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(DE,{options:XQ.map(e=>({value:e,label:e$[e]}))})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`followUpOn`,label:`Follow up on`,children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`,allowClear:!0})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(DE,{options:t$.map(e=>({value:e,label:n$[e]}))})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(tV,{placeholder:`Stockholm`})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(tV,{placeholder:`LinkedIn, referral…`})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(PL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(PL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(tV,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(OB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(tV,{placeholder:`https://…`})}),(0,Z.jsx)(OB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(DE,{mode:`tags`,options:b,placeholder:`fintech, remote-ok, dream-job…`,tokenSeparators:[`,`]})}),!o&&(0,Z.jsx)(OB.Item,{name:`notes`,label:`Notes`,help:`Saved as a note linked to this application. Searchable.`,children:(0,Z.jsx)(tV.TextArea,{rows:4,placeholder:`Anything worth remembering…`})})]})]})}var kee={dark:{bgBase:`#0d1117`,bgRaised:`#161b22`,bgSunken:`#010409`,border:`#30363d`,borderStrong:`#444c56`,textPrimary:`#e6edf3`,textMuted:`#8b949e`,textFaint:`#6e7681`,accent:`#58a6ff`,success:`#3fb950`,danger:`#f85149`,warning:`#d29922`},light:{bgBase:`#ffffff`,bgRaised:`#ffffff`,bgSunken:`#f6f8fa`,border:`#d0d7de`,borderStrong:`#afb8c1`,textPrimary:`#1f2328`,textMuted:`#656d76`,textFaint:`#8c959f`,accent:`#0969da`,success:`#1a7f37`,danger:`#d1242f`,warning:`#9a6700`}},N9={bgBase:`var(--jt-bg-base)`,bgRaised:`var(--jt-bg-raised)`,bgSunken:`var(--jt-bg-sunken)`,border:`var(--jt-border)`,borderStrong:`var(--jt-border-strong)`,textPrimary:`var(--jt-text-primary)`,textMuted:`var(--jt-text-muted)`,textFaint:`var(--jt-text-faint)`,accent:`var(--jt-accent)`,success:`var(--jt-success)`,danger:`var(--jt-danger)`,warning:`var(--jt-warning)`};function Aee(e){let t=kee[e];return{algorithm:e===`dark`?yY.darkAlgorithm:yY.defaultAlgorithm,token:{colorBgBase:t.bgBase,colorBgContainer:t.bgRaised,colorBgElevated:t.bgRaised,colorBgLayout:t.bgBase,colorBorder:t.border,colorBorderSecondary:t.border,colorText:t.textPrimary,colorTextSecondary:t.textMuted,colorTextTertiary:t.textFaint,colorPrimary:t.accent,colorLink:t.accent,colorSuccess:t.success,colorError:t.danger,colorWarning:t.warning,borderRadius:8,fontSize:14},components:{Layout:{siderBg:t.bgSunken,headerBg:t.bgSunken,bodyBg:t.bgBase}}}}function P9(e){return`${S$(e.month).slice(0,3)} ${e.year}`}function jee({points:e,height:t=140}){let[n,r]=(0,_.useState)(null);if(e.length===0)return null;let i=Math.max(...e.map(e=>e.count),1),a=e.reduce((e,t)=>e+t.count,0),o=n===null?null:e[n];return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`baseline`,style:{marginBottom:8},children:[(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:o?`${P9(o)}: ${o.count} application${o.count===1?``:`s`}`:`${a} application${a===1?``:`s`} over ${e.length} months`}),(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[`peak `,i]})]}),(0,Z.jsxs)(`svg`,{viewBox:`0 0 ${e.length*10} 100`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Applications per month, ${P9(e[0])} to ${P9(e.at(-1))}. Peak ${i} in one month, ${a} in total.`,style:{display:`block`,width:`100%`,height:t},onMouseLeave:()=>r(null),children:[(0,Z.jsx)(`title`,{children:`Applications per month`}),e.map((e,t)=>{let a=e.count===0?0:Math.max(e.count/i*100,2);return(0,Z.jsxs)(`g`,{onMouseEnter:()=>r(t),children:[(0,Z.jsx)(`rect`,{x:t*10,y:`0`,width:10,height:100,fill:`transparent`}),(0,Z.jsx)(`rect`,{x:t*10+3/2,y:100-a,width:7,height:Math.max(a,1),rx:`1`,fill:e.count===0?N9.border:N9.accent,opacity:n===null||n===t?1:.45})]},`${e.year}-${e.month}`)})]}),(0,Z.jsx)(Pz,{justify:`space-between`,style:{marginTop:6},children:[e[0],e[Math.floor(e.length/2)],e.at(-1)].map((e,t)=>(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:11},children:P9(e)},t))})]})}var Mee=[.45,.6,.78,1];function Nee({stages:e}){let t=e[0]?.count??0;return(0,Z.jsxs)(vz,{direction:`vertical`,size:10,style:{width:`100%`},children:[e.map((e,n)=>{let r=t>0?e.count/t:0;return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,marginBottom:4,gap:8},children:[(0,Z.jsx)(AX.Text,{style:{fontSize:13},children:e$[e.status]}),(0,Z.jsxs)(vz,{size:8,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e.count}),e.conversion!==null&&(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[Math.round(e.conversion*100),`% of previous`]})]})]}),(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 6`,preserveAspectRatio:`none`,role:`img`,"aria-label":`${e$[e.status]}: ${e.count} applications ever reached this stage`,style:{display:`block`,width:`100%`,height:10},children:[(0,Z.jsx)(`title`,{children:`${e$[e.status]}: ${e.count}`}),(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`6`,rx:`1.5`,fill:N9.bgSunken}),r>0&&(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:Math.max(r*100,1),height:`6`,rx:`1.5`,fill:N9.accent,opacity:Mee[n]??1})]})]},e.status)}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Counted from your status history: an application that interviewed and was then turned down still counts at every stage it reached.`})]})}function Pee({values:e,label:t,height:n=28}){if(e.length<2)return null;let r=Math.max(...e,1),i=100/(e.length-1),a=e.map((e,t)=>`${(t*i).toFixed(2)},${(100-e/r*100).toFixed(2)}`).join(` `),o=`0,100 ${a} 100,100`;return(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 100`,preserveAspectRatio:`none`,role:`img`,"aria-label":t,style:{display:`block`,width:`100%`,height:n},children:[(0,Z.jsx)(`title`,{children:t}),(0,Z.jsx)(`polygon`,{points:o,fill:N9.accent,opacity:.12}),(0,Z.jsx)(`polyline`,{points:a,fill:`none`,stroke:N9.accent,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`})]})}function Fee(){let{data:e,isLoading:t}=L7(),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(`follow-ups`),o=y$(b$());if(t||!e)return(0,Z.jsx)(TS,{active:!0,paragraph:{rows:8}});let{stats:s,followUps:c,recentActivity:l,funnel:u,volume:d,stale:f,reconnect:p}=e;if(s.total===0)return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_F,{children:(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:(0,Z.jsxs)(vz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:`No applications yet`}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Add the first one, or bring in a spreadsheet you already keep.`})]}),children:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(aP,{}),onClick:()=>r(!0),children:`New application`}),(0,Z.jsx)(gn,{to:`/applications`,children:(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(YQ,{}),children:`Import`})})]})})}),(0,Z.jsx)(M9,{open:n,onClose:()=>r(!1)})]});let m=d.slice(-12),h=d.slice(-13,-1),g=h.length>0?h.reduce((e,t)=>e+t.count,0)/h.length:0,v=s.thisMonth-g,y={"follow-ups":c.length,quiet:f.length,reconnect:p.length}[i];return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsx)(IU,{title:`Total applications`,value:s.total})})}),(0,Z.jsx)(NI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsx)(IU,{title:`Still active`,value:s.active,valueStyle:{color:N9.accent}})})}),(0,Z.jsx)(NI,{xs:12,sm:12,md:6,children:(0,Z.jsxs)(_F,{size:`small`,children:[(0,Z.jsx)(IU,{title:`${S$(o.month)} ${o.year}`,value:s.thisMonth}),(0,Z.jsx)(Pee,{values:m.map(e=>e.count),label:`Applications in each of the last ${m.length} months: ${m.map(e=>e.count).join(`, `)}`}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:g===0?`first month on record`:`${v>=0?`+`:``}${v.toFixed(1)} vs your monthly average`})]})}),(0,Z.jsx)(NI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Response rate`}),(0,Z.jsx)(iU,{percent:Math.round(s.responseRate*100),size:`small`,strokeColor:N9.accent}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Anything past “applied” counts as a reply`})]})})})]}),(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:24,lg:14,children:(0,Z.jsx)(Oee,{onStartApplication:()=>r(!0)})}),(0,Z.jsx)(NI,{xs:24,lg:10,children:(0,Z.jsx)(_F,{title:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(jR,{}),(0,Z.jsx)(`span`,{children:`Needs attention`})]}),extra:(0,Z.jsx)(qI,{size:`small`,value:i,onChange:e=>a(e),options:[{label:`Follow-ups (${c.length})`,value:`follow-ups`},{label:`Gone quiet (${f.length})`,value:`quiet`},{label:`Reconnect (${p.length})`,value:`reconnect`}]}),styles:{body:{maxHeight:320,overflowY:`auto`}},children:y===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:i===`follow-ups`?`Nothing due. All caught up.`:i===`quiet`?`Nothing has gone quiet`:`Nobody is due a reconnect`}):i===`follow-ups`?(0,Z.jsx)(_H,{size:`small`,dataSource:c,renderItem:e=>(0,Z.jsxs)(_H.Item,{children:[(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsx)(gn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(Pz,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)(AX.Text,{type:`danger`,children:[`due `,e.followUpOn]})]})}),(0,Z.jsx)(D9,{status:e.status})]})}):i===`reconnect`?(0,Z.jsx)(_H,{size:`small`,dataSource:p,renderItem:e=>(0,Z.jsxs)(_H.Item,{children:[(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsx)(gn,{to:`/people/${e.id}`,children:e.name}),description:(0,Z.jsxs)(Pz,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:[e.headline,e.companyName].filter(Boolean).join(` at `)}),(0,Z.jsxs)(AX.Text,{type:`danger`,children:[`due `,e.reconnectOn]})]})}),(0,Z.jsx)(lY,{children:s$[e.relationship]})]})}):(0,Z.jsx)(_H,{size:`small`,dataSource:f,header:(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Still live, no follow-up date, and nothing has moved.`}),renderItem:e=>(0,Z.jsxs)(_H.Item,{children:[(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsx)(gn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(Pz,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)(AX.Text,{type:`warning`,children:[`silent `,e.silentDays,` days`]})]})}),(0,Z.jsx)(D9,{status:e.status})]})})})})]}),(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:24,lg:12,children:(0,Z.jsx)(_F,{title:`Pipeline`,size:`small`,children:(0,Z.jsx)(Nee,{stages:u})})}),(0,Z.jsx)(NI,{xs:24,lg:12,children:(0,Z.jsx)(_F,{title:`Applications over time`,size:`small`,children:(0,Z.jsx)(jee,{points:d})})})]}),(0,Z.jsx)(_F,{title:`Recent activity`,size:`small`,styles:{body:{maxHeight:360,overflowY:`auto`}},children:l.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No status changes yet`}):(0,Z.jsx)(DY,{items:l.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsxs)(AX.Text,{children:[(0,Z.jsx)(gn,{to:`/applications/${e.applicationId}`,children:e.jobTitle}),` at `,e.companyName]}),(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[e.fromStatus?`${e$[e.fromStatus]} → ${e$[e.toStatus]}`:`Applied (${e$[e.toStatus]})`,` `,`· `,e.occurredOn]})]})}))})}),(0,Z.jsx)(M9,{open:n,onClose:()=>r(!1)})]})}function Iee({periods:e,year:t,month:n,onSelect:r}){let i=(0,_.useMemo)(()=>e.map(e=>({key:`y:${e.year}`,title:(0,Z.jsx)(F9,{label:String(e.year),count:e.count,strong:!0}),children:(e.months??[]).map(e=>({key:`m:${e.year}:${e.month}`,title:(0,Z.jsx)(F9,{label:S$(e.month),count:e.count})}))})),[e]),a=(0,_.useMemo)(()=>t&&n?[`m:${t}:${n}`]:t?[`y:${t}`]:[],[t,n]),o=(0,_.useMemo)(()=>{let n=e[0],r=n?[`y:${n.year}`]:[];return t&&!r.includes(`y:${t}`)&&r.push(`y:${t}`),r},[e,t]);return e.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No applications yet`}):(0,Z.jsx)(Rq,{treeData:i,selectedKeys:a,defaultExpandedKeys:o,blockNode:!0,onSelect:e=>{let t=String(e[0]??``);if(t.startsWith(`m:`)){let[,e,n]=t.split(`:`);r({year:Number(e),month:Number(n)})}else t.startsWith(`y:`)?r({year:Number(t.slice(2))}):r({})}})}function F9({label:e,count:t,strong:n}){return(0,Z.jsxs)(`span`,{style:{display:`flex`,justifyContent:`space-between`,gap:12},children:[(0,Z.jsx)(AX.Text,{strong:n,children:e}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:t})]})}var Lee={new:`green`,duplicate:`default`,error:`red`},Ree={new:`New`,duplicate:`Duplicate, skipped`,error:`Error`};function zee({open:e,onClose:t}){let n=An(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(`csv`),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null);function h(){i(null),c(null),u(null),m(null)}function g(){h(),t()}let v=e=>{let t=e.name.toLowerCase().endsWith(`.xlsx`)?`xlsx`:`csv`;return i(e),o(t),m(null),f(!0),k7.previewImport(e,t).then(c).catch(e=>m(e instanceof Error?e.message:`Could not read that file`)).finally(()=>f(!1)),!1};async function y(){if(r){f(!0),m(null);try{let e=await k7.commitImport(r,a);if(u(e),e.created>0)for(let e of[`applications`,`application`,`periods`,`dashboard`,`companies`,`company`,`search`])n.invalidateQueries({queryKey:[e]})}catch(e){m(e instanceof Error?e.message:`Import failed`)}finally{f(!1)}}}return(0,Z.jsx)(xH,{title:`Import applications`,open:e,onCancel:g,width:800,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(AX.Paragraph,{type:`secondary`,children:`CSV or .xlsx with the same columns Export produces: Position, Company, Location, Date, Status, Notes. Location is optional. Rows that exactly match an application you have already logged are skipped automatically.`}),(0,Z.jsxs)(SZ.Dragger,{accept:`.csv,.xlsx`,maxCount:1,showUploadList:!1,beforeUpload:v,disabled:d,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(tQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a CSV or Excel file here`})]})]}),p&&(0,Z.jsx)(Rp,{type:`error`,showIcon:!0,message:p}),s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(vz,{wrap:!0,children:[(0,Z.jsxs)(lY,{color:`green`,children:[s.totals.new,` new`]}),(0,Z.jsxs)(lY,{children:[s.totals.duplicate,` duplicate, will be skipped`]}),s.totals.error>0&&(0,Z.jsxs)(lY,{color:`red`,children:[s.totals.error,` error`]})]}),s.fileErrors.map(e=>(0,Z.jsx)(Rp,{type:`warning`,showIcon:!0,message:e},e)),(0,Z.jsx)(XJ,{size:`small`,rowKey:`rowNumber`,columns:[{title:`Row`,dataIndex:`rowNumber`,width:60},{title:`Position`,dataIndex:`jobTitle`,ellipsis:!0},{title:`Company`,dataIndex:`companyName`,ellipsis:!0},{title:`Date`,dataIndex:`appliedOn`,width:110},{title:`Status`,dataIndex:`status`,width:110,render:e=>e?e$[e]:`—`},{title:`Result`,dataIndex:`verdict`,width:200,render:(e,t)=>(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(lY,{color:Lee[e],children:Ree[e]}),t.errors.length>0&&(0,Z.jsx)(AX.Text,{type:`danger`,style:{fontSize:12},children:t.errors.join(`; `)})]})}],dataSource:s.rows,pagination:{pageSize:10},scroll:{y:320}}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:h,children:`Choose a different file`}),(0,Z.jsxs)(Rk,{type:`primary`,loading:d,disabled:s.totals.new===0,onClick:y,children:[`Import `,s.totals.new,` application`,s.totals.new===1?``:`s`]})]})]}),l&&(0,Z.jsx)(CU,{status:l.failed>0?`warning`:`success`,title:`Imported ${l.created} application${l.created===1?``:`s`}`,subTitle:`${l.skipped} duplicate row${l.skipped===1?``:`s`} skipped`+(l.failed>0?`, ${l.failed} row${l.failed===1?``:`s`} failed`:``),extra:(0,Z.jsx)(Rk,{type:`primary`,onClick:g,children:`Done`})})]})})}var I9=[{value:`appliedOn`,label:`Sort: date applied`,kind:`date`},{value:`company`,label:`Sort: company`,kind:`text`},{value:`jobTitle`,label:`Sort: job title`,kind:`text`},{value:`status`,label:`Sort: status`,kind:`text`}],L9={date:[{value:`desc`,label:`Newest first`},{value:`asc`,label:`Oldest first`}],text:[{value:`asc`,label:`A–Z`},{value:`desc`,label:`Z–A`}]};function R9(e){return I9.find(t=>t.value===e)?.kind??`date`}function z9(e){return L9[R9(e)][0].value}function Bee(){let e=tt(),[t,n]=Sn(),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=t.get(`sort`)??`appliedOn`,c=t.get(`direction`)??z9(s),l=(0,_.useMemo)(()=>{let e={sort:s,direction:c};for(let n of[`q`,`source`,`from`,`to`,`location`]){let r=t.get(n);r&&(e[n]=r)}for(let n of[`year`,`month`]){let r=t.get(n);r&&(e[n]=Number(r))}for(let n of[`status`,`workMode`,`tags`]){let r=t.get(n);r&&(e[n]=r.split(`,`))}return e},[t,s,c]),{data:u,isLoading:d,isFetching:f,hasNextPage:p,fetchNextPage:m,isFetchingNextPage:h}=N7(l),{data:g}=F7(),{data:v}=R7(),{data:y}=I7(),b=t.get(`location`)?.split(`|`).filter(Boolean)??[],x=u?.pages??[],S=(0,_.useMemo)(()=>x.flatMap(e=>e.items),[x]),C=x[0];function w(e){let r=new URLSearchParams(t);for(let[t,n]of Object.entries(e))if(n==null||n===``||Array.isArray(n)&&n.length===0)r.delete(t);else{let e=t===`location`?`|`:`,`;r.set(t,Array.isArray(n)?n.join(e):String(n))}n(r,{replace:!0})}let T=[{title:`Applied`,dataIndex:`appliedOn`,width:118,sorter:!1,render:e=>(0,Z.jsx)(AX.Text,{children:e})},{title:`Company`,key:`company`,width:190,render:(t,n)=>(0,Z.jsx)(Rk,{type:`link`,style:{padding:0,height:`auto`},onClick:t=>{t.stopPropagation(),e(`/companies/${n.company.id}`)},children:n.company.name})},{title:`Job title`,dataIndex:`jobTitle`,render:(e,t)=>(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e}),t.location&&(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[t.location,` · `,n$[t.workMode]]})]})},{title:`Status`,dataIndex:`status`,width:116,render:(e,t)=>(0,Z.jsx)(D9,{status:t.status})},{title:`Tags`,key:`tags`,width:210,render:(e,t)=>(0,Z.jsx)(vz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(lY,{color:e.color??void 0,style:{marginInlineEnd:0},children:e.name},e.id))})},{title:`Source`,dataIndex:`sourceName`,width:120,render:e=>e??(0,Z.jsx)(AX.Text,{type:`secondary`,children:`—`})}],E=t.get(`from`),D=t.get(`to`),O=E&&D?[(0,Kk.default)(E),(0,Kk.default)(D)]:null,k=(0,Kk.default)(),A=[{label:`Today`,value:[k,k]},{label:`Yesterday`,value:[k.subtract(1,`day`),k.subtract(1,`day`)]},{label:`This week`,value:[k.startOf(`week`),k.endOf(`week`)]},{label:`This month`,value:[k.startOf(`month`),k.endOf(`month`)]},{label:`Last 7 days`,value:[k.subtract(6,`day`),k]},{label:`Last 30 days`,value:[k.subtract(29,`day`),k]}];function j(e){if(!e||!e[0]||!e[1]){w({from:``,to:``});return}w({from:e[0].format(`YYYY-MM-DD`),to:e[1].format(`YYYY-MM-DD`)})}let M=t.get(`year`)?Number(t.get(`year`)):void 0,N=t.get(`month`)?Number(t.get(`month`)):void 0,P=M&&N?`${S$(N)} ${M}`:M?String(M):`All applications`;return(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{xs:24,md:6,lg:5,children:(0,Z.jsx)(_F,{size:`small`,title:`By period`,extra:(M||N)&&(0,Z.jsx)(Rk,{size:`small`,type:`link`,onClick:()=>w({year:``,month:``}),children:`Clear`}),styles:{body:{maxHeight:`calc(100vh - 220px)`,overflowY:`auto`}},children:(0,Z.jsx)(Iee,{periods:g?.periods??[],year:M,month:N,onSelect:e=>w({year:e.year??``,month:e.month??``})})})}),(0,Z.jsx)(NI,{xs:24,md:18,lg:19,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:P}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:C?S.length<C.total?`Showing ${S.length} of ${C.total} applications`:`${C.total} application${C.total===1?``:`s`}`:`Loading…`})]}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(bz,{menu:{items:[{key:`csv`,label:`Export as CSV`},{key:`xlsx`,label:`Export as Excel (.xlsx)`}],onClick:({key:e})=>{window.location.href=k7.exportUrl(l,e)}},children:(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(gZ,{}),children:`Export`})}),(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(YQ,{}),onClick:()=>o(!0),children:`Import`}),(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(iX,{}),onClick:()=>e(`/applications/duplicates`),children:`Duplicates`}),(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(aP,{}),onClick:()=>i(!0),children:`New application`})]})]}),(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(tV,{allowClear:!0,size:`large`,prefix:(0,Z.jsx)(SE,{}),placeholder:`Search by meaning, like “server-side developer” or “remote fintech”`,defaultValue:t.get(`q`)??``,onChange:e=>{e.target.value===``&&w({q:``})},onPressEnter:e=>w({q:e.target.value})}),(0,Z.jsxs)(Pz,{gap:8,wrap:!0,children:[(0,Z.jsx)(PR.RangePicker,{allowClear:!0,value:O,presets:A,format:`YYYY-MM-DD`,onChange:e=>j(e)}),(0,Z.jsx)(DE,{mode:`multiple`,allowClear:!0,placeholder:`Status`,style:{minWidth:180},suffixIcon:(0,Z.jsx)(YZ,{}),value:t.get(`status`)?.split(`,`)??[],onChange:e=>w({status:e}),options:XQ.map(e=>({value:e,label:e$[e]}))}),(0,Z.jsx)(DE,{mode:`multiple`,allowClear:!0,placeholder:`Work mode`,style:{minWidth:160},value:t.get(`workMode`)?.split(`,`)??[],onChange:e=>w({workMode:e}),options:t$.map(e=>({value:e,label:n$[e]}))}),(0,Z.jsx)(DE,{mode:`tags`,allowClear:!0,placeholder:`Location`,style:{minWidth:200},value:b,onChange:e=>w({location:e.map(e=>e.replace(/\|/g,` `).trim()).filter(Boolean)}),optionFilterProp:`value`,options:(y?.locations??[]).map(e=>({value:e.label,label:`${e.label} (${e.count})`}))}),(0,Z.jsx)(DE,{mode:`multiple`,allowClear:!0,placeholder:`Tags`,style:{minWidth:200},value:t.get(`tags`)?.split(`,`)??[],onChange:e=>w({tags:e}),options:(v?.tags??[]).map(e=>({value:e.name,label:e.name}))}),(0,Z.jsx)(DE,{style:{minWidth:170},value:s,onChange:e=>w({sort:e,direction:z9(e)}),options:I9.map(({value:e,label:t})=>({value:e,label:t}))}),(0,Z.jsx)(DE,{style:{width:130},value:c,onChange:e=>w({direction:e}),options:L9[R9(s)]})]}),C?.searched&&!C.semanticReady&&(0,Z.jsx)(Rp,{type:`info`,showIcon:!0,icon:(0,Z.jsx)(KQ,{}),message:`Results will improve shortly. The semantic model is still loading.`})]})}),(0,Z.jsx)(XJ,{rowKey:`id`,columns:T,dataSource:S,loading:d||f&&!h,pagination:!1,onRow:t=>({onClick:()=>e(`/applications/${t.id}`),style:{cursor:`pointer`}}),locale:{emptyText:(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:t.get(`q`)?`Nothing matched “${t.get(`q`)}”`:`No applications for this filter`})},footer:p?()=>(0,Z.jsx)(Pz,{justify:`center`,children:(0,Z.jsx)(_D,{title:`Adds the next page to the list`,children:(0,Z.jsx)(Rk,{loading:h,onClick:()=>void m(),children:`Load more`})})}):void 0})]})}),(0,Z.jsx)(M9,{open:r,onClose:()=>i(!1)}),(0,Z.jsx)(zee,{open:a,onClose:()=>o(!1)})]})}function B9({open:e,note:t,onClose:n,target:r}){let[i]=OB.useForm(),{message:a}=FC.useApp(),o=Z7();return(0,Z.jsx)(xH,{open:e,title:t?`Edit note`:`New note`,okText:`Save`,destroyOnHidden:!0,onCancel:n,afterOpenChange:e=>{e&&(t?i.setFieldsValue({title:t.title,body:t.body,targetType:t.targetType,targetId:t.targetId,pinned:t.pinned}):(i.resetFields(),i.setFieldsValue({targetType:r?r.type:`standalone`,targetId:r?r.id:null,pinned:!1,body:``})))},onOk:async()=>{let e=await i.validateFields();await o.mutateAsync({...t?{id:t.id}:{},body:{title:e.title,body:e.body??``,targetType:e.targetType,targetId:e.targetType===`standalone`?null:e.targetId??null,pinned:e.pinned??!1}}),a.success(t?`Note updated`:`Note saved`),n()},children:(0,Z.jsxs)(OB,{form:i,layout:`vertical`,children:[(0,Z.jsx)(OB.Item,{name:`title`,label:`Title`,rules:[{required:!0,message:`Title is required`}],children:(0,Z.jsx)(tV,{placeholder:`Interview prep, salary research…`})}),(0,Z.jsx)(OB.Item,{name:`body`,label:`Note`,children:(0,Z.jsx)(tV.TextArea,{rows:8,placeholder:`Anything worth keeping`})}),r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(OB.Item,{name:`targetType`,hidden:!0,children:(0,Z.jsx)(tV,{})}),(0,Z.jsx)(OB.Item,{name:`targetId`,hidden:!0,children:(0,Z.jsx)(tV,{})}),(0,Z.jsxs)(AX.Paragraph,{type:`secondary`,style:{marginBottom:16},children:[`Attached to `,r.label]})]}):(0,Z.jsx)(Vee,{form:i}),(0,Z.jsx)(OB.Item,{name:`pinned`,label:`Pinned`,valuePropName:`checked`,children:(0,Z.jsx)(PW,{})})]})})}function Vee({form:e}){let t=OB.useWatch(`targetType`,e)??`standalone`,{data:n}=z7(),{data:r}=M7({limit:200}),i=(0,_.useMemo)(()=>t===`company`?(n?.companies??[]).map(e=>({value:e.id,label:e.name})):t===`application`?(r?.items??[]).map(e=>({value:e.id,label:`${e.jobTitle} at ${e.company.name}`})):[],[t,n,r]);return(0,Z.jsxs)(Pz,{gap:12,children:[(0,Z.jsx)(OB.Item,{name:`targetType`,label:`Attach to`,style:{flex:1},children:(0,Z.jsx)(DE,{options:[{value:`standalone`,label:`Nothing in particular`},{value:`company`,label:`A company`},{value:`application`,label:`An application`}],onChange:()=>e.setFieldValue(`targetId`,null)})}),t!==`standalone`&&(0,Z.jsx)(OB.Item,{name:`targetId`,label:t===`company`?`Company`:`Application`,style:{flex:2},rules:[{required:!0,message:`Pick what this note is about`}],children:(0,Z.jsx)(DE,{showSearch:!0,optionFilterProp:`label`,options:i})})]})}function V9({open:e,onClose:t,contact:n,defaults:r,onSaved:i}){let[a]=OB.useForm(),{message:o}=FC.useApp(),s=h9(),{data:c}=W7(OB.useWatch(`companyName`,a)??``),l=(0,_.useMemo)(()=>(c?.companies??[]).map(e=>({value:e.name})),[c]),u=n?.id,d=r?.companyName,f=r?.relationship;(0,_.useEffect)(()=>{e&&(a.resetFields(),n?a.setFieldsValue({name:n.name,companyName:n.companyName??void 0,headline:n.headline??void 0,relationship:n.relationship,email:n.email??void 0,phone:n.phone??void 0,linkedinUrl:n.linkedinUrl??void 0,reconnectOn:n.reconnectOn?(0,Kk.default)(n.reconnectOn):null,about:n.about??void 0}):a.setFieldsValue({relationship:f??`connection`,companyName:d}))},[e,u,d,f,a]);async function p(e){let r={name:e.name,companyName:e.companyName??null,headline:e.headline??null,relationship:e.relationship,email:e.email??null,phone:e.phone??null,linkedinUrl:e.linkedinUrl??null,reconnectOn:e.reconnectOn?e.reconnectOn.format(`YYYY-MM-DD`):null,about:e.about??null};try{let e=await s.mutateAsync({id:n?.id,body:r});o.success(n?`Person updated`:`Person added`),i?.(e),t()}catch(e){e instanceof m7&&e.fieldErrors.length>0?a.setFields(e.fieldErrors.map(e=>({name:e.path,errors:[e.message]}))):o.error(e instanceof Error?e.message:`Could not save`)}}return(0,Z.jsx)(lz,{title:n?`Edit ${n.name}`:`Add a person`,open:e,onClose:t,width:560,destroyOnHidden:!0,extra:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Rk,{type:`primary`,loading:s.isPending,onClick:()=>a.submit(),children:`Save`})]}),children:(0,Z.jsxs)(OB,{form:a,layout:`vertical`,onFinish:p,requiredMark:`optional`,children:[(0,Z.jsx)(OB.Item,{name:`name`,label:`Name`,rules:[{required:!0,message:`Name is required`}],children:(0,Z.jsx)(tV,{autoFocus:!0,placeholder:`Anna Svensson`})}),(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`companyName`,label:`Works at`,children:(0,Z.jsx)(PE,{options:l,placeholder:`Company`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`headline`,label:`Their role`,children:(0,Z.jsx)(tV,{placeholder:`Engineering Manager`})})})]}),(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`relationship`,label:`How you know them`,children:(0,Z.jsx)(DE,{options:o$.map(e=>({value:e,label:s$[e]}))})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`reconnectOn`,label:`Reconnect on`,tooltip:`Shows up on the dashboard when the day comes`,children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`,presets:[{label:`In a week`,value:(0,Kk.default)().add(1,`week`)},{label:`In a month`,value:(0,Kk.default)().add(1,`month`)},{label:`In three months`,value:(0,Kk.default)().add(3,`month`)}]})})})]}),(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`email`,label:`Email`,rules:[{type:`email`,message:`That is not an email address`}],children:(0,Z.jsx)(tV,{})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`phone`,label:`Phone`,children:(0,Z.jsx)(tV,{})})})]}),(0,Z.jsx)(OB.Item,{name:`linkedinUrl`,label:`LinkedIn profile`,children:(0,Z.jsx)(tV,{placeholder:`https://www.linkedin.com/in/...`})}),(0,Z.jsx)(OB.Item,{name:`about`,label:`Notes`,children:(0,Z.jsx)(tV.TextArea,{rows:5,placeholder:`Where you met, what they work on, what you talked about`})})]})})}function H9({open:e,onClose:t,contact:n,applicationId:r}){let[i]=OB.useForm(),{message:a}=FC.useApp(),o=_9();(0,_.useEffect)(()=>{e&&(i.resetFields(),i.setFieldsValue({occurredOn:(0,Kk.default)(),channel:`linkedin`,direction:`outbound`}))},[e,i]);async function s(e){if(n)try{await o.mutateAsync({contactId:n.id,body:{occurredOn:e.occurredOn.format(`YYYY-MM-DD`),channel:e.channel,direction:e.direction,summary:e.summary,applicationId:r??null,...e.reconnectOn?{reconnectOn:e.reconnectOn.format(`YYYY-MM-DD`)}:{}}}),a.success(`Logged`),t()}catch(e){a.error(e instanceof Error?e.message:`Could not log that`)}}return(0,Z.jsx)(xH,{title:n?`Log a conversation with ${n.name}`:``,open:e,onCancel:t,onOk:()=>i.submit(),okText:`Log it`,confirmLoading:o.isPending,destroyOnHidden:!0,children:(0,Z.jsxs)(OB,{form:i,layout:`vertical`,onFinish:s,children:[(0,Z.jsx)(OB.Item,{name:`direction`,label:`Who reached out`,children:(0,Z.jsx)(qI,{options:[{label:`I did`,value:`outbound`},{label:`They did`,value:`inbound`}]})}),(0,Z.jsx)(OB.Item,{name:`channel`,label:`How`,children:(0,Z.jsx)(DE,{options:c$.map(e=>({value:e,label:l$[e]}))})}),(0,Z.jsx)(OB.Item,{name:`occurredOn`,label:`When`,rules:[{required:!0}],children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`})}),(0,Z.jsx)(OB.Item,{name:`summary`,label:`What happened`,rules:[{required:!0,message:`Say what happened`}],children:(0,Z.jsx)(tV.TextArea,{rows:3,placeholder:`Asked about the platform team; she offered to refer me`})}),(0,Z.jsx)(OB.Item,{name:`reconnectOn`,label:`Get back in touch on`,tooltip:`Optional. Sets their next reminder.`,children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`,presets:[{label:`In a week`,value:(0,Kk.default)().add(1,`week`)},{label:`In two weeks`,value:(0,Kk.default)().add(2,`week`)},{label:`In a month`,value:(0,Kk.default)().add(1,`month`)}]})})]})})}function U9(e){return e.lastInteractionOn?`last spoke ${e.lastInteractionOn}`:`no conversations logged`}function W9({contact:e}){return(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/people/${e.id}`,children:e.name}),(0,Z.jsx)(lY,{children:s$[e.relationship]})]}),description:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[e.headline&&(0,Z.jsx)(`span`,{children:e.headline}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:U9(e)})]})})}function Hee({companyName:e}){let{data:t,isLoading:n}=d9({company:e}),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),s=t?.contacts??[];return(0,Z.jsxs)(_F,{title:`People you know at ${e} (${s.length})`,loading:n,extra:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(aP,{}),onClick:()=>i(!0),children:`Add person`}),children:[s.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`Nobody you know works here yet`}):(0,Z.jsx)(_H,{dataSource:s,renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(_D,{title:`Log a conversation`,children:(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(pQ,{}),onClick:()=>o(e)})},`log`)],children:(0,Z.jsx)(W9,{contact:e})})}),(0,Z.jsx)(V9,{open:r,onClose:()=>i(!1),defaults:{companyName:e}}),(0,Z.jsx)(H9,{open:a!==null,contact:a,onClose:()=>o(null)})]})}function Uee({application:e}){let{message:t}=FC.useApp(),{data:n}=m9(`application`,e.id),{data:r}=d9({company:e.company.name}),i=y9(),a=b9(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),u=n?.contacts??[],d=new Set(u.map(e=>e.id)),f=(r?.contacts??[]).filter(e=>!d.has(e.id));async function p(n,r){try{await i.mutateAsync({contactId:n.id,body:{targetType:`application`,targetId:e.id,role:r}}),t.success(`Linked ${n.name}`)}catch(e){t.error(e instanceof Error?e.message:`Could not link`)}}let m=e=>({items:f$.map(e=>({key:e,label:p$[e]})),onClick:({key:t})=>void p(e,t)});return(0,Z.jsxs)(_F,{title:`People (${u.length})`,extra:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(aP,{}),onClick:()=>s(!0),children:`Add person`}),children:[u.length===0&&f.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`You don't know anyone at ${e.company.name} yet`}):(0,Z.jsxs)(vz,{direction:`vertical`,size:8,style:{width:`100%`},children:[u.length>0&&(0,Z.jsx)(_H,{size:`small`,dataSource:u,renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(_D,{title:`Log a conversation about this application`,children:(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(pQ,{}),onClick:()=>l(e)})},`log`),(0,Z.jsx)(_D,{title:`Unlink`,children:(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(UZ,{}),onClick:()=>a.mutate(e.linkId)})},`unlink`)],children:(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/people/${e.id}`,children:e.name}),(0,Z.jsx)(lY,{color:`blue`,children:p$[e.role]})]}),description:e.headline??U9(e)})})}),f.length>0&&(0,Z.jsx)(_H,{size:`small`,header:(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[`Also at `,e.company.name]}),dataSource:f,renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(bz,{menu:m(e),trigger:[`click`],children:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(sQ,{}),children:`Link`})},`link`)],children:(0,Z.jsx)(W9,{contact:e})})})]}),(0,Z.jsx)(V9,{open:o,onClose:()=>s(!1),defaults:{companyName:e.company.name}}),(0,Z.jsx)(H9,{open:c!==null,contact:c,applicationId:e.id,onClose:()=>l(null)})]})}function Wee(){let{id:e}=rt(),t=tt(),{message:n}=FC.useApp(),{data:r,isLoading:i}=P7(e),a=q7(),o=J7(),s=Q7(),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(TS,{active:!0,paragraph:{rows:10}});let m=QQ(r.status);async function h(t){e&&(await a.mutateAsync({id:e,body:{status:t,comment:null}}),n.success(`Moved to ${e$[t]}`))}return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`flex-start`,wrap:!0,gap:12,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Rk,{type:`link`,icon:(0,Z.jsx)(TZ,{}),style:{padding:0},onClick:()=>t(`/applications`),children:`Back to applications`}),(0,Z.jsx)(AX.Title,{level:3,style:{margin:0},children:r.jobTitle}),(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/companies/${r.company.id}`,children:r.company.name}),(0,Z.jsxs)(AX.Text,{type:`secondary`,children:[`applied `,r.appliedOn]}),(0,Z.jsx)(D9,{status:r.status})]})]}),(0,Z.jsxs)(vz,{wrap:!0,children:[m&&(0,Z.jsxs)(Rk,{type:`primary`,onClick:()=>void h(m),children:[`Move to `,e$[m]]}),(0,Z.jsx)(DE,{style:{width:150},value:r.status,onChange:e=>void h(e),options:XQ.map(e=>({value:e,label:e$[e]}))}),(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(NY,{}),onClick:()=>l(!0),children:`Edit`}),(0,Z.jsx)(TH,{title:`Delete this application?`,description:`Its notes and status history go too. This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{e&&(await o.mutateAsync(e),n.success(`Application deleted`),t(`/applications`))},children:(0,Z.jsx)(Rk,{danger:!0,icon:(0,Z.jsx)(AY,{})})})]})]}),(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:24,lg:14,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(_F,{title:`Details`,children:(0,Z.jsxs)(BR,{column:{xs:1,sm:2},size:`small`,bordered:!0,children:[(0,Z.jsx)(BR.Item,{label:`Company`,children:r.company.name}),(0,Z.jsx)(BR.Item,{label:`Applied on`,children:r.appliedOn}),(0,Z.jsx)(BR.Item,{label:`Location`,children:r.location??`—`}),(0,Z.jsx)(BR.Item,{label:`Work mode`,children:n$[r.workMode]}),(0,Z.jsx)(BR.Item,{label:`Source`,children:r.sourceName??`—`}),(0,Z.jsx)(BR.Item,{label:`Follow up`,children:r.followUpOn??`—`}),(0,Z.jsx)(BR.Item,{label:`Salary`,span:2,children:r.salaryMin||r.salaryMax?`${r.salaryMin?.toLocaleString()??`?`} – ${r.salaryMax?.toLocaleString()??`?`} ${r.salaryCurrency??``}`:`—`}),(0,Z.jsx)(BR.Item,{label:`Posting`,span:2,children:r.jobUrl?(0,Z.jsx)(`a`,{href:r.jobUrl,target:`_blank`,rel:`noreferrer`,children:(0,Z.jsxs)(vz,{size:4,children:[(0,Z.jsx)(sQ,{}),r.jobUrl]})}):`—`}),(0,Z.jsx)(BR.Item,{label:`Tags`,span:2,children:r.tags.length>0?(0,Z.jsx)(vz,{size:4,wrap:!0,children:r.tags.map(e=>(0,Z.jsx)(lY,{children:e.name},e.id))}):`—`})]})}),(0,Z.jsx)(Uee,{application:r})]})}),(0,Z.jsx)(NI,{xs:24,lg:10,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(_F,{title:`Status history`,children:r.statusEvents.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No changes recorded`}):(0,Z.jsx)(DY,{items:r.statusEvents.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e.fromStatus?`${e$[e.fromStatus]} → ${e$[e.toStatus]}`:`Applied`}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:e.occurredOn}),e.comment&&(0,Z.jsx)(AX.Text,{children:e.comment})]})}))})}),(0,Z.jsx)(_F,{title:`Notes (${r.notes.length})`,extra:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(aP,{}),onClick:()=>p(!0),children:`Add note`}),children:r.notes.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No notes yet`}):(0,Z.jsx)(_H,{size:`small`,dataSource:r.notes,renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(NY,{}),onClick:()=>d(e)},`edit`),(0,Z.jsx)(TH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await s.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Rk,{type:`text`,danger:!0,icon:(0,Z.jsx)(AY,{})})},`delete`)],children:(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,children:[e.pinned&&(0,Z.jsx)(TQ,{style:{color:`#faad14`}}),(0,Z.jsx)(AX.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)(AX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:4,expandable:!0,symbol:`more`},children:e.body})})})})})]})})]}),(0,Z.jsx)(M9,{open:c,onClose:()=>l(!1),application:r}),(0,Z.jsx)(B9,{open:f||u!==null,note:u,target:{type:`application`,id:r.id,label:r.jobTitle},onClose:()=>{p(!1),d(null)}})]})}function G9(e){return[...e.members.map(e=>e.id)].sort().join(`|`)}function Gee(){let{message:e}=FC.useApp(),{data:t,isLoading:n,isFetching:r,refetch:i}=U7(),a=Y7(),[o,s]=(0,_.useState)({}),[c,l]=(0,_.useState)(new Set),u=(0,_.useMemo)(()=>(t?.groups??[]).filter(e=>!c.has(G9(e))),[t,c]),d=e=>o[G9(e)]??e.keepId,f=e=>e.members.filter(t=>t.id!==d(e)).map(e=>e.id),p=u.filter(e=>e.kind===`exact`),m=u.length-p.length,h=p.flatMap(f);async function g(t){if(t.length!==0)try{let n=await a.mutateAsync(t);e.success(`Removed ${n.deleted} application${n.deleted===1?``:`s`}`)}catch{e.error(`Could not remove those applications`)}}return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:`Duplicates`}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:n?`Scanning…`:[`${t?.scanned??0} application${t?.scanned===1?``:`s`} scanned`,`${p.length} exact repeat${p.length===1?``:`s`}`,...m>0?[`${m} similar to review`]:[]].join(` · `)})]}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(sU,{}),loading:r,onClick:()=>void i(),children:`Rescan`}),(0,Z.jsx)(TH,{title:`Delete ${h.length} application${h.length===1?``:`s`}?`,description:`The kept record in each group stays. This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},disabled:h.length===0,onConfirm:()=>void g(h),children:(0,Z.jsxs)(Rk,{danger:!0,type:`primary`,icon:(0,Z.jsx)(AY,{}),disabled:h.length===0,loading:a.isPending,children:[`Remove `,h.length,` exact repeat`,h.length===1?``:`s`]})})]})]}),n&&(0,Z.jsx)(TS,{active:!0}),!n&&u.length===0&&(0,Z.jsx)(_F,{children:(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:(t?.scanned??0)===0?`Nothing to scan yet`:`No duplicates. Every application is a distinct role or employer.`})}),u.map(e=>(0,Z.jsx)(Kee,{group:e,keptId:d(e),busy:a.isPending,onKeep:t=>s(n=>({...n,[G9(e)]:t})),onDismiss:()=>l(t=>new Set(t).add(G9(e))),onRemove:()=>void g(f(e))},G9(e)))]})}function Kee({group:e,keptId:t,busy:n,onKeep:r,onDismiss:i,onRemove:a}){let o=e.members.length-1;return(0,Z.jsx)(_F,{size:`small`,title:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e.companyName}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:e.members[0]?.jobTitle}),(0,Z.jsx)(lY,{color:e.kind===`exact`?`red`:`orange`,children:e.kind===`exact`?`same title`:`similar title`})]}),extra:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{size:`small`,onClick:i,children:`Not a duplicate`}),(0,Z.jsx)(TH,{title:`Delete ${o} application${o===1?``:`s`}?`,description:`This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:a,children:(0,Z.jsxs)(Rk,{size:`small`,danger:!0,icon:(0,Z.jsx)(AY,{}),loading:n,children:[`Delete `,o]})})]}),children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[e.kind===`similar`&&(0,Z.jsx)(Rp,{type:`warning`,showIcon:!0,message:`Close but not identical. Two applications a year apart can look like this. Delete only if it really is the same job.`}),(0,Z.jsx)(XJ,{rowKey:`id`,size:`small`,columns:[{title:`Position`,key:`jobTitle`,render:(e,n)=>(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/applications/${n.id}`,children:n.jobTitle}),n.archived&&(0,Z.jsx)(lY,{children:`Archived`}),n.id===t?(0,Z.jsx)(lY,{color:`green`,children:`Keep`}):(0,Z.jsx)(lY,{color:`red`,children:`Remove`})]})},{title:`Applied`,dataIndex:`appliedOn`,width:118},{title:`Status`,key:`status`,width:120,render:(e,t)=>(0,Z.jsx)(D9,{status:t.status})},{title:`Where`,key:`location`,width:200,render:(e,t)=>[t.location,n$[t.workMode]].filter(Boolean).join(` · `)||`—`},{title:`Notes`,key:`noteCount`,width:80,render:(e,t)=>t.noteCount>0?t.noteCount:`—`}],dataSource:e.members,pagination:!1,rowSelection:{type:`radio`,columnTitle:`Keep`,columnWidth:60,selectedRowKeys:[t],onChange:e=>r(String(e[0]))}})]})})}var K9=25;function qee(){let e=tt(),[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(K9),a=O9(t,300),{data:o,isLoading:s}=z7(a?{q:a}:{});return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:`Companies`}),(0,Z.jsx)(tV,{allowClear:!0,prefix:(0,Z.jsx)(SE,{}),placeholder:`Find a company`,style:{maxWidth:320},value:t,onChange:e=>n(e.target.value)})]}),(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsx)(XJ,{rowKey:`id`,size:`middle`,loading:s,columns:[{title:`Company`,dataIndex:`name`,render:(e,t)=>(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e}),t.website&&(0,Z.jsx)(AX.Link,{href:t.website,target:`_blank`,style:{fontSize:12},children:t.website.replace(/^https?:\/\//,``)})]}),sorter:(e,t)=>e.name.localeCompare(t.name)},{title:`Applications`,dataIndex:`applicationCount`,width:140,align:`right`,sorter:(e,t)=>e.applicationCount-t.applicationCount,defaultSortOrder:`descend`,render:e=>(0,Z.jsx)(AX.Text,{strong:e>2,type:e>2?`warning`:void 0,children:e})},{title:`Active`,dataIndex:`activeCount`,width:90,align:`right`},{title:`Last applied`,dataIndex:`lastAppliedOn`,width:130,sorter:(e,t)=>(e.lastAppliedOn??``).localeCompare(t.lastAppliedOn??``),render:e=>e??(0,Z.jsx)(AX.Text,{type:`secondary`,children:`—`})},{title:`Tags`,key:`tags`,width:260,render:(e,t)=>(0,Z.jsx)(vz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(lY,{style:{marginInlineEnd:0},children:e.name},e.id))})}],dataSource:o?.companies??[],pagination:{pageSize:r,showSizeChanger:!0,onChange:(e,t)=>i(t),hideOnSinglePage:r===K9},onRow:t=>({onClick:()=>e(`/companies/${t.id}`),style:{cursor:`pointer`}})})})]})}function Jee(){let{id:e}=rt(),t=tt(),{message:n}=FC.useApp(),{data:r,isLoading:i}=B7(e),{data:a}=V7(e?{targetType:`company`,targetId:e}:{}),{data:o}=R7(),s=X7(),c=Q7(),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(TS,{active:!0,paragraph:{rows:8}});let{company:p,applications:m}=r,h=m.filter(e=>[`applied`,`screening`,`interview`].includes(e.status)).length;return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Rk,{type:`link`,icon:(0,Z.jsx)(TZ,{}),style:{padding:0},onClick:()=>t(`/companies`),children:`Back to companies`}),(0,Z.jsx)(AX.Title,{level:3,style:{margin:0},children:p.name}),p.website&&(0,Z.jsx)(AX.Link,{href:p.website,target:`_blank`,children:p.website})]}),(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:12,md:6,children:(0,Z.jsx)(_F,{children:(0,Z.jsx)(IU,{title:`Applications`,value:m.length})})}),(0,Z.jsx)(NI,{xs:12,md:6,children:(0,Z.jsx)(_F,{children:(0,Z.jsx)(IU,{title:`Still active`,value:h,valueStyle:{color:N9.accent}})})}),(0,Z.jsx)(NI,{xs:24,md:12,children:(0,Z.jsx)(_F,{children:(0,Z.jsxs)(vz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Company tags`}),(0,Z.jsx)(DE,{mode:`tags`,style:{width:`100%`},placeholder:`fintech, remote-first…`,value:p.tags.map(e=>e.name),options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),onChange:t=>{e&&s.mutate({id:e,body:{tags:t}})}})]})})})]}),(0,Z.jsx)(_F,{title:`Application history`,children:(0,Z.jsx)(XJ,{rowKey:`id`,size:`middle`,columns:[{title:`Applied`,dataIndex:`appliedOn`,width:120},{title:`Job title`,dataIndex:`jobTitle`,render:e=>(0,Z.jsx)(AX.Text,{strong:!0,children:e})},{title:`Status`,dataIndex:`status`,width:120,render:(e,t)=>(0,Z.jsx)(D9,{status:t.status})},{title:`Source`,dataIndex:`sourceName`,width:130}],dataSource:m,pagination:!1,onRow:e=>({onClick:()=>t(`/applications/${e.id}`),style:{cursor:`pointer`}})})}),(0,Z.jsx)(Hee,{companyName:p.name}),(0,Z.jsx)(_F,{title:`Notes about ${p.name}`,extra:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(aP,{}),onClick:()=>f(!0),children:`Add note`}),children:(a?.notes??[]).length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No notes about this company`}):(0,Z.jsx)(_H,{dataSource:a?.notes??[],renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(NY,{}),onClick:()=>u(e)},`edit`),(0,Z.jsx)(TH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await c.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Rk,{type:`text`,danger:!0,icon:(0,Z.jsx)(AY,{})})},`delete`)],children:(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,children:[e.pinned&&(0,Z.jsx)(TQ,{style:{color:`#faad14`}}),(0,Z.jsx)(AX.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)(AX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e.body})})})})}),(0,Z.jsx)(B9,{open:d||l!==null,note:l,target:{type:`company`,id:p.id,label:p.name},onClose:()=>{f(!1),u(null)}})]})}function Yee(){let{message:e}=FC.useApp(),[t,n]=(0,_.useState)(`all`),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),{data:l,isLoading:u}=V7(t===`all`?{}:{targetType:t}),d=Q7(),f=l?.notes??[],p=(0,_.useMemo)(()=>{let e=r.trim().toLowerCase();return e?f.filter(t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||(t.targetLabel?.toLowerCase().includes(e)??!1)):f},[f,r]);return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:`Notes`}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(qI,{value:t,onChange:e=>n(e),options:[{label:`All`,value:`all`},{label:`Standalone`,value:`standalone`},{label:`Companies`,value:`company`},{label:`Applications`,value:`application`}]}),(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(aP,{}),onClick:()=>c(!0),children:`New note`})]})]}),(0,Z.jsx)(tV,{allowClear:!0,prefix:(0,Z.jsx)(SE,{}),placeholder:`Search notes by title, body, or what they're attached to`,value:r,onChange:e=>i(e.target.value)}),(0,Z.jsx)(_F,{size:`small`,loading:u,children:p.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:r?`Nothing matched “${r}”`:`No notes here yet`}):(0,Z.jsx)(_H,{dataSource:p,renderItem:t=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(NY,{}),onClick:()=>o(t)},`edit`),(0,Z.jsx)(TH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await d.mutateAsync(t.id),e.success(`Note deleted`)},children:(0,Z.jsx)(Rk,{type:`text`,danger:!0,icon:(0,Z.jsx)(AY,{})})},`delete`)],children:(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[t.pinned&&(0,Z.jsx)(TQ,{style:{color:`#faad14`}}),(0,Z.jsx)(AX.Text,{strong:!0,children:t.title}),(0,Z.jsx)(Xee,{note:t})]}),description:(0,Z.jsx)(AX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:3,expandable:!0,symbol:`more`},children:t.body})})})})}),(0,Z.jsx)(B9,{open:s||a!==null,note:a,onClose:()=>{c(!1),o(null)}})]})}function Xee({note:e}){if(e.targetType===`standalone`)return(0,Z.jsx)(lY,{children:`general`});if(!e.targetId)return(0,Z.jsx)(lY,{children:`unlinked`});let t=e.targetType===`company`?`/companies/${e.targetId}`:`/applications/${e.targetId}`;return(0,Z.jsx)(gn,{to:t,children:(0,Z.jsxs)(lY,{color:`blue`,children:[e.targetType,`: `,e.targetLabel??`view`]})})}function Zee({open:e,onClose:t,opening:n,draft:r}){let[i]=OB.useForm(),{message:a}=FC.useApp(),o=!!n,s=t9(),c=n9(),{data:l}=W7(OB.useWatch(`companyName`,i)??``);(0,_.useEffect)(()=>{e&&(n?i.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,savedOn:(0,Kk.default)(n.savedOn),jobUrl:n.jobUrl??void 0,location:n.location??void 0,workMode:n.workMode,sourceName:n.sourceName??void 0,salaryMin:n.salaryMin,salaryMax:n.salaryMax,salaryCurrency:n.salaryCurrency??void 0,notes:n.notes??void 0}):(i.resetFields(),i.setFieldsValue({savedOn:(0,Kk.default)(),workMode:r?.workMode??`unspecified`,...r?{companyName:r.companyName,jobTitle:r.jobTitle,jobUrl:r.jobUrl??void 0,location:r.location??void 0,sourceName:r.sourceName??void 0,salaryMin:r.salaryMin,salaryMax:r.salaryMax,salaryCurrency:r.salaryCurrency??void 0,notes:r.notes??void 0}:{}})))},[e,n,r,i]);let u=(0,_.useMemo)(()=>(l?.companies??[]).map(e=>({value:e.name})),[l]);async function d(e){let r={companyName:e.companyName,jobTitle:e.jobTitle,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,notes:e.notes??null,...o?{}:{savedOn:e.savedOn.format(`YYYY-MM-DD`)}};try{n?(await c.mutateAsync({id:n.id,body:r}),a.success(`Opening updated`)):(await s.mutateAsync(r),a.success(`Opening saved`)),t()}catch(e){e instanceof m7&&e.fieldErrors.length>0?(i.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),a.error(`Please check the highlighted fields`)):a.error(e instanceof Error?e.message:`Could not save`)}}return(0,Z.jsxs)(lz,{title:o?`Edit opening`:`Save opening for later`,open:e,onClose:t,width:560,destroyOnHidden:!0,extra:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Rk,{type:`primary`,loading:s.isPending||c.isPending,onClick:()=>i.submit(),children:o?`Save changes`:`Save opening`})]}),children:[(0,Z.jsx)(AX.Paragraph,{type:`secondary`,children:r&&!o?`Read from the posting. Check it over before saving. Anything the parser could not find is blank rather than guessed.`:`For a role you found but are not ready to apply to yet. No status, no tags, just enough to find it again. Convert it into a real application when you are ready.`}),(0,Z.jsxs)(OB,{form:i,layout:`vertical`,onFinish:d,requiredMark:`optional`,children:[(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(PE,{options:u,placeholder:`Start typing to see existing companies`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(tV,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`savedOn`,label:`Found on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`,disabled:o})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(DE,{options:t$.map(e=>({value:e,label:n$[e]}))})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(tV,{placeholder:`Stockholm`})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(PL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(PL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(tV,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(OB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(tV,{placeholder:`LinkedIn, referral…`})}),(0,Z.jsx)(OB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(tV,{placeholder:`https://…`})}),(0,Z.jsx)(OB.Item,{name:`notes`,label:`Notes`,children:(0,Z.jsx)(tV.TextArea,{rows:4,placeholder:`Why this looked interesting, what you're missing to apply…`})})]})]})}var Qee=!1;function $ee({open:e,onClose:t,onUse:n}){let[r,i]=(0,_.useState)(`link`),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(null);function h(){o(``),c(``),f(null),m(null),u(!1)}function g(){h(),t()}async function v(e){u(!0),f(null),m(null);try{let t=await e();(t.draft.companyName.trim()===``||t.draft.jobTitle.trim()===``)&&f(`Could not make out the company and job title. Open the form and fill them in, or paste more of the posting.`),m(t)}catch(e){f(e instanceof Error?e.message:`Could not read that posting`),e instanceof m7&&e.code===`ingest_blocked`&&i(`text`)}finally{u(!1)}}let y=p?.draft;return(0,Z.jsxs)(xH,{open:e,onCancel:g,title:`Save from a posting`,width:640,destroyOnHidden:!0,footer:(0,Z.jsxs)(Pz,{justify:`end`,gap:8,children:[(0,Z.jsx)(Rk,{onClick:g,children:`Cancel`}),(0,Z.jsx)(Rk,{type:`primary`,disabled:!y,onClick:()=>{y&&(n(y),h())},children:`Review and save`})]}),children:[(0,Z.jsx)(rF,{activeKey:r,onChange:e=>{i(e),f(null),m(null)},items:[{key:`link`,label:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(sQ,{}),` Paste a link`]}),disabled:Qee,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(tV.Search,{placeholder:`https://boards.greenhouse.io/…`,value:a,enterButton:`Read`,loading:l,onChange:e=>o(e.target.value),onSearch:e=>e.trim()&&void v(()=>k7.ingestUrl(e.trim()))}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Works on most company career pages and applicant tracking systems. LinkedIn and Indeed block automated readers. For those, copy the posting and use the other tab.`})]})},{key:`text`,label:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Lz,{}),` Paste the text`]}),children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(tV.TextArea,{rows:8,value:s,placeholder:`Backend Engineer at Spotify
434
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function y6(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;y6(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var b6=new Set([`type`,`properties`,`required`,`additionalProperties`]),x6=[`oneOf`,`anyOf`];function S6(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function C6(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!b6.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??S6(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}j$(n,r,e.length===1?e[0]:C6(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=S6(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function w6(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of b6)if(t in e)return;let n=t.filter(e=>x6.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=C6(t);else{let e=n[0],i=x6.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>C6([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,p6(e,r))}function T6(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):p6(i,s),p6(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())y6(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])w6(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}p6(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,j$(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:O6(t,`input`,e.processors),output:O6(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function E6(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 E6(r.element,n);if(r.type===`set`)return E6(r.valueType,n);if(r.type===`lazy`)return E6(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 E6(r.innerType,n);if(r.type===`intersection`)return E6(r.left,n)||E6(r.right,n);if(r.type===`record`||r.type===`map`)return E6(r.keyType,n)||E6(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:E6(r.in,n)||E6(r.out,n);if(r.type===`object`){for(let e in r.shape)if(E6(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(E6(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(E6(e,n))return!0;return!!(r.rest&&E6(r.rest,n))}return!1}var D6=(e,t={})=>n=>{let r=m6({...n,processors:t});return g6(e,r),v6(r,e),T6(r,e)},O6=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=m6({...i??{},target:a,io:t,processors:n});return g6(e,o),v6(o,e),T6(o,e)},k6=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},A6=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},j6=(e,t)=>{k6(e,`minimum`,t),A6(e,`maximum`,t)},M6=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},N6=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},P6=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},F6=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},I6=(e,t)=>k6(e,`minimum`,t.minimum),L6=(e,t)=>A6(e,`maximum`,t.maximum),R6=e=>(t,n)=>{F6(t,n.format);let[r,i]=e[n.format];k6(t,`minimum`,r),A6(t,`maximum`,i)},z6={greater_than:(e,t)=>k6(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>A6(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>M6(e,t.value),number_format:R6(Q$),bigint_format:R6($$),min_length:I6,max_length:L6,length_equals:(e,t)=>j6(e,t.length),min_size:I6,max_size:L6,size_equals:(e,t)=>j6(e,t.size),string_format:(e,t)=>{F6(e,t.format),t.pattern&&N6(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>P6(e,t.mime)};function B6(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)z6[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&k6(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&k6(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&A6(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&A6(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&M6(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&P6(t,i.mime);for(let e of i.patterns??[])N6(t,e);return t}var V6={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},H6=new Map([[Y2,P0],[Z2,F0]]),U6=e=>H6.get(e)??e,W6=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=B6(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=V6[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(U6);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},G6=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=B6(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):h6(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},K6=(e,t,n,r)=>{n.type=`boolean`},q6=(e,t,n,r)=>{n.not={}},J6=(e,t,n,r)=>{let i=e._zod.def,a=C$(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Y6=(e,t,n,r)=>{h6(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},X6=(e,t,n,r)=>{h6(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Z6=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=B6(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=g6(a.element,t,{...r,path:[...r.path,`items`]})};function Q6(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Q6(t.out):t.type===`catch`?Q6(t.innerType):e._zod.optin}var $6=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&h6(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)j$(i.properties,e,g6(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?Q6(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=g6(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},e8=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>g6(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},t8=(e,t,n,r)=>{let i=e._zod.def,a=g6(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=g6(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},n8=(e,t,n,r)=>{let i=e._zod.def,a=g6(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},r8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},i8=Symbol();function a8(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(h6(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),i8):JSON.parse(o)}var o8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=a8(i.defaultValue,e,t,n,r);o!==i8&&(n.default=o)},s8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=a8(i.defaultValue,e,t,n,r);o!==i8&&(n._prefault=o)},c8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{h6(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},l8=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;g6(o,t,r);let s=t.seen.get(e);s.ref=o},u8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},d8=(e,t,n,r)=>{let i=e._zod.def;g6(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},f8=new WeakSet([Object.prototype,Error.prototype]);function p8(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var m8=L1(`ZodError`,(e,t)=>{J1.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);f8.has(n)||(f8.add(n),p8(n,`format`,e=>t=>Z1(e,t)),p8(n,`flatten`,e=>t=>X1(e,t)),p8(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,T$,2)}),p8(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,T$,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),h8=$1(m8),g8=e0(m8),_8=t0(m8),v8=r0(m8),y8=l0(m8),b8=u0(m8),x8=d0(m8),S8=f0(m8),C8=p0(m8),w8=m0(m8),T8=h0(m8),E8=g0(m8);function D8(){B1.localeError||V1(a3())}function O8(){B1.memoizer||V1({memoizer:n3()})}var k8=L1(`ZodType`,(e,t)=>(D8(),h2.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(R$(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return J$(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(K5(e,t))},superRefine(e,t){return this.check(q5(e,t))},overwrite(e){return this.check(r6(e))},optional(){return D5(this)},exactOptional(){return k5(this)},nullable(){return j5(this)},nullish(){return D5(j5(this))},nonoptional(e){return L5(this,e)},array(){return h5(this)},or(e){return y5([this,e])},and(e){return x5(this,e)},transform(e){return V5(this,T5(e))},default(e){return N5(this,e)},prefault(e){return F5(this,e)},catch(e){return z5(this,e)},pipe(e){return V5(this,e)},readonly(){return W5(this)},describe(e){let t=this.clone();return l3.add(t,{description:e}),t},meta(...e){if(e.length===0)return l3.get(this);let t=this.clone();return l3.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 S1(this,`~standard`,{...v2(this),jsonSchema:{input:O6(this,`input`),output:O6(this,`output`)}})},set"~standard"(e){x1(this,`~standard`,e)},parse:function e(t,n){return h8(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await g8(this,t,n,{callee:e})},safeParse(e,t){return _8(this,e,t)},async safeParseAsync(e,t){return v8(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){x1(this,`spa`,e)},validate(e,t){return o0(this,e,t)},validateAsync(e,t){return c0(this,e,t)},encode:function e(t,n){return y8(this,t,n,{callee:e})},decode:function e(t,n){return b8(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await x8(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await S8(this,t,n,{callee:e})},safeEncode(e,t){return C8(this,e,t)},safeDecode(e,t){return w8(this,e,t)},async safeEncodeAsync(e,t){return T8(this,e,t)},async safeDecodeAsync(e,t){return E8(this,e,t)},toJSONSchema(e){return D6(this,{})(e)},get description(){return l3.get(this)?.description},get _def(){return this._zod.def}}),A8=L1(`_ZodString`,(e,t)=>{y2.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>W6(e,t,n,r)},C1({format:e=>B6(e).format??null,minLength:e=>B6(e).minimum??null,maxLength:e=>B6(e).maximum??null},{regex(...e){return this.check(Z3(...e))},includes(...e){return this.check(e6(...e))},startsWith(...e){return this.check(t6(...e))},endsWith(...e){return this.check(n6(...e))},min(...e){return this.check(Y3(...e))},max(...e){return this.check(J3(...e))},length(...e){return this.check(X3(...e))},nonempty(...e){return this.check(Y3(1,...e))},lowercase(e){return this.check(Q3(e))},uppercase(e){return this.check($3(e))},trim(){return this.check(a6())},normalize(...e){return this.check(i6(...e))},toLowerCase(){return this.check(o6())},toUpperCase(){return this.check(s6())},slugify(){return this.check(c6())}})),j8=L1(`ZodString`,(e,t)=>{y2.init(e,t),A8.init(e,t)},{email(e){return this.check(d3(R8,e))},url(e){return this.check(_3(H8,e))},jwt(e){return this.check(M3(r5,e))},emoji(e){return this.check(v3(U8,e))},guid(e){return this.check(f3(z8,e))},uuid(e){return this.check(p3(B8,e))},uuidv4(e){return this.check(m3(B8,e))},uuidv6(e){return this.check(h3(B8,e))},uuidv7(e){return this.check(g3(B8,e))},nanoid(e){return this.check(y3(W8,e))},cuid(e){return this.check(b3(G8,e))},cuid2(e){return this.check(x3(K8,e))},ulid(e){return this.check(S3(q8,e))},base64(e){return this.check(k3(e5,e))},base64url(e){return this.check(A3(t5,e))},xid(e){return this.check(C3(J8,e))},ksuid(e){return this.check(w3(Y8,e))},ipv4(e){return this.check(T3(X8,e))},ipv6(e){return this.check(E3(Z8,e))},cidrv4(e){return this.check(D3(Q8,e))},cidrv6(e){return this.check(O3($8,e))},e164(e){return this.check(j3(n5,e))},datetime(e){return this.check(N3(P8,e))},date(e){return this.check(P3(F8,e))},time(e){return this.check(F3(I8,e))},duration(e){return this.check(I3(L8,e))}});function M8(e){return u3(j8,e)}var N8=L1(`ZodStringFormat`,(e,t)=>{b2.init(e,t),A8.init(e,t)}),P8=L1(`ZodISODateTime`,(e,t)=>{L2.init(e,t),N8.init(e,t)}),F8=L1(`ZodISODate`,(e,t)=>{R2.init(e,t),N8.init(e,t)}),I8=L1(`ZodISOTime`,(e,t)=>{z2.init(e,t),N8.init(e,t)}),L8=L1(`ZodISODuration`,(e,t)=>{B2.init(e,t),N8.init(e,t)}),R8=L1(`ZodEmail`,(e,t)=>{C2.init(e,t),N8.init(e,t)}),z8=L1(`ZodGUID`,(e,t)=>{x2.init(e,t),N8.init(e,t)}),B8=L1(`ZodUUID`,(e,t)=>{S2.init(e,t),N8.init(e,t)});function V8(e){return p3(B8,e)}var H8=L1(`ZodURL`,(e,t)=>{k2.init(e,t),N8.init(e,t)}),U8=L1(`ZodEmoji`,(e,t)=>{A2.init(e,t),N8.init(e,t)}),W8=L1(`ZodNanoID`,(e,t)=>{j2.init(e,t),N8.init(e,t)}),G8=L1(`ZodCUID`,(e,t)=>{M2.init(e,t),N8.init(e,t)}),K8=L1(`ZodCUID2`,(e,t)=>{N2.init(e,t),N8.init(e,t)}),q8=L1(`ZodULID`,(e,t)=>{P2.init(e,t),N8.init(e,t)}),J8=L1(`ZodXID`,(e,t)=>{F2.init(e,t),N8.init(e,t)}),Y8=L1(`ZodKSUID`,(e,t)=>{I2.init(e,t),N8.init(e,t)}),X8=L1(`ZodIPv4`,(e,t)=>{V2.init(e,t),N8.init(e,t)}),Z8=L1(`ZodIPv6`,(e,t)=>{W2.init(e,t),N8.init(e,t)}),Q8=L1(`ZodCIDRv4`,(e,t)=>{G2.init(e,t),N8.init(e,t)}),$8=L1(`ZodCIDRv6`,(e,t)=>{q2.init(e,t),N8.init(e,t)}),e5=L1(`ZodBase64`,(e,t)=>{X2.init(e,t),N8.init(e,t)}),t5=L1(`ZodBase64URL`,(e,t)=>{$2.init(e,t),N8.init(e,t)}),n5=L1(`ZodE164`,(e,t)=>{e4.init(e,t),N8.init(e,t)}),r5=L1(`ZodJWT`,(e,t)=>{n4.init(e,t),N8.init(e,t)}),i5=L1(`ZodNumber`,(e,t)=>{r4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G6(e,t,n,r),e.isFinite=!0},C1({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=B6(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=B6(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=B6(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>B6(e).format??null},{gt(e,t){return this.check(G3(e,t))},gte(e,t){return this.check(K3(e,t))},min(e,t){return this.check(K3(e,t))},lt(e,t){return this.check(U3(e,t))},lte(e,t){return this.check(W3(e,t))},max(e,t){return this.check(W3(e,t))},int(e){return this.check(s5(e))},safe(e){return this.check(s5(e))},positive(e){return this.check(G3(0,e))},nonnegative(e){return this.check(K3(0,e))},negative(e){return this.check(U3(0,e))},nonpositive(e){return this.check(W3(0,e))},multipleOf(e,t){return this.check(q3(e,t))},step(e,t){return this.check(q3(e,t))},finite(){return this}}));function a5(e){return L3(i5,e)}var o5=L1(`ZodNumberFormat`,(e,t)=>{i4.init(e,t),i5.init(e,t)});function s5(e){return z3(o5,e)}var c5=L1(`ZodBoolean`,(e,t)=>{a4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K6(e,t,n,r)});function l5(e){return B3(c5,e)}var u5=L1(`ZodUnknown`,(e,t)=>{o4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function d5(){return V3(u5)}var f5=L1(`ZodNever`,(e,t)=>{s4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q6(e,t,n,r)});function p5(e){return H3(f5,e)}var m5=L1(`ZodArray`,(e,t)=>{O8(),l4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Z6(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Y3(e,t))},nonempty(e){return this.check(Y3(1,e))},max(e,t){return this.check(J3(e,t))},length(e,t){return this.check(X3(e,t))},unwrap(){return this.element}});function h5(e,t){return l6(m5,e,t)}var g5=L1(`ZodObject`,(e,t)=>{O8(),h4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$6(e,t,n,r),A1(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return C5(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(R$(this._zod.def,{catchall:e}))},passthrough(){return this.clone(R$(this._zod.def,{catchall:d5()}))},loose(){return this.clone(R$(this._zod.def,{catchall:d5()}))},strict(){return this.clone(R$(this._zod.def,{catchall:p5()}))},strip(){return this.clone(R$(this._zod.def,{catchall:void 0}))},extend(e){return r1(this,e)},safeExtend(e){return a1(this,e)},merge(e){return o1(this,e)},pick(e){return e1(this,e)},omit(e){return n1(this,e)},partial(...e){return s1(E5,this,e[0])},exactPartial(...e){return s1(O5,this,e[0],`exactPartial`)},required(...e){return c1(I5,this,e[0])}});function _5(e,t){return new g5({type:`object`,shape:e??{},...Y$(t)})}var v5=L1(`ZodUnion`,(e,t)=>{_4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e8(e,t,n,r),e.options=t.options});function y5(e,t){return new v5({type:`union`,options:e,...Y$(t)})}var b5=L1(`ZodIntersection`,(e,t)=>{v4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t8(e,t,n,r)});function x5(e,t){return new b5({type:`intersection`,left:e,right:t})}var S5=L1(`ZodEnum`,(e,t)=>{x4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J6(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new S5({...t,checks:[],...Y$(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new S5({...t,checks:[],...Y$(r),entries:i})}});function C5(e,t){return new S5({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Y$(t)})}var w5=L1(`ZodTransform`,(e,t)=>{O8(),S4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>X6(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new z1(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(y1(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(y1(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function T5(e){return new w5({type:`transform`,transform:e})}var E5=L1(`ZodOptional`,(e,t)=>{w4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>d8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function D5(e){return new E5({type:`optional`,innerType:e})}var O5=L1(`ZodExactOptional`,(e,t)=>{T4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>d8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function k5(e){return new O5({type:`optional`,innerType:e})}var A5=L1(`ZodNullable`,(e,t)=>{E4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function j5(e){return new A5({type:`nullable`,innerType:e})}var M5=L1(`ZodDefault`,(e,t)=>{D4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function N5(e,t){return new M5({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():G$(t)}})}var P5=L1(`ZodPrefault`,(e,t)=>{k4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function F5(e,t){return new P5({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():G$(t)}})}var I5=L1(`ZodNonOptional`,(e,t)=>{A4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function L5(e,t){return new I5({type:`nonoptional`,innerType:e,...Y$(t)})}var R5=L1(`ZodCatch`,(e,t)=>{N4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>c8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function z5(e,t){return new R5({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:M1(t)})}var B5=L1(`ZodPipe`,(e,t)=>{P4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>l8(e,t,n,r),e.in=t.in,e.out=t.out});function V5(e,t){return new B5({type:`pipe`,in:e,out:t})}var H5=L1(`ZodPreprocess`,(e,t)=>{B5.init(e,t),I4.init(e,t)}),U5=L1(`ZodReadonly`,(e,t)=>{L4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>u8(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function W5(e){return new U5({type:`readonly`,innerType:e})}var G5=L1(`ZodCustom`,(e,t)=>{z4.init(e,t),k8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y6(e,t,n,r)});function K5(e,t={}){return u6(G5,e,t)}function q5(e,t){return d6(e,t)}function J5(e,t){return new H5({type:`pipe`,in:T5(e),out:t})}function Y5(e){return R3(i5,e)}var X5=M8().regex(/^\d{4}-\d{2}-\d{2}$/,`Expected a YYYY-MM-DD date`),Z5=e=>M8().trim().max(e).nullish().transform(e=>e==null||e===``?null:e),Q5=C5(XQ),$5=C5(t$),e7=C5(i$),t7=C5(a$);C5(r$);var n7=h5(M8().trim().min(1).max(60)).max(30);_5({companyName:M8().trim().min(1,`Company is required`).max(200),jobTitle:M8().trim().min(1,`Job title is required`).max(200),appliedOn:X5,status:Q5.default(`applied`),jobUrl:Z5(2e3),location:Z5(200),workMode:$5.default(`unspecified`),sourceName:Z5(120),salaryMin:a5().int().nonnegative().nullish().transform(e=>e??null),salaryMax:a5().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:Z5(8),followUpOn:X5.nullish().transform(e=>e??null),tags:n7.default([]),notes:Z5(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),_5({companyName:M8().trim().min(1).max(200).optional(),jobTitle:M8().trim().min(1).max(200).optional(),appliedOn:X5.optional(),status:Q5.optional(),statusComment:M8().trim().max(2e3).nullish(),jobUrl:Z5(2e3).optional(),location:Z5(200).optional(),workMode:$5.optional(),sourceName:Z5(120).optional(),salaryMin:a5().int().nonnegative().nullish(),salaryMax:a5().int().nonnegative().nullish(),salaryCurrency:Z5(8).optional(),followUpOn:X5.nullish(),archived:l5().optional(),tags:n7.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({status:Q5,occurredOn:X5.optional(),comment:M8().trim().max(2e3).nullish().transform(e=>e??null)});var r7=e=>J5(e=>{if(e==null)return;let t=(Array.isArray(e)?e.map(String):String(e).split(`,`)).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},h5(e).optional()),i7=e=>J5(e=>{if(e==null)return;let t=(Array.isArray(e)?e.map(String):String(e).split(`|`)).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},h5(e).optional()),a7=_5({q:M8().trim().max(300).optional(),year:Y5().int().min(1970).max(2200).optional(),month:Y5().int().min(1).max(12).optional(),status:r7(Q5),workMode:r7($5),tags:r7(M8()),location:i7(M8().max(200)),companyId:V8().optional(),source:M8().trim().max(120).optional(),from:X5.optional(),to:X5.optional(),archived:C5([`true`,`false`,`all`]).default(`false`).transform(e=>e===`all`?`all`:e===`true`),followUpDue:C5([`true`,`false`]).optional().transform(e=>e===`true`),sort:C5([`appliedOn`,`company`,`jobTitle`,`status`,`createdAt`]).default(`appliedOn`),direction:C5([`asc`,`desc`]).default(`desc`),limit:Y5().int().min(1).max(200).default(50),cursor:M8().optional()});_5({ids:h5(V8()).min(1).max(500)}),_5({ids:h5(V8()).min(1).max(100),status:Q5,occurredOn:X5.optional(),comment:M8().trim().max(2e3).nullish().transform(e=>e??null)});var o7=y5([l5(),C5([`true`,`false`]).transform(e=>e===`true`)]).optional();_5({includeArchived:o7,q:M8().trim().max(300).optional(),location:i7(M8().max(200)),source:M8().trim().max(120).optional(),sort:C5([`savedOn`,`fit`]).optional(),minFit:Y5().int().min(0).max(100).optional()}),_5({company:M8().trim().min(1).max(200),title:M8().trim().max(200).optional().default(``),excludeId:V8().optional()}),_5({q:M8().trim().min(1).max(300),limit:Y5().int().min(1).max(100).default(25),types:r7(C5([`application`,`company`,`note`,`contact`]))}),a7.extend({format:C5([`csv`,`xlsx`]).default(`csv`)}),_5({name:M8().trim().min(1).max(200),website:Z5(2e3),location:Z5(200),tags:n7.default([])}),_5({name:M8().trim().min(1).max(200).optional(),website:Z5(2e3).optional(),location:Z5(200).optional(),archived:l5().optional(),tags:n7.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({title:M8().trim().min(1).max(200),body:M8().max(5e4).default(``),targetType:e7.default(`standalone`),targetId:V8().nullish().transform(e=>e??null),pinned:l5().default(!1)}),_5({title:M8().trim().min(1).max(200).optional(),body:M8().max(5e4).optional(),targetType:e7.optional(),targetId:V8().nullish(),pinned:l5().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({name:M8().trim().min(1).max(60),color:Z5(30),scope:t7.default(`both`)}),_5({companyName:M8().trim().min(1,`Company is required`).max(200),jobTitle:M8().trim().min(1,`Job title is required`).max(200),jobUrl:Z5(2e3),location:Z5(200),workMode:$5.default(`unspecified`),sourceName:Z5(120),salaryMin:a5().int().nonnegative().nullish().transform(e=>e??null),salaryMax:a5().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:Z5(8),notes:Z5(2e4),savedOn:X5.optional()}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),_5({companyName:M8().trim().min(1).max(200).optional(),jobTitle:M8().trim().min(1).max(200).optional(),jobUrl:Z5(2e3).optional(),location:Z5(200).optional(),workMode:$5.optional(),sourceName:Z5(120).optional(),salaryMin:a5().int().nonnegative().nullish(),salaryMax:a5().int().nonnegative().nullish(),salaryCurrency:Z5(8).optional(),notes:Z5(2e4).optional(),savedOn:X5.optional(),archived:l5().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({appliedOn:X5.optional(),status:Q5.optional(),tags:n7.optional()}),_5({url:M8().trim().min(1).max(2e3)}),_5({text:M8().min(1).max(2e5),url:Z5(2e3).optional()}),_5({url:M8().trim().min(1).max(2e3).optional(),text:M8().min(1).max(2e5).optional(),save:l5().default(!1)}).refine(e=>e.url!==void 0||e.text!==void 0,{message:`Give a url to read, or the posting text`}),_5({postings:h5(_5({companyName:Z5(200),jobTitle:M8().trim().min(1,`Job title is required`).max(200),location:Z5(200),workMode:$5.default(`unspecified`),salaryMin:a5().int().nonnegative().nullish().transform(e=>e??null),salaryMax:a5().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:Z5(8),description:Z5(2e4)})).min(1).max(25)}),_5({companyName:M8().trim().min(1,`Company is required`).max(200),jobTitle:M8().trim().min(1,`Job title is required`).max(200),jobUrl:Z5(2e3),location:Z5(200),workMode:$5.default(`unspecified`),sourceName:Z5(120),salaryMin:a5().int().nonnegative().nullish().transform(e=>e??null),salaryMax:a5().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:Z5(8),notes:Z5(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),_5({target:M8().min(1)});var s7=C5(o$),c7=C5(c$),l7=C5(u$),u7=C5(d$),d7=C5(f$);_5({name:M8().trim().min(1,`Name is required`).max(200),companyName:Z5(200),headline:Z5(300),email:Z5(320),phone:Z5(60),linkedinUrl:Z5(2e3),relationship:s7.default(`connection`),about:Z5(2e4),reconnectOn:X5.nullish().transform(e=>e??null)}),_5({name:M8().trim().min(1).max(200).optional(),companyName:Z5(200).optional(),headline:Z5(300).optional(),email:Z5(320).optional(),phone:Z5(60).optional(),linkedinUrl:Z5(2e3).optional(),relationship:s7.optional(),about:Z5(2e4).optional(),reconnectOn:X5.nullish(),archived:l5().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),_5({q:M8().trim().max(300).optional(),company:M8().trim().max(200).optional(),relationship:r7(s7),reconnectDue:o7,includeArchived:o7,limit:Y5().int().min(1).max(5e3).default(500)}),_5({occurredOn:X5.optional(),channel:c7.default(`linkedin`),direction:l7.default(`outbound`),summary:M8().trim().min(1,`Say what happened`).max(5e3),applicationId:V8().nullish().transform(e=>e??null),reconnectOn:X5.nullish()}),_5({targetType:u7,targetId:V8(),role:d7.default(`contact`)});var f7=e=>h5(M8().trim().min(1).max(200)).max(e);_5({summary:Z5(5e4),targetTitles:f7(20).default([]),locations:f7(20).default([]),workModes:h5($5).max(4).default([]),salaryFloor:a5().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:Z5(8),includeKeywords:f7(30).default([]),excludeKeywords:f7(30).default([])}),_5({summary:Z5(5e4).optional(),targetTitles:f7(20).optional(),locations:f7(20).optional(),workModes:h5($5).max(4).optional(),salaryFloor:a5().int().nonnegative().nullish(),salaryCurrency:Z5(8).optional(),includeKeywords:f7(30).optional(),excludeKeywords:f7(30).optional()}),_5({defaultFollowUpDays:a5().int().min(1).max(90).nullish().transform(e=>e??null),autoGhostAfterDays:a5().int().min(14).max(365).nullish().transform(e=>e??null)}).partial(),_5({csv:M8().min(1).max(2e7)});function p7(e){return e===`exact`}var m7=class extends Error{status;code;details;constructor(e,t,n,r){super(n),this.name=`ApiError`,this.status=e,this.code=t,this.details=r}get fieldErrors(){return Array.isArray(this.details)?this.details:[]}};async function h7(e,t){let n=await fetch(e,{...t,headers:{...t?.body?{"Content-Type":`application/json`}:{},...t?.headers}});if(n.status===204)return;let r=await n.text(),i=r?JSON.parse(r):null;if(!n.ok)throw new m7(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}function g7(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!=null&&r!==``){if(Array.isArray(r)){if(r.length===0)continue;t.set(n,r.join(`,`))}else t.set(n,String(r))}let n=t.toString();return n?`?${n}`:``}var _7={csv:`text/csv`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};async function v7(e,t,n){let r=await fetch(`/api/import${g7({format:t,mode:n})}`,{method:`POST`,headers:{"Content-Type":_7[t]},body:e}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok)throw new m7(r.status,a?.error??`unknown`,a?.message??r.statusText,a?.details);return a}async function y7(e,t){let n=await fetch(`/api/backup/import${g7({mode:t})}`,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e}),r=await n.text(),i=r?JSON.parse(r):null;if(!n.ok)throw new m7(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}var b7={listApplications:e=>h7(`/api/applications${g7(e)}`),getApplication:e=>h7(`/api/applications/${e}`),periods:()=>h7(`/api/applications/periods`),applicationLocations:()=>h7(`/api/applications/locations`),checkDuplicates:e=>h7(`/api/applications/check${g7(e)}`),duplicateGroups:()=>h7(`/api/applications/duplicates`),createApplication:e=>h7(`/api/applications`,{method:`POST`,body:JSON.stringify(e)}),updateApplication:(e,t)=>h7(`/api/applications/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),changeStatus:(e,t)=>h7(`/api/applications/${e}/status`,{method:`POST`,body:JSON.stringify(t)}),deleteApplication:e=>h7(`/api/applications/${e}`,{method:`DELETE`}),deleteApplications:e=>h7(`/api/applications/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:e})}),listCompanies:(e={})=>h7(`/api/companies${g7(e)}`),suggestCompanies:e=>h7(`/api/companies/suggest${g7({q:e})}`),getCompany:e=>h7(`/api/companies/${e}`),updateCompany:(e,t)=>h7(`/api/companies/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),listTags:()=>h7(`/api/tags`),listNotes:(e={})=>h7(`/api/notes${g7(e)}`),createNote:e=>h7(`/api/notes`,{method:`POST`,body:JSON.stringify(e)}),updateNote:(e,t)=>h7(`/api/notes/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteNote:e=>h7(`/api/notes/${e}`,{method:`DELETE`}),dashboard:()=>h7(`/api/dashboard`),listContacts:(e={})=>h7(`/api/contacts${g7(e)}`),getContact:e=>h7(`/api/contacts/${e}`),createContact:e=>h7(`/api/contacts`,{method:`POST`,body:JSON.stringify(e)}),updateContact:(e,t)=>h7(`/api/contacts/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteContact:e=>h7(`/api/contacts/${e}`,{method:`DELETE`}),logInteraction:(e,t)=>h7(`/api/contacts/${e}/interactions`,{method:`POST`,body:JSON.stringify(t)}),deleteInteraction:e=>h7(`/api/interactions/${e}`,{method:`DELETE`}),linkedContacts:(e,t)=>h7(`/api/contacts/linked/${e}/${t}`),linkContact:(e,t)=>h7(`/api/contacts/${e}/links`,{method:`POST`,body:JSON.stringify(t)}),unlinkContact:e=>h7(`/api/contact-links/${e}`,{method:`DELETE`}),previewLinkedInImport:e=>h7(`/api/contacts/import/linkedin?mode=preview`,{method:`POST`,body:JSON.stringify({csv:e})}),commitLinkedInImport:e=>h7(`/api/contacts/import/linkedin?mode=commit`,{method:`POST`,body:JSON.stringify({csv:e})}),search:(e,t)=>h7(`/api/search${g7({q:e,types:t,limit:25})}`),exportUrl:(e,t)=>`/api/export${g7({...e,format:t})}`,previewImport:(e,t)=>v7(e,t,`preview`),commitImport:(e,t)=>v7(e,t,`commit`),listOpenings:(e={})=>h7(`/api/openings${g7(e)}`),getProfile:()=>h7(`/api/profile`),updateProfile:e=>h7(`/api/profile`,{method:`PUT`,body:JSON.stringify(e)}),getRules:()=>h7(`/api/rules`),updateRules:e=>h7(`/api/rules`,{method:`PUT`,body:JSON.stringify(e)}),previewAutoGhost:()=>h7(`/api/rules/auto-ghost`),runAutoGhost:()=>h7(`/api/rules/auto-ghost/run`,{method:`POST`}),getOpening:e=>h7(`/api/openings/${e}`),createOpening:e=>h7(`/api/openings`,{method:`POST`,body:JSON.stringify(e)}),updateOpening:(e,t)=>h7(`/api/openings/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteOpening:e=>h7(`/api/openings/${e}`,{method:`DELETE`}),convertOpening:(e,t)=>h7(`/api/openings/${e}/convert`,{method:`POST`,body:JSON.stringify(t)}),ingestUrl:e=>h7(`/api/ingest/url`,{method:`POST`,body:JSON.stringify({url:e})}),ingestText:(e,t)=>h7(`/api/ingest/text`,{method:`POST`,body:JSON.stringify({text:e,url:t??null})}),clipPosting:e=>h7(`/api/ingest/clip`,{method:`POST`,body:JSON.stringify(e)}),getDbTargets:()=>h7(`/api/db/targets`),switchDb:e=>h7(`/api/db/switch`,{method:`POST`,body:JSON.stringify({target:e})}),backupExportUrl:`/api/backup/export`,previewBackup:e=>y7(e,`preview`),commitBackup:e=>y7(e,`commit`),getDataStatus:()=>h7(`/api/backup/status`),clearDatabase:()=>h7(`/api/backup/clear`,{method:`POST`}),seedDatabase:()=>h7(`/api/backup/seed`,{method:`POST`}),getMeta:()=>h7(`/api/meta`)},x7=class extends Error{name=`RepoError`;cause;constructor(e,t){super(e),t?.cause!==void 0&&(this.cause=t.cause)}},S7=class extends x7{name=`SchemaError`},C7=new Set([`string`,`number`,`integer`,`boolean`,`date`,`json`,`binary`]);function w7(e){let t=Object.keys(e);if(t.length===0)throw new S7(`A schema must define at least one field`);let n={},r={},i={},a;for(let o of t){let t=e[o];if(!C7.has(t.type))throw new S7(`Field "${o}" has unknown type ${JSON.stringify(t.type)}. Expected one of: ${[...C7].join(`, `)}`);let s=t.column??o;if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(s))throw new S7(`Field "${o}" maps to column ${JSON.stringify(s)}, which is not a plain identifier. Column names must match /^[A-Za-z_][A-Za-z0-9_]*$/ because repolayer never quotes-and-interpolates arbitrary text into SQL.`);if(s in r)throw new S7(`Fields "${r[s]}" and "${o}" both map to column "${s}"`);if(t.primaryKey){if(a!==void 0)throw new S7(`Schema declares two primary keys ("${a}" and "${o}"). repolayer supports single-column primary keys only.`);if(t.nullable)throw new S7(`Primary key "${o}" cannot be nullable`);if(t.type===`binary`)throw new S7(`Primary key "${o}" cannot be binary. MySQL cannot key a BLOB, and a page cursor has no portable encoding for one. Use a string key, such as the hex of the bytes.`);a=o}if(t.type===`binary`&&t.default!==void 0)throw new S7(`Field "${o}" is binary and declares a default. Every engine spells a byte literal differently and MySQL gives a BLOB no literal default at all, so set the value on create instead.`);n[o]=s,r[s]=o,i[o]=t.type}if(a===void 0)throw new S7("Schema has no primary key. Mark exactly one field with `primaryKey: true`.");return Object.freeze({fields:e,primaryKey:a,columns:Object.freeze(n),fieldsByColumn:Object.freeze(r),fieldNames:Object.freeze(t),types:Object.freeze(i)})}var T7=[`gt`,`gte`,`lt`,`lte`],E7=[`eq`,`ne`,`in`,`nin`,`isNull`],D7=[`like`,`ilike`];[...E7,...T7],[...E7,...T7,...D7],new Set(E7),new Set(E7);var O7={createdAt:{type:`date`,column:`created_at`},updatedAt:{type:`date`,column:`updated_at`}};w7({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},website:{type:`string`,nullable:!0},location:{type:`string`,nullable:!0},archived:{type:`boolean`},...O7}),w7({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},titleKey:{type:`string`,column:`title_key`},appliedOn:{type:`date`,column:`applied_on`},periodYear:{type:`integer`,column:`period_year`},periodMonth:{type:`integer`,column:`period_month`},status:{type:`string`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},followUpOn:{type:`date`,nullable:!0,column:`follow_up_on`},archived:{type:`boolean`},...O7}),w7({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},color:{type:`string`,nullable:!0},scope:{type:`string`},...O7}),w7({id:{type:`string`,primaryKey:!0},tagId:{type:`string`,column:`tag_id`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},...O7}),w7({id:{type:`string`,primaryKey:!0},title:{type:`string`},body:{type:`string`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,nullable:!0,column:`target_id`},pinned:{type:`boolean`},...O7}),w7({id:{type:`string`,primaryKey:!0},applicationId:{type:`string`,column:`application_id`},fromStatus:{type:`string`,nullable:!0,column:`from_status`},toStatus:{type:`string`,column:`to_status`},occurredOn:{type:`date`,column:`occurred_on`},commentText:{type:`string`,nullable:!0,column:`comment_text`},...O7}),w7({id:{type:`string`,primaryKey:!0},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},model:{type:`string`},dim:{type:`integer`},embedding:{type:`json`},textHash:{type:`string`,column:`text_hash`},...O7}),w7({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},notes:{type:`string`,nullable:!0},savedOn:{type:`date`,column:`saved_on`},archived:{type:`boolean`},convertedApplicationId:{type:`string`,nullable:!0,column:`converted_application_id`},...O7}),w7({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,column:`name_key`},companyName:{type:`string`,nullable:!0,column:`company_name`},companyKey:{type:`string`,nullable:!0,column:`company_key`},headline:{type:`string`,nullable:!0},email:{type:`string`,nullable:!0},phone:{type:`string`,nullable:!0},linkedinUrl:{type:`string`,nullable:!0,column:`linkedin_url`},relationship:{type:`string`},about:{type:`string`,nullable:!0},reconnectOn:{type:`date`,nullable:!0,column:`reconnect_on`},connectedOn:{type:`date`,nullable:!0,column:`connected_on`},archived:{type:`boolean`},...O7}),w7({id:{type:`string`,primaryKey:!0},contactId:{type:`string`,column:`contact_id`},occurredOn:{type:`date`,column:`occurred_on`},channel:{type:`string`,column:`channel_name`},direction:{type:`string`},summary:{type:`string`,column:`summary_text`},applicationId:{type:`string`,nullable:!0,column:`application_id`},...O7}),w7({id:{type:`string`,primaryKey:!0},contactId:{type:`string`,column:`contact_id`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},role:{type:`string`,column:`link_role`},...O7}),w7({id:{type:`string`,primaryKey:!0},settingKey:{type:`string`,unique:!0,column:`setting_key`},value:{type:`json`},...O7}),[{header:`Position`,value:e=>e.jobTitle,width:34},{header:`Company`,value:e=>e.company.name,width:28},{header:`Location`,value:e=>e.location??``,width:22},{header:`Date`,value:e=>e.appliedOn,width:13},{header:`Status`,value:e=>e$[e.status],width:13},{header:`Notes`,value:e=>e.notesText,width:70,wrap:!0}].map(e=>e.header).filter(e=>e!==`Location`),new Map(Object.entries(e$).map(([e,t])=>[t.toLowerCase(),e]));var k7=b7,A7={applications:e=>[`applications`,e],application:e=>[`application`,e],periods:()=>[`periods`],applicationLocations:()=>[`applications`,`locations`],companies:e=>[`companies`,e],company:e=>[`company`,e],companySuggest:e=>[`company-suggest`,e],tags:()=>[`tags`],notes:e=>[`notes`,e],dashboard:()=>[`dashboard`],duplicates:e=>[`duplicates`,e],duplicateGroups:()=>[`duplicates`,`groups`],search:e=>[`search`,e],openings:e=>[`openings`,e],contacts:e=>[`contacts`,e],profile:()=>[`profile`],rules:()=>[`rules`],autoGhostPreview:()=>[`rules`,`auto-ghost`],contact:e=>[`contact`,e],linkedContacts:(e,t)=>[`contacts`,`linked`,e,t],opening:e=>[`opening`,e],dbTargets:()=>[`db-targets`],dataStatus:()=>[`data-status`],meta:()=>[`meta`]};function j7(e){e.invalidateQueries({queryKey:[`applications`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`periods`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`companies`]}),e.invalidateQueries({queryKey:[`company`]}),e.invalidateQueries({queryKey:[`tags`]}),e.invalidateQueries({queryKey:[`duplicates`]}),e.invalidateQueries({queryKey:[`search`]})}function M7(e){return ei({queryKey:A7.applications(e),queryFn:()=>k7.listApplications(e),placeholderData:e=>e})}function N7(e){return ni({queryKey:A7.applications(e),queryFn:({pageParam:t})=>k7.listApplications(t?{...e,cursor:t}:e),initialPageParam:null,getNextPageParam:e=>e.hasMore?e.cursor:null,placeholderData:e=>e})}function P7(e){return ei({queryKey:A7.application(e??``),queryFn:()=>k7.getApplication(e),enabled:!!e})}function F7(){return ei({queryKey:A7.periods(),queryFn:()=>k7.periods()})}function I7(){return ei({queryKey:A7.applicationLocations(),queryFn:()=>k7.applicationLocations()})}function L7(){return ei({queryKey:A7.dashboard(),queryFn:()=>k7.dashboard()})}function R7(){return ei({queryKey:A7.tags(),queryFn:()=>k7.listTags()})}function z7(e={}){return ei({queryKey:A7.companies(e),queryFn:()=>k7.listCompanies(e)})}function B7(e){return ei({queryKey:A7.company(e??``),queryFn:()=>k7.getCompany(e),enabled:!!e})}function V7(e={}){return ei({queryKey:A7.notes(e),queryFn:()=>k7.listNotes(e)})}function H7(e){let{enabled:t=!0,...n}=e;return ei({queryKey:A7.duplicates(n),queryFn:()=>k7.checkDuplicates(n),enabled:t&&n.company.trim().length>1,staleTime:5e3})}function U7(){return ei({queryKey:A7.duplicateGroups(),queryFn:()=>k7.duplicateGroups()})}function W7(e){return ei({queryKey:A7.companySuggest(e),queryFn:()=>k7.suggestCompanies(e),enabled:e.trim().length>0,staleTime:3e4})}function G7(){let e=An();return ti({mutationFn:e=>k7.createApplication(e),onSuccess:()=>j7(e)})}function K7(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.updateApplication(e,t),onSuccess:()=>j7(e)})}function q7(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.changeStatus(e,t),onSuccess:()=>j7(e)})}function J7(){let e=An();return ti({mutationFn:e=>k7.deleteApplication(e),onSuccess:()=>j7(e)})}function Y7(){let e=An();return ti({mutationFn:e=>k7.deleteApplications(e),onSuccess:()=>j7(e)})}function X7(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.updateCompany(e,t),onSuccess:()=>j7(e)})}function Z7(){let e=An();return ti({mutationFn:({id:e,body:t})=>e?k7.updateNote(e,t):k7.createNote(t),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`search`]})}})}function Q7(){let e=An();return ti({mutationFn:e=>k7.deleteNote(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]})}})}function $7(e={}){return ei({queryKey:A7.openings(e),queryFn:()=>k7.listOpenings(e)})}function e9(e){e.invalidateQueries({queryKey:[`openings`]}),e.invalidateQueries({queryKey:[`opening`]})}function t9(){let e=An();return ti({mutationFn:e=>k7.createOpening(e),onSuccess:()=>e9(e)})}function n9(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.updateOpening(e,t),onSuccess:()=>e9(e)})}function r9(){let e=An();return ti({mutationFn:e=>k7.deleteOpening(e),onSuccess:()=>e9(e)})}function i9(){let e=An();return ti({mutationFn:({id:e,body:t})=>k7.convertOpening(e,t),onSuccess:()=>{e9(e),e.invalidateQueries({queryKey:[`applications`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`periods`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`companies`]}),e.invalidateQueries({queryKey:[`search`]})}})}function a9(){return ei({queryKey:A7.dbTargets(),queryFn:()=>k7.getDbTargets()})}function o9(){return ti({mutationFn:e=>k7.switchDb(e)})}function s9(){return ei({queryKey:A7.dataStatus(),queryFn:()=>k7.getDataStatus()})}function c9(){let e=An();return ti({mutationFn:()=>k7.clearDatabase(),onSuccess:()=>void e.invalidateQueries()})}function l9(){let e=An();return ti({mutationFn:()=>k7.seedDatabase(),onSuccess:()=>void e.invalidateQueries()})}function u9(){return ei({queryKey:A7.meta(),queryFn:()=>k7.getMeta(),staleTime:1/0})}function d9(e={}){return ei({queryKey:A7.contacts(e),queryFn:()=>k7.listContacts(e),placeholderData:e=>e})}function f9(e){return ei({queryKey:A7.contact(e??``),queryFn:()=>k7.getContact(e),enabled:!!e})}function p9(e){e.invalidateQueries({queryKey:[`contacts`]}),e.invalidateQueries({queryKey:[`contact`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`duplicates`]}),e.invalidateQueries({queryKey:[`search`]})}function m9(e,t){return ei({queryKey:A7.linkedContacts(e,t??``),queryFn:()=>k7.linkedContacts(e,t),enabled:!!t})}function h9(){let e=An();return ti({mutationFn:({id:e,body:t})=>e?k7.updateContact(e,t):k7.createContact(t),onSuccess:()=>p9(e)})}function g9(){let e=An();return ti({mutationFn:e=>k7.deleteContact(e),onSuccess:()=>p9(e)})}function _9(){let e=An();return ti({mutationFn:({contactId:e,body:t})=>k7.logInteraction(e,t),onSuccess:()=>p9(e)})}function v9(){let e=An();return ti({mutationFn:e=>k7.deleteInteraction(e),onSuccess:()=>p9(e)})}function y9(){let e=An();return ti({mutationFn:({contactId:e,body:t})=>k7.linkContact(e,t),onSuccess:()=>p9(e)})}function b9(){let e=An();return ti({mutationFn:e=>k7.unlinkContact(e),onSuccess:()=>p9(e)})}function x9(){return ei({queryKey:A7.profile(),queryFn:()=>k7.getProfile()})}function S9(){let e=An();return ti({mutationFn:e=>k7.updateProfile(e),onSuccess:t=>{e.setQueryData(A7.profile(),t),e.invalidateQueries({queryKey:[`openings`]})}})}function C9(){return ei({queryKey:A7.rules(),queryFn:()=>k7.getRules()})}function w9(){let e=An();return ti({mutationFn:e=>k7.updateRules(e),onSuccess:()=>void e.invalidateQueries({queryKey:[`rules`]})})}function T9(e){return ei({queryKey:A7.autoGhostPreview(),queryFn:()=>k7.previewAutoGhost(),enabled:e})}function E9(){let e=An();return ti({mutationFn:()=>k7.runAutoGhost(),onSuccess:()=>{j7(e),e.invalidateQueries({queryKey:[`rules`]})}})}function D9({status:e}){return(0,Z.jsx)(lY,{color:$Q[e],children:e$[e]})}function O9(e,t=300){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var k9={exact:`error`,similar:`warning`,company:`info`,none:`success`};function A9({check:e,loading:t}){if(t&&!e)return(0,Z.jsx)(Rp,{type:`info`,showIcon:!0,message:`Checking your history…`,style:{marginBottom:16}});if(!e)return null;let n=e.contacts??[];if(e.verdict===`none`)return(0,Z.jsx)(Rp,{type:`success`,showIcon:!0,message:`No history with this company`,description:(0,Z.jsxs)(vz,{direction:`vertical`,size:6,style:{width:`100%`},children:[(0,Z.jsx)(`span`,{children:`This looks like a company you haven't applied to before.`}),(0,Z.jsx)(j9,{people:n})]}),style:{marginBottom:16}});let r=e.company?.name??`this company`;return(0,Z.jsx)(Rp,{type:k9[e.verdict],showIcon:!0,style:{marginBottom:16},message:Eee(e.verdict,r,e.priorCount),description:(0,Z.jsxs)(vz,{direction:`vertical`,size:6,style:{width:`100%`},children:[e.matches.length>0?e.matches.slice(0,5).map(e=>(0,Z.jsx)(Dee,{match:e},e.id)):(0,Z.jsx)(AX.Text,{type:`secondary`,children:`None of them were for this role, but it is worth a look before you apply again.`}),(0,Z.jsx)(j9,{people:n}),!e.semanticUsed&&e.matches.length>0&&(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Matched on wording only. Semantic matching is still warming up.`})]})})}function j9({people:e}){if(e.length===0)return null;let t=e.slice(0,3);return(0,Z.jsxs)(vz,{direction:`vertical`,size:2,children:[(0,Z.jsxs)(AX.Text,{strong:!0,children:[`You know `,e.length===1?`1 person`:`${e.length} people`,` here. Worth asking for a referral?`]}),t.map(e=>(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/people/${e.id}`,children:e.name}),e.headline&&(0,Z.jsx)(AX.Text,{type:`secondary`,children:e.headline}),(0,Z.jsx)(lY,{children:s$[e.relationship]})]},e.id))]})}function Eee(e,t,n){let r=n===1?`once`:`${n} times`;switch(e){case`exact`:return`You have already applied for this exact role at ${t}`;case`similar`:return`You have applied for a very similar role at ${t}`;default:return`You have applied to ${t} ${r} before`}}function Dee({match:e}){let t=Math.round(Math.max(e.titleSimilarity,e.semanticSimilarity??0)*100);return(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/applications/${e.id}`,children:e.jobTitle}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:e.appliedOn}),(0,Z.jsx)(lY,{color:$Q[e.status],children:e$[e.status]}),e.matchKind===`exact`?(0,Z.jsx)(lY,{color:`red`,children:`exact title`}):(0,Z.jsxs)(lY,{children:[t,`% similar`]})]})}function Oee({onStartApplication:e}){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(``),a=O9(t,350),{data:o,isFetching:s}=H7({company:a,title:O9(r,350)}),c=a.trim().length>1;return(0,Z.jsx)(_F,{title:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(jQ,{}),(0,Z.jsx)(`span`,{children:`Check before you apply`})]}),extra:e&&(0,Z.jsx)(Rk,{type:`link`,onClick:e,children:`New application`}),children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{xs:24,sm:12,children:(0,Z.jsx)(tV,{placeholder:`Company`,value:t,onChange:e=>n(e.target.value),allowClear:!0})}),(0,Z.jsx)(NI,{xs:24,sm:12,children:(0,Z.jsx)(tV,{placeholder:`Job title (optional)`,value:r,onChange:e=>i(e.target.value),allowClear:!0})})]}),c?(0,Z.jsx)(A9,{check:o,loading:s}):(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Type a company name to see whether you have been here before.`})]})})}function M9({open:e,onClose:t,application:n}){let[r]=OB.useForm(),{message:i,modal:a}=FC.useApp(),o=!!n,s=G7(),c=K7(),{data:l}=R7(),u=OB.useWatch(`companyName`,r)??``,d=OB.useWatch(`jobTitle`,r)??``,f=O9(u,300),p=O9(d,300),m=o&&u.trim()===(n?.company.name??``).trim()&&d.trim()===(n?.jobTitle??``).trim(),{data:h}=W7(f),{data:g,isFetching:v}=H7({company:f,title:p,...n?{excludeId:n.id}:{},enabled:e&&!m});(0,_.useEffect)(()=>{e&&(n?r.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,appliedOn:(0,Kk.default)(n.appliedOn),status:n.status,jobUrl:n.jobUrl??void 0,location:n.location??void 0,workMode:n.workMode,sourceName:n.sourceName??void 0,salaryMin:n.salaryMin,salaryMax:n.salaryMax,salaryCurrency:n.salaryCurrency??void 0,followUpOn:n.followUpOn?(0,Kk.default)(n.followUpOn):null,tags:n.tags.map(e=>e.name)}):(r.resetFields(),r.setFieldsValue({appliedOn:(0,Kk.default)(),status:`applied`,workMode:`unspecified`,tags:[]})))},[e,n,r]);let y=(0,_.useMemo)(()=>(h?.companies??[]).map(e=>({value:e.name,label:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(`span`,{children:e.name}),e.applicationCount>0&&(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[e.applicationCount,` application`,e.applicationCount===1?``:`s`]})]})})),[h]),b=(0,_.useMemo)(()=>(l?.tags??[]).map(e=>({value:e.name,label:e.name})),[l]),[x,S]=(0,_.useState)(!1);async function C(e){if(g&&p7(g.verdict)&&!o&&!await new Promise(e=>{a.confirm({title:`You have applied for this exact role before`,content:(0,Z.jsxs)(vz,{direction:`vertical`,children:[(0,Z.jsxs)(AX.Text,{children:[g.matches[0]?.jobTitle,` at `,g.company?.name,` on`,` `,g.matches[0]?.appliedOn,`.`]}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Save this as a new application anyway?`})]}),okText:`Save anyway`,cancelText:`Go back`,onOk:()=>e(!0),onCancel:()=>e(!1)})}))return;let l={companyName:e.companyName,jobTitle:e.jobTitle,appliedOn:e.appliedOn.format(`YYYY-MM-DD`),status:e.status,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,followUpOn:e.followUpOn?e.followUpOn.format(`YYYY-MM-DD`):null,tags:e.tags??[],...o?{}:{notes:e.notes??null}};S(!0);try{n?(await c.mutateAsync({id:n.id,body:l}),i.success(`Application updated`)):(await s.mutateAsync(l),i.success(`Application saved`)),t()}catch(e){e instanceof m7&&e.fieldErrors.length>0?(r.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),i.error(`Please check the highlighted fields`)):i.error(e instanceof Error?e.message:`Could not save`)}finally{S(!1)}}return(0,Z.jsxs)(lz,{title:o?`Edit application`:`New application`,open:e,onClose:t,width:640,destroyOnHidden:!0,extra:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Rk,{type:`primary`,loading:x,onClick:()=>r.submit(),children:o?`Save changes`:`Save application`})]}),children:[!m&&(0,Z.jsx)(A9,{check:g,loading:v}),(0,Z.jsxs)(OB,{form:r,layout:`vertical`,onFinish:C,requiredMark:`optional`,children:[(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(PE,{options:y,placeholder:`Start typing to see existing companies`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(tV,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(DE,{options:XQ.map(e=>({value:e,label:e$[e]}))})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`followUpOn`,label:`Follow up on`,children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`,allowClear:!0})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(DE,{options:t$.map(e=>({value:e,label:n$[e]}))})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(tV,{placeholder:`Stockholm`})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(tV,{placeholder:`LinkedIn, referral…`})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(PL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(PL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(tV,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(OB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(tV,{placeholder:`https://…`})}),(0,Z.jsx)(OB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(DE,{mode:`tags`,options:b,placeholder:`fintech, remote-ok, dream-job…`,tokenSeparators:[`,`]})}),!o&&(0,Z.jsx)(OB.Item,{name:`notes`,label:`Notes`,help:`Saved as a note linked to this application. Searchable.`,children:(0,Z.jsx)(tV.TextArea,{rows:4,placeholder:`Anything worth remembering…`})})]})]})}var kee={dark:{bgBase:`#0d1117`,bgRaised:`#161b22`,bgSunken:`#010409`,border:`#30363d`,borderStrong:`#444c56`,textPrimary:`#e6edf3`,textMuted:`#8b949e`,textFaint:`#6e7681`,accent:`#58a6ff`,success:`#3fb950`,danger:`#f85149`,warning:`#d29922`},light:{bgBase:`#ffffff`,bgRaised:`#ffffff`,bgSunken:`#f6f8fa`,border:`#d0d7de`,borderStrong:`#afb8c1`,textPrimary:`#1f2328`,textMuted:`#656d76`,textFaint:`#8c959f`,accent:`#0969da`,success:`#1a7f37`,danger:`#d1242f`,warning:`#9a6700`}},N9={bgBase:`var(--jt-bg-base)`,bgRaised:`var(--jt-bg-raised)`,bgSunken:`var(--jt-bg-sunken)`,border:`var(--jt-border)`,borderStrong:`var(--jt-border-strong)`,textPrimary:`var(--jt-text-primary)`,textMuted:`var(--jt-text-muted)`,textFaint:`var(--jt-text-faint)`,accent:`var(--jt-accent)`,success:`var(--jt-success)`,danger:`var(--jt-danger)`,warning:`var(--jt-warning)`};function Aee(e){let t=kee[e];return{algorithm:e===`dark`?yY.darkAlgorithm:yY.defaultAlgorithm,token:{colorBgBase:t.bgBase,colorBgContainer:t.bgRaised,colorBgElevated:t.bgRaised,colorBgLayout:t.bgBase,colorBorder:t.border,colorBorderSecondary:t.border,colorText:t.textPrimary,colorTextSecondary:t.textMuted,colorTextTertiary:t.textFaint,colorPrimary:t.accent,colorLink:t.accent,colorSuccess:t.success,colorError:t.danger,colorWarning:t.warning,borderRadius:8,fontSize:14},components:{Layout:{siderBg:t.bgSunken,headerBg:t.bgSunken,bodyBg:t.bgBase}}}}function P9(e){return`${S$(e.month).slice(0,3)} ${e.year}`}function jee({points:e,height:t=140}){let[n,r]=(0,_.useState)(null);if(e.length===0)return null;let i=Math.max(...e.map(e=>e.count),1),a=e.reduce((e,t)=>e+t.count,0),o=n===null?null:e[n];return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`baseline`,style:{marginBottom:8},children:[(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:o?`${P9(o)}: ${o.count} application${o.count===1?``:`s`}`:`${a} application${a===1?``:`s`} over ${e.length} months`}),(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[`peak `,i]})]}),(0,Z.jsxs)(`svg`,{viewBox:`0 0 ${e.length*10} 100`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Applications per month, ${P9(e[0])} to ${P9(e.at(-1))}. Peak ${i} in one month, ${a} in total.`,style:{display:`block`,width:`100%`,height:t},onMouseLeave:()=>r(null),children:[(0,Z.jsx)(`title`,{children:`Applications per month`}),e.map((e,t)=>{let a=e.count===0?0:Math.max(e.count/i*100,2);return(0,Z.jsxs)(`g`,{onMouseEnter:()=>r(t),children:[(0,Z.jsx)(`rect`,{x:t*10,y:`0`,width:10,height:100,fill:`transparent`}),(0,Z.jsx)(`rect`,{x:t*10+3/2,y:100-a,width:7,height:Math.max(a,1),rx:`1`,fill:e.count===0?N9.border:N9.accent,opacity:n===null||n===t?1:.45})]},`${e.year}-${e.month}`)})]}),(0,Z.jsx)(Pz,{justify:`space-between`,style:{marginTop:6},children:[e[0],e[Math.floor(e.length/2)],e.at(-1)].map((e,t)=>(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:11},children:P9(e)},t))})]})}var Mee=[.45,.6,.78,1];function Nee({stages:e}){let t=e[0]?.count??0;return(0,Z.jsxs)(vz,{direction:`vertical`,size:10,style:{width:`100%`},children:[e.map((e,n)=>{let r=t>0?e.count/t:0;return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,marginBottom:4,gap:8},children:[(0,Z.jsx)(AX.Text,{style:{fontSize:13},children:e$[e.status]}),(0,Z.jsxs)(vz,{size:8,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e.count}),e.conversion!==null&&(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[Math.round(e.conversion*100),`% of previous`]})]})]}),(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 6`,preserveAspectRatio:`none`,role:`img`,"aria-label":`${e$[e.status]}: ${e.count} applications ever reached this stage`,style:{display:`block`,width:`100%`,height:10},children:[(0,Z.jsx)(`title`,{children:`${e$[e.status]}: ${e.count}`}),(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`6`,rx:`1.5`,fill:N9.bgSunken}),r>0&&(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:Math.max(r*100,1),height:`6`,rx:`1.5`,fill:N9.accent,opacity:Mee[n]??1})]})]},e.status)}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Counted from your status history: an application that interviewed and was then turned down still counts at every stage it reached.`})]})}function Pee({values:e,label:t,height:n=28}){if(e.length<2)return null;let r=Math.max(...e,1),i=100/(e.length-1),a=e.map((e,t)=>`${(t*i).toFixed(2)},${(100-e/r*100).toFixed(2)}`).join(` `),o=`0,100 ${a} 100,100`;return(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 100`,preserveAspectRatio:`none`,role:`img`,"aria-label":t,style:{display:`block`,width:`100%`,height:n},children:[(0,Z.jsx)(`title`,{children:t}),(0,Z.jsx)(`polygon`,{points:o,fill:N9.accent,opacity:.12}),(0,Z.jsx)(`polyline`,{points:a,fill:`none`,stroke:N9.accent,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`})]})}function Fee(){let{data:e,isLoading:t}=L7(),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(`follow-ups`),o=y$(b$());if(t||!e)return(0,Z.jsx)(TS,{active:!0,paragraph:{rows:8}});let{stats:s,followUps:c,recentActivity:l,funnel:u,volume:d,stale:f,reconnect:p}=e;if(s.total===0)return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_F,{children:(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:(0,Z.jsxs)(vz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:`No applications yet`}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Add the first one, or bring in a spreadsheet you already keep.`})]}),children:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(aP,{}),onClick:()=>r(!0),children:`New application`}),(0,Z.jsx)(gn,{to:`/applications`,children:(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(YQ,{}),children:`Import`})})]})})}),(0,Z.jsx)(M9,{open:n,onClose:()=>r(!1)})]});let m=d.slice(-12),h=d.slice(-13,-1),g=h.length>0?h.reduce((e,t)=>e+t.count,0)/h.length:0,v=s.thisMonth-g,y={"follow-ups":c.length,quiet:f.length,reconnect:p.length}[i];return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsx)(IU,{title:`Total applications`,value:s.total})})}),(0,Z.jsx)(NI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsx)(IU,{title:`Still active`,value:s.active,valueStyle:{color:N9.accent}})})}),(0,Z.jsx)(NI,{xs:12,sm:12,md:6,children:(0,Z.jsxs)(_F,{size:`small`,children:[(0,Z.jsx)(IU,{title:`${S$(o.month)} ${o.year}`,value:s.thisMonth}),(0,Z.jsx)(Pee,{values:m.map(e=>e.count),label:`Applications in each of the last ${m.length} months: ${m.map(e=>e.count).join(`, `)}`}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:g===0?`first month on record`:`${v>=0?`+`:``}${v.toFixed(1)} vs your monthly average`})]})}),(0,Z.jsx)(NI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Response rate`}),(0,Z.jsx)(iU,{percent:Math.round(s.responseRate*100),size:`small`,strokeColor:N9.accent}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Anything past “applied” counts as a reply`})]})})})]}),(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:24,lg:14,children:(0,Z.jsx)(Oee,{onStartApplication:()=>r(!0)})}),(0,Z.jsx)(NI,{xs:24,lg:10,children:(0,Z.jsx)(_F,{title:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(jR,{}),(0,Z.jsx)(`span`,{children:`Needs attention`})]}),extra:(0,Z.jsx)(qI,{size:`small`,value:i,onChange:e=>a(e),options:[{label:`Follow-ups (${c.length})`,value:`follow-ups`},{label:`Gone quiet (${f.length})`,value:`quiet`},{label:`Reconnect (${p.length})`,value:`reconnect`}]}),styles:{body:{maxHeight:320,overflowY:`auto`}},children:y===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:i===`follow-ups`?`Nothing due. All caught up.`:i===`quiet`?`Nothing has gone quiet`:`Nobody is due a reconnect`}):i===`follow-ups`?(0,Z.jsx)(_H,{size:`small`,dataSource:c,renderItem:e=>(0,Z.jsxs)(_H.Item,{children:[(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsx)(gn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(Pz,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)(AX.Text,{type:`danger`,children:[`due `,e.followUpOn]})]})}),(0,Z.jsx)(D9,{status:e.status})]})}):i===`reconnect`?(0,Z.jsx)(_H,{size:`small`,dataSource:p,renderItem:e=>(0,Z.jsxs)(_H.Item,{children:[(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsx)(gn,{to:`/people/${e.id}`,children:e.name}),description:(0,Z.jsxs)(Pz,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:[e.headline,e.companyName].filter(Boolean).join(` at `)}),(0,Z.jsxs)(AX.Text,{type:`danger`,children:[`due `,e.reconnectOn]})]})}),(0,Z.jsx)(lY,{children:s$[e.relationship]})]})}):(0,Z.jsx)(_H,{size:`small`,dataSource:f,header:(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Still live, no follow-up date, and nothing has moved.`}),renderItem:e=>(0,Z.jsxs)(_H.Item,{children:[(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsx)(gn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(Pz,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)(AX.Text,{type:`warning`,children:[`silent `,e.silentDays,` days`]})]})}),(0,Z.jsx)(D9,{status:e.status})]})})})})]}),(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:24,lg:12,children:(0,Z.jsx)(_F,{title:`Pipeline`,size:`small`,children:(0,Z.jsx)(Nee,{stages:u})})}),(0,Z.jsx)(NI,{xs:24,lg:12,children:(0,Z.jsx)(_F,{title:`Applications over time`,size:`small`,children:(0,Z.jsx)(jee,{points:d})})})]}),(0,Z.jsx)(_F,{title:`Recent activity`,size:`small`,styles:{body:{maxHeight:360,overflowY:`auto`}},children:l.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No status changes yet`}):(0,Z.jsx)(DY,{items:l.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsxs)(AX.Text,{children:[(0,Z.jsx)(gn,{to:`/applications/${e.applicationId}`,children:e.jobTitle}),` at `,e.companyName]}),(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[e.fromStatus?`${e$[e.fromStatus]} → ${e$[e.toStatus]}`:`Applied (${e$[e.toStatus]})`,` `,`· `,e.occurredOn]})]})}))})}),(0,Z.jsx)(M9,{open:n,onClose:()=>r(!1)})]})}function Iee({periods:e,year:t,month:n,onSelect:r}){let i=(0,_.useMemo)(()=>e.map(e=>({key:`y:${e.year}`,title:(0,Z.jsx)(F9,{label:String(e.year),count:e.count,strong:!0}),children:(e.months??[]).map(e=>({key:`m:${e.year}:${e.month}`,title:(0,Z.jsx)(F9,{label:S$(e.month),count:e.count})}))})),[e]),a=(0,_.useMemo)(()=>t&&n?[`m:${t}:${n}`]:t?[`y:${t}`]:[],[t,n]),o=(0,_.useMemo)(()=>{let n=e[0],r=n?[`y:${n.year}`]:[];return t&&!r.includes(`y:${t}`)&&r.push(`y:${t}`),r},[e,t]);return e.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No applications yet`}):(0,Z.jsx)(Rq,{treeData:i,selectedKeys:a,defaultExpandedKeys:o,blockNode:!0,onSelect:e=>{let t=String(e[0]??``);if(t.startsWith(`m:`)){let[,e,n]=t.split(`:`);r({year:Number(e),month:Number(n)})}else t.startsWith(`y:`)?r({year:Number(t.slice(2))}):r({})}})}function F9({label:e,count:t,strong:n}){return(0,Z.jsxs)(`span`,{style:{display:`flex`,justifyContent:`space-between`,gap:12},children:[(0,Z.jsx)(AX.Text,{strong:n,children:e}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:t})]})}var Lee={new:`green`,duplicate:`default`,error:`red`},Ree={new:`New`,duplicate:`Duplicate, skipped`,error:`Error`};function zee({open:e,onClose:t}){let n=An(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(`csv`),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null);function h(){i(null),c(null),u(null),m(null)}function g(){h(),t()}let v=e=>{let t=e.name.toLowerCase().endsWith(`.xlsx`)?`xlsx`:`csv`;return i(e),o(t),m(null),f(!0),k7.previewImport(e,t).then(c).catch(e=>m(e instanceof Error?e.message:`Could not read that file`)).finally(()=>f(!1)),!1};async function y(){if(r){f(!0),m(null);try{let e=await k7.commitImport(r,a);if(u(e),e.created>0)for(let e of[`applications`,`application`,`periods`,`dashboard`,`companies`,`company`,`search`])n.invalidateQueries({queryKey:[e]})}catch(e){m(e instanceof Error?e.message:`Import failed`)}finally{f(!1)}}}return(0,Z.jsx)(xH,{title:`Import applications`,open:e,onCancel:g,width:800,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(AX.Paragraph,{type:`secondary`,children:`CSV or .xlsx with the same columns Export produces: Position, Company, Location, Date, Status, Notes. Location is optional. Rows that exactly match an application you have already logged are skipped automatically.`}),(0,Z.jsxs)(SZ.Dragger,{accept:`.csv,.xlsx`,maxCount:1,showUploadList:!1,beforeUpload:v,disabled:d,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(tQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a CSV or Excel file here`})]})]}),p&&(0,Z.jsx)(Rp,{type:`error`,showIcon:!0,message:p}),s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(vz,{wrap:!0,children:[(0,Z.jsxs)(lY,{color:`green`,children:[s.totals.new,` new`]}),(0,Z.jsxs)(lY,{children:[s.totals.duplicate,` duplicate, will be skipped`]}),s.totals.error>0&&(0,Z.jsxs)(lY,{color:`red`,children:[s.totals.error,` error`]})]}),s.fileErrors.map(e=>(0,Z.jsx)(Rp,{type:`warning`,showIcon:!0,message:e},e)),(0,Z.jsx)(XJ,{size:`small`,rowKey:`rowNumber`,columns:[{title:`Row`,dataIndex:`rowNumber`,width:60},{title:`Position`,dataIndex:`jobTitle`,ellipsis:!0},{title:`Company`,dataIndex:`companyName`,ellipsis:!0},{title:`Date`,dataIndex:`appliedOn`,width:110},{title:`Status`,dataIndex:`status`,width:110,render:e=>e?e$[e]:`—`},{title:`Result`,dataIndex:`verdict`,width:200,render:(e,t)=>(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(lY,{color:Lee[e],children:Ree[e]}),t.errors.length>0&&(0,Z.jsx)(AX.Text,{type:`danger`,style:{fontSize:12},children:t.errors.join(`; `)})]})}],dataSource:s.rows,pagination:{pageSize:10},scroll:{y:320}}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:h,children:`Choose a different file`}),(0,Z.jsxs)(Rk,{type:`primary`,loading:d,disabled:s.totals.new===0,onClick:y,children:[`Import `,s.totals.new,` application`,s.totals.new===1?``:`s`]})]})]}),l&&(0,Z.jsx)(CU,{status:l.failed>0?`warning`:`success`,title:`Imported ${l.created} application${l.created===1?``:`s`}`,subTitle:`${l.skipped} duplicate row${l.skipped===1?``:`s`} skipped`+(l.failed>0?`, ${l.failed} row${l.failed===1?``:`s`} failed`:``),extra:(0,Z.jsx)(Rk,{type:`primary`,onClick:g,children:`Done`})})]})})}var I9=[{value:`appliedOn`,label:`Sort: date applied`,kind:`date`},{value:`company`,label:`Sort: company`,kind:`text`},{value:`jobTitle`,label:`Sort: job title`,kind:`text`},{value:`status`,label:`Sort: status`,kind:`text`}],L9={date:[{value:`desc`,label:`Newest first`},{value:`asc`,label:`Oldest first`}],text:[{value:`asc`,label:`A–Z`},{value:`desc`,label:`Z–A`}]};function R9(e){return I9.find(t=>t.value===e)?.kind??`date`}function z9(e){return L9[R9(e)][0].value}function Bee(){let e=tt(),[t,n]=Sn(),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=t.get(`sort`)??`appliedOn`,c=t.get(`direction`)??z9(s),l=(0,_.useMemo)(()=>{let e={sort:s,direction:c};for(let n of[`q`,`source`,`from`,`to`,`location`]){let r=t.get(n);r&&(e[n]=r)}for(let n of[`year`,`month`]){let r=t.get(n);r&&(e[n]=Number(r))}for(let n of[`status`,`workMode`,`tags`]){let r=t.get(n);r&&(e[n]=r.split(`,`))}return e},[t,s,c]),{data:u,isLoading:d,isFetching:f,hasNextPage:p,fetchNextPage:m,isFetchingNextPage:h}=N7(l),{data:g}=F7(),{data:v}=R7(),{data:y}=I7(),b=t.get(`location`)?.split(`|`).filter(Boolean)??[],x=u?.pages??[],S=(0,_.useMemo)(()=>x.flatMap(e=>e.items),[x]),C=x[0];function w(e){let r=new URLSearchParams(t);for(let[t,n]of Object.entries(e))if(n==null||n===``||Array.isArray(n)&&n.length===0)r.delete(t);else{let e=t===`location`?`|`:`,`;r.set(t,Array.isArray(n)?n.join(e):String(n))}n(r,{replace:!0})}let T=[{title:`Applied`,dataIndex:`appliedOn`,width:118,sorter:!1,render:e=>(0,Z.jsx)(AX.Text,{children:e})},{title:`Company`,key:`company`,width:190,render:(t,n)=>(0,Z.jsx)(Rk,{type:`link`,style:{padding:0,height:`auto`},onClick:t=>{t.stopPropagation(),e(`/companies/${n.company.id}`)},children:n.company.name})},{title:`Job title`,dataIndex:`jobTitle`,render:(e,t)=>(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e}),t.location&&(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[t.location,` · `,n$[t.workMode]]})]})},{title:`Status`,dataIndex:`status`,width:116,render:(e,t)=>(0,Z.jsx)(D9,{status:t.status})},{title:`Tags`,key:`tags`,width:210,render:(e,t)=>(0,Z.jsx)(vz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(lY,{color:e.color??void 0,style:{marginInlineEnd:0},children:e.name},e.id))})},{title:`Source`,dataIndex:`sourceName`,width:120,render:e=>e??(0,Z.jsx)(AX.Text,{type:`secondary`,children:`—`})}],E=t.get(`from`),D=t.get(`to`),O=E&&D?[(0,Kk.default)(E),(0,Kk.default)(D)]:null,k=(0,Kk.default)(),A=[{label:`Today`,value:[k,k]},{label:`Yesterday`,value:[k.subtract(1,`day`),k.subtract(1,`day`)]},{label:`This week`,value:[k.startOf(`week`),k.endOf(`week`)]},{label:`This month`,value:[k.startOf(`month`),k.endOf(`month`)]},{label:`Last 7 days`,value:[k.subtract(6,`day`),k]},{label:`Last 30 days`,value:[k.subtract(29,`day`),k]}];function j(e){if(!e||!e[0]||!e[1]){w({from:``,to:``});return}w({from:e[0].format(`YYYY-MM-DD`),to:e[1].format(`YYYY-MM-DD`)})}let M=t.get(`year`)?Number(t.get(`year`)):void 0,N=t.get(`month`)?Number(t.get(`month`)):void 0,P=M&&N?`${S$(N)} ${M}`:M?String(M):`All applications`;return(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{xs:24,md:6,lg:5,children:(0,Z.jsx)(_F,{size:`small`,title:`By period`,extra:(M||N)&&(0,Z.jsx)(Rk,{size:`small`,type:`link`,onClick:()=>w({year:``,month:``}),children:`Clear`}),styles:{body:{maxHeight:`calc(100vh - 220px)`,overflowY:`auto`}},children:(0,Z.jsx)(Iee,{periods:g?.periods??[],year:M,month:N,onSelect:e=>w({year:e.year??``,month:e.month??``})})})}),(0,Z.jsx)(NI,{xs:24,md:18,lg:19,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:P}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:C?S.length<C.total?`Showing ${S.length} of ${C.total} applications`:`${C.total} application${C.total===1?``:`s`}`:`Loading…`})]}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(bz,{menu:{items:[{key:`csv`,label:`Export as CSV`},{key:`xlsx`,label:`Export as Excel (.xlsx)`}],onClick:({key:e})=>{window.location.href=k7.exportUrl(l,e)}},children:(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(gZ,{}),children:`Export`})}),(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(YQ,{}),onClick:()=>o(!0),children:`Import`}),(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(iX,{}),onClick:()=>e(`/applications/duplicates`),children:`Duplicates`}),(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(aP,{}),onClick:()=>i(!0),children:`New application`})]})]}),(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(tV,{allowClear:!0,size:`large`,prefix:(0,Z.jsx)(SE,{}),placeholder:`Search by meaning, like “server-side developer” or “remote fintech”`,defaultValue:t.get(`q`)??``,onChange:e=>{e.target.value===``&&w({q:``})},onPressEnter:e=>w({q:e.target.value})}),(0,Z.jsxs)(Pz,{gap:8,wrap:!0,children:[(0,Z.jsx)(PR.RangePicker,{allowClear:!0,value:O,presets:A,format:`YYYY-MM-DD`,onChange:e=>j(e)}),(0,Z.jsx)(DE,{mode:`multiple`,allowClear:!0,placeholder:`Status`,style:{minWidth:180},suffixIcon:(0,Z.jsx)(YZ,{}),value:t.get(`status`)?.split(`,`)??[],onChange:e=>w({status:e}),options:XQ.map(e=>({value:e,label:e$[e]}))}),(0,Z.jsx)(DE,{mode:`multiple`,allowClear:!0,placeholder:`Work mode`,style:{minWidth:160},value:t.get(`workMode`)?.split(`,`)??[],onChange:e=>w({workMode:e}),options:t$.map(e=>({value:e,label:n$[e]}))}),(0,Z.jsx)(DE,{mode:`tags`,allowClear:!0,placeholder:`Location`,style:{minWidth:200},value:b,onChange:e=>w({location:e.map(e=>e.replace(/\|/g,` `).trim()).filter(Boolean)}),optionFilterProp:`value`,options:(y?.locations??[]).map(e=>({value:e.label,label:`${e.label} (${e.count})`}))}),(0,Z.jsx)(DE,{mode:`multiple`,allowClear:!0,placeholder:`Tags`,style:{minWidth:200},value:t.get(`tags`)?.split(`,`)??[],onChange:e=>w({tags:e}),options:(v?.tags??[]).map(e=>({value:e.name,label:e.name}))}),(0,Z.jsx)(DE,{style:{minWidth:170},value:s,onChange:e=>w({sort:e,direction:z9(e)}),options:I9.map(({value:e,label:t})=>({value:e,label:t}))}),(0,Z.jsx)(DE,{style:{width:130},value:c,onChange:e=>w({direction:e}),options:L9[R9(s)]})]}),C?.searched&&!C.semanticReady&&(0,Z.jsx)(Rp,{type:`info`,showIcon:!0,icon:(0,Z.jsx)(KQ,{}),message:`Results will improve shortly. The semantic model is still loading.`})]})}),(0,Z.jsx)(XJ,{rowKey:`id`,columns:T,dataSource:S,loading:d||f&&!h,pagination:!1,onRow:t=>({onClick:()=>e(`/applications/${t.id}`),style:{cursor:`pointer`}}),locale:{emptyText:(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:t.get(`q`)?`Nothing matched “${t.get(`q`)}”`:`No applications for this filter`})},footer:p?()=>(0,Z.jsx)(Pz,{justify:`center`,children:(0,Z.jsx)(_D,{title:`Adds the next page to the list`,children:(0,Z.jsx)(Rk,{loading:h,onClick:()=>void m(),children:`Load more`})})}):void 0})]})}),(0,Z.jsx)(M9,{open:r,onClose:()=>i(!1)}),(0,Z.jsx)(zee,{open:a,onClose:()=>o(!1)})]})}function B9({open:e,note:t,onClose:n,target:r}){let[i]=OB.useForm(),{message:a}=FC.useApp(),o=Z7();return(0,Z.jsx)(xH,{open:e,title:t?`Edit note`:`New note`,okText:`Save`,destroyOnHidden:!0,onCancel:n,afterOpenChange:e=>{e&&(t?i.setFieldsValue({title:t.title,body:t.body,targetType:t.targetType,targetId:t.targetId,pinned:t.pinned}):(i.resetFields(),i.setFieldsValue({targetType:r?r.type:`standalone`,targetId:r?r.id:null,pinned:!1,body:``})))},onOk:async()=>{let e=await i.validateFields();await o.mutateAsync({...t?{id:t.id}:{},body:{title:e.title,body:e.body??``,targetType:e.targetType,targetId:e.targetType===`standalone`?null:e.targetId??null,pinned:e.pinned??!1}}),a.success(t?`Note updated`:`Note saved`),n()},children:(0,Z.jsxs)(OB,{form:i,layout:`vertical`,children:[(0,Z.jsx)(OB.Item,{name:`title`,label:`Title`,rules:[{required:!0,message:`Title is required`}],children:(0,Z.jsx)(tV,{placeholder:`Interview prep, salary research…`})}),(0,Z.jsx)(OB.Item,{name:`body`,label:`Note`,children:(0,Z.jsx)(tV.TextArea,{rows:8,placeholder:`Anything worth keeping`})}),r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(OB.Item,{name:`targetType`,hidden:!0,children:(0,Z.jsx)(tV,{})}),(0,Z.jsx)(OB.Item,{name:`targetId`,hidden:!0,children:(0,Z.jsx)(tV,{})}),(0,Z.jsxs)(AX.Paragraph,{type:`secondary`,style:{marginBottom:16},children:[`Attached to `,r.label]})]}):(0,Z.jsx)(Vee,{form:i}),(0,Z.jsx)(OB.Item,{name:`pinned`,label:`Pinned`,valuePropName:`checked`,children:(0,Z.jsx)(PW,{})})]})})}function Vee({form:e}){let t=OB.useWatch(`targetType`,e)??`standalone`,{data:n}=z7(),{data:r}=M7({limit:200}),i=(0,_.useMemo)(()=>t===`company`?(n?.companies??[]).map(e=>({value:e.id,label:e.name})):t===`application`?(r?.items??[]).map(e=>({value:e.id,label:`${e.jobTitle} at ${e.company.name}`})):[],[t,n,r]);return(0,Z.jsxs)(Pz,{gap:12,children:[(0,Z.jsx)(OB.Item,{name:`targetType`,label:`Attach to`,style:{flex:1},children:(0,Z.jsx)(DE,{options:[{value:`standalone`,label:`Nothing in particular`},{value:`company`,label:`A company`},{value:`application`,label:`An application`}],onChange:()=>e.setFieldValue(`targetId`,null)})}),t!==`standalone`&&(0,Z.jsx)(OB.Item,{name:`targetId`,label:t===`company`?`Company`:`Application`,style:{flex:2},rules:[{required:!0,message:`Pick what this note is about`}],children:(0,Z.jsx)(DE,{showSearch:!0,optionFilterProp:`label`,options:i})})]})}function V9({open:e,onClose:t,contact:n,defaults:r,onSaved:i}){let[a]=OB.useForm(),{message:o}=FC.useApp(),s=h9(),{data:c}=W7(OB.useWatch(`companyName`,a)??``),l=(0,_.useMemo)(()=>(c?.companies??[]).map(e=>({value:e.name})),[c]),u=n?.id,d=r?.companyName,f=r?.relationship;(0,_.useEffect)(()=>{e&&(a.resetFields(),n?a.setFieldsValue({name:n.name,companyName:n.companyName??void 0,headline:n.headline??void 0,relationship:n.relationship,email:n.email??void 0,phone:n.phone??void 0,linkedinUrl:n.linkedinUrl??void 0,reconnectOn:n.reconnectOn?(0,Kk.default)(n.reconnectOn):null,about:n.about??void 0}):a.setFieldsValue({relationship:f??`connection`,companyName:d}))},[e,u,d,f,a]);async function p(e){let r={name:e.name,companyName:e.companyName??null,headline:e.headline??null,relationship:e.relationship,email:e.email??null,phone:e.phone??null,linkedinUrl:e.linkedinUrl??null,reconnectOn:e.reconnectOn?e.reconnectOn.format(`YYYY-MM-DD`):null,about:e.about??null};try{let e=await s.mutateAsync({id:n?.id,body:r});o.success(n?`Person updated`:`Person added`),i?.(e),t()}catch(e){e instanceof m7&&e.fieldErrors.length>0?a.setFields(e.fieldErrors.map(e=>({name:e.path,errors:[e.message]}))):o.error(e instanceof Error?e.message:`Could not save`)}}return(0,Z.jsx)(lz,{title:n?`Edit ${n.name}`:`Add a person`,open:e,onClose:t,width:560,destroyOnHidden:!0,extra:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Rk,{type:`primary`,loading:s.isPending,onClick:()=>a.submit(),children:`Save`})]}),children:(0,Z.jsxs)(OB,{form:a,layout:`vertical`,onFinish:p,requiredMark:`optional`,children:[(0,Z.jsx)(OB.Item,{name:`name`,label:`Name`,rules:[{required:!0,message:`Name is required`}],children:(0,Z.jsx)(tV,{autoFocus:!0,placeholder:`Anna Svensson`})}),(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`companyName`,label:`Works at`,children:(0,Z.jsx)(PE,{options:l,placeholder:`Company`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`headline`,label:`Their role`,children:(0,Z.jsx)(tV,{placeholder:`Engineering Manager`})})})]}),(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`relationship`,label:`How you know them`,children:(0,Z.jsx)(DE,{options:o$.map(e=>({value:e,label:s$[e]}))})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`reconnectOn`,label:`Reconnect on`,tooltip:`Shows up on the dashboard when the day comes`,children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`,presets:[{label:`In a week`,value:(0,Kk.default)().add(1,`week`)},{label:`In a month`,value:(0,Kk.default)().add(1,`month`)},{label:`In three months`,value:(0,Kk.default)().add(3,`month`)}]})})})]}),(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`email`,label:`Email`,rules:[{type:`email`,message:`That is not an email address`}],children:(0,Z.jsx)(tV,{})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`phone`,label:`Phone`,children:(0,Z.jsx)(tV,{})})})]}),(0,Z.jsx)(OB.Item,{name:`linkedinUrl`,label:`LinkedIn profile`,children:(0,Z.jsx)(tV,{placeholder:`https://www.linkedin.com/in/...`})}),(0,Z.jsx)(OB.Item,{name:`about`,label:`Notes`,children:(0,Z.jsx)(tV.TextArea,{rows:5,placeholder:`Where you met, what they work on, what you talked about`})})]})})}function H9({open:e,onClose:t,contact:n,applicationId:r}){let[i]=OB.useForm(),{message:a}=FC.useApp(),o=_9();(0,_.useEffect)(()=>{e&&(i.resetFields(),i.setFieldsValue({occurredOn:(0,Kk.default)(),channel:`linkedin`,direction:`outbound`}))},[e,i]);async function s(e){if(n)try{await o.mutateAsync({contactId:n.id,body:{occurredOn:e.occurredOn.format(`YYYY-MM-DD`),channel:e.channel,direction:e.direction,summary:e.summary,applicationId:r??null,...e.reconnectOn?{reconnectOn:e.reconnectOn.format(`YYYY-MM-DD`)}:{}}}),a.success(`Logged`),t()}catch(e){a.error(e instanceof Error?e.message:`Could not log that`)}}return(0,Z.jsx)(xH,{title:n?`Log a conversation with ${n.name}`:``,open:e,onCancel:t,onOk:()=>i.submit(),okText:`Log it`,confirmLoading:o.isPending,destroyOnHidden:!0,children:(0,Z.jsxs)(OB,{form:i,layout:`vertical`,onFinish:s,children:[(0,Z.jsx)(OB.Item,{name:`direction`,label:`Who reached out`,children:(0,Z.jsx)(qI,{options:[{label:`I did`,value:`outbound`},{label:`They did`,value:`inbound`}]})}),(0,Z.jsx)(OB.Item,{name:`channel`,label:`How`,children:(0,Z.jsx)(DE,{options:c$.map(e=>({value:e,label:l$[e]}))})}),(0,Z.jsx)(OB.Item,{name:`occurredOn`,label:`When`,rules:[{required:!0}],children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`})}),(0,Z.jsx)(OB.Item,{name:`summary`,label:`What happened`,rules:[{required:!0,message:`Say what happened`}],children:(0,Z.jsx)(tV.TextArea,{rows:3,placeholder:`Asked about the platform team; she offered to refer me`})}),(0,Z.jsx)(OB.Item,{name:`reconnectOn`,label:`Get back in touch on`,tooltip:`Optional. Sets their next reminder.`,children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`,presets:[{label:`In a week`,value:(0,Kk.default)().add(1,`week`)},{label:`In two weeks`,value:(0,Kk.default)().add(2,`week`)},{label:`In a month`,value:(0,Kk.default)().add(1,`month`)}]})})]})})}function U9(e){return e.lastInteractionOn?`last spoke ${e.lastInteractionOn}`:`no conversations logged`}function W9({contact:e}){return(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/people/${e.id}`,children:e.name}),(0,Z.jsx)(lY,{children:s$[e.relationship]})]}),description:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[e.headline&&(0,Z.jsx)(`span`,{children:e.headline}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:U9(e)})]})})}function Hee({companyName:e}){let{data:t,isLoading:n}=d9({company:e}),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),s=t?.contacts??[];return(0,Z.jsxs)(_F,{title:`People you know at ${e} (${s.length})`,loading:n,extra:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(aP,{}),onClick:()=>i(!0),children:`Add person`}),children:[s.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`Nobody you know works here yet`}):(0,Z.jsx)(_H,{dataSource:s,renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(_D,{title:`Log a conversation`,children:(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(pQ,{}),onClick:()=>o(e)})},`log`)],children:(0,Z.jsx)(W9,{contact:e})})}),(0,Z.jsx)(V9,{open:r,onClose:()=>i(!1),defaults:{companyName:e}}),(0,Z.jsx)(H9,{open:a!==null,contact:a,onClose:()=>o(null)})]})}function Uee({application:e}){let{message:t}=FC.useApp(),{data:n}=m9(`application`,e.id),{data:r}=d9({company:e.company.name}),i=y9(),a=b9(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),u=n?.contacts??[],d=new Set(u.map(e=>e.id)),f=(r?.contacts??[]).filter(e=>!d.has(e.id));async function p(n,r){try{await i.mutateAsync({contactId:n.id,body:{targetType:`application`,targetId:e.id,role:r}}),t.success(`Linked ${n.name}`)}catch(e){t.error(e instanceof Error?e.message:`Could not link`)}}let m=e=>({items:f$.map(e=>({key:e,label:p$[e]})),onClick:({key:t})=>void p(e,t)});return(0,Z.jsxs)(_F,{title:`People (${u.length})`,extra:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(aP,{}),onClick:()=>s(!0),children:`Add person`}),children:[u.length===0&&f.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`You don't know anyone at ${e.company.name} yet`}):(0,Z.jsxs)(vz,{direction:`vertical`,size:8,style:{width:`100%`},children:[u.length>0&&(0,Z.jsx)(_H,{size:`small`,dataSource:u,renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(_D,{title:`Log a conversation about this application`,children:(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(pQ,{}),onClick:()=>l(e)})},`log`),(0,Z.jsx)(_D,{title:`Unlink`,children:(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(UZ,{}),onClick:()=>a.mutate(e.linkId)})},`unlink`)],children:(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/people/${e.id}`,children:e.name}),(0,Z.jsx)(lY,{color:`blue`,children:p$[e.role]})]}),description:e.headline??U9(e)})})}),f.length>0&&(0,Z.jsx)(_H,{size:`small`,header:(0,Z.jsxs)(AX.Text,{type:`secondary`,style:{fontSize:12},children:[`Also at `,e.company.name]}),dataSource:f,renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(bz,{menu:m(e),trigger:[`click`],children:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(sQ,{}),children:`Link`})},`link`)],children:(0,Z.jsx)(W9,{contact:e})})})]}),(0,Z.jsx)(V9,{open:o,onClose:()=>s(!1),defaults:{companyName:e.company.name}}),(0,Z.jsx)(H9,{open:c!==null,contact:c,applicationId:e.id,onClose:()=>l(null)})]})}function Wee(){let{id:e}=rt(),t=tt(),{message:n}=FC.useApp(),{data:r,isLoading:i}=P7(e),a=q7(),o=J7(),s=Q7(),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(TS,{active:!0,paragraph:{rows:10}});let m=QQ(r.status);async function h(t){e&&(await a.mutateAsync({id:e,body:{status:t,comment:null}}),n.success(`Moved to ${e$[t]}`))}return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`flex-start`,wrap:!0,gap:12,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Rk,{type:`link`,icon:(0,Z.jsx)(TZ,{}),style:{padding:0},onClick:()=>t(`/applications`),children:`Back to applications`}),(0,Z.jsx)(AX.Title,{level:3,style:{margin:0},children:r.jobTitle}),(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/companies/${r.company.id}`,children:r.company.name}),(0,Z.jsxs)(AX.Text,{type:`secondary`,children:[`applied `,r.appliedOn]}),(0,Z.jsx)(D9,{status:r.status})]})]}),(0,Z.jsxs)(vz,{wrap:!0,children:[m&&(0,Z.jsxs)(Rk,{type:`primary`,onClick:()=>void h(m),children:[`Move to `,e$[m]]}),(0,Z.jsx)(DE,{style:{width:150},value:r.status,onChange:e=>void h(e),options:XQ.map(e=>({value:e,label:e$[e]}))}),(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(NY,{}),onClick:()=>l(!0),children:`Edit`}),(0,Z.jsx)(TH,{title:`Delete this application?`,description:`Its notes and status history go too. This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{e&&(await o.mutateAsync(e),n.success(`Application deleted`),t(`/applications`))},children:(0,Z.jsx)(Rk,{danger:!0,icon:(0,Z.jsx)(AY,{})})})]})]}),(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:24,lg:14,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(_F,{title:`Details`,children:(0,Z.jsxs)(BR,{column:{xs:1,sm:2},size:`small`,bordered:!0,children:[(0,Z.jsx)(BR.Item,{label:`Company`,children:r.company.name}),(0,Z.jsx)(BR.Item,{label:`Applied on`,children:r.appliedOn}),(0,Z.jsx)(BR.Item,{label:`Location`,children:r.location??`—`}),(0,Z.jsx)(BR.Item,{label:`Work mode`,children:n$[r.workMode]}),(0,Z.jsx)(BR.Item,{label:`Source`,children:r.sourceName??`—`}),(0,Z.jsx)(BR.Item,{label:`Follow up`,children:r.followUpOn??`—`}),(0,Z.jsx)(BR.Item,{label:`Salary`,span:2,children:r.salaryMin||r.salaryMax?`${r.salaryMin?.toLocaleString()??`?`} – ${r.salaryMax?.toLocaleString()??`?`} ${r.salaryCurrency??``}`:`—`}),(0,Z.jsx)(BR.Item,{label:`Posting`,span:2,children:r.jobUrl?(0,Z.jsx)(`a`,{href:r.jobUrl,target:`_blank`,rel:`noreferrer`,children:(0,Z.jsxs)(vz,{size:4,children:[(0,Z.jsx)(sQ,{}),r.jobUrl]})}):`—`}),(0,Z.jsx)(BR.Item,{label:`Tags`,span:2,children:r.tags.length>0?(0,Z.jsx)(vz,{size:4,wrap:!0,children:r.tags.map(e=>(0,Z.jsx)(lY,{children:e.name},e.id))}):`—`})]})}),(0,Z.jsx)(Uee,{application:r})]})}),(0,Z.jsx)(NI,{xs:24,lg:10,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(_F,{title:`Status history`,children:r.statusEvents.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No changes recorded`}):(0,Z.jsx)(DY,{items:r.statusEvents.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e.fromStatus?`${e$[e.fromStatus]} → ${e$[e.toStatus]}`:`Applied`}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:e.occurredOn}),e.comment&&(0,Z.jsx)(AX.Text,{children:e.comment})]})}))})}),(0,Z.jsx)(_F,{title:`Notes (${r.notes.length})`,extra:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(aP,{}),onClick:()=>p(!0),children:`Add note`}),children:r.notes.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No notes yet`}):(0,Z.jsx)(_H,{size:`small`,dataSource:r.notes,renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(NY,{}),onClick:()=>d(e)},`edit`),(0,Z.jsx)(TH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await s.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Rk,{type:`text`,danger:!0,icon:(0,Z.jsx)(AY,{})})},`delete`)],children:(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,children:[e.pinned&&(0,Z.jsx)(TQ,{style:{color:`#faad14`}}),(0,Z.jsx)(AX.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)(AX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:4,expandable:!0,symbol:`more`},children:e.body})})})})})]})})]}),(0,Z.jsx)(M9,{open:c,onClose:()=>l(!1),application:r}),(0,Z.jsx)(B9,{open:f||u!==null,note:u,target:{type:`application`,id:r.id,label:r.jobTitle},onClose:()=>{p(!1),d(null)}})]})}function G9(e){return[...e.members.map(e=>e.id)].sort().join(`|`)}function Gee(){let{message:e}=FC.useApp(),{data:t,isLoading:n,isFetching:r,refetch:i}=U7(),a=Y7(),[o,s]=(0,_.useState)({}),[c,l]=(0,_.useState)(new Set),u=(0,_.useMemo)(()=>(t?.groups??[]).filter(e=>!c.has(G9(e))),[t,c]),d=e=>o[G9(e)]??e.keepId,f=e=>e.members.filter(t=>t.id!==d(e)).map(e=>e.id),p=u.filter(e=>e.kind===`exact`),m=u.length-p.length,h=p.flatMap(f);async function g(t){if(t.length!==0)try{let n=await a.mutateAsync(t);e.success(`Removed ${n.deleted} application${n.deleted===1?``:`s`}`)}catch{e.error(`Could not remove those applications`)}}return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:`Duplicates`}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:n?`Scanning…`:[`${t?.scanned??0} application${t?.scanned===1?``:`s`} scanned`,`${p.length} exact repeat${p.length===1?``:`s`}`,...m>0?[`${m} similar to review`]:[]].join(` · `)})]}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(sU,{}),loading:r,onClick:()=>void i(),children:`Rescan`}),(0,Z.jsx)(TH,{title:`Delete ${h.length} application${h.length===1?``:`s`}?`,description:`The kept record in each group stays. This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},disabled:h.length===0,onConfirm:()=>void g(h),children:(0,Z.jsxs)(Rk,{danger:!0,type:`primary`,icon:(0,Z.jsx)(AY,{}),disabled:h.length===0,loading:a.isPending,children:[`Remove `,h.length,` exact repeat`,h.length===1?``:`s`]})})]})]}),n&&(0,Z.jsx)(TS,{active:!0}),!n&&u.length===0&&(0,Z.jsx)(_F,{children:(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:(t?.scanned??0)===0?`Nothing to scan yet`:`No duplicates. Every application is a distinct role or employer.`})}),u.map(e=>(0,Z.jsx)(Kee,{group:e,keptId:d(e),busy:a.isPending,onKeep:t=>s(n=>({...n,[G9(e)]:t})),onDismiss:()=>l(t=>new Set(t).add(G9(e))),onRemove:()=>void g(f(e))},G9(e)))]})}function Kee({group:e,keptId:t,busy:n,onKeep:r,onDismiss:i,onRemove:a}){let o=e.members.length-1;return(0,Z.jsx)(_F,{size:`small`,title:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e.companyName}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:e.members[0]?.jobTitle}),(0,Z.jsx)(lY,{color:e.kind===`exact`?`red`:`orange`,children:e.kind===`exact`?`same title`:`similar title`})]}),extra:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{size:`small`,onClick:i,children:`Not a duplicate`}),(0,Z.jsx)(TH,{title:`Delete ${o} application${o===1?``:`s`}?`,description:`This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:a,children:(0,Z.jsxs)(Rk,{size:`small`,danger:!0,icon:(0,Z.jsx)(AY,{}),loading:n,children:[`Delete `,o]})})]}),children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[e.kind===`similar`&&(0,Z.jsx)(Rp,{type:`warning`,showIcon:!0,message:`Close but not identical. Two applications a year apart can look like this. Delete only if it really is the same job.`}),(0,Z.jsx)(XJ,{rowKey:`id`,size:`small`,columns:[{title:`Position`,key:`jobTitle`,render:(e,n)=>(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(0,Z.jsx)(gn,{to:`/applications/${n.id}`,children:n.jobTitle}),n.archived&&(0,Z.jsx)(lY,{children:`Archived`}),n.id===t?(0,Z.jsx)(lY,{color:`green`,children:`Keep`}):(0,Z.jsx)(lY,{color:`red`,children:`Remove`})]})},{title:`Applied`,dataIndex:`appliedOn`,width:118},{title:`Status`,key:`status`,width:120,render:(e,t)=>(0,Z.jsx)(D9,{status:t.status})},{title:`Where`,key:`location`,width:200,render:(e,t)=>[t.location,n$[t.workMode]].filter(Boolean).join(` · `)||`—`},{title:`Notes`,key:`noteCount`,width:80,render:(e,t)=>t.noteCount>0?t.noteCount:`—`}],dataSource:e.members,pagination:!1,rowSelection:{type:`radio`,columnTitle:`Keep`,columnWidth:60,selectedRowKeys:[t],onChange:e=>r(String(e[0]))}})]})})}var K9=25;function qee(){let e=tt(),[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(K9),a=O9(t,300),{data:o,isLoading:s}=z7(a?{q:a}:{});return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:`Companies`}),(0,Z.jsx)(tV,{allowClear:!0,prefix:(0,Z.jsx)(SE,{}),placeholder:`Find a company`,style:{maxWidth:320},value:t,onChange:e=>n(e.target.value)})]}),(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsx)(XJ,{rowKey:`id`,size:`middle`,loading:s,columns:[{title:`Company`,dataIndex:`name`,render:(e,t)=>(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e}),t.website&&(0,Z.jsx)(AX.Link,{href:t.website,target:`_blank`,style:{fontSize:12},children:t.website.replace(/^https?:\/\//,``)})]}),sorter:(e,t)=>e.name.localeCompare(t.name)},{title:`Applications`,dataIndex:`applicationCount`,width:140,align:`right`,sorter:(e,t)=>e.applicationCount-t.applicationCount,defaultSortOrder:`descend`,render:e=>(0,Z.jsx)(AX.Text,{strong:e>2,type:e>2?`warning`:void 0,children:e})},{title:`Active`,dataIndex:`activeCount`,width:90,align:`right`},{title:`Last applied`,dataIndex:`lastAppliedOn`,width:130,sorter:(e,t)=>(e.lastAppliedOn??``).localeCompare(t.lastAppliedOn??``),render:e=>e??(0,Z.jsx)(AX.Text,{type:`secondary`,children:`—`})},{title:`Tags`,key:`tags`,width:260,render:(e,t)=>(0,Z.jsx)(vz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(lY,{style:{marginInlineEnd:0},children:e.name},e.id))})}],dataSource:o?.companies??[],pagination:{pageSize:r,showSizeChanger:!0,onChange:(e,t)=>i(t),hideOnSinglePage:r===K9},onRow:t=>({onClick:()=>e(`/companies/${t.id}`),style:{cursor:`pointer`}})})})]})}function Jee(){let{id:e}=rt(),t=tt(),{message:n}=FC.useApp(),{data:r,isLoading:i}=B7(e),{data:a}=V7(e?{targetType:`company`,targetId:e}:{}),{data:o}=R7(),s=X7(),c=Q7(),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(TS,{active:!0,paragraph:{rows:8}});let{company:p,applications:m}=r,h=m.filter(e=>[`applied`,`screening`,`interview`].includes(e.status)).length;return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Rk,{type:`link`,icon:(0,Z.jsx)(TZ,{}),style:{padding:0},onClick:()=>t(`/companies`),children:`Back to companies`}),(0,Z.jsx)(AX.Title,{level:3,style:{margin:0},children:p.name}),p.website&&(0,Z.jsx)(AX.Link,{href:p.website,target:`_blank`,children:p.website})]}),(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:12,md:6,children:(0,Z.jsx)(_F,{children:(0,Z.jsx)(IU,{title:`Applications`,value:m.length})})}),(0,Z.jsx)(NI,{xs:12,md:6,children:(0,Z.jsx)(_F,{children:(0,Z.jsx)(IU,{title:`Still active`,value:h,valueStyle:{color:N9.accent}})})}),(0,Z.jsx)(NI,{xs:24,md:12,children:(0,Z.jsx)(_F,{children:(0,Z.jsxs)(vz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Company tags`}),(0,Z.jsx)(DE,{mode:`tags`,style:{width:`100%`},placeholder:`fintech, remote-first…`,value:p.tags.map(e=>e.name),options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),onChange:t=>{e&&s.mutate({id:e,body:{tags:t}})}})]})})})]}),(0,Z.jsx)(_F,{title:`Application history`,children:(0,Z.jsx)(XJ,{rowKey:`id`,size:`middle`,columns:[{title:`Applied`,dataIndex:`appliedOn`,width:120},{title:`Job title`,dataIndex:`jobTitle`,render:e=>(0,Z.jsx)(AX.Text,{strong:!0,children:e})},{title:`Status`,dataIndex:`status`,width:120,render:(e,t)=>(0,Z.jsx)(D9,{status:t.status})},{title:`Source`,dataIndex:`sourceName`,width:130}],dataSource:m,pagination:!1,onRow:e=>({onClick:()=>t(`/applications/${e.id}`),style:{cursor:`pointer`}})})}),(0,Z.jsx)(Hee,{companyName:p.name}),(0,Z.jsx)(_F,{title:`Notes about ${p.name}`,extra:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(aP,{}),onClick:()=>f(!0),children:`Add note`}),children:(a?.notes??[]).length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No notes about this company`}):(0,Z.jsx)(_H,{dataSource:a?.notes??[],renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(NY,{}),onClick:()=>u(e)},`edit`),(0,Z.jsx)(TH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await c.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Rk,{type:`text`,danger:!0,icon:(0,Z.jsx)(AY,{})})},`delete`)],children:(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,children:[e.pinned&&(0,Z.jsx)(TQ,{style:{color:`#faad14`}}),(0,Z.jsx)(AX.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)(AX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e.body})})})})}),(0,Z.jsx)(B9,{open:d||l!==null,note:l,target:{type:`company`,id:p.id,label:p.name},onClose:()=>{f(!1),u(null)}})]})}function Yee(){let{message:e}=FC.useApp(),[t,n]=(0,_.useState)(`all`),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),{data:l,isLoading:u}=V7(t===`all`?{}:{targetType:t}),d=Q7(),f=l?.notes??[],p=(0,_.useMemo)(()=>{let e=r.trim().toLowerCase();return e?f.filter(t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||(t.targetLabel?.toLowerCase().includes(e)??!1)):f},[f,r]);return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:`Notes`}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(qI,{value:t,onChange:e=>n(e),options:[{label:`All`,value:`all`},{label:`Standalone`,value:`standalone`},{label:`Companies`,value:`company`},{label:`Applications`,value:`application`}]}),(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(aP,{}),onClick:()=>c(!0),children:`New note`})]})]}),(0,Z.jsx)(tV,{allowClear:!0,prefix:(0,Z.jsx)(SE,{}),placeholder:`Search notes by title, body, or what they're attached to`,value:r,onChange:e=>i(e.target.value)}),(0,Z.jsx)(_F,{size:`small`,loading:u,children:p.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:r?`Nothing matched “${r}”`:`No notes here yet`}):(0,Z.jsx)(_H,{dataSource:p,renderItem:t=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(NY,{}),onClick:()=>o(t)},`edit`),(0,Z.jsx)(TH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await d.mutateAsync(t.id),e.success(`Note deleted`)},children:(0,Z.jsx)(Rk,{type:`text`,danger:!0,icon:(0,Z.jsx)(AY,{})})},`delete`)],children:(0,Z.jsx)(_H.Item.Meta,{title:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[t.pinned&&(0,Z.jsx)(TQ,{style:{color:`#faad14`}}),(0,Z.jsx)(AX.Text,{strong:!0,children:t.title}),(0,Z.jsx)(Xee,{note:t})]}),description:(0,Z.jsx)(AX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:3,expandable:!0,symbol:`more`},children:t.body})})})})}),(0,Z.jsx)(B9,{open:s||a!==null,note:a,onClose:()=>{c(!1),o(null)}})]})}function Xee({note:e}){if(e.targetType===`standalone`)return(0,Z.jsx)(lY,{children:`general`});if(!e.targetId)return(0,Z.jsx)(lY,{children:`unlinked`});let t=e.targetType===`company`?`/companies/${e.targetId}`:`/applications/${e.targetId}`;return(0,Z.jsx)(gn,{to:t,children:(0,Z.jsxs)(lY,{color:`blue`,children:[e.targetType,`: `,e.targetLabel??`view`]})})}function Zee({open:e,onClose:t,opening:n,draft:r}){let[i]=OB.useForm(),{message:a}=FC.useApp(),o=!!n,s=t9(),c=n9(),{data:l}=W7(OB.useWatch(`companyName`,i)??``);(0,_.useEffect)(()=>{e&&(n?i.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,savedOn:(0,Kk.default)(n.savedOn),jobUrl:n.jobUrl??void 0,location:n.location??void 0,workMode:n.workMode,sourceName:n.sourceName??void 0,salaryMin:n.salaryMin,salaryMax:n.salaryMax,salaryCurrency:n.salaryCurrency??void 0,notes:n.notes??void 0}):(i.resetFields(),i.setFieldsValue({savedOn:(0,Kk.default)(),workMode:r?.workMode??`unspecified`,...r?{companyName:r.companyName,jobTitle:r.jobTitle,jobUrl:r.jobUrl??void 0,location:r.location??void 0,sourceName:r.sourceName??void 0,salaryMin:r.salaryMin,salaryMax:r.salaryMax,salaryCurrency:r.salaryCurrency??void 0,notes:r.notes??void 0}:{}})))},[e,n,r,i]);let u=(0,_.useMemo)(()=>(l?.companies??[]).map(e=>({value:e.name})),[l]);async function d(e){let r={companyName:e.companyName,jobTitle:e.jobTitle,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,notes:e.notes??null,...o?{}:{savedOn:e.savedOn.format(`YYYY-MM-DD`)}};try{n?(await c.mutateAsync({id:n.id,body:r}),a.success(`Opening updated`)):(await s.mutateAsync(r),a.success(`Opening saved`)),t()}catch(e){e instanceof m7&&e.fieldErrors.length>0?(i.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),a.error(`Please check the highlighted fields`)):a.error(e instanceof Error?e.message:`Could not save`)}}return(0,Z.jsxs)(lz,{title:o?`Edit opening`:`Save opening for later`,open:e,onClose:t,width:560,destroyOnHidden:!0,extra:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Rk,{type:`primary`,loading:s.isPending||c.isPending,onClick:()=>i.submit(),children:o?`Save changes`:`Save opening`})]}),children:[(0,Z.jsx)(AX.Paragraph,{type:`secondary`,children:r&&!o?`Read from the posting. Check it over before saving. Anything the parser could not find is blank rather than guessed.`:`For a role you found but are not ready to apply to yet. No status, no tags, just enough to find it again. Convert it into a real application when you are ready.`}),(0,Z.jsxs)(OB,{form:i,layout:`vertical`,onFinish:d,requiredMark:`optional`,children:[(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(PE,{options:u,placeholder:`Start typing to see existing companies`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(NI,{span:12,children:(0,Z.jsx)(OB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(tV,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`savedOn`,label:`Found on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`,disabled:o})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(DE,{options:t$.map(e=>({value:e,label:n$[e]}))})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(tV,{placeholder:`Stockholm`})})})]}),(0,Z.jsxs)(wU,{gutter:16,children:[(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(PL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(PL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(NI,{span:8,children:(0,Z.jsx)(OB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(tV,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(OB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(tV,{placeholder:`LinkedIn, referral…`})}),(0,Z.jsx)(OB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(tV,{placeholder:`https://…`})}),(0,Z.jsx)(OB.Item,{name:`notes`,label:`Notes`,children:(0,Z.jsx)(tV.TextArea,{rows:4,placeholder:`Why this looked interesting, what you're missing to apply…`})})]})]})}var Qee=!1;function $ee({open:e,onClose:t,onUse:n}){let[r,i]=(0,_.useState)(`link`),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(null);function h(){o(``),c(``),f(null),m(null),u(!1)}function g(){h(),t()}async function v(e){u(!0),f(null),m(null);try{let t=await e();(t.draft.companyName.trim()===``||t.draft.jobTitle.trim()===``)&&f(`Could not make out the company and job title. Open the form and fill them in, or paste more of the posting.`),m(t)}catch(e){f(e instanceof Error?e.message:`Could not read that posting`),e instanceof m7&&e.code===`ingest_blocked`&&i(`text`)}finally{u(!1)}}let y=p?.draft;return(0,Z.jsxs)(xH,{open:e,onCancel:g,title:`Save from a posting`,width:640,destroyOnHidden:!0,footer:(0,Z.jsxs)(Pz,{justify:`end`,gap:8,children:[(0,Z.jsx)(Rk,{onClick:g,children:`Cancel`}),(0,Z.jsx)(Rk,{type:`primary`,disabled:!y,onClick:()=>{y&&(n(y),h())},children:`Review and save`})]}),children:[(0,Z.jsx)(rF,{activeKey:r,onChange:e=>{i(e),f(null),m(null)},items:[{key:`link`,label:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(sQ,{}),` Paste a link`]}),disabled:Qee,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(tV.Search,{placeholder:`https://boards.greenhouse.io/…`,value:a,enterButton:`Read`,loading:l,onChange:e=>o(e.target.value),onSearch:e=>e.trim()&&void v(()=>k7.ingestUrl(e.trim()))}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Works on most company career pages and applicant tracking systems. LinkedIn and Indeed block automated readers. For those, copy the posting and use the other tab.`})]})},{key:`text`,label:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Lz,{}),` Paste the text`]}),children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(tV.TextArea,{rows:8,value:s,placeholder:`Backend Engineer at Spotify
435
435
  Stockholm, hybrid
436
436
  Salary: SEK 55 000 - 70 000`,onChange:e=>c(e.target.value)}),(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,gap:12,wrap:!0,children:[(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:`Everything you paste is kept as the opening's note, so nothing is lost to a wrong guess.`}),(0,Z.jsx)(Rk,{loading:l,disabled:s.trim()===``,onClick:()=>void v(()=>k7.ingestText(s,a.trim()||void 0)),children:`Read`})]})]})}]}),d&&(0,Z.jsx)(Rp,{type:`warning`,showIcon:!0,message:d,style:{marginTop:12}}),y&&(0,Z.jsxs)(vz,{direction:`vertical`,size:8,style:{width:`100%`,marginTop:16},children:[(0,Z.jsxs)(AX.Text,{strong:!0,children:[y.jobTitle||`Untitled role`,y.companyName?` at ${y.companyName}`:``]}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:[y.location,y.sourceName].filter(Boolean).join(` · `)||`No location found`}),(0,Z.jsx)(A9,{check:p?.duplicate})]})]})}function ete(e){return e>=70?`green`:e>=45?`gold`:`default`}function tte({fit:e}){if(!e)return null;let t=(0,Z.jsxs)(vz,{direction:`vertical`,size:2,children:[e.reasons.map(e=>(0,Z.jsxs)(vz,{size:6,align:`start`,children:[e.effect===`plus`?(0,Z.jsx)(jZ,{style:{color:`#52c41a`}}):e.effect===`minus`?(0,Z.jsx)(PZ,{style:{color:`#ff4d4f`}}):(0,Z.jsx)(gQ,{}),(0,Z.jsx)(`span`,{children:e.label})]},`${e.factor}-${e.label}`)),!e.semanticUsed&&(0,Z.jsx)(AX.Text,{style:{color:`inherit`,opacity:.75,fontSize:12},children:`Your summary is not compared yet while the search model loads.`})]});return(0,Z.jsx)(_D,{title:t,children:(0,Z.jsx)(lY,{color:ete(e.score),style:{marginInlineEnd:0,minWidth:44,textAlign:`center`},children:e.score})})}function nte(){let e=tt(),{message:t}=FC.useApp(),[n,r]=(0,_.useState)(`active`),{data:i,isLoading:a}=$7(n===`archived`?{archived:!0}:{}),{data:o}=R7(),s=r9(),c=i9(),l=n9(),[u,d]=(0,_.useState)([]),[f,p]=(0,_.useState)(`newest`),m=(0,_.useMemo)(()=>{let e=i?.openings??[];return n===`archived`?e.filter(e=>e.archived):e},[i,n]),h=(0,_.useMemo)(()=>{let e=m.filter(e=>g$(e.location,u));return f===`fit`?[...e].sort((e,t)=>(t.fit?.score??-1)-(e.fit?.score??-1)):e},[m,u,f]),g=m.some(e=>e.fit!==null),v=(0,_.useMemo)(()=>{let e=new Map;for(let t of m){let n=t.location?.replace(/\s+/g,` `).trim();if(!n)continue;let r=e.get(h$(n))??{label:n,count:0};r.count+=1,e.set(h$(n),r)}return[...e.values()].sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label)).map(e=>({value:e.label,label:`${e.label} (${e.count})`}))},[m]),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(void 0),[T,E]=(0,_.useState)(void 0),[D,O]=(0,_.useState)(null),[k]=OB.useForm();function A(e){O(e),k.setFieldsValue({appliedOn:(0,Kk.default)(),status:`applied`,tags:[]})}async function j(n){if(D)try{let r=await c.mutateAsync({id:D.id,body:{appliedOn:n.appliedOn.format(`YYYY-MM-DD`),status:n.status,tags:n.tags??[]}});t.success(`Converted to an application`),O(null),e(`/applications/${r.id}`)}catch(e){t.error(e instanceof Error?e.message:`Could not convert`)}}async function M(e){try{await l.mutateAsync({id:e.id,body:{archived:!1}}),t.success(`Opening restored`)}catch(e){t.error(e instanceof Error?e.message:`Could not restore`)}}let N=[...g?[{title:`Fit`,key:`fit`,width:70,render:(e,t)=>(0,Z.jsx)(tte,{fit:t.fit})}]:[],{title:`Company`,dataIndex:[`company`,`name`]},{title:`Job title`,dataIndex:`jobTitle`},{title:`Found on`,dataIndex:`savedOn`,width:120},{title:`Location`,key:`location`,render:(e,t)=>[t.location,n$[t.workMode]].filter(Boolean).join(` · `)||(0,Z.jsx)(AX.Text,{type:`secondary`,children:`—`})},{title:`Source`,dataIndex:`sourceName`,render:e=>e??`—`}],P=e=>e.jobUrl&&(0,Z.jsx)(_D,{title:`Open job posting`,children:(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(sQ,{}),href:e.jobUrl,target:`_blank`,rel:`noreferrer`})}),F=e=>(0,Z.jsx)(TH,{title:`Delete this opening?`,description:`This removes it for good and cannot be undone.`,onConfirm:()=>s.mutate(e.id),okText:`Delete`,okButtonProps:{danger:!0},children:(0,Z.jsx)(Rk,{size:`small`,danger:!0,children:`Delete`})}),I=[...N,{title:``,key:`actions`,width:260,render:(e,t)=>(0,Z.jsxs)(vz,{onClick:e=>e.stopPropagation(),children:[P(t),(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(jB,{}),onClick:()=>A(t),children:`Convert`}),(0,Z.jsx)(Rk,{size:`small`,onClick:()=>{E(t),w(void 0),b(!0)},children:`Edit`}),F(t)]})}],L=[...N,{title:`Archived because`,key:`reason`,width:160,render:(e,t)=>t.convertedApplicationId?(0,Z.jsx)(gn,{to:`/applications/${t.convertedApplicationId}`,children:(0,Z.jsx)(lY,{color:`blue`,children:`Converted`})}):(0,Z.jsx)(lY,{children:`Archived by hand`})},{title:``,key:`actions`,width:220,render:(e,t)=>(0,Z.jsxs)(vz,{onClick:e=>e.stopPropagation(),children:[P(t),(0,Z.jsx)(Rk,{size:`small`,icon:(0,Z.jsx)(OQ,{}),loading:l.isPending,onClick:()=>M(t),children:`Restore`}),F(t)]})}];return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:`Job openings`}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:n===`active`?`Saved for later. Convert one to a real application when you're ready to apply.`:`Openings that were converted into an application or archived by hand.`})]}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(QZ,{}),onClick:()=>S(!0),children:`Save from posting`}),(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(aP,{}),onClick:()=>{E(void 0),w(void 0),b(!0)},children:`Save opening for later`})]})]}),(0,Z.jsxs)(Pz,{gap:12,wrap:!0,align:`center`,children:[(0,Z.jsx)(qI,{value:n,onChange:r,options:[{label:`Active`,value:`active`},{label:`Archived`,value:`archived`}]}),(0,Z.jsx)(DE,{mode:`tags`,allowClear:!0,placeholder:`Location`,style:{minWidth:220},value:u,onChange:e=>d(e.map(e=>e.trim()).filter(Boolean)),optionFilterProp:`value`,options:v}),g?(0,Z.jsx)(qI,{value:f,onChange:e=>p(e),options:[{label:`Newest first`,value:`newest`},{label:`Best fit first`,value:`fit`}]}):m.length>0&&(0,Z.jsxs)(AX.Text,{type:`secondary`,children:[(0,Z.jsx)(gn,{to:`/settings`,children:`Fill in your profile`}),` to rank these by how well they fit.`]})]}),(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsx)(XJ,{rowKey:`id`,columns:n===`archived`?L:I,dataSource:h,loading:a,pagination:!1,locale:{emptyText:(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:u.length>0?`No openings in that location`:n===`active`?`Nothing saved yet. Use “Save opening for later” for a role you're not ready to apply to.`:`No archived openings.`})}})}),(0,Z.jsx)(Zee,{open:y,onClose:()=>{b(!1),w(void 0)},opening:T,draft:C}),(0,Z.jsx)($ee,{open:x,onClose:()=>S(!1),onUse:e=>{S(!1),E(void 0),w(e),b(!0)}}),(0,Z.jsx)(xH,{title:D?`Convert "${D.jobTitle}" at ${D.company.name}`:``,open:!!D,onCancel:()=>O(null),onOk:()=>k.submit(),okText:`Create application`,confirmLoading:c.isPending,children:(0,Z.jsxs)(OB,{form:k,layout:`vertical`,onFinish:j,children:[(0,Z.jsx)(OB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0}],children:(0,Z.jsx)(PR,{style:{width:`100%`},format:`YYYY-MM-DD`})}),(0,Z.jsx)(OB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(DE,{options:XQ.map(e=>({value:e,label:e$[e]}))})}),(0,Z.jsx)(OB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(DE,{mode:`tags`,options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),placeholder:`fintech, remote-ok…`,tokenSeparators:[`,`]})})]})})]})}var q9={new:{color:`green`,label:`New`},duplicate:{color:`default`,label:`Already added`},error:{color:`red`,label:`Skipped`}};function rte({open:e,onClose:t}){let n=An(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);function p(){i(null),o(null),c(null),f(null)}function m(){p(),t()}let h=e=>(f(null),u(!0),e.text().then(async e=>{i(e),o(await k7.previewLinkedInImport(e))}).catch(e=>f(e instanceof Error?e.message:`Could not read that file`)).finally(()=>u(!1)),!1);async function g(){if(r){u(!0),f(null);try{let e=await k7.commitLinkedInImport(r);if(c(e),e.created>0)for(let e of[`contacts`,`contact`,`duplicates`,`search`,`dashboard`])n.invalidateQueries({queryKey:[e]})}catch(e){f(e instanceof Error?e.message:`Import failed`)}finally{u(!1)}}}return(0,Z.jsx)(xH,{title:`Import LinkedIn connections`,open:e,onCancel:m,width:860,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[d&&(0,Z.jsx)(Rp,{type:`error`,showIcon:!0,message:d}),!a&&!s&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(AX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:[`LinkedIn lets you download your own data: open LinkedIn, go to Settings, then Data privacy, then Get a copy of your data, and choose Connections. The file you get by email is `,(0,Z.jsx)(AX.Text,{code:!0,children:`Connections.csv`}),`. People already in JobTrack are recognized and skipped, so importing a newer export later is safe.`]}),(0,Z.jsxs)(SZ.Dragger,{accept:`.csv`,maxCount:1,showUploadList:!1,beforeUpload:h,disabled:l,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(tQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drop Connections.csv here`}),(0,Z.jsx)(`p`,{className:`ant-upload-hint`,children:`Nothing is saved until you confirm`})]})]}),a&&!s&&(0,Z.jsxs)(Z.Fragment,{children:[a.fileErrors.map(e=>(0,Z.jsx)(Rp,{type:`error`,showIcon:!0,message:e},e)),(0,Z.jsxs)(vz,{size:32,wrap:!0,children:[(0,Z.jsx)(IU,{title:`New people`,value:a.totals.new}),(0,Z.jsx)(IU,{title:`At companies in JobTrack`,value:a.totals.atKnownCompanies}),(0,Z.jsx)(IU,{title:`Already added`,value:a.totals.duplicate}),a.totals.error>0&&(0,Z.jsx)(IU,{title:`Skipped`,value:a.totals.error})]}),(0,Z.jsx)(XJ,{rowKey:`rowNumber`,size:`small`,columns:[{title:`Name`,dataIndex:`name`,ellipsis:!0},{title:`Works at`,dataIndex:`companyName`,ellipsis:!0,render:(e,t)=>e?(0,Z.jsxs)(vz,{size:4,children:[(0,Z.jsx)(`span`,{children:e}),t.knownCompany&&(0,Z.jsx)(lY,{color:`blue`,children:`in JobTrack`})]}):null},{title:`Role`,dataIndex:`headline`,ellipsis:!0},{title:`Result`,dataIndex:`verdict`,width:140,render:e=>(0,Z.jsx)(lY,{color:q9[e].color,children:q9[e].label})}],dataSource:a.rows,pagination:{pageSize:10,showSizeChanger:!1}}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:p,children:`Choose a different file`}),(0,Z.jsxs)(Rk,{type:`primary`,loading:l,disabled:a.totals.new===0,onClick:g,children:[`Import `,a.totals.new,` `,a.totals.new===1?`person`:`people`]})]})]}),s&&(0,Z.jsx)(CU,{status:`success`,title:`Imported ${s.created} ${s.created===1?`person`:`people`}`,subTitle:s.skipped>0?`${s.skipped} skipped because they were already added or had no name.`:void 0,extra:(0,Z.jsx)(Rk,{type:`primary`,onClick:m,children:`Done`})})]})})}var J9=25,ite=5e3;function ate(){let e=tt(),[t,n]=Sn(),[r,i]=(0,_.useState)(t.get(`q`)??``),[a,o]=(0,_.useState)(J9),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),d=O9(r,300),f=t.get(`relationship`)?.split(`,`).filter(Boolean)??[],p=t.get(`view`)===`reconnect`?`reconnect`:`all`,{data:m,isLoading:h}=d9({limit:ite,...d?{q:d}:{},...f.length>0?{relationship:f}:{},...p===`reconnect`?{reconnectDue:!0}:{}});function g(e){let r=new URLSearchParams(t);for(let[t,n]of Object.entries(e)){let e=Array.isArray(n)?n.join(`,`):n;e?r.set(t,e):r.delete(t)}n(r,{replace:!0})}let v=b$(),y=[{title:`Name`,dataIndex:`name`,sorter:(e,t)=>e.name.localeCompare(t.name),render:(e,t)=>(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Text,{strong:!0,children:e}),t.headline&&(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:t.headline})]})},{title:`Works at`,dataIndex:`companyName`,width:220,sorter:(e,t)=>(e.companyName??``).localeCompare(t.companyName??``)},{title:`How you know them`,dataIndex:`relationship`,width:170,render:(e,t)=>(0,Z.jsx)(lY,{children:s$[t.relationship]})},{title:`Last spoke`,dataIndex:`lastInteractionOn`,width:130,sorter:(e,t)=>(e.lastInteractionOn??``).localeCompare(t.lastInteractionOn??``),render:e=>e??(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Never`})},{title:`Reconnect on`,dataIndex:`reconnectOn`,width:140,sorter:(e,t)=>(e.reconnectOn??`9999`).localeCompare(t.reconnectOn??`9999`),render:e=>e?(0,Z.jsx)(AX.Text,{type:e<=v?`danger`:void 0,children:e}):null}],b=m?.contacts.length??0;return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:`People`}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:p===`reconnect`?`${b} ${b===1?`person`:`people`} due a reconnect`:`${b} ${b===1?`person`:`people`} in your network`})]}),(0,Z.jsxs)(vz,{wrap:!0,children:[(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(uQ,{}),onClick:()=>u(!0),children:`Import LinkedIn connections`}),(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(aP,{}),onClick:()=>c(!0),children:`Add person`})]})]}),(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsxs)(Pz,{gap:8,wrap:!0,align:`center`,children:[(0,Z.jsx)(qI,{value:p,onChange:e=>g({view:e===`reconnect`?`reconnect`:null}),options:[{label:`Everyone`,value:`all`},{label:`Due a reconnect`,value:`reconnect`}]}),(0,Z.jsx)(tV,{allowClear:!0,prefix:(0,Z.jsx)(SE,{}),placeholder:`Name, company, role or notes`,style:{maxWidth:320},value:r,onChange:e=>{i(e.target.value),g({q:e.target.value||null})}}),(0,Z.jsx)(DE,{mode:`multiple`,allowClear:!0,placeholder:`How you know them`,style:{minWidth:220},value:f,onChange:e=>g({relationship:e}),options:o$.map(e=>({value:e,label:s$[e]}))})]})}),(0,Z.jsx)(_F,{size:`small`,children:(0,Z.jsx)(XJ,{rowKey:`id`,size:`middle`,loading:h,columns:y,dataSource:m?.contacts??[],pagination:{pageSize:a,showSizeChanger:!0,onChange:(e,t)=>o(t),hideOnSinglePage:a===J9},onRow:t=>({onClick:()=>e(`/people/${t.id}`),style:{cursor:`pointer`}}),locale:{emptyText:p===`reconnect`?`Nobody is due a reconnect`:d||f.length>0?`Nobody matches that`:`No people yet. Add someone, or import your LinkedIn connections.`}})}),(0,Z.jsx)(V9,{open:s,onClose:()=>c(!1),onSaved:t=>e(`/people/${t.id}`)}),(0,Z.jsx)(rte,{open:l,onClose:()=>u(!1)})]})}function ote(){let{id:e}=rt(),t=tt(),{message:n}=FC.useApp(),{data:r,isLoading:i}=f9(e),a=g9(),o=v9(),s=b9(),c=h9(),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(TS,{active:!0,paragraph:{rows:8}});let p=r.reconnectOn!==null&&r.reconnectOn<=b$(),m=(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Not set`});return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{justify:`space-between`,align:`flex-start`,wrap:!0,gap:12,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Rk,{type:`link`,icon:(0,Z.jsx)(TZ,{}),style:{padding:0},onClick:()=>t(`/people`),children:`Back to people`}),(0,Z.jsx)(AX.Title,{level:3,style:{margin:0},children:r.name}),(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[(r.headline||r.companyName)&&(0,Z.jsx)(AX.Text,{children:[r.headline,r.companyName].filter(Boolean).join(` at `)}),(0,Z.jsx)(lY,{children:s$[r.relationship]}),r.archived&&(0,Z.jsx)(lY,{color:`default`,children:`Archived`})]})]}),(0,Z.jsxs)(vz,{wrap:!0,children:[(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(pQ,{}),onClick:()=>f(!0),children:`Log a conversation`}),(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(NY,{}),onClick:()=>u(!0),children:`Edit`}),(0,Z.jsx)(TH,{title:`Delete ${r.name}?`,description:`Their conversations and links go too. This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{e&&(await a.mutateAsync(e),n.success(`Person deleted`),t(`/people`))},children:(0,Z.jsx)(Rk,{danger:!0,icon:(0,Z.jsx)(AY,{})})})]})]}),(0,Z.jsxs)(wU,{gutter:[16,16],children:[(0,Z.jsx)(NI,{xs:24,lg:12,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(_F,{title:`Details`,children:(0,Z.jsxs)(BR,{column:1,size:`small`,bordered:!0,children:[(0,Z.jsx)(BR.Item,{label:`Works at`,children:r.companyName??m}),(0,Z.jsx)(BR.Item,{label:`Their role`,children:r.headline??m}),(0,Z.jsx)(BR.Item,{label:`Email`,children:r.email?(0,Z.jsx)(`a`,{href:`mailto:${r.email}`,children:r.email}):m}),(0,Z.jsx)(BR.Item,{label:`Phone`,children:r.phone??m}),(0,Z.jsx)(BR.Item,{label:`LinkedIn`,children:r.linkedinUrl?(0,Z.jsx)(`a`,{href:r.linkedinUrl,target:`_blank`,rel:`noreferrer`,children:(0,Z.jsxs)(vz,{size:4,children:[(0,Z.jsx)(uQ,{}),`Profile`]})}):m}),r.connectedOn&&(0,Z.jsx)(BR.Item,{label:`Connected on`,children:r.connectedOn}),(0,Z.jsx)(BR.Item,{label:`Reconnect on`,children:r.reconnectOn?(0,Z.jsxs)(vz,{size:8,children:[(0,Z.jsx)(AX.Text,{type:p?`danger`:void 0,children:r.reconnectOn}),(0,Z.jsx)(Rk,{size:`small`,type:`link`,onClick:()=>e&&c.mutate({id:e,body:{reconnectOn:null}}),children:`Clear`})]}):m})]})}),r.about&&(0,Z.jsx)(_F,{title:`Notes`,children:(0,Z.jsx)(AX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:r.about})}),(0,Z.jsx)(_F,{title:`Applications and openings (${r.links.length})`,children:r.links.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`Not linked to anything. Link people from an application's page.`}):(0,Z.jsx)(_H,{size:`small`,dataSource:r.links,renderItem:e=>(0,Z.jsx)(_H.Item,{actions:[(0,Z.jsx)(Rk,{type:`text`,icon:(0,Z.jsx)(UZ,{}),onClick:()=>s.mutate(e.id)},`unlink`)],children:(0,Z.jsxs)(vz,{size:8,wrap:!0,children:[e.targetType===`application`?(0,Z.jsx)(gn,{to:`/applications/${e.targetId}`,children:e.targetLabel??`Deleted application`}):(0,Z.jsx)(gn,{to:`/openings`,children:e.targetLabel??`Deleted opening`}),(0,Z.jsx)(lY,{color:`blue`,children:p$[e.role]}),e.targetType===`opening`&&(0,Z.jsx)(lY,{children:`Opening`})]})})})})]})}),(0,Z.jsx)(NI,{xs:24,lg:12,children:(0,Z.jsx)(_F,{title:`Conversations (${r.interactions.length})`,children:r.interactions.length===0?(0,Z.jsx)(ZT,{image:ZT.PRESENTED_IMAGE_SIMPLE,description:`No conversations logged yet`}):(0,Z.jsx)(DY,{items:r.interactions.map(e=>({color:e.direction===`inbound`?`green`:`blue`,children:(0,Z.jsxs)(Pz,{justify:`space-between`,gap:8,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:0,children:[(0,Z.jsxs)(AX.Text,{strong:!0,children:[e.direction===`inbound`?`They reached out`:`You reached out`,` via `,l$[e.channel]]}),(0,Z.jsx)(AX.Text,{type:`secondary`,style:{fontSize:12},children:e.occurredOn}),(0,Z.jsx)(AX.Text,{style:{whiteSpace:`pre-wrap`},children:e.summary}),e.applicationId&&(0,Z.jsx)(gn,{to:`/applications/${e.applicationId}`,style:{fontSize:12},children:`About an application`})]}),(0,Z.jsx)(TH,{title:`Delete this conversation?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:()=>o.mutate(e.id),children:(0,Z.jsx)(Rk,{type:`text`,size:`small`,danger:!0,icon:(0,Z.jsx)(AY,{})})})]})}))})})})]}),(0,Z.jsx)(V9,{open:l,onClose:()=>u(!1),contact:r}),(0,Z.jsx)(H9,{open:d,contact:r,onClose:()=>f(!1)})]})}function Y9({placeholder:e,...t}){return(0,Z.jsx)(DE,{mode:`tags`,open:!1,tokenSeparators:[`,`],placeholder:e,suffixIcon:null,...t})}function ste(){let[e]=OB.useForm(),{message:t}=FC.useApp(),{data:n,isLoading:r}=x9(),i=S9();(0,_.useEffect)(()=>{n&&e.setFieldsValue({summary:n.summary??void 0,targetTitles:n.targetTitles,locations:n.locations,workModes:n.workModes,salaryFloor:n.salaryFloor,salaryCurrency:n.salaryCurrency??void 0,includeKeywords:n.includeKeywords,excludeKeywords:n.excludeKeywords})},[n,e]);async function a(e){let n={summary:e.summary?.trim()||null,targetTitles:e.targetTitles??[],locations:e.locations??[],workModes:e.workModes??[],salaryFloor:e.salaryFloor??null,salaryCurrency:e.salaryCurrency?.trim()||null,includeKeywords:e.includeKeywords??[],excludeKeywords:e.excludeKeywords??[]};try{await i.mutateAsync(n),t.success(`Profile saved. Openings are ranked against it.`)}catch(e){t.error(e instanceof Error?e.message:`Could not save the profile`)}}return(0,Z.jsx)(_F,{title:`Your profile`,loading:r,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(AX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`What you are looking for. The Openings page ranks saved openings against it and shows why each one scored as it did. Leave anything blank that does not matter to you.`}),(0,Z.jsxs)(OB,{form:e,layout:`vertical`,onFinish:a,children:[(0,Z.jsx)(OB.Item,{name:`summary`,label:`About you`,tooltip:`Compared with each posting by meaning, once the search model has loaded. A pasted CV works well.`,children:(0,Z.jsx)(tV.TextArea,{rows:6,placeholder:`Backend engineer, eight years in payments and data platforms. Kotlin, Postgres, Kafka.`})}),(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{xs:24,md:12,children:(0,Z.jsx)(OB.Item,{name:`targetTitles`,label:`Job titles you want`,children:(0,Z.jsx)(Y9,{placeholder:`Backend Engineer, Platform Engineer`})})}),(0,Z.jsx)(NI,{xs:24,md:12,children:(0,Z.jsx)(OB.Item,{name:`locations`,label:`Places you would work`,children:(0,Z.jsx)(Y9,{placeholder:`Stockholm, Uppsala`})})})]}),(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{xs:24,md:12,children:(0,Z.jsx)(OB.Item,{name:`workModes`,label:`Work modes`,tooltip:`A remote role counts as in every location when you pick Remote`,children:(0,Z.jsx)(DE,{mode:`multiple`,allowClear:!0,placeholder:`Any`,options:t$.filter(e=>e!==`unspecified`).map(e=>({value:e,label:n$[e]}))})})}),(0,Z.jsx)(NI,{xs:16,md:8,children:(0,Z.jsx)(OB.Item,{name:`salaryFloor`,label:`Lowest salary you would take`,children:(0,Z.jsx)(PL,{style:{width:`100%`},min:0,step:1e4,placeholder:`Yearly`})})}),(0,Z.jsx)(NI,{xs:8,md:4,children:(0,Z.jsx)(OB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(tV,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsxs)(wU,{gutter:12,children:[(0,Z.jsx)(NI,{xs:24,md:12,children:(0,Z.jsx)(OB.Item,{name:`includeKeywords`,label:`Words that make a posting better`,children:(0,Z.jsx)(Y9,{placeholder:`Kotlin, payments, on-call free`})})}),(0,Z.jsx)(NI,{xs:24,md:12,children:(0,Z.jsx)(OB.Item,{name:`excludeKeywords`,label:`Words that rule a posting out`,tooltip:`Each one found takes a large share off the score`,children:(0,Z.jsx)(Y9,{placeholder:`PHP, consultancy`})})})]}),(0,Z.jsx)(Rk,{type:`primary`,htmlType:`submit`,loading:i.isPending,children:`Save profile`})]})]})})}var cte=7,lte=45;function ute(){let{message:e}=FC.useApp(),{data:t,isLoading:n}=C9(),r=w9(),i=E9(),a=t?.autoGhostAfterDays!==null&&t?.autoGhostAfterDays!==void 0,{data:o}=T9(a);function s(t){r.mutate(t,{onError:t=>e.error(t instanceof Error?t.message:`Could not save`)})}async function c(){try{let t=await i.mutateAsync();e.success(t.changed===0?`Nothing to change`:`Marked ${t.changed} application${t.changed===1?``:`s`} ghosted`)}catch(t){e.error(t instanceof Error?t.message:`Could not run the rule`)}}let l=o?.candidates??[];return(0,Z.jsx)(_F,{title:`Automation`,loading:n,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:20,style:{width:`100%`},children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:6,style:{width:`100%`},children:[(0,Z.jsxs)(vz,{size:12,wrap:!0,children:[(0,Z.jsx)(PW,{checked:t?.defaultFollowUpDays!==null&&t?.defaultFollowUpDays!==void 0,onChange:e=>s({defaultFollowUpDays:e?cte:null})}),(0,Z.jsx)(AX.Text,{strong:!0,children:`Give new applications a follow-up date`}),t?.defaultFollowUpDays!=null&&(0,Z.jsxs)(vz,{size:6,children:[(0,Z.jsx)(PL,{size:`small`,min:1,max:90,value:t.defaultFollowUpDays,onChange:e=>typeof e==`number`&&s({defaultFollowUpDays:e})}),(0,Z.jsx)(`span`,{children:`days after applying`})]})]}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Only when you leave the date blank, and never a date that has already passed, so importing old applications does not flood your follow-ups.`})]}),(0,Z.jsxs)(vz,{direction:`vertical`,size:6,style:{width:`100%`},children:[(0,Z.jsxs)(vz,{size:12,wrap:!0,children:[(0,Z.jsx)(PW,{checked:a,onChange:e=>s({autoGhostAfterDays:e?lte:null})}),(0,Z.jsx)(AX.Text,{strong:!0,children:`Mark silent applications as ghosted`}),a&&(0,Z.jsxs)(vz,{size:6,children:[(0,Z.jsx)(`span`,{children:`after`}),(0,Z.jsx)(PL,{size:`small`,min:14,max:365,value:t.autoGhostAfterDays,onChange:e=>typeof e==`number`&&s({autoGhostAfterDays:e})}),(0,Z.jsx)(`span`,{children:`days`})]})]}),(0,Z.jsx)(AX.Text,{type:`secondary`,children:`Applies to applications still at Applied or Screening where nothing has happened in that long: no status change, and no follow-up date in that time. A follow-up planned for later keeps an application safe. It runs every hour while JobTrack is running. Each change is written to the application's status history with a note saying why, so it is easy to undo.`}),a&&(l.length===0?(0,Z.jsx)(Rp,{type:`success`,showIcon:!0,message:`Nothing would be marked ghosted right now.`}):(0,Z.jsx)(Rp,{type:`warning`,showIcon:!0,message:`${l.length} application${l.length===1?``:`s`} would be marked ghosted on the next run`,description:(0,Z.jsxs)(vz,{direction:`vertical`,style:{width:`100%`},children:[(0,Z.jsx)(_H,{size:`small`,dataSource:l.slice(0,5),renderItem:e=>(0,Z.jsxs)(_H.Item,{children:[(0,Z.jsxs)(gn,{to:`/applications/${e.id}`,children:[e.jobTitle,` at `,e.company.name]}),(0,Z.jsxs)(AX.Text,{type:`secondary`,children:[`silent `,e.silentDays,` days`]})]})}),l.length>5&&(0,Z.jsxs)(AX.Text,{type:`secondary`,children:[`and `,l.length-5,` more`]}),(0,Z.jsx)(Rk,{onClick:()=>void c(),loading:i.isPending,children:`Run now`})]})}))]})]})})}var dte={companies:`Companies`,applications:`Applications`,tags:`Tags`,tagLinks:`Tag links`,notes:`Notes`,statusEvents:`Status events`,jobOpenings:`Job openings`,contacts:`People`,interactions:`Interactions`,contactLinks:`People links`,appSettings:`Settings`};function X9({counts:e}){return(0,Z.jsx)(BR,{size:`small`,column:2,bordered:!0,children:Object.entries(e).map(([e,t])=>(0,Z.jsx)(BR.Item,{label:dte[e]??e,children:t},e))})}function fte(){let{message:e}=FC.useApp(),{data:t,isLoading:n}=a9(),r=o9(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{c.current&&clearInterval(c.current)},[]);function l(t){xH.confirm({title:`Switch to "${t}"?`,content:"The server restarts to connect to the new target. This page will reconnect and reload automatically once it is back. Under `npm run dev`, you may need to restart it by hand.",okText:`Switch and restart`,onOk:async()=>{try{await r.mutateAsync(t)}catch(t){e.error(t instanceof Error?t.message:`Could not switch database`);return}s(!0),c.current=setInterval(()=>{k7.getDbTargets().then(()=>{c.current&&clearInterval(c.current),window.location.reload()}).catch(()=>{})},500)}})}if(o)return(0,Z.jsx)(_F,{title:`Database`,children:(0,Z.jsx)(CU,{icon:(0,Z.jsx)(sU,{spin:!0}),title:`Reconnecting…`,subTitle:`Waiting for the server to come back up.`})});let u=t?.targets??[];return(0,Z.jsx)(_F,{title:`Database`,loading:n,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)(AX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:[`Connection settings live in `,(0,Z.jsx)(`code`,{children:`.env`}),` and are never shown or editable here.`,u.length<=1&&` Only one target is configured, so there is nothing to switch between.`]}),(0,Z.jsx)(BR,{size:`small`,column:1,bordered:!0,children:(0,Z.jsx)(BR.Item,{label:`Active target`,children:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(BZ,{}),t?.active,` (`,u.find(e=>e.name===t?.active)?.driver,`)`]})})}),u.length>1&&(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(DE,{style:{width:220},value:i??t?.active,options:u.map(e=>({value:e.name,label:`${e.name} (${e.driver})`})),onChange:a}),(0,Z.jsx)(Rk,{type:`primary`,disabled:!i||i===t?.active,loading:r.isPending,onClick:()=>i&&l(i),children:`Switch`})]})]})})}function pte(){let{message:e}=FC.useApp(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);function p(){n(null),i(null),o(null),u(null)}function m(){p(),f(!1)}let h=e=>(n(e),u(null),c(!0),k7.previewBackup(e).then(i).catch(e=>u(e instanceof Error?e.message:`Could not read that file`)).finally(()=>c(!1)),!1);function g(){t&&xH.confirm({title:`Replace all data in the active database?`,content:`Every table is wiped and recreated from this backup. This cannot be undone.`,okText:`Restore`,okButtonProps:{danger:!0},onOk:async()=>{c(!0),u(null);try{let e=await k7.commitBackup(t);o(e)}catch(t){e.error(t instanceof Error?t.message:`Restore failed`)}finally{c(!1)}}})}return(0,Z.jsxs)(_F,{title:`Backup & restore`,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(AX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`A full-fidelity snapshot of every table: every field, every relation, driver-agnostic. Not the same as the CSV/Excel export elsewhere in the app, which is a lossy report meant for people to read. This file is scrambled (gzip + obfuscation) so it isn't plain, readable JSON at rest. That's an obfuscation step, not encryption, and does not protect the personal data inside from anyone who actually wants it.`}),(0,Z.jsx)(Rk,{icon:(0,Z.jsx)(BZ,{}),onClick:()=>{window.location.href=k7.backupExportUrl},children:`Export backup`}),(0,Z.jsx)(Rk,{onClick:()=>f(!0),children:`Restore from backup…`})]}),(0,Z.jsx)(xH,{title:`Restore from backup`,open:d,onCancel:m,width:600,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!r&&!a&&(0,Z.jsxs)(SZ.Dragger,{accept:`.jtbak`,maxCount:1,showUploadList:!1,beforeUpload:h,disabled:s,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(tQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a JobTrack backup file (.jtbak) here`})]}),l&&(0,Z.jsx)(Rp,{type:`error`,showIcon:!0,message:l}),r&&!a&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(AX.Text,{type:`secondary`,children:[`Backup taken `,new Date(r.exportedAt).toLocaleString(),`. Restoring will replace everything currently in the active database with:`]}),(0,Z.jsx)(X9,{counts:r.counts}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:p,children:`Choose a different file`}),(0,Z.jsx)(Rk,{type:`primary`,danger:!0,loading:s,onClick:g,children:`Restore`})]})]}),a&&(0,Z.jsx)(CU,{status:`success`,title:`Restore complete`,extra:(0,Z.jsxs)(vz,{direction:`vertical`,style:{width:`100%`},children:[(0,Z.jsx)(X9,{counts:a.counts}),(0,Z.jsx)(Rk,{type:`primary`,onClick:()=>window.location.reload(),children:`Reload`})]})})]})})]})}var Z9=`CLEAR`;function mte(){let{message:e}=FC.useApp(),{data:t,isLoading:n}=s9(),r=c9(),i=l9(),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``);function l(){o(!1),c(``)}function u(){r.mutate(void 0,{onSuccess:()=>{e.success(`Database cleared`),l()},onError:t=>e.error(t instanceof Error?t.message:`Could not clear the database`)})}function d(){i.mutate(void 0,{onSuccess:t=>e.success(`Seeded ${t.applications} applications and ${t.companies} companies`),onError:t=>e.error(t instanceof Error?t.message:`Could not seed the database`)})}let f=t?.counts??{};return(0,Z.jsxs)(_F,{title:`Reset & demo data`,loading:n,children:[(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(AX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`Wipe everything in the active database, or (only while it's empty) fill it with a realistic multi-year demo dataset to explore the app with.`}),!t?.empty&&(0,Z.jsx)(X9,{counts:f}),(0,Z.jsxs)(vz,{wrap:!0,children:[t?.empty&&(0,Z.jsx)(Rk,{type:`primary`,icon:(0,Z.jsx)(KZ,{}),loading:i.isPending,onClick:d,children:`Seed with demo data`}),(0,Z.jsx)(Rk,{danger:!0,disabled:t?.empty,onClick:()=>o(!0),children:`Clear database…`})]})]}),(0,Z.jsx)(xH,{title:`Clear the active database?`,open:a,onCancel:l,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(Rp,{type:`warning`,showIcon:!0,message:`This permanently deletes every row below. There is no undo. Export a backup first if you might want this data again.`}),(0,Z.jsx)(X9,{counts:f}),(0,Z.jsxs)(AX.Text,{children:[`Type `,(0,Z.jsx)(AX.Text,{code:!0,children:Z9}),` to confirm.`]}),(0,Z.jsx)(tV,{value:s,onChange:e=>c(e.target.value),placeholder:Z9,onPressEnter:()=>s===Z9&&u()}),(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(Rk,{onClick:l,children:`Cancel`}),(0,Z.jsx)(Rk,{danger:!0,type:`primary`,disabled:s!==Z9,loading:r.isPending,onClick:u,children:`Clear database`})]})]})})]})}function hte(){let{data:e,isLoading:t}=u9(),n=e?`${e.name} ${e.version}`:``;return(0,Z.jsx)(_F,{title:`About`,loading:t,children:(0,Z.jsxs)(BR,{size:`small`,column:1,bordered:!0,children:[(0,Z.jsx)(BR.Item,{label:`Running`,children:(0,Z.jsxs)(vz,{children:[(0,Z.jsx)(iQ,{}),(0,Z.jsxs)(AX.Text,{copyable:{text:n},children:[(0,Z.jsx)(`code`,{children:e?.name}),` `,e?.version]})]})}),(0,Z.jsx)(BR.Item,{label:`Database driver`,children:e?.driver})]})})}function gte(){return(0,Z.jsxs)(vz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(AX.Title,{level:4,style:{margin:0},children:`Settings`}),(0,Z.jsx)(ste,{}),(0,Z.jsx)(ute,{}),(0,Z.jsx)(fte,{}),(0,Z.jsx)(pte,{}),(0,Z.jsx)(mte,{}),(0,Z.jsx)(hte,{})]})}var Q9=`jobtrack.theme`,$9=[{key:`/dashboard`,icon:(0,Z.jsx)(LZ,{}),label:(0,Z.jsx)(gn,{to:`/dashboard`,children:`Dashboard`})},{key:`/applications`,icon:(0,Z.jsx)(SQ,{}),label:(0,Z.jsx)(gn,{to:`/applications`,children:`Applications`})},{key:`/openings`,icon:(0,Z.jsx)(OZ,{}),label:(0,Z.jsx)(gn,{to:`/openings`,children:`Openings`})},{key:`/companies`,icon:(0,Z.jsx)(LQ,{}),label:(0,Z.jsx)(gn,{to:`/companies`,children:`Companies`})},{key:`/people`,icon:(0,Z.jsx)(UQ,{}),label:(0,Z.jsx)(gn,{to:`/people`,children:`People`})},{key:`/notes`,icon:(0,Z.jsx)(Lz,{}),label:(0,Z.jsx)(gn,{to:`/notes`,children:`Notes`})},{key:`/settings`,icon:(0,Z.jsx)(PQ,{}),label:(0,Z.jsx)(gn,{to:`/settings`,children:`Settings`})}],_te=[{key:`light`,icon:(0,Z.jsx)(BQ,{}),label:`Light`},{key:`dark`,icon:(0,Z.jsx)(yQ,{}),label:`Dark`}];function vte(){let[e,t]=(0,_.useState)(()=>{try{let e=localStorage.getItem(Q9);if(e)return e===`dark`}catch{}return window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1});(0,_.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e?`dark`:`light`);try{localStorage.setItem(Q9,e?`dark`:`light`)}catch{}},[e]);let n=Qe(),r=(0,_.useMemo)(()=>{let e=$9.find(e=>n.pathname.startsWith(e.key));return e?[e.key]:[`/dashboard`]},[n.pathname]);return(0,Z.jsx)(Bh,{theme:Aee(e?`dark`:`light`),children:(0,Z.jsx)(FC,{children:(0,Z.jsxs)(uV,{style:{minHeight:`100vh`},children:[(0,Z.jsxs)(uV.Header,{style:{display:`flex`,alignItems:`center`,gap:24,paddingInline:24,borderBottom:`1px solid ${N9.border}`,position:`sticky`,top:0,zIndex:10},children:[(0,Z.jsxs)(AX.Title,{level:4,style:{margin:0,whiteSpace:`nowrap`},children:[`Job`,(0,Z.jsx)(`span`,{style:{color:N9.accent},children:`Track`})]}),(0,Z.jsx)(Mk,{mode:`horizontal`,selectedKeys:r,items:$9,style:{flex:1,minWidth:0,borderBottom:`none`}}),(0,Z.jsx)(bz,{trigger:[`click`],menu:{items:_te,selectable:!0,selectedKeys:[e?`dark`:`light`],onClick:({key:e})=>t(e===`dark`)},children:(0,Z.jsx)(Rk,{icon:e?(0,Z.jsx)(yQ,{}):(0,Z.jsx)(BQ,{}),"aria-label":`Theme settings`,children:`Theme`})})]}),(0,Z.jsx)(uV.Content,{style:{padding:24},children:(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(Et,{path:`/`,element:(0,Z.jsx)(Tt,{to:`/dashboard`,replace:!0})}),(0,Z.jsx)(Et,{path:`/dashboard`,element:(0,Z.jsx)(Fee,{})}),(0,Z.jsx)(Et,{path:`/applications`,element:(0,Z.jsx)(Bee,{})}),(0,Z.jsx)(Et,{path:`/applications/duplicates`,element:(0,Z.jsx)(Gee,{})}),(0,Z.jsx)(Et,{path:`/applications/:id`,element:(0,Z.jsx)(Wee,{})}),(0,Z.jsx)(Et,{path:`/openings`,element:(0,Z.jsx)(nte,{})}),(0,Z.jsx)(Et,{path:`/companies`,element:(0,Z.jsx)(qee,{})}),(0,Z.jsx)(Et,{path:`/companies/:id`,element:(0,Z.jsx)(Jee,{})}),(0,Z.jsx)(Et,{path:`/people`,element:(0,Z.jsx)(ate,{})}),(0,Z.jsx)(Et,{path:`/people/:id`,element:(0,Z.jsx)(ote,{})}),(0,Z.jsx)(Et,{path:`/notes`,element:(0,Z.jsx)(Yee,{})}),(0,Z.jsx)(Et,{path:`/settings`,element:(0,Z.jsx)(gte,{})}),(0,Z.jsx)(Et,{path:`*`,element:(0,Z.jsx)(Tt,{to:`/dashboard`,replace:!0})})]})})]})})})}var yte=new Vr({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});(0,v.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(_.StrictMode,{children:(0,Z.jsx)(jn,{client:yte,children:(0,Z.jsx)(hn,{children:(0,Z.jsx)(vte,{})})})}));
437
- //# sourceMappingURL=index-DN_P3r0S.js.map
437
+ //# sourceMappingURL=index-DlMmBA0s.js.map
@@ -18,7 +18,7 @@
18
18
 
19
19
  <meta name="description" content="Track job applications, spot the ones you have already applied for, and search them by meaning." />
20
20
  <title>JobTrack</title>
21
- <script type="module" crossorigin src="/assets/index-DN_P3r0S.js"></script>
21
+ <script type="module" crossorigin src="/assets/index-DlMmBA0s.js"></script>
22
22
  <link rel="stylesheet" crossorigin href="/assets/index-CRnClsEb.css">
23
23
  </head>
24
24
  <body>