@inploi/sdk 3.1.2 → 3.1.3

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/cdn/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // This is an inploi sdk script. Learn more at https://inploi.com
2
2
 
3
- "use strict";(()=>{var on=Object.defineProperty,un=Object.defineProperties;var an=Object.getOwnPropertyDescriptors;var Re=Object.getOwnPropertySymbols;var ln=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable;var Ne=(e,r,n)=>r in e?on(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,_=(e,r)=>{for(var n in r||(r={}))ln.call(r,n)&&Ne(e,n,r[n]);if(Re)for(var n of Re(r))cn.call(r,n)&&Ne(e,n,r[n]);return e},F=(e,r)=>un(e,an(r));var pn=(e,r)=>()=>(e&&(r=e(e=0)),r);var x=(e,r,n)=>new Promise((t,i)=>{var o=s=>{try{c(n.next(s))}catch(p){i(p)}},u=s=>{try{c(n.throw(s))}catch(p){i(p)}},c=s=>s.done?t(s.value):Promise.resolve(s.value).then(o,u);c((n=n.apply(e,r)).next())});var $e=pn(()=>{"use strict"});function oe(e,r){if(!e)throw new Error(r)}function B(e,r){return r in e}var Qn=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Q="%c[inploi SDK]",ee="color: #65BC67; font-weight: bold;",ue={warn:(...e)=>console.warn(Q,ee,...e),error:(...e)=>console.error(Q,ee,...e),info:(...e)=>console.info(Q,ee,...e),log:(...e)=>console.log(Q,ee,...e)},ae={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var fn="Unauthenticated",yn="This action is unauthorized.",q=class extends Error{constructor(n,t){super(n);this.status=t,this.name="ErrorWithStatus"}},W=class extends q{constructor(r){super(r!=null?r:"Not found"),this.name="NotFoundError",this.status=404}},H=class extends q{constructor(r,n){super(r!=null?r:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},N=class extends q{constructor(n,t){let i=t?` in ${t}`:"";super(`Schema validation failed${i}`);this.issues=n;this.source=t;this.name="SchemaValidationError",this.status=400}},ne=class extends q{constructor(n,t,i){super(n);this.data=i;this.name="ApiError",this.status=t!=null?t:500}};var X=class extends q{constructor(n){var t;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(t=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?t:void 0}};function le(e){return x(this,null,function*(){let r=new Headers(e.headers).get("content-type"),n=r==null?void 0:r.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new X(e);return e.json().catch(()=>{throw new X(e)})})}var dn=["message","error","errors","exception","exceptions"];function hn(e){let r=[];if(typeof e=="object"&&e!==null){for(let n of dn)if(B(e,n)){let t=e[n];typeof t=="string"&&r.push(t),Array.isArray(t)&&t.every(i=>typeof i=="string")&&r.push(...t)}B(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&B(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&B(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&r.push(e.integration_response.error.message)}return r.length===0&&r.push("Unknown error"),[...new Set(r)].join(", ")}function ce(e,r){if(r>=300){let n=hn(e);throw r===404?new W(n):n===fn?new H("You are not authenticated.",r):n===yn?new H(n,r):new ne(n,r,e)}}var Le=e=>{let r={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(i,...o)=>x(void 0,[i,...o],function*(n,t={}){let u=F(_({},t),{headers:_(_({},t.headers),r)}),c=yield fetch(`${e.baseUrl}${n}`,u);if(c.status===404)throw new W;let s=yield le(c);return ce(s,c.status),s})}};var Fe="3.1.2";var re={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"};var qe=Fe;var C="isdk_session",Me=`${C}-candidate_id`,vn=`${C}-consent`;var ye="RFC3986",de={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},gn="RFC1738";var bn=Array.isArray,T=(()=>{let e=[];for(let r=0;r<256;++r)e.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return e})();var pe=1024,kn=(e,r,n,t,i)=>{if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let u="";for(let c=0;c<o.length;c+=pe){let s=o.length>=pe?o.slice(c,c+pe):o,p=[];for(let f=0;f<s.length;++f){let l=s.charCodeAt(f);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===gn&&(l===40||l===41)){p[p.length]=s.charAt(f);continue}if(l<128){p[p.length]=T[l];continue}if(l<2048){p[p.length]=T[192|l>>6]+T[128|l&63];continue}if(l<55296||l>=57344){p[p.length]=T[224|l>>12]+T[128|l>>6&63]+T[128|l&63];continue}f+=1,l=65536+((l&1023)<<10|s.charCodeAt(f)&1023),p[p.length]=T[240|l>>18]+T[128|l>>12&63]+T[128|l>>6&63]+T[128|l&63]}u+=p.join("")}return u};function _n(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function ze(e,r){if(bn(e)){let n=[];for(let t=0;t<e.length;t+=1)n.push(r(e[t]));return n}return r(e)}var yr=Array.isArray;var wn=Object.prototype.hasOwnProperty,Be={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,r){return String(e)+"["+r+"]"},repeat(e){return String(e)}},P=Array.isArray,xn=Array.prototype.push,Ge=function(e,r){xn.apply(e,P(r)?r:[r])},En=Date.prototype.toISOString,b={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:kn,encodeValuesOnly:!1,format:ye,formatter:de[ye],indices:!1,serializeDate(e){return En.call(e)},skipNulls:!1,strictNullHandling:!1};function An(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var fe={};function Ve(e,r,n,t,i,o,u,c,s,p,f,l,v,a,d,E,w,A){let y=e,m=A,j=0,K=!1;for(;(m=m.get(fe))!==void 0&&!K;){let g=m.get(e);if(j+=1,typeof g!="undefined"){if(g===j)throw new RangeError("Cyclic object value");K=!0}typeof m.get(fe)=="undefined"&&(j=0)}if(typeof p=="function"?y=p(r,y):y instanceof Date?y=v==null?void 0:v(y):n==="comma"&&P(y)&&(y=ze(y,function(g){return g instanceof Date?v==null?void 0:v(g):g})),y===null){if(o)return s&&!E?s(r,b.encoder,w,"key",a):r;y=""}if(An(y)||_n(y)){if(s){let g=E?r:s(r,b.encoder,w,"key",a);return[(d==null?void 0:d(g))+"="+(d==null?void 0:d(s(y,b.encoder,w,"value",a)))]}return[(d==null?void 0:d(r))+"="+(d==null?void 0:d(String(y)))]}let J=[];if(typeof y=="undefined")return J;let h;if(n==="comma"&&P(y))E&&s&&(y=ze(y,s)),h=[{value:y.length>0?y.join(",")||null:void 0}];else if(P(p))h=p;else{let g=Object.keys(y);h=f?g.sort(f):g}let R=c?String(r).replace(/\./g,"%2E"):String(r),z=t&&P(y)&&y.length===1?R+"[]":R;if(i&&P(y)&&y.length===0)return z+"[]";for(let g=0;g<h.length;++g){let D=h[g],Ce=typeof D=="object"&&typeof D.value!="undefined"?D.value:y[D];if(u&&Ce===null)continue;let se=l&&c?D.replace(/\./g,"%2E"):D,sn=P(y)?typeof n=="function"?n(z,se):z:z+(l?"."+se:"["+se+"]");A.set(e,j);let je=new WeakMap;je.set(fe,A),Ge(J,Ve(Ce,sn,n,t,i,o,u,c,n==="comma"&&E&&P(y)?null:s,p,f,l,v,a,d,E,w,je))}return J}function Sn(e=b){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let r=e.charset||b.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=ye;if(typeof e.format!="undefined"){if(!wn.call(de,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let t=de[n],i=b.filter;(typeof e.filter=="function"||P(e.filter))&&(i=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in Be?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=b.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let u=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:b.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:b.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:b.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:b.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?b.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:b.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:b.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:b.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:b.encodeValuesOnly,filter:i,format:n,formatter:t,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:b.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:b.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:b.strictNullHandling}}function Ue(e,r={}){let n=e,t=Sn(r),i,o;typeof t.filter=="function"?(o=t.filter,n=o("",n)):P(t.filter)&&(o=t.filter,i=o);let u=[];if(typeof n!="object"||n===null)return"";let c=Be[t.arrayFormat],s=c==="comma"&&t.commaRoundTrip;i||(i=Object.keys(n)),t.sort&&i.sort(t.sort);let p=new WeakMap;for(let v=0;v<i.length;++v){let a=i[v];t.skipNulls&&n[a]===null||Ge(u,Ve(n[a],a,c,s,t.allowEmptyArrays,t.strictNullHandling,t.skipNulls,t.encodeDotInKeys,t.encode?t.encoder:null,t.filter,t.sort,t.allowDots,t.serializeDate,t.format,t.formatter,t.encodeValuesOnly,t.charset,p))}let f=u.join(t.delimiter),l=t.addQueryPrefix===!0?"?":"";return t.charsetSentinel&&(t.charset==="iso-8859-1"?l+="utf8=%26%2310003%3B&":l+="utf8=%E2%9C%93&"),f.length>0?l+f:""}function he(e,r,n){let t=e["~standard"].validate(r);if(t instanceof Promise)throw new TypeError("Async schema");if(t.issues)throw new N(t.issues,n);return t.value}function In(e,r,n){try{return{success:!0,output:he(e,r,n)}}catch(t){if(t instanceof N)return{success:!1,issues:t.issues,source:t.source};throw t}}var $=class{constructor(r){if(this.baseUrl=re[r.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),r.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",r.apiKey.key)}else this.headers.set("x-publishable-key",r.apiKey.key);this.logger=r.logger,this._environment=r.environment}get environment(){return this._environment}getFetchParams(r,n){var s;let t=(s=n.validateIn)!=null?s:!0,{searchParams:i,body:o}=t?Ke(r,n):n,u=new URL(this.baseUrl),c=r.pathname;if("params"in n&&n.params)for(let[p,f]of Object.entries(n.params))c=c.replace(`:${p}`,String(f));return u.pathname=c,r.schema.searchParams&&(u.search=Ue(i)),[u.toString(),_({method:r.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(r,n){return x(this,null,function*(){var u;let t=yield le(n.response);if(ce(t,n.response.status),!((u=n.validateOut)!=null?u:!0))return t;let o=In(r.schema.response,t,"response");if(!o.success)throw new N(o.issues,o.source);return o.output})}request(r,n){return x(this,null,function*(){try{let t=this.getFetchParams(r,n),i=yield fetch(...t);return yield this.parseResponse(r,{response:i,validateOut:n.validateOut})}catch(t){throw t instanceof N?this.logger.error(t.message,t.issues):this.logger.error(t),t}})}};function M(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function Ke(e,r){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=he(e.schema.searchParams,"searchParams"in r?r.searchParams:{})),e.schema.body&&(n.body=he(e.schema.body,"body"in r?r.body:{})),n}var O,Tn={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Pn(e){var r,n,t;return!e&&!O?Tn:{lang:(r=e==null?void 0:e.lang)!=null?r:O==null?void 0:O.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:O==null?void 0:O.abortEarly,abortPipeEarly:(t=e==null?void 0:e.abortPipeEarly)!=null?t:O==null?void 0:O.abortPipeEarly}}var me;function On(e){return me==null?void 0:me.get(e)}var ve;function Dn(e){return ve==null?void 0:ve.get(e)}var ge;function Cn(e,r){var n;return(n=ge==null?void 0:ge.get(e))==null?void 0:n.get(r)}function be(e){var n,t,i;let r=typeof e;return r==="string"?`"${e}"`:r==="number"||r==="bigint"||r==="boolean"?`${e}`:r==="object"||r==="function"?(i=e&&((t=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:t.name))!=null?i:"null":r}function S(e,r,n,t,i){var l,v,a,d,E,w,A,y;let o=i&&"input"in i?i.input:n.value,u=(v=(l=i==null?void 0:i.expected)!=null?l:e.expects)!=null?v:null,c=(a=i==null?void 0:i.received)!=null?a:be(o),s={kind:e.kind,type:e.type,input:o,expected:u,received:c,message:`Invalid ${r}: ${u?`Expected ${u} but r`:"R"}eceived ${c}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:t.lang,abortEarly:t.abortEarly,abortPipeEarly:t.abortPipeEarly},p=e.kind==="schema",f=(y=(A=(w=(E=(d=i==null?void 0:i.message)!=null?d:e.message)!=null?E:Cn(e.reference,s.lang))!=null?w:p?Dn(s.lang):null)!=null?A:t.message)!=null?y:On(s.lang);f!==void 0&&(s.message=typeof f=="function"?f(s):f),p&&(n.typed=!1),n.issues?n.issues.push(s):n.issues=[s]}var Je=new WeakMap;function I(e){let r=Je.get(e);return r||(r={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},Pn())}},Je.set(e,r)),r}function jn(e,r){return Object.prototype.hasOwnProperty.call(e,r)&&r!=="__proto__"&&r!=="prototype"&&r!=="constructor"}function He(e,r){var t;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${r} `)})`:(t=n[0])!=null?t:"never"}var Rn=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,_r=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function ke(e){return{kind:"validation",type:"email",reference:ke,expects:null,async:!1,requirement:Rn,message:e,"~run"(r,n){return r.typed&&!this.requirement.test(r.value)&&S(this,"email",r,n),r}}}function Nn(e,r,n){return typeof e.fallback=="function"?e.fallback(r,n):e.fallback}function _e(e,r,n){return typeof e.default=="function"?e.default(r,n):e.default}function we(e,r){return{kind:"schema",type:"array",reference:we,expects:"Array",async:!1,item:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(Array.isArray(i)){n.typed=!0,n.value=[];for(let u=0;u<i.length;u++){let c=i[u],s=this.item["~run"]({value:c},t);if(s.issues){let p={type:"array",origin:"value",input:i,key:u,value:c};for(let f of s.issues)f.path?f.path.unshift(p):f.path=[p],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=s.issues),t.abortEarly){n.typed=!1;break}}s.typed||(n.typed=!1),n.value.push(s.value)}}else S(this,"type",n,t);return n}}}function xe(e,r){return{kind:"schema",type:"literal",reference:xe,expects:be(e),async:!1,literal:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===this.literal?n.typed=!0:S(this,"type",n,t),n}}}function G(e,r){return{kind:"schema",type:"nullish",reference:G,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function V(e){return{kind:"schema",type:"number",reference:V,expects:"number",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="number"&&!isNaN(r.value)?r.typed=!0:S(this,"type",r,n),r}}}function U(e,r){return{kind:"schema",type:"object",reference:U,expects:"Object",async:!1,entries:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(i&&typeof i=="object"){n.typed=!0,n.value={};for(let u in this.entries){let c=this.entries[u];if(u in i||(c.type==="exact_optional"||c.type==="optional"||c.type==="nullish")&&c.default!==void 0){let s=u in i?i[u]:_e(c),p=c["~run"]({value:s},t);if(p.issues){let f={type:"object",origin:"value",input:i,key:u,value:s};for(let l of p.issues)l.path?l.path.unshift(f):l.path=[f],(o=n.issues)==null||o.push(l);if(n.issues||(n.issues=p.issues),t.abortEarly){n.typed=!1;break}}p.typed||(n.typed=!1),n.value[u]=p.value}else if(c.fallback!==void 0)n.value[u]=Nn(c);else if(c.type!=="exact_optional"&&c.type!=="optional"&&c.type!=="nullish"&&(S(this,"key",n,t,{input:void 0,expected:`"${u}"`,path:[{type:"object",origin:"key",input:i,key:u,value:i[u]}]}),t.abortEarly))break}}else S(this,"type",n,t);return n}}}function L(e,r){return{kind:"schema",type:"optional",reference:L,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===void 0&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function te(e,r){return{kind:"schema",type:"picklist",reference:te,expects:He(e.map(be),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return this.options.includes(n.value)?n.typed=!0:S(this,"type",n,t),n}}}function Ee(e,r,n){return{kind:"schema",type:"record",reference:Ee,expects:"Object",async:!1,key:e,value:r,message:n,get"~standard"(){return I(this)},"~run"(t,i){var u,c;let o=t.value;if(o&&typeof o=="object"){t.typed=!0,t.value={};for(let s in o)if(jn(o,s)){let p=o[s],f=this.key["~run"]({value:s},i);if(f.issues){let v={type:"object",origin:"key",input:o,key:s,value:p};for(let a of f.issues)a.path=[v],(u=t.issues)==null||u.push(a);if(t.issues||(t.issues=f.issues),i.abortEarly){t.typed=!1;break}}let l=this.value["~run"]({value:p},i);if(l.issues){let v={type:"object",origin:"value",input:o,key:s,value:p};for(let a of l.issues)a.path?a.path.unshift(v):a.path=[v],(c=t.issues)==null||c.push(a);if(t.issues||(t.issues=l.issues),i.abortEarly){t.typed=!1;break}}(!f.typed||!l.typed)&&(t.typed=!1),f.typed&&(t.value[f.value]=l.value)}}else S(this,"type",t,i);return t}}}function k(e){return{kind:"schema",type:"string",reference:k,expects:"string",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="string"?r.typed=!0:S(this,"type",r,n),r}}}function We(e){let r;if(e)for(let n of e)if(r)for(let t of n.issues)r.push(t);else r=n.issues;return r}function Ae(e,r){return{kind:"schema",type:"union",reference:Ae,expects:He(e.map(n=>n.expects),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){let i,o,u;for(let c of this.options){let s=c["~run"]({value:n.value},t);if(s.typed)if(s.issues)o?o.push(s):o=[s];else{i=s;break}else u?u.push(s):u=[s]}if(i)return i;if(o){if(o.length===1)return o[0];S(this,"type",n,t,{issues:We(o)}),n.typed=!0}else{if((u==null?void 0:u.length)===1)return u[0];S(this,"type",n,t,{issues:We(u)})}return n}}}function Se(...e){return F(_({},e[0]),{pipe:e,get"~standard"(){return I(this)},"~run"(r,n){for(let t of e)if(t.kind!=="metadata"){if(r.issues&&(t.kind==="schema"||t.kind==="transformation")){r.typed=!1;break}(!r.issues||!n.abortEarly&&!n.abortPipeEarly)&&(r=t["~run"](r,n))}return r}})}var Y=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16));function Ie(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Xe=["DAILY","WEEKLY","MONTHLY"],Fn=Ee(k(),Ae([k(),we(k()),U({type:xe("provided"),lat:V(),lng:V(),radius:V(),unit:L(te(["miles","km"])),label:L(k())})])),Cr={pathname:"/job/:id",method:"GET",schema:{response:U({id:V(),external_id:G(k()),city:G(k()),town:G(k()),category:G(k())})}};var qn={pathname:"/search/save",method:"POST",schema:{response:M(),body:U({contact:U({email:Se(L(k()),k(),ke()),first_name:L(k()),last_name:L(k())}),alerts:Se(L(k()),k(),te(Xe)),filters:Fn})}};$e();var ie=new Map,Oe={get:e=>{var r;if(ie.has(e))return(r=ie.get(e))!=null?r:null;try{return window.sessionStorage.getItem(e)}catch(n){return null}},set:(e,r)=>{try{window.sessionStorage.setItem(e,r),ie.delete(e)}catch(n){ie.set(e,r)}}};var Qe=7*24*60*60*1e3,en=e=>{let r=new Date;return r.setTime(r.getTime()+Qe),`${C}=${e};expires=${r.toUTCString()};path=/`},Mn=(e,r)=>{let n=e.get("session_id");if(r||n)return n;let t=Oe.get(`${C}-session_id`);return typeof t=="string"?t:null},zn=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(Me);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Bn=new RegExp(`(?:^|;\\s*)${C}=([^;]+)`),Z=e=>{var n,t;let r=e?e.headers.get("cookie"):document.cookie;return r&&(t=(n=Bn.exec(r))==null?void 0:n[1])!=null?t:null},nn=()=>{var e;try{let r=JSON.parse((e=window.localStorage.getItem(C))!=null?e:"null");return typeof r!="object"||r===null||!("id"in r)||!("expires"in r)||typeof r.id!="string"||typeof r.expires!="number"?null:r.id!==""&&r.expires>Date.now()?r.id:null}catch(r){return null}},Ze=()=>{var e;return(e=Z())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:nn()},Gn=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",rn=e=>{if(document.cookie=en(e)+Gn(),Z()!==e)try{window.localStorage.setItem(C,JSON.stringify({id:e,expires:Date.now()+Qe}))}catch(r){}},De=e=>{var t,i,o;let r=e?e.url:location.href,{searchParams:n}=new URL(r);return{anonymous_id:e?(t=Z(e))!=null?t:n.get("anonymous_id"):(o=(i=Z())!=null?i:n.get("anonymous_id"))!=null?o:nn(),session_id:Mn(n,typeof window=="undefined")}},Ye=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=De().anonymous_id;if(e)return e;let r=Y(),n=De().anonymous_id;return n||(rn(r),r)},Vn=e=>typeof e!="object"||e===null?null:{anonymous_id:"anonymous_id"in e&&typeof e.anonymous_id=="string"?e.anonymous_id:null,session_id:"session_id"in e&&typeof e.session_id=="string"?e.session_id:null},Un=e=>e==="about:client"?"":e,Kn={pathname:"/log",method:"POST",schema:{response:M(),body:M()}},tn=({rpcClient:e,logger:r,onEvent:n,persistence:t="device",siteKind:i})=>{let o=null,u=null,c=0,s=0,p=a=>t==="none"?{anonymous_id:null,session_id:a?null:o}:De(a),f=(a,d,E)=>x(void 0,null,function*(){try{let w={library:{name:"inploi-sdk",version:qe},page:d},A=p(a.request),y=t==="none"?null:zn(),m={anonymous_id:A.anonymous_id,session_id:A.session_id,candidate_id:y,event:a.event,sent_at:new Date().toISOString(),context:w,properties:a.properties,custom_properties:_(_({},a.customProperties),E)},j=t==="none"?null:a.request?Z(a.request):Ze(),K=++c,J=yield e.request(Kn,_({body:m},a.keepalive&&{keepalive:!0})),h=Vn(J);if(t==="none")return!a.request&&(h!=null&&h.session_id)&&K>s&&(s=K,h.session_id!==m.session_id&&(o=h.session_id)),m.session_id=a.request?(h==null?void 0:h.session_id)||null:o,n==null||n(m),{success:!0,data:m};let R=a.request?j:Ze(),z=R!==null&&R!==j,g=R!=null?R:j,D=!z&&(!g||!(h!=null&&h.anonymous_id)||g===h.anonymous_id);return D?(h!=null&&h.anonymous_id&&(m.anonymous_id=h.anonymous_id),h!=null&&h.session_id&&(m.session_id=h.session_id)):m.anonymous_id=g,!a.request&&typeof window!="undefined"&&m.anonymous_id&&(D&&m.session_id&&Oe.set(`${C}-session_id`,m.session_id.toString()),rn(m.anonymous_id)),n==null||n(m),{success:!0,data:m}}catch(w){return r.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:w}}}),l=Promise.resolve();return{log:a=>x(void 0,null,function*(){oe(a.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let d="request"in a&&a.request?{href:a.request.url,referrer:Un(a.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(a.page_context==="no_query"){let y=new URL(d.href),m=d.referrer?new URL(d.referrer):void 0;d={href:y.origin+y.pathname,referrer:m?m.origin+m.pathname:""}}t==="none"&&a.event==="FLOW_NODE"&&a.properties&&"trigger"in a.properties&&(a.properties.trigger==="pagehide"||a.properties.trigger==="hidden")&&(a=F(_({},a),{keepalive:!0}));let E={event_id:Y(),consent_lane:t,site_kind:i};if(t==="device"||a.request||o||a.keepalive)return f(a,d,E);let w=()=>f(a,d,E),A=l.then(w,w);return l=A,A}),supportsNoQueryPageContext:!0,getHeaders:a=>{let d=new Headers;return t==="none"||!(a!=null&&a.anonymous_id)||d.append("Set-Cookie",en(a.anonymous_id)),d},getSessionInfo:p,getOrCreateAnonymousId:()=>t==="none"?u!=null?u:u=Y():Ye()}};function Pe({publishableKey:e,env:r,logger:n=ue,onEvent:t,persistence:i,siteKind:o}){let u=Le({baseUrl:re[r],publishableKey:e}),c=n===!1?ae:n,s=new $({environment:r,apiKey:{type:"publishable",key:e},logger:c}),p=tn({rpcClient:s,logger:c,onEvent:t,persistence:i,siteKind:o});return{register:l=>l({logger:c,apiClient:u,analytics:p,rpcClient:s,publishableKey:e,env:r}),analytics:p,apiClient:u}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=Pe;window.inploi.ready=Ie;})();
3
+ "use strict";(()=>{var on=Object.defineProperty,un=Object.defineProperties;var an=Object.getOwnPropertyDescriptors;var je=Object.getOwnPropertySymbols;var ln=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable;var Ne=(e,r,n)=>r in e?on(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,_=(e,r)=>{for(var n in r||(r={}))ln.call(r,n)&&Ne(e,n,r[n]);if(je)for(var n of je(r))cn.call(r,n)&&Ne(e,n,r[n]);return e},F=(e,r)=>un(e,an(r));var pn=(e,r)=>()=>(e&&(r=e(e=0)),r);var x=(e,r,n)=>new Promise((t,i)=>{var o=s=>{try{c(n.next(s))}catch(p){i(p)}},u=s=>{try{c(n.throw(s))}catch(p){i(p)}},c=s=>s.done?t(s.value):Promise.resolve(s.value).then(o,u);c((n=n.apply(e,r)).next())});var $e=pn(()=>{"use strict"});function oe(e,r){if(!e)throw new Error(r)}function B(e,r){return r in e}var Qn=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Q="%c[inploi SDK]",ee="color: #65BC67; font-weight: bold;",ue={warn:(...e)=>console.warn(Q,ee,...e),error:(...e)=>console.error(Q,ee,...e),info:(...e)=>console.info(Q,ee,...e),log:(...e)=>console.log(Q,ee,...e)},ae={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var fn="Unauthenticated",yn="This action is unauthorized.",q=class extends Error{constructor(n,t){super(n);this.status=t,this.name="ErrorWithStatus"}},W=class extends q{constructor(r){super(r!=null?r:"Not found"),this.name="NotFoundError",this.status=404}},H=class extends q{constructor(r,n){super(r!=null?r:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},N=class extends q{constructor(n,t){let i=t?` in ${t}`:"";super(`Schema validation failed${i}`);this.issues=n;this.source=t;this.name="SchemaValidationError",this.status=400}},ne=class extends q{constructor(n,t,i){super(n);this.data=i;this.name="ApiError",this.status=t!=null?t:500}};var X=class extends q{constructor(n){var t;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(t=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?t:void 0}};function le(e){return x(this,null,function*(){let r=new Headers(e.headers).get("content-type"),n=r==null?void 0:r.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new X(e);return e.json().catch(()=>{throw new X(e)})})}var dn=["message","error","errors","exception","exceptions"];function hn(e){let r=[];if(typeof e=="object"&&e!==null){for(let n of dn)if(B(e,n)){let t=e[n];typeof t=="string"&&r.push(t),Array.isArray(t)&&t.every(i=>typeof i=="string")&&r.push(...t)}B(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&B(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&B(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&r.push(e.integration_response.error.message)}return r.length===0&&r.push("Unknown error"),[...new Set(r)].join(", ")}function ce(e,r){if(r>=300){let n=hn(e);throw r===404?new W(n):n===fn?new H("You are not authenticated.",r):n===yn?new H(n,r):new ne(n,r,e)}}var Le=e=>{let r={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(i,...o)=>x(void 0,[i,...o],function*(n,t={}){let u=F(_({},t),{headers:_(_({},t.headers),r)}),c=yield fetch(`${e.baseUrl}${n}`,u);if(c.status===404)throw new W;let s=yield le(c);return ce(s,c.status),s})}};var Fe="3.1.3";var re={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"};var qe=Fe;var D="isdk_session",Me=`${D}-candidate_id`,vn=`${D}-consent`;var ye="RFC3986",de={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},gn="RFC1738";var bn=Array.isArray,T=(()=>{let e=[];for(let r=0;r<256;++r)e.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return e})();var pe=1024,kn=(e,r,n,t,i)=>{if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let u="";for(let c=0;c<o.length;c+=pe){let s=o.length>=pe?o.slice(c,c+pe):o,p=[];for(let f=0;f<s.length;++f){let l=s.charCodeAt(f);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===gn&&(l===40||l===41)){p[p.length]=s.charAt(f);continue}if(l<128){p[p.length]=T[l];continue}if(l<2048){p[p.length]=T[192|l>>6]+T[128|l&63];continue}if(l<55296||l>=57344){p[p.length]=T[224|l>>12]+T[128|l>>6&63]+T[128|l&63];continue}f+=1,l=65536+((l&1023)<<10|s.charCodeAt(f)&1023),p[p.length]=T[240|l>>18]+T[128|l>>12&63]+T[128|l>>6&63]+T[128|l&63]}u+=p.join("")}return u};function _n(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function ze(e,r){if(bn(e)){let n=[];for(let t=0;t<e.length;t+=1)n.push(r(e[t]));return n}return r(e)}var yr=Array.isArray;var wn=Object.prototype.hasOwnProperty,Be={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,r){return String(e)+"["+r+"]"},repeat(e){return String(e)}},P=Array.isArray,xn=Array.prototype.push,Ge=function(e,r){xn.apply(e,P(r)?r:[r])},En=Date.prototype.toISOString,b={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:kn,encodeValuesOnly:!1,format:ye,formatter:de[ye],indices:!1,serializeDate(e){return En.call(e)},skipNulls:!1,strictNullHandling:!1};function An(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var fe={};function Ue(e,r,n,t,i,o,u,c,s,p,f,l,v,a,d,E,w,A){let y=e,m=A,R=0,K=!1;for(;(m=m.get(fe))!==void 0&&!K;){let g=m.get(e);if(R+=1,typeof g!="undefined"){if(g===R)throw new RangeError("Cyclic object value");K=!0}typeof m.get(fe)=="undefined"&&(R=0)}if(typeof p=="function"?y=p(r,y):y instanceof Date?y=v==null?void 0:v(y):n==="comma"&&P(y)&&(y=ze(y,function(g){return g instanceof Date?v==null?void 0:v(g):g})),y===null){if(o)return s&&!E?s(r,b.encoder,w,"key",a):r;y=""}if(An(y)||_n(y)){if(s){let g=E?r:s(r,b.encoder,w,"key",a);return[(d==null?void 0:d(g))+"="+(d==null?void 0:d(s(y,b.encoder,w,"value",a)))]}return[(d==null?void 0:d(r))+"="+(d==null?void 0:d(String(y)))]}let J=[];if(typeof y=="undefined")return J;let h;if(n==="comma"&&P(y))E&&s&&(y=ze(y,s)),h=[{value:y.length>0?y.join(",")||null:void 0}];else if(P(p))h=p;else{let g=Object.keys(y);h=f?g.sort(f):g}let j=c?String(r).replace(/\./g,"%2E"):String(r),z=t&&P(y)&&y.length===1?j+"[]":j;if(i&&P(y)&&y.length===0)return z+"[]";for(let g=0;g<h.length;++g){let C=h[g],De=typeof C=="object"&&typeof C.value!="undefined"?C.value:y[C];if(u&&De===null)continue;let se=l&&c?C.replace(/\./g,"%2E"):C,sn=P(y)?typeof n=="function"?n(z,se):z:z+(l?"."+se:"["+se+"]");A.set(e,R);let Re=new WeakMap;Re.set(fe,A),Ge(J,Ue(De,sn,n,t,i,o,u,c,n==="comma"&&E&&P(y)?null:s,p,f,l,v,a,d,E,w,Re))}return J}function Sn(e=b){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let r=e.charset||b.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=ye;if(typeof e.format!="undefined"){if(!wn.call(de,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let t=de[n],i=b.filter;(typeof e.filter=="function"||P(e.filter))&&(i=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in Be?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=b.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let u=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:b.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:b.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:b.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:b.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?b.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:b.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:b.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:b.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:b.encodeValuesOnly,filter:i,format:n,formatter:t,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:b.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:b.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:b.strictNullHandling}}function Ve(e,r={}){let n=e,t=Sn(r),i,o;typeof t.filter=="function"?(o=t.filter,n=o("",n)):P(t.filter)&&(o=t.filter,i=o);let u=[];if(typeof n!="object"||n===null)return"";let c=Be[t.arrayFormat],s=c==="comma"&&t.commaRoundTrip;i||(i=Object.keys(n)),t.sort&&i.sort(t.sort);let p=new WeakMap;for(let v=0;v<i.length;++v){let a=i[v];t.skipNulls&&n[a]===null||Ge(u,Ue(n[a],a,c,s,t.allowEmptyArrays,t.strictNullHandling,t.skipNulls,t.encodeDotInKeys,t.encode?t.encoder:null,t.filter,t.sort,t.allowDots,t.serializeDate,t.format,t.formatter,t.encodeValuesOnly,t.charset,p))}let f=u.join(t.delimiter),l=t.addQueryPrefix===!0?"?":"";return t.charsetSentinel&&(t.charset==="iso-8859-1"?l+="utf8=%26%2310003%3B&":l+="utf8=%E2%9C%93&"),f.length>0?l+f:""}function he(e,r,n){let t=e["~standard"].validate(r);if(t instanceof Promise)throw new TypeError("Async schema");if(t.issues)throw new N(t.issues,n);return t.value}function In(e,r,n){try{return{success:!0,output:he(e,r,n)}}catch(t){if(t instanceof N)return{success:!1,issues:t.issues,source:t.source};throw t}}var $=class{constructor(r){if(this.baseUrl=re[r.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),r.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",r.apiKey.key)}else this.headers.set("x-publishable-key",r.apiKey.key);this.logger=r.logger,this._environment=r.environment}get environment(){return this._environment}getFetchParams(r,n){var s;let t=(s=n.validateIn)!=null?s:!0,{searchParams:i,body:o}=t?Ke(r,n):n,u=new URL(this.baseUrl),c=r.pathname;if("params"in n&&n.params)for(let[p,f]of Object.entries(n.params))c=c.replace(`:${p}`,String(f));return u.pathname=c,r.schema.searchParams&&(u.search=Ve(i)),[u.toString(),_({method:r.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(r,n){return x(this,null,function*(){var u;let t=yield le(n.response);if(ce(t,n.response.status),!((u=n.validateOut)!=null?u:!0))return t;let o=In(r.schema.response,t,"response");if(!o.success)throw new N(o.issues,o.source);return o.output})}request(r,n){return x(this,null,function*(){try{let t=this.getFetchParams(r,n),i=yield fetch(...t);return yield this.parseResponse(r,{response:i,validateOut:n.validateOut})}catch(t){throw t instanceof N?this.logger.error(t.message,t.issues):this.logger.error(t),t}})}};function M(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function Ke(e,r){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=he(e.schema.searchParams,"searchParams"in r?r.searchParams:{})),e.schema.body&&(n.body=he(e.schema.body,"body"in r?r.body:{})),n}var O,Tn={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Pn(e){var r,n,t;return!e&&!O?Tn:{lang:(r=e==null?void 0:e.lang)!=null?r:O==null?void 0:O.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:O==null?void 0:O.abortEarly,abortPipeEarly:(t=e==null?void 0:e.abortPipeEarly)!=null?t:O==null?void 0:O.abortPipeEarly}}var me;function On(e){return me==null?void 0:me.get(e)}var ve;function Cn(e){return ve==null?void 0:ve.get(e)}var ge;function Dn(e,r){var n;return(n=ge==null?void 0:ge.get(e))==null?void 0:n.get(r)}function be(e){var n,t,i;let r=typeof e;return r==="string"?`"${e}"`:r==="number"||r==="bigint"||r==="boolean"?`${e}`:r==="object"||r==="function"?(i=e&&((t=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:t.name))!=null?i:"null":r}function S(e,r,n,t,i){var l,v,a,d,E,w,A,y;let o=i&&"input"in i?i.input:n.value,u=(v=(l=i==null?void 0:i.expected)!=null?l:e.expects)!=null?v:null,c=(a=i==null?void 0:i.received)!=null?a:be(o),s={kind:e.kind,type:e.type,input:o,expected:u,received:c,message:`Invalid ${r}: ${u?`Expected ${u} but r`:"R"}eceived ${c}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:t.lang,abortEarly:t.abortEarly,abortPipeEarly:t.abortPipeEarly},p=e.kind==="schema",f=(y=(A=(w=(E=(d=i==null?void 0:i.message)!=null?d:e.message)!=null?E:Dn(e.reference,s.lang))!=null?w:p?Cn(s.lang):null)!=null?A:t.message)!=null?y:On(s.lang);f!==void 0&&(s.message=typeof f=="function"?f(s):f),p&&(n.typed=!1),n.issues?n.issues.push(s):n.issues=[s]}var Je=new WeakMap;function I(e){let r=Je.get(e);return r||(r={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},Pn())}},Je.set(e,r)),r}function Rn(e,r){return Object.prototype.hasOwnProperty.call(e,r)&&r!=="__proto__"&&r!=="prototype"&&r!=="constructor"}function He(e,r){var t;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${r} `)})`:(t=n[0])!=null?t:"never"}var jn=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,_r=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function ke(e){return{kind:"validation",type:"email",reference:ke,expects:null,async:!1,requirement:jn,message:e,"~run"(r,n){return r.typed&&!this.requirement.test(r.value)&&S(this,"email",r,n),r}}}function Nn(e,r,n){return typeof e.fallback=="function"?e.fallback(r,n):e.fallback}function _e(e,r,n){return typeof e.default=="function"?e.default(r,n):e.default}function we(e,r){return{kind:"schema",type:"array",reference:we,expects:"Array",async:!1,item:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(Array.isArray(i)){n.typed=!0,n.value=[];for(let u=0;u<i.length;u++){let c=i[u],s=this.item["~run"]({value:c},t);if(s.issues){let p={type:"array",origin:"value",input:i,key:u,value:c};for(let f of s.issues)f.path?f.path.unshift(p):f.path=[p],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=s.issues),t.abortEarly){n.typed=!1;break}}s.typed||(n.typed=!1),n.value.push(s.value)}}else S(this,"type",n,t);return n}}}function xe(e,r){return{kind:"schema",type:"literal",reference:xe,expects:be(e),async:!1,literal:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===this.literal?n.typed=!0:S(this,"type",n,t),n}}}function G(e,r){return{kind:"schema",type:"nullish",reference:G,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function U(e){return{kind:"schema",type:"number",reference:U,expects:"number",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="number"&&!isNaN(r.value)?r.typed=!0:S(this,"type",r,n),r}}}function V(e,r){return{kind:"schema",type:"object",reference:V,expects:"Object",async:!1,entries:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(i&&typeof i=="object"){n.typed=!0,n.value={};for(let u in this.entries){let c=this.entries[u];if(u in i||(c.type==="exact_optional"||c.type==="optional"||c.type==="nullish")&&c.default!==void 0){let s=u in i?i[u]:_e(c),p=c["~run"]({value:s},t);if(p.issues){let f={type:"object",origin:"value",input:i,key:u,value:s};for(let l of p.issues)l.path?l.path.unshift(f):l.path=[f],(o=n.issues)==null||o.push(l);if(n.issues||(n.issues=p.issues),t.abortEarly){n.typed=!1;break}}p.typed||(n.typed=!1),n.value[u]=p.value}else if(c.fallback!==void 0)n.value[u]=Nn(c);else if(c.type!=="exact_optional"&&c.type!=="optional"&&c.type!=="nullish"&&(S(this,"key",n,t,{input:void 0,expected:`"${u}"`,path:[{type:"object",origin:"key",input:i,key:u,value:i[u]}]}),t.abortEarly))break}}else S(this,"type",n,t);return n}}}function L(e,r){return{kind:"schema",type:"optional",reference:L,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===void 0&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function te(e,r){return{kind:"schema",type:"picklist",reference:te,expects:He(e.map(be),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return this.options.includes(n.value)?n.typed=!0:S(this,"type",n,t),n}}}function Ee(e,r,n){return{kind:"schema",type:"record",reference:Ee,expects:"Object",async:!1,key:e,value:r,message:n,get"~standard"(){return I(this)},"~run"(t,i){var u,c;let o=t.value;if(o&&typeof o=="object"){t.typed=!0,t.value={};for(let s in o)if(Rn(o,s)){let p=o[s],f=this.key["~run"]({value:s},i);if(f.issues){let v={type:"object",origin:"key",input:o,key:s,value:p};for(let a of f.issues)a.path=[v],(u=t.issues)==null||u.push(a);if(t.issues||(t.issues=f.issues),i.abortEarly){t.typed=!1;break}}let l=this.value["~run"]({value:p},i);if(l.issues){let v={type:"object",origin:"value",input:o,key:s,value:p};for(let a of l.issues)a.path?a.path.unshift(v):a.path=[v],(c=t.issues)==null||c.push(a);if(t.issues||(t.issues=l.issues),i.abortEarly){t.typed=!1;break}}(!f.typed||!l.typed)&&(t.typed=!1),f.typed&&(t.value[f.value]=l.value)}}else S(this,"type",t,i);return t}}}function k(e){return{kind:"schema",type:"string",reference:k,expects:"string",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="string"?r.typed=!0:S(this,"type",r,n),r}}}function We(e){let r;if(e)for(let n of e)if(r)for(let t of n.issues)r.push(t);else r=n.issues;return r}function Ae(e,r){return{kind:"schema",type:"union",reference:Ae,expects:He(e.map(n=>n.expects),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){let i,o,u;for(let c of this.options){let s=c["~run"]({value:n.value},t);if(s.typed)if(s.issues)o?o.push(s):o=[s];else{i=s;break}else u?u.push(s):u=[s]}if(i)return i;if(o){if(o.length===1)return o[0];S(this,"type",n,t,{issues:We(o)}),n.typed=!0}else{if((u==null?void 0:u.length)===1)return u[0];S(this,"type",n,t,{issues:We(u)})}return n}}}function Se(...e){return F(_({},e[0]),{pipe:e,get"~standard"(){return I(this)},"~run"(r,n){for(let t of e)if(t.kind!=="metadata"){if(r.issues&&(t.kind==="schema"||t.kind==="transformation")){r.typed=!1;break}(!r.issues||!n.abortEarly&&!n.abortPipeEarly)&&(r=t["~run"](r,n))}return r}})}var Y=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16));function Ie(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Xe=["DAILY","WEEKLY","MONTHLY"],Fn=Ee(k(),Ae([k(),we(k()),V({type:xe("provided"),lat:U(),lng:U(),radius:U(),unit:L(te(["miles","km"])),label:L(k())})])),Dr={pathname:"/job/:id",method:"GET",schema:{response:V({id:U(),external_id:G(k()),city:G(k()),town:G(k()),category:G(k())})}};var qn={pathname:"/search/save",method:"POST",schema:{response:M(),body:V({contact:V({email:Se(L(k()),k(),ke()),first_name:L(k()),last_name:L(k())}),alerts:Se(L(k()),k(),te(Xe)),filters:Fn})}};$e();var ie=new Map,Oe={get:e=>{var r;if(ie.has(e))return(r=ie.get(e))!=null?r:null;try{return window.sessionStorage.getItem(e)}catch(n){return null}},set:(e,r)=>{try{window.sessionStorage.setItem(e,r),ie.delete(e)}catch(n){ie.set(e,r)}}};var Qe=7*24*60*60*1e3,en=e=>{let r=new Date;return r.setTime(r.getTime()+Qe),`${D}=${e};expires=${r.toUTCString()};path=/`},Mn=(e,r)=>{let n=e.get("session_id");if(r||n)return n;let t=Oe.get(`${D}-session_id`);return typeof t=="string"?t:null},zn=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(Me);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Bn=new RegExp(`(?:^|;\\s*)${D}=([^;]+)`),Z=e=>{var n,t;let r=e?e.headers.get("cookie"):document.cookie;return r&&(t=(n=Bn.exec(r))==null?void 0:n[1])!=null?t:null},nn=()=>{var e;try{let r=JSON.parse((e=window.localStorage.getItem(D))!=null?e:"null");return typeof r!="object"||r===null||!("id"in r)||!("expires"in r)||typeof r.id!="string"||typeof r.expires!="number"?null:r.id!==""&&r.expires>Date.now()?r.id:null}catch(r){return null}},Ze=()=>{var e;return(e=Z())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:nn()},Gn=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",rn=e=>{if(document.cookie=en(e)+Gn(),Z()!==e)try{window.localStorage.setItem(D,JSON.stringify({id:e,expires:Date.now()+Qe}))}catch(r){}},Ce=e=>{var t,i,o;let r=e?e.url:location.href,{searchParams:n}=new URL(r);return{anonymous_id:e?(t=Z(e))!=null?t:n.get("anonymous_id"):(o=(i=Z())!=null?i:n.get("anonymous_id"))!=null?o:nn(),session_id:Mn(n,typeof window=="undefined")}},Ye=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=Ce().anonymous_id;if(e)return e;let r=Y(),n=Ce().anonymous_id;return n||(rn(r),r)},Un=e=>typeof e!="object"||e===null?null:{anonymous_id:"anonymous_id"in e&&typeof e.anonymous_id=="string"?e.anonymous_id:null,session_id:"session_id"in e&&typeof e.session_id=="string"?e.session_id:null},Vn=e=>e==="about:client"?"":e,Kn={pathname:"/log",method:"POST",schema:{response:M(),body:M()}},tn=({rpcClient:e,logger:r,onEvent:n,persistence:t="device",siteKind:i})=>{let o=null,u=null,c=0,s=0,p=a=>t==="none"?{anonymous_id:null,session_id:a?null:o}:Ce(a),f=(a,d,E)=>x(void 0,null,function*(){try{let w={library:{name:"inploi-sdk",version:qe},page:d},A=p(a.request),y=t==="none"?null:zn(),m={anonymous_id:A.anonymous_id,session_id:A.session_id,candidate_id:y,event:a.event,sent_at:new Date().toISOString(),context:w,properties:a.properties,custom_properties:_(_({},a.customProperties),E)},R=t==="none"?null:a.request?Z(a.request):Ze(),K=++c,J=yield e.request(Kn,_({body:m},a.keepalive&&{keepalive:!0})),h=Un(J);if(t==="none")return!a.request&&(h!=null&&h.session_id)&&K>s&&(s=K,h.session_id!==m.session_id&&(o=h.session_id)),m.session_id=a.request?(h==null?void 0:h.session_id)||null:o,n==null||n(m),{success:!0,data:m};let j=a.request?R:Ze(),z=j!==null&&j!==R,g=j!=null?j:R,C=!z&&(!g||!(h!=null&&h.anonymous_id)||g===h.anonymous_id);return C?(h!=null&&h.anonymous_id&&(m.anonymous_id=h.anonymous_id),h!=null&&h.session_id&&(m.session_id=h.session_id)):m.anonymous_id=g,!a.request&&typeof window!="undefined"&&m.anonymous_id&&(C&&m.session_id&&Oe.set(`${D}-session_id`,m.session_id.toString()),rn(m.anonymous_id)),n==null||n(m),{success:!0,data:m}}catch(w){return r.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:w}}}),l=Promise.resolve();return{log:a=>x(void 0,null,function*(){oe(a.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let d="request"in a&&a.request?{href:a.request.url,referrer:Vn(a.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(a.page_context==="no_query"){let y=new URL(d.href),m=d.referrer?new URL(d.referrer):void 0;d={href:y.origin+y.pathname,referrer:m?m.origin+m.pathname:""}}t==="none"&&a.event==="FLOW_NODE"&&a.properties&&"trigger"in a.properties&&(a.properties.trigger==="pagehide"||a.properties.trigger==="hidden")&&(a=F(_({},a),{keepalive:!0}));let E={event_id:Y(),consent_lane:t,site_kind:i};if(t==="device"||a.request||o||a.keepalive)return f(a,d,E);let w=()=>f(a,d,E),A=l.then(w,w);return l=A,A}),supportsNoQueryPageContext:!0,getHeaders:a=>{let d=new Headers;return t==="none"||!(a!=null&&a.anonymous_id)||d.append("Set-Cookie",en(a.anonymous_id)),d},getSessionInfo:p,getOrCreateAnonymousId:()=>t==="none"?u!=null?u:u=Y():Ye()}};function Pe({publishableKey:e,env:r,logger:n=ue,onEvent:t,persistence:i,siteKind:o}){let u=Le({baseUrl:re[r],publishableKey:e}),c=n===!1?ae:n,s=new $({environment:r,apiKey:{type:"publishable",key:e},logger:c}),p=tn({rpcClient:s,logger:c,onEvent:t,persistence:i,siteKind:o});return{register:l=>l({logger:c,apiClient:u,analytics:p,rpcClient:s,publishableKey:e,env:r}),analytics:p,apiClient:u}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=Pe;window.inploi.ready=Ie;})();
@@ -1,4 +1,4 @@
1
- var a={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"gb",lincolnshire:"gb",surrey:"gb","republic of ireland":"ie",eire:"ie","hong kong sar":"hk","united states of america":"us",turkey:"tr","czech republic":"cz",burma:"mm",kosovo:"xk",xk:"xk"},m=`adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel
1
+ var c={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"gb","republic of ireland":"ie",eire:"ie","hong kong sar":"hk","united states of america":"us",turkey:"tr","czech republic":"cz",burma:"mm",kosovo:"xk",xk:"xk"},o={lincolnshire:"gb",surrey:"gb"},g=`adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel
2
2
  bfbfa bgbgr bhbhr bibdi bjben blblm bmbmu bnbrn bobol bqbes brbra bsbhs btbtn bvbvt bwbwa byblr bzblz cacan cccck cdcod
3
3
  cfcaf cgcog chche ciciv ckcok clchl cmcmr cnchn cocol crcri cucub cvcpv cwcuw cxcxr cycyp czcze dedeu djdji dkdnk dmdma
4
4
  dodom dzdza ececu eeest egegy ehesh ereri esesp eteth fifin fjfji fkflk fmfsm fofro frfra gagab gbgbr gdgrd gegeo gfguf
@@ -10,5 +10,5 @@ ncncl nener nfnfk ngnga ninic nlnld nonor npnpl nrnru nuniu nznzl omomn papan pe
10
10
  pnpcn prpri pspse ptprt pwplw pypry qaqat rereu rorou rssrb rurus rwrwa sasau sbslb scsyc sdsdn seswe sgsgp shshn sisvn
11
11
  sjsjm sksvk slsle smsmr snsen sosom srsur ssssd ststp svslv sxsxm sysyr szswz tctca tdtcd tfatf tgtgo ththa tjtjk tktkl
12
12
  tltls tmtkm tntun toton trtur tttto tvtuv twtwn tztza uaukr uguga umumi ususa uyury uzuzb vavat vcvct veven vgvgb vivir
13
- vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,n,c=()=>{if(n)return n;n=new Map;let r=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let s of m.split(/\s+/)){let t=s.slice(0,2),e=r.of(t.toUpperCase());e&&n.set(e.toLowerCase(),t),n.set(t,t),n.set(s.slice(2),t)}return n},g=r=>{let s=r.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(a,s))return a[s];let t=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(s)?s.slice(0,2):s;return c().get(t)},o=r=>[...new Set(r.flatMap(t=>g(t)??[]))].sort();export{o as a};
14
- //# sourceMappingURL=chunk-KC7FKSIJ.mjs.map
13
+ vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,r,i=()=>{if(r)return r;r=new Map;let s=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let t of g.split(/\s+/)){let n=t.slice(0,2),e=s.of(n.toUpperCase());e&&r.set(e.toLowerCase(),n),r.set(n,n),r.set(t.slice(2),n)}return r},a=(s,t)=>Object.prototype.hasOwnProperty.call(s,t)?s[t]:void 0,m=s=>{let t=s.trim().toLowerCase(),n=a(c,t);if(n)return n;let e=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(t)?t.slice(0,2):t;return i().get(e)},l=s=>m(s)?.toUpperCase(),b=s=>[...new Set(s.flatMap(n=>a(o,n.trim().toLowerCase())??m(n)??[]))].sort();export{l as a,b};
14
+ //# sourceMappingURL=chunk-U6WFJKHV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sdk.country-codes.ts"],"sourcesContent":["/** Names for a country that are not its English name. */\nconst COUNTRY_ALIASES: Record<string, string> = {\n\tuk: 'gb',\n\t'great britain': 'gb',\n\tengland: 'gb',\n\tscotland: 'gb',\n\twales: 'gb',\n\t'northern ireland': 'gb',\n\t'republic of ireland': 'ie',\n\teire: 'ie',\n\t'hong kong sar': 'hk',\n\t'united states of america': 'us',\n\tturkey: 'tr',\n\t'czech republic': 'cz',\n\tburma: 'mm',\n\t// Preserve Intl's existing Kosovo support without treating XK as an ISO subdivision prefix.\n\tkosovo: 'xk',\n\txk: 'xk',\n};\n\n/** Places below country level that one ATS feed gives as a job's country. Hub search only: never a job's country. */\nconst FEED_PLACE_ALIASES: Record<string, string> = {\n\t// County values observed in Kisimul's job feed; do not infer GB for other unknown place names.\n\tlincolnshire: 'gb',\n\tsurrey: 'gb',\n};\n\n/** All 249 ISO 3166-1 alpha-2 + alpha-3 pairs, packed to keep the browser table small.\n * Source: Unicode CLDR supplementalData.xml, territoryCodes (current ISO countries only).\n * https://raw.githubusercontent.com/unicode-org/cldr/main/common/supplemental/supplementalData.xml */\nconst ISO_COUNTRY_CODES = `adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel\nbfbfa bgbgr bhbhr bibdi bjben blblm bmbmu bnbrn bobol bqbes brbra bsbhs btbtn bvbvt bwbwa byblr bzblz cacan cccck cdcod\ncfcaf cgcog chche ciciv ckcok clchl cmcmr cnchn cocol crcri cucub cvcpv cwcuw cxcxr cycyp czcze dedeu djdji dkdnk dmdma\ndodom dzdza ececu eeest egegy ehesh ereri esesp eteth fifin fjfji fkflk fmfsm fofro frfra gagab gbgbr gdgrd gegeo gfguf\nggggy ghgha gigib glgrl gmgmb gngin gpglp gqgnq grgrc gssgs gtgtm gugum gwgnb gyguy hkhkg hmhmd hnhnd hrhrv hthti huhun\nididn ieirl ilisr imimn inind ioiot iqirq irirn isisl itita jejey jmjam jojor jpjpn keken kgkgz khkhm kikir kmcom knkna\nkpprk krkor kwkwt kycym kzkaz lalao lblbn lclca lilie lklka lrlbr lslso ltltu lulux lvlva lylby mamar mcmco mdmda memne\nmfmaf mgmdg mhmhl mkmkd mlmli mmmmr mnmng momac mpmnp mqmtq mrmrt msmsr mtmlt mumus mvmdv mwmwi mxmex mymys mzmoz nanam\nncncl nener nfnfk ngnga ninic nlnld nonor npnpl nrnru nuniu nznzl omomn papan peper pfpyf pgpng phphl pkpak plpol pmspm\npnpcn prpri pspse ptprt pwplw pypry qaqat rereu rorou rssrb rurus rwrwa sasau sbslb scsyc sdsdn seswe sgsgp shshn sisvn\nsjsjm sksvk slsle smsmr snsen sosom srsur ssssd ststp svslv sxsxm sysyr szswz tctca tdtcd tfatf tgtgo ththa tjtjk tktkl\ntltls tmtkm tntun toton trtur tttto tvtuv twtwn tztza uaukr uguga umumi ususa uyury uzuzb vavat vcvct veven vgvgb vivir\nvnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`;\n\n/** Each country's lower-case English name, ISO2 and ISO3 code, mapped to its ISO2 code. */\nlet codesByName: Map<string, string> | undefined;\nconst countryCodesByName = () => {\n\tif (codesByName) return codesByName;\n\tcodesByName = new Map();\n\tconst names = new Intl.DisplayNames(['en'], { type: 'region', fallback: 'none' });\n\tfor (const pair of ISO_COUNTRY_CODES.split(/\\s+/)) {\n\t\tconst code = pair.slice(0, 2);\n\t\tconst name = names.of(code.toUpperCase());\n\t\tif (name) codesByName.set(name.toLowerCase(), code);\n\t\tcodesByName.set(code, code);\n\t\tcodesByName.set(pair.slice(2), code);\n\t}\n\treturn codesByName;\n};\n\nconst alias = (aliases: Record<string, string>, name: string) =>\n\tObject.prototype.hasOwnProperty.call(aliases, name) ? aliases[name] : undefined;\n\nconst toCountryCode = (value: string) => {\n\tconst name = value.trim().toLowerCase();\n\tconst aliased = alias(COUNTRY_ALIASES, name);\n\tif (aliased) return aliased;\n\tconst country = /^[a-z]{2}-[a-z0-9]{1,3}$/.test(name) ? name.slice(0, 2) : name;\n\treturn countryCodesByName().get(country);\n};\n\n/**\n * The upper-case ISO2 code of the country a value names: its English name, an ISO2, ISO3 or subdivision code in any\n * case, or another name for it (\"UK\", \"England\", \"Republic of Ireland\"). Undefined for anything else, including\n * places within a country (\"Essex\"): the caller never guesses.\n */\nexport const countryCodeOf = (value: string): string | undefined => toCountryCode(value)?.toUpperCase();\n\n/**\n * The countries a hub's location search covers, as the geocoder's ISO codes, read from the free text its live\n * jobs give as their country (\"United Kingdom\", \"England\", \"GB\", \"GBR\", \"GB-CMA\", \"Republic of Ireland\"). Values\n * that name no country are left out. The caller chooses its own fallback when none is left.\n */\nexport const jobCountryCodes = (jobCountries: string[]): string[] => {\n\tconst codes = new Set(\n\t\tjobCountries.flatMap(value => alias(FEED_PLACE_ALIASES, value.trim().toLowerCase()) ?? toCountryCode(value) ?? []),\n\t);\n\treturn [...codes].sort();\n};\n"],"mappings":"AACA,IAAMA,EAA0C,CAC/C,GAAI,KACJ,gBAAiB,KACjB,QAAS,KACT,SAAU,KACV,MAAO,KACP,mBAAoB,KACpB,sBAAuB,KACvB,KAAM,KACN,gBAAiB,KACjB,2BAA4B,KAC5B,OAAQ,KACR,iBAAkB,KAClB,MAAO,KAEP,OAAQ,KACR,GAAI,IACL,EAGMC,EAA6C,CAElD,aAAc,KACd,OAAQ,IACT,EAKMC,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uDAetBC,EACEC,EAAqB,IAAM,CAChC,GAAID,EAAa,OAAOA,EACxBA,EAAc,IAAI,IAClB,IAAME,EAAQ,IAAI,KAAK,aAAa,CAAC,IAAI,EAAG,CAAE,KAAM,SAAU,SAAU,MAAO,CAAC,EAChF,QAAWC,KAAQJ,EAAkB,MAAM,KAAK,EAAG,CAClD,IAAMK,EAAOD,EAAK,MAAM,EAAG,CAAC,EACtBE,EAAOH,EAAM,GAAGE,EAAK,YAAY,CAAC,EACpCC,GAAML,EAAY,IAAIK,EAAK,YAAY,EAAGD,CAAI,EAClDJ,EAAY,IAAII,EAAMA,CAAI,EAC1BJ,EAAY,IAAIG,EAAK,MAAM,CAAC,EAAGC,CAAI,CACpC,CACA,OAAOJ,CACR,EAEMM,EAAQ,CAACC,EAAiCF,IAC/C,OAAO,UAAU,eAAe,KAAKE,EAASF,CAAI,EAAIE,EAAQF,CAAI,EAAI,OAEjEG,EAAiBC,GAAkB,CACxC,IAAMJ,EAAOI,EAAM,KAAK,EAAE,YAAY,EAChCC,EAAUJ,EAAMT,EAAiBQ,CAAI,EAC3C,GAAIK,EAAS,OAAOA,EACpB,IAAMC,EAAU,2BAA2B,KAAKN,CAAI,EAAIA,EAAK,MAAM,EAAG,CAAC,EAAIA,EAC3E,OAAOJ,EAAmB,EAAE,IAAIU,CAAO,CACxC,EAOaC,EAAiBH,GAAsCD,EAAcC,CAAK,GAAG,YAAY,EAOzFI,EAAmBC,GAIxB,CAAC,GAHM,IAAI,IACjBA,EAAa,QAAQL,GAASH,EAAMR,EAAoBW,EAAM,KAAK,EAAE,YAAY,CAAC,GAAKD,EAAcC,CAAK,GAAK,CAAC,CAAC,CAClH,CACgB,EAAE,KAAK","names":["COUNTRY_ALIASES","FEED_PLACE_ALIASES","ISO_COUNTRY_CODES","codesByName","countryCodesByName","names","pair","code","name","alias","aliases","toCountryCode","value","aliased","country","countryCodeOf","jobCountryCodes","jobCountries"]}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var on=Object.create;var ae=Object.defineProperty;var sn=Object.getOwnPropertyDescriptor;var an=Object.getOwnPropertyNames;var cn=Object.getPrototypeOf,ln=Object.prototype.hasOwnProperty;var pn=(t,n)=>()=>(t&&(n=t(t=0)),n);var et=(t,n)=>{for(var o in n)ae(t,o,{get:n[o],enumerable:!0})},tt=(t,n,o,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of an(n))!ln.call(t,l)&&l!==o&&ae(t,l,{get:()=>n[l],enumerable:!(s=sn(n,l))||s.enumerable});return t};var E=(t,n,o)=>(o=t!=null?on(cn(t)):{},tt(n||!t||!t.__esModule?ae(o,"default",{value:t,enumerable:!0}):o,t)),dn=t=>tt(ae({},"__esModule",{value:!0}),t);var Xt={};et(Xt,{jobCountryCodes:()=>We});var Qt,Or,H,Lr,Dr,We,ze=pn(()=>{"use strict";Qt={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"gb",lincolnshire:"gb",surrey:"gb","republic of ireland":"ie",eire:"ie","hong kong sar":"hk","united states of america":"us",turkey:"tr","czech republic":"cz",burma:"mm",kosovo:"xk",xk:"xk"},Or=`adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel
1
+ "use strict";var un=Object.create;var le=Object.defineProperty;var mn=Object.getOwnPropertyDescriptor;var gn=Object.getOwnPropertyNames;var hn=Object.getPrototypeOf,fn=Object.prototype.hasOwnProperty;var bn=(t,r)=>()=>(t&&(r=t(t=0)),r);var tt=(t,r)=>{for(var i in r)le(t,i,{get:r[i],enumerable:!0})},nt=(t,r,i,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of gn(r))!fn.call(t,p)&&p!==i&&le(t,p,{get:()=>r[p],enumerable:!(s=mn(r,p))||s.enumerable});return t};var w=(t,r,i)=>(i=t!=null?un(hn(t)):{},nt(r||!t||!t.__esModule?le(i,"default",{value:t,enumerable:!0}):i,t)),yn=t=>nt(le({},"__esModule",{value:!0}),t);var cn={};tt(cn,{countryCodeOf:()=>to,jobCountryCodes:()=>ze});var Qr,Zr,Xr,H,eo,sn,an,to,ze,Ye=bn(()=>{"use strict";Qr={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"gb","republic of ireland":"ie",eire:"ie","hong kong sar":"hk","united states of america":"us",turkey:"tr","czech republic":"cz",burma:"mm",kosovo:"xk",xk:"xk"},Zr={lincolnshire:"gb",surrey:"gb"},Xr=`adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel
2
2
  bfbfa bgbgr bhbhr bibdi bjben blblm bmbmu bnbrn bobol bqbes brbra bsbhs btbtn bvbvt bwbwa byblr bzblz cacan cccck cdcod
3
3
  cfcaf cgcog chche ciciv ckcok clchl cmcmr cnchn cocol crcri cucub cvcpv cwcuw cxcxr cycyp czcze dedeu djdji dkdnk dmdma
4
4
  dodom dzdza ececu eeest egegy ehesh ereri esesp eteth fifin fjfji fkflk fmfsm fofro frfra gagab gbgbr gdgrd gegeo gfguf
@@ -10,5 +10,5 @@ ncncl nener nfnfk ngnga ninic nlnld nonor npnpl nrnru nuniu nznzl omomn papan pe
10
10
  pnpcn prpri pspse ptprt pwplw pypry qaqat rereu rorou rssrb rurus rwrwa sasau sbslb scsyc sdsdn seswe sgsgp shshn sisvn
11
11
  sjsjm sksvk slsle smsmr snsen sosom srsur ssssd ststp svslv sxsxm sysyr szswz tctca tdtcd tfatf tgtgo ththa tjtjk tktkl
12
12
  tltls tmtkm tntun toton trtur tttto tvtuv twtwn tztza uaukr uguga umumi ususa uyury uzuzb vavat vcvct veven vgvgb vivir
13
- vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,Lr=()=>{if(H)return H;H=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let n of Or.split(/\s+/)){let o=n.slice(0,2),s=t.of(o.toUpperCase());s&&H.set(s.toLowerCase(),o),H.set(o,o),H.set(n.slice(2),o)}return H},Dr=t=>{let n=t.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(Qt,n))return Qt[n];let o=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(n)?n.slice(0,2):n;return Lr().get(o)},We=t=>[...new Set(t.flatMap(o=>Dr(o)??[]))].sort()});var Br={};et(Br,{ANALYTICS_EVENTS:()=>yt,ApiError:()=>F,InploiRpcClient:()=>Z,JOB_ALERT_FREQUENCIES:()=>He,NotFoundError:()=>B,ParsingError:()=>M,SchemaValidationError:()=>k,SdkError:()=>Re,UnauthorisedError:()=>U,addressSearchCountry:()=>en,blendAddressSuggestions:()=>Ze,consentStorageKey:()=>ge,createPlugin:()=>nt,createTalentBankClient:()=>zt,endpoint:()=>ne,generateUUID:()=>Y,getConsentAcceptance:()=>St,getJobCountries:()=>Ye,getOrCreateAnonymousId:()=>je,hashConsentConfig:()=>me,initialiseSdk:()=>bt,inploiBrandedLogger:()=>pe,isApiErrorWithData:()=>rt,isSdkError:()=>it,jobCountryCodes:()=>We,noLogging:()=>de,ready:()=>Yt,saveClosedRoleJobAlerts:()=>Zt,saveSearchEndpoint:()=>Ke,searchAddressSuggestions:()=>tn,setConsentAcceptance:()=>_t,typed:()=>O,validateEndpointInputs:()=>Le});module.exports=dn(Br);var ce="%c[inploi SDK]",le="color: #65BC67; font-weight: bold;",pe={warn:(...t)=>console.warn(ce,le,...t),error:(...t)=>console.error(ce,le,...t),info:(...t)=>console.info(ce,le,...t),log:(...t)=>console.log(ce,le,...t)},de={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var nt=t=>t;function Ie(t,n){if(!t)throw new Error(n)}function z(t,n){return n in t}var Kr=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var un="Unauthenticated",vn="This action is unauthorized.",N=class extends Error{constructor(o,s){super(o);this.status=s,this.name="ErrorWithStatus"}},B=class extends N{constructor(n){super(n??"Not found"),this.name="NotFoundError",this.status=404}},U=class extends N{constructor(n,o){super(n??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=o??401}},k=class extends N{constructor(o,s){let l=s?` in ${s}`:"";super(`Schema validation failed${l}`);this.issues=o;this.source=s;this.name="SchemaValidationError",this.status=400}},F=class extends N{constructor(o,s,l){super(o);this.data=l;this.name="ApiError",this.status=s??500}},rt=t=>t instanceof F&&t.data!==void 0,M=class extends N{constructor(o){super("Error parsing response into JSON.");this.response=o;this.name="ParsingError",this.status=o&&o.status>=300?o.status:500,this.contentType=new Headers(o?.headers).get("content-type")??void 0}};async function we(t){let o=new Headers(t.headers).get("content-type")?.replace(/;.*/,"").trim().toLowerCase();if(o&&o!=="application/json"&&!o.endsWith("+json"))throw new M(t);return t.json().catch(()=>{throw new M(t)})}var mn=["message","error","errors","exception","exceptions"];function gn(t){let n=[];if(typeof t=="object"&&t!==null){for(let o of mn)if(z(t,o)){let s=t[o];typeof s=="string"&&n.push(s),Array.isArray(s)&&s.every(l=>typeof l=="string")&&n.push(...s)}z(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&z(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&z(t.integration_response.error,"message")&&typeof t.integration_response.error.message=="string"&&n.push(t.integration_response.error.message)}return n.length===0&&n.push("Unknown error"),[...new Set(n)].join(", ")}function ke(t,n){if(n>=300){let o=gn(t);throw n===404?new B(o):o===un?new U("You are not authenticated.",n):o===vn?new U(o,n):new F(o,n,t)}}var ot=t=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(o,s={})=>{let l={...s,headers:{...s.headers,...n}},p=await fetch(`${t.baseUrl}${o}`,l);if(p.status===404)throw new B;let u=await we(p);return ke(u,p.status),u}}},Re={NotFound:B,Unauthorised:U,SchemaValidation:k,Api:F,JsonParsing:M};function it(t){return Object.values(Re).some(n=>t instanceof n)}var st="3.1.2";var ue={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},at={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},ct=st;var j="isdk_session",lt=`${j}-candidate_id`,pt=`${j}-consent`;var ve=new Map,Pe={get:t=>{if(ve.has(t))return ve.get(t)??null;try{return window.sessionStorage.getItem(t)}catch{return null}},set:(t,n)=>{try{window.sessionStorage.setItem(t,n),ve.delete(t)}catch{ve.set(t,n)}}};var Y=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16));var ut=7*24*60*60*1e3,vt=t=>{let n=new Date;return n.setTime(n.getTime()+ut),`${j}=${t};expires=${n.toUTCString()};path=/`},fn=(t,n)=>{let o=t.get("session_id");if(n||o)return o;let s=Pe.get(`${j}-session_id`);return typeof s=="string"?s:null},bn=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(lt);return typeof t=="string"&&t!==""?t:null}catch{return null}},yn=new RegExp(`(?:^|;\\s*)${j}=([^;]+)`),te=t=>{let n=t?t.headers.get("cookie"):document.cookie;return n?yn.exec(n)?.[1]??null:null},mt=()=>{try{let t=JSON.parse(window.localStorage.getItem(j)??"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch{return null}},dt=()=>te()??(new URL(location.href).searchParams.get("anonymous_id")?null:mt()),Sn=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",gt=t=>{if(document.cookie=vt(t)+Sn(),te()!==t)try{window.localStorage.setItem(j,JSON.stringify({id:t,expires:Date.now()+ut}))}catch{}},Ce=t=>{let n=t?t.url:location.href,{searchParams:o}=new URL(n);return{anonymous_id:t?te(t)??o.get("anonymous_id"):te()??o.get("anonymous_id")??mt(),session_id:fn(o,typeof window>"u")}},je=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=Ce().anonymous_id;if(t)return t;let n=Y(),o=Ce().anonymous_id;return o||(gt(n),n)},_n=t=>typeof t!="object"||t===null?null:{anonymous_id:"anonymous_id"in t&&typeof t.anonymous_id=="string"?t.anonymous_id:null,session_id:"session_id"in t&&typeof t.session_id=="string"?t.session_id:null},xn=t=>t==="about:client"?"":t,An={pathname:"/log",method:"POST",schema:{response:O(),body:O()}},ht=({rpcClient:t,logger:n,onEvent:o,persistence:s="device",siteKind:l})=>{let p=null,u=null,m=0,S=0,I=d=>s==="none"?{anonymous_id:null,session_id:d?null:p}:Ce(d),K=async(d,b,ie)=>{try{let W={library:{name:"inploi-sdk",version:ct},page:b},ee=I(d.request),se=s==="none"?null:bn(),y={anonymous_id:ee.anonymous_id,session_id:ee.session_id,candidate_id:se,event:d.event,sent_at:new Date().toISOString(),context:W,properties:d.properties,custom_properties:{...d.customProperties,...ie}},Ae=s==="none"?null:d.request?te(d.request):dt(),Qe=++m,nn=await t.request(An,{body:y,...d.keepalive&&{keepalive:!0}}),w=_n(nn);if(s==="none")return!d.request&&w?.session_id&&Qe>S&&(S=Qe,w.session_id!==y.session_id&&(p=w.session_id)),y.session_id=d.request?w?.session_id||null:p,o?.(y),{success:!0,data:y};let Te=d.request?Ae:dt(),rn=Te!==null&&Te!==Ae,Ee=Te??Ae,Xe=!rn&&(!Ee||!w?.anonymous_id||Ee===w.anonymous_id);return Xe?(w?.anonymous_id&&(y.anonymous_id=w.anonymous_id),w?.session_id&&(y.session_id=w.session_id)):y.anonymous_id=Ee,!d.request&&typeof window<"u"&&y.anonymous_id&&(Xe&&y.session_id&&Pe.set(`${j}-session_id`,y.session_id.toString()),gt(y.anonymous_id)),o?.(y),{success:!0,data:y}}catch(W){return n.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:W}}},D=Promise.resolve();return{log:async d=>{Ie(d.request||typeof window<"u","Cannot log on the server without a request. Please pass a request to `log`.");let b="request"in d&&d.request?{href:d.request.url,referrer:xn(d.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(d.page_context==="no_query"){let se=new URL(b.href),y=b.referrer?new URL(b.referrer):void 0;b={href:se.origin+se.pathname,referrer:y?y.origin+y.pathname:""}}s==="none"&&d.event==="FLOW_NODE"&&d.properties&&"trigger"in d.properties&&(d.properties.trigger==="pagehide"||d.properties.trigger==="hidden")&&(d={...d,keepalive:!0});let ie={event_id:Y(),consent_lane:s,site_kind:l};if(s==="device"||d.request||p||d.keepalive)return K(d,b,ie);let W=()=>K(d,b,ie),ee=D.then(W,W);return D=ee,ee},supportsNoQueryPageContext:!0,getHeaders:d=>{let b=new Headers;return s==="none"||!d?.anonymous_id||b.append("Set-Cookie",vt(d.anonymous_id)),b},getSessionInfo:I,getOrCreateAnonymousId:()=>s==="none"?u??(u=Y()):je()}};var ft=require("neoqs");function Oe(t,n,o){let s=t["~standard"].validate(n);if(s instanceof Promise)throw new TypeError("Async schema");if(s.issues)throw new k(s.issues,o);return s.value}function Tn(t,n,o){try{return{success:!0,output:Oe(t,n,o)}}catch(s){if(s instanceof k)return{success:!1,issues:s.issues,source:s.source};throw s}}var Z=class{constructor(n){if(this.baseUrl=ue[n.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),n.apiKey.type==="secret"){if(typeof window<"u")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",n.apiKey.key)}else this.headers.set("x-publishable-key",n.apiKey.key);this.logger=n.logger,this._environment=n.environment}get environment(){return this._environment}getFetchParams(n,o){let s=o.validateIn??!0,{searchParams:l,body:p}=s?Le(n,o):o,u=new URL(this.baseUrl),m=n.pathname;if("params"in o&&o.params)for(let[S,I]of Object.entries(o.params))m=m.replace(`:${S}`,String(I));return u.pathname=m,n.schema.searchParams&&(u.search=(0,ft.stringify)(l)),[u.toString(),{method:n.method,body:p?JSON.stringify(p):void 0,headers:this.headers,signal:o.signal,...o.keepalive&&{keepalive:!0}}]}async parseResponse(n,o){let s=await we(o.response);if(ke(s,o.response.status),!(o.validateOut??!0))return s;let p=Tn(n.schema.response,s,"response");if(!p.success)throw new k(p.issues,p.source);return p.output}async request(n,o){try{let s=this.getFetchParams(n,o),l=await fetch(...s);return await this.parseResponse(n,{response:l,validateOut:o.validateOut})}catch(s){throw s instanceof k?this.logger.error(s.message,s.issues):this.logger.error(s),s}}};function O(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function ne(t){return t}function Le(t,n){let o={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(o.searchParams=Oe(t.schema.searchParams,"searchParams"in n?n.searchParams:{})),t.schema.body&&(o.body=Oe(t.schema.body,"body"in n?n.body:{})),o}function bt({publishableKey:t,env:n,logger:o=pe,onEvent:s,persistence:l,siteKind:p}){let u=ot({baseUrl:ue[n],publishableKey:t}),m=o===!1?de:o,S=new Z({environment:n,apiKey:{type:"publishable",key:t},logger:m}),I=ht({rpcClient:S,logger:m,onEvent:s,persistence:l,siteKind:p});return{register:D=>D({logger:m,apiClient:u,analytics:I,rpcClient:S,publishableKey:t,env:n}),analytics:I,apiClient:u}}var yt={VIEW_PAGE:"A careers-site page shown (not a job page).",VIEW_JOB:"A job's own page shown; one per job id the page names.",PAGE_ENGAGEMENT:"A page view's attention summary, sent when the view is hidden or left.",VIEW_SEARCH:"A job search seen for two seconds.",SEARCH_SETTLE:"A searched query or filter with results, unchanged for five seconds.",SEARCH_RESULTS:"A search whose results returned, zero included; once per distinct query, filters, place and order.",SEARCH_PAGINATE:"A move to another page of search results.",SEARCH_JOB_CLICK:"A job opened from search results.",SAVE_JOB:"A job saved or unsaved by the candidate.",LINK_CLICK:"A tracked link clicked.",INTERACTION:"A tagged interaction (`tag` names it).",FLOW_START:"An application flow started.",FLOW_INTERACT:"The candidate's first answer in a flow.",FLOW_END:"An application flow ended.",FLOW_NODE:"The candidate's path through an application, summarised when it pauses or ends.",FLOW_SUBMIT:"An application submitted, with the outcome.",FLOW_REDIRECT:"A flow sent the candidate to an external apply page.",FEEDBACK:"A rating or comment.",ADDRESS_SHADOW_COMPARED:"Engineering telemetry: the address lookup's shadow comparison.",SUBMIT_FORM:"Declared but sent by nothing."};function me(t){let n=JSON.stringify({message:t.message,acceptLabel:t.acceptLabel??"",declineLabel:t.declineLabel??""}),o=5381;for(let s=0;s<n.length;s++)o=o*33^n.charCodeAt(s);return(o>>>0).toString(36)}function ge(t,n){return`${pt}:${t}:${n}`}function St(t,n){if(typeof window>"u")return!1;try{let o=ge(t,me(n));return window.localStorage.getItem(o)==="accepted"}catch{return!1}}function _t(t,n){if(!(typeof window>"u"))try{let o=ge(t,me(n));window.localStorage.setItem(o,"accepted")}catch{}}var a=E(require("valibot"),1),En=["agent","sdk","form","integration","migration"],In=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var wn=["screening","cv_match","interview","overall"],kn=["PENDING","IN_PROGRESS","COMPLETED","CANCELLED"],Rn=["agent"],Pn=["job","company"],Cn=["created_at","updated_at","score","interview_score"],jn=["asc","desc"],On=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Ln=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written","ats_submission_attempted","ats_submission_succeeded","ats_submission_failed","ats_retry_payload_purged","note","share","verdict","offer_terms","offer_sent","offer_accepted","offer_declined","offer_withdrawn","exported","message_held","message_sent","message_delivered","message_failed","message_uncertain","message_cancelled","message_not_sent","score_override"],Dn=["interview","not_for_me"],xt=a.picklist(Dn),Nn=["accept","reject"],At=a.picklist(Nn),Bn=["transient_pass_through","failed_ats_submission_hold","retention","erasure","demo_reset"],wo=a.picklist(Bn),Un=["pending","submitted","failed","not_required"],Fn=["user","system","automation","integration","candidate"],he=a.picklist(En),R=a.picklist(In),A=a.pipe(a.string(),a.trim(),a.minLength(1),a.maxLength(100)),fe=a.picklist(wn),Tt=a.picklist(kn),Et=a.picklist(Rn),It=a.picklist(Pn),wt=a.picklist(Cn),kt=a.picklist(jn),re=a.pipe(a.string(),a.trim(),a.minLength(1),a.maxLength(100)),be=a.picklist(On),De=a.picklist(Ln),Rt=a.picklist(Fn),q=a.picklist(Un);var h=a.variant("type",[a.object({type:a.literal("user"),id:a.pipe(a.string(),a.minLength(1)),email:a.pipe(a.string(),a.minLength(1)),name:a.pipe(a.string(),a.minLength(1))}),a.object({type:a.literal("system"),id:a.pipe(a.string(),a.minLength(1)),name:a.optional(a.string())}),a.object({type:a.literal("automation"),id:a.pipe(a.string(),a.minLength(1)),name:a.optional(a.string())}),a.object({type:a.literal("integration"),id:a.pipe(a.string(),a.minLength(1)),name:a.optional(a.string())}),a.object({type:a.literal("candidate"),id:a.pipe(a.string(),a.minLength(1)),email:a.optional(a.string())})]);var P=E(require("valibot"),1),Mn=P.object({total:P.number(),page:P.number(),perPage:P.number(),lastPage:P.number()});function Pt(t){return P.object({data:P.array(t),pagination:Mn})}var i=E(require("valibot"),1);function Ct(t){return/^\p{Zs}*\(?\p{Zs}*(\+|00)[\p{Zs}().-]*\d/u.test(t)}var Ne=i.object({id:i.string(),email:i.nullable(i.string()),firstName:i.nullable(i.string()),lastName:i.nullable(i.string()),phone:i.nullable(i.string()),source:i.nullable(he),identifiedAt:i.nullable(i.string()),createdAt:i.string(),updatedAt:i.string()}),qn=i.pipe(i.string(),i.trim(),i.minLength(1)),jt=64*1024,oe=i.pipe(i.string(),i.trim(),i.minLength(1),i.maxLength(500)),Vn=i.pipe(i.string(),i.regex(/^[A-Z]{2}$/)),Gn=i.pipe(i.string(),i.maxLength(500),i.check(t=>Ct(t.trim()),"phone must start with its country code (+ or 00)")),$n=i.pipe(i.string(),i.regex(/^[\w:-]+$/)),Jn=new Set(["__proto__","constructor","prototype"]),Hn=i.custom(t=>Yn(t),"custom answer must be a JSON value"),Oo=i.strictObject({firstName:i.nullable(i.string()),lastName:i.nullable(i.string()),email:i.string(),phone:i.nullable(i.string()),country:i.nullable(i.string()),postcode:i.nullable(i.string()),currentTitle:i.nullable(i.string()),currentEmployer:i.nullable(i.string()),custom:i.record(i.string(),i.unknown())});var Ot=i.strictObject({firstName:i.optional(oe),lastName:i.optional(oe),phone:i.optional(i.nullable(Gn)),country:i.optional(i.nullable(Vn)),postcode:i.optional(i.nullable(oe)),currentTitle:i.optional(i.nullable(oe)),currentEmployer:i.optional(i.nullable(oe)),custom:i.optional(i.pipe(i.custom(t=>Be(t)&&Object.keys(t).every(n=>!Jn.has(n))&&Zn(t)<=jt,`custom must be a JSON object of at most ${jt} bytes`),i.record($n,i.nullable(Hn))))}),Kn=i.pipe(i.custom(t=>Be(t)&&Object.keys(t).every(n=>Object.hasOwn(Ot.entries,n)),"set must be an object of profile fields"),Ot),Wn=i.strictObject({email:qn}),Lo=i.strictObject({identity:Wn,set:Kn,ifVersion:i.optional(i.pipe(i.number(),i.integer(),i.minValue(0))),disclosures:i.optional(i.unknown())}),zn=i.strictObject({noticeId:i.pipe(i.string(),i.minLength(1),i.maxLength(200)),version:i.pipe(i.string(),i.minLength(1),i.maxLength(64)),wordingHash:i.pipe(i.string(),i.minLength(1),i.maxLength(128))}),Do=i.variant("withdrawTalentPool",[i.strictObject({withdrawTalentPool:i.literal(!1)}),i.strictObject({withdrawTalentPool:i.literal(!0),notice:zn})]);function Be(t){if(typeof t!="object"||t===null)return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function Yn(t){try{return Lt(t,JSON.parse(JSON.stringify(t)))}catch{return!1}}function Lt(t,n){if(t===n)return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null||Array.isArray(t)!==Array.isArray(n)||!Array.isArray(t)&&!Be(t))return!1;let o=Object.keys(t);return o.length!==Object.keys(n).length?!1:o.every(s=>Object.hasOwn(n,s)&&Lt(t[s],n[s]))}function Zn(t){try{return new TextEncoder().encode(JSON.stringify(t)).length}catch{return Number.POSITIVE_INFINITY}}var r=E(require("valibot"),1);var f=E(require("valibot"),1),T=f.pipe(f.string(),f.minLength(1)),V=f.pipe(f.number(),f.integer(),f.minValue(1)),L=f.record(f.string(),f.unknown()),Qn="(?!\\.{1,2}(?:/|$))[A-Za-z0-9._-]{1,128}",Bo=f.pipe(f.string(),f.regex(new RegExp(`^${Qn}$`)));var _=E(require("valibot"),1);var Dt=_.object({id:_.string(),applicationId:_.string(),status:Tt,conductedBy:Et,agentInterviewId:_.nullable(_.string()),generatedScore:_.nullable(_.number()),completedAt:_.nullable(_.string()),meta:_.nullable(L),createdAt:_.string(),updatedAt:_.string()});var Xn=r.object({quote:r.string(),source:r.picklist(["cv","answer"])}),Ue=r.object({score:r.number(),reason:r.string(),confidence:r.number(),share:r.optional(r.number()),evidence:r.optional(r.array(Xn))}),Fe=r.object({categoryId:r.string(),answerKey:r.string(),reason:r.picklist(["unanswered","unrecognised"])}),Nt=r.object({id:r.string(),candidateId:r.string(),jobId:r.number(),stage:A,stageGroup:R,stageEnteredAt:r.string(),rating:r.nullable(r.number()),disqualifiedAt:r.nullable(r.string()),disqualificationReason:r.nullable(re),disqualificationNote:r.nullable(r.string()),source:be,sourceDetail:r.nullable(r.string()),sessionId:r.nullable(r.number()),externalApplicationId:r.nullable(r.string()),meta:r.nullable(L),context:r.nullable(L),scoredAt:r.nullable(r.string()),atsSubmissionStatus:r.optional(r.nullable(q)),atsSubmissionAttempts:r.optional(r.number()),atsNextAttemptAt:r.optional(r.nullable(r.string())),atsSubmittedAt:r.optional(r.nullable(r.string())),atsLastErrorCode:r.optional(r.nullable(r.string())),atsLastErrorMessage:r.optional(r.nullable(r.string())),createdAt:r.string(),updatedAt:r.string()}),er=r.object({id:r.string(),applicationId:r.string(),scoreType:fe,score:r.nullable(r.number()),reason:r.nullable(r.string()),categories:r.nullable(r.record(r.string(),Ue)),leftOut:r.optional(r.array(Fe)),scoredBy:r.nullable(r.string()),createdAt:r.string()}),G=r.object({...Nt.entries,candidate:r.nullable(Ne),score:r.nullable(er),interview:r.nullable(Dt)}),Ho=r.object({...Ne.entries,applications:r.array(Nt)}),Bt=r.object({id:r.string(),applicationId:r.string(),action:De,fromStage:r.nullable(A),fromStageGroup:r.nullable(R),toStage:r.nullable(A),toStageGroup:r.nullable(R),disqualificationReason:r.nullable(re),disqualificationNote:r.nullable(r.string()),actorId:r.nullable(r.string()),actorType:Rt,actorEmail:r.nullable(r.string()),actorName:r.nullable(r.string()),meta:r.nullable(L),schemaVersion:r.number(),createdAt:r.string()}),tr=500,Ut=r.object({scoreId:r.pipe(r.string(),r.minLength(1),r.maxLength(255)),scoredBy:r.pipe(r.string(),r.regex(/^scoring:[^:\s]{1,128}:[^:\s]{1,128}$/)),decision:At,reason:r.pipe(r.string(),r.maxLength(tr),r.check(t=>t.trim().length>0,"reason must not be blank")),score:r.pipe(r.number(),r.finite())}),nr=500,rr=200,Ko=r.strictObject({from:r.pipe(r.string(),r.isoTimestamp()),to:r.pipe(r.string(),r.isoTimestamp()),jobIds:r.pipe(r.array(r.pipe(r.number(),r.integer(),r.minValue(1))),r.minLength(1),r.maxLength(nr)),actions:r.optional(r.pipe(r.array(De),r.minLength(1))),cursor:r.nullable(r.pipe(r.string(),r.regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\|.{1,255}$/))),limit:r.pipe(r.number(),r.integer(),r.minValue(1),r.maxValue(rr))});var g=E(require("valibot"),1);var Ft=g.object({anonymousId:T,email:T,firstName:g.nullish(g.string()),lastName:g.nullish(g.string()),phone:g.nullish(g.string()),source:g.nullish(he),updateExisting:g.optional(g.boolean())}),Me=g.object({candidateId:g.string(),isNew:g.boolean()}),Zo=g.union([g.object({ok:g.literal(!0)}),Me]);var e=E(require("valibot"),1);var or=["note","share","verdict","offer_terms","offer_sent","offer_accepted","offer_declined","offer_withdrawn","exported","score_override"],ir=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate",...or],Se=e.picklist(ir),qe=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>n.trim()).filter(n=>n.length>0))),sr=e.pipe(qe,e.array(A)),ar=e.pipe(qe,e.array(R)),Mt=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>Number(n.trim())).filter(n=>Number.isInteger(n)&&n>0))),cr=e.pipe(qe,e.array(q)),qt=e.object({stages:e.optional(sr),stage_groups:e.optional(ar),job_id:e.optional(e.string()),job_ids:e.optional(Mt),candidate_id:e.optional(e.string()),is_disqualified:e.optional(e.picklist(["true","false"])),created_from:e.optional(e.string()),created_to:e.optional(e.string()),updated_from:e.optional(e.string()),updated_to:e.optional(e.string()),entered_stage_from:e.optional(e.string()),entered_stage_to:e.optional(e.string()),from:e.optional(e.string()),to:e.optional(e.string()),q:e.optional(e.string()),scored:e.optional(e.picklist(["true","false"])),ats_submission_status:e.optional(cr),sort:e.optional(wt),order:e.optional(kt),page:e.optional(e.string()),per_page:e.optional(e.string())}),Q=e.pipe(T,e.maxLength(255)),lr=e.object({status:e.picklist(["pending","not_required"]),integrationId:e.nullish(Q)}),ri=e.pipe(e.object({candidateId:T,disclosures:e.optional(e.unknown()),jobLocation:e.optional(e.unknown()),jobId:V,meta:e.nullish(L),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),externalJobId:e.nullish(e.pipe(T,e.maxLength(255))),context:e.nullish(L),source:e.nullish(be),sourceDetail:e.nullish(e.string()),stage:e.nullish(A),stageGroup:e.nullish(R),actor:e.nullish(h),atsSubmission:e.nullish(lr),duplicateScope:e.nullish(e.picklist(["job","attempt"]))}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together"),e.check(t=>t.duplicateScope!=="attempt"||typeof t.meta?.attempt_id=="string"&&t.meta.attempt_id!=="","duplicateScope attempt needs meta.attempt_id")),Vt=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),oi=e.union([e.object({ok:e.literal(!0),duplicate:e.literal(!1),applicationId:e.string(),candidateId:e.string(),atsHeld:e.optional(e.boolean())}),e.object({ok:e.literal(!0),duplicate:e.literal(!0),existingApplication:Vt,atsHeld:e.optional(e.boolean())}),e.object({ok:e.literal(!1),refused:e.literal("pass_through_untracked")})]),Gt=e.object({email:e.pipe(e.string(),e.minLength(1),e.maxLength(320)),scope:e.optional(It,"job"),jobId:e.optional(e.union([e.string(),e.number()]))}),$t=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(Vt)}),pr=Date.UTC(1e4,0,1),Jt=e.pipe(e.string(),e.regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})$/),e.check(t=>{let[n,o,s]=t.slice(0,10).split("-").map(Number),l=new Date(Date.UTC(n,o-1,s)),p=Date.parse(t);return l.getUTCMonth()===o-1&&l.getUTCDate()===s&&p>=0&&p<pr},"must be a real time")),Ve=e.pipe(e.string(),e.regex(/^[A-Za-z0-9_.:-]{1,100}$/)),ii=e.object({status:e.picklist(["pending","submitted","failed"]),nextAttemptAt:e.nullish(Jt),errorCode:e.nullish(Ve),errorMessage:e.nullish(e.pipe(e.string(),e.maxLength(1e4))),externalApplicationId:e.nullish(Q),externalRunId:e.nullish(Q),integrationId:e.nullish(Q),answeredPending:e.optional(e.boolean())}),dr=e.picklist(["invalid_transition","next_attempt_required","retry_hold_expired"]),si=e.variant("kind",[e.object({kind:e.literal("recorded"),application:G}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(q),to:q,reason:dr})]),ur=e.object({integrationId:e.string(),state:e.picklist(["closed","open","half_open"]),coolingUntil:e.nullable(e.string()),transientCount:e.number(),held:e.boolean()}),ai=e.object({groups:e.array(e.object({integrationId:e.nullable(e.string()),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),count:e.number(),retryable:e.number(),sendable:e.optional(e.number()),nextRetryUntil:e.optional(e.nullable(e.string()))})),oldestPendingAgeSeconds:e.nullable(e.number()),breakers:e.array(ur),restoreHold:e.optional(e.boolean())}),ci=e.object({status:e.picklist(["pending","failed"]),integrationId:e.nullable(Q),errorCode:e.nullable(Ve)}),li=e.object({rows:e.array(e.object({id:e.string(),jobId:e.number(),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),errorMessage:e.nullable(e.string()),attempts:e.number(),nextAttemptAt:e.nullable(e.string()),payloadHeld:e.boolean(),receivedAt:e.nullable(e.string()),retryUntil:e.nullable(e.string()),updatedAt:e.string()})),truncated:e.boolean()}),pi=e.object({actor:h,expectedAtsLogCount:e.optional(e.pipe(e.number(),e.integer(),e.minValue(0)))}),vr=e.picklist(["invalid_transition","retry_payload_missing","retry_hold_expired","stale"]),di=e.variant("kind",[e.object({kind:e.literal("retried"),application:G}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(q),reason:vr})]),ui=e.object({status:e.optional(e.picklist(["pending","failed"])),integrationId:e.nullable(Q),errorCode:e.nullable(Ve),actor:h}),vi=e.object({retried:e.number()});var mi=e.object({integrationId:e.string(),wasOpen:e.boolean()}),gi=e.object({integrationId:e.string(),wasHeld:e.boolean()}),hi=e.object({applicationId:T,scoreType:fe,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Ue)),leftOut:e.nullish(e.array(Fe)),scoredBy:e.nullish(e.string()),actor:e.nullish(h),idempotencyKey:e.nullish(e.pipe(e.string(),e.maxLength(255)))}),fi=e.object({scoreId:e.string()}),bi=Pt(G);var yi=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),Si=e.array(Bt),ye=e.object({stage:e.nullish(A),note:e.nullish(e.string())}),mr=e.object({stage:e.nullish(A),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),gr=e.pipe(e.string(),e.regex(/^[a-z0-9_.:-]{1,64}$/));var $=e.pipe(e.object({mode:e.picklist(["send","hold","none"]),templateKey:e.pipe(e.string(),e.regex(/^(received|rejection|interest_confirmation|campaign:invite|stage:[a-z0-9_-]{1,48})$/)),templateVersion:e.pipe(e.number(),e.integer(),e.minValue(1)),configVersionId:T,voice:e.optional(e.picklist(["casual","formal"])),holdUntil:e.optional(e.pipe(Jt,e.endsWith("Z","must be UTC with a Z suffix"),e.check(t=>Date.parse(t)>Date.now(),"must be in the future"))),subject:e.optional(e.pipe(e.string(),e.maxLength(200))),body:e.optional(e.pipe(e.string(),e.maxLength(2e4)))}),e.check(t=>t.mode==="hold"||t.holdUntil===void 0,"holdUntil is only for hold mode"),e.transform(({subject:t,body:n,...o})=>({...o,...t===void 0||t===""?{}:{subject:t},...n===void 0||n===""?{}:{body:n}}))),hr=e.variant("action",[e.object({action:e.literal("note"),actor:h,message:e.optional(e.never()),meta:e.object({note:T})}),e.object({action:e.literal("share"),actor:h,message:e.optional(e.never()),meta:e.object({subjectUserIds:e.pipe(e.array(T),e.minLength(1),e.maxLength(20)),comment:e.optional(e.string())})}),e.object({action:e.literal("verdict"),actor:h,message:e.optional(e.never()),meta:e.object({code:xt,comment:e.optional(e.string())})}),e.object({action:e.literal("offer_terms"),actor:h,message:e.optional(e.never()),meta:e.object({salary:e.optional(e.string()),startDate:e.optional(e.string()),hours:e.optional(e.string())})}),...["offer_sent","offer_accepted","offer_declined","offer_withdrawn"].map(t=>e.object({action:e.literal(t),actor:h,message:e.optional(e.never()),meta:e.object({reason:e.optional(e.string())})})),e.object({action:e.literal("exported"),actor:h,message:e.optional(e.never()),meta:e.object({presetId:gr,exportId:T})}),e.object({action:e.literal("score_override"),actor:h,message:e.optional(e.never()),meta:e.pipe(Ut,e.transform(t=>({...t,reason:t.reason.trim()})))})]),fr=e.variant("action",[hr,e.object({action:e.literal("shortlist"),actor:h,message:e.optional($),meta:e.nullish(ye)}),e.object({action:e.literal("move_to_interview"),actor:h,message:e.optional($),meta:e.nullish(ye)}),e.object({action:e.literal("make_offer"),actor:h,message:e.optional($),meta:e.nullish(ye)}),e.object({action:e.literal("hire"),actor:h,message:e.optional($),meta:e.nullish(mr)}),e.object({action:e.literal("withdraw"),actor:h,message:e.optional(e.never()),meta:e.nullish(ye)}),e.object({action:e.literal("move_to_stage"),actor:h,message:e.optional(e.never()),meta:e.object({stage:A,stageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:h,message:e.optional($),meta:e.object({toStage:A,toStageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:h,message:e.optional($),meta:e.object({reason:re,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:h,message:e.optional($),meta:e.object({toStage:A,toStageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("rate"),actor:h,message:e.optional(e.never()),meta:e.object({rating:e.nullable(e.pipe(e.number(),e.integer(),e.minValue(1),e.maxValue(5)))})})]),_i=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:fr}),Ht=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),xi=e.variant("kind",[e.object({kind:e.literal("updated"),action:Se,application:G}),e.object({kind:e.literal("skipped"),action:Se,applicationId:e.string(),reason:Ht})]),Ai=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:Se,application:G})),skipped:e.array(e.object({kind:e.literal("skipped"),action:Se,applicationId:e.string(),reason:Ht})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),v=e.pipe(e.number(),e.integer(),e.minValue(0)),Kt=e.object({APPLIED:v,SHORTLISTED:v,INTERVIEWED:v,OFFERED:v,HIRED:v,REJECTED:v,WITHDRAWN:v}),br=e.pipe(e.string(),e.minLength(1),e.maxLength(255)),Ti=e.object({pendingShares:e.optional(e.boolean())}),Ei=e.object({job_ids:Mt,verdict_by:e.optional(br),pending_shares:e.optional(e.literal("1"))}),Ii=e.object({counts:e.record(e.string(),Kt),existingAppliedCounts:e.optional(e.record(e.string(),v)),awaitingVerdictCounts:e.optional(e.record(e.string(),v)),pendingShareCounts:e.optional(e.record(e.string(),v))}),wi=e.omit(qt,["sort","order","page","per_page"]),ki=e.object({counts:Kt}),Wt=92,yr=864e5,C=e.pipe(e.string(),e.regex(/^\d{4}-\d{2}-\d{2}$/),e.check(t=>{let n=new Date(`${t}T00:00:00Z`);return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t},"must be a real calendar day"));function Ge({from:t,to:n}){let o=(Date.parse(`${n}T00:00:00Z`)-Date.parse(`${t}T00:00:00Z`))/yr+1;return o>=1&&o<=Wt}var $e=`to must be on or after from, and the range must span at most ${Wt} days`,Ri=e.pipe(e.object({from:C,to:C}),e.check(Ge,$e)),Sr=e.object({job_id:V,date:C,received:v,scored:v,shortlisted:v}),Pi=e.object({rows:e.array(Sr)}),_r=5e3,Ci=e.pipe(e.object({from:C,to:C,jobIds:e.pipe(e.array(V),e.maxLength(_r))}),e.check(Ge,$e)),xr=e.object({job_id:V,date:C,received:v}),ji=e.object({rows:e.array(xr)}),Ar=5e3,Tr=e.pipe(e.object({from:C,to:C,jobIds:e.optional(e.pipe(e.array(V),e.maxLength(Ar)))}),e.check(Ge,$e)),Oi=e.pipe(e.object({from:e.string(),to:e.string(),job_ids:e.optional(e.string())}),e.transform(({from:t,to:n,job_ids:o})=>({from:t,to:n,jobIds:o===void 0?void 0:o===""?[]:o.split(",").map(s=>/^\d+$/.test(s.trim())?Number(s):Number.NaN)})),Tr),Je=e.pipe(e.array(v),e.length(5)),Er=e.object({received:v,scored:v,shortlisted:v,histogram:e.pipe(e.array(v),e.length(101)),median_lag_minutes:e.nullable(e.number()),scored_same_day:v}),Ir=e.object({job_id:V,received:v,scored:v,shortlisted:v,score_sum:e.number(),bands:Je}),wr=e.object({date:C,received:v,scored:v,score_sum:e.number(),bands:Je,scored_on_day:v}),kr=e.object({id:e.string(),label:e.nullable(e.string()),sum:e.number(),count:v}),Rr=e.object({template_id:e.string(),scored:v,criteria:e.array(kr)}),Li=e.object({totals:Er,by_job:e.array(Ir),by_day:e.array(wr),criteria:e.array(Rr)}),Pr=e.object({date:C,scored:v,bands:Je}),Di=e.object({rows:e.array(Pr)});var Ni=e.object({...e.omit(qt,["page","per_page"]).entries,per_group:e.optional(e.string())}),J=e.object({data:e.array(G),total:v}),Bi=e.object({board:e.object({APPLIED:J,SHORTLISTED:J,INTERVIEWED:J,OFFERED:J,HIRED:J,REJECTED:J,WITHDRAWN:J})});var X=E(require("valibot"));var zt=({environment:t,publishableKey:n,logger:o})=>{let s=at[t];return{async checkDuplicate(l){let p;try{p=X.parse(Gt,{email:l.email,scope:l.scope,...l.scope==="job"&&l.jobId!=null?{jobId:l.jobId}:{}})}catch{return o.error("[TalentBankClient] checkDuplicate input failed validation"),{isDuplicate:!1}}try{let u=await fetch(`${s}/applications/check-duplicate`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":n},body:JSON.stringify(p)});if(!u.ok)return o.error(`[TalentBankClient] checkDuplicate failed with status ${u.status}`),{isDuplicate:!1};let m=await u.json(),S=X.safeParse($t,m);return S.success?S.output:(o.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof m=="object"&&m!=null&&typeof m.isDuplicate=="boolean"?{isDuplicate:m.isDuplicate}:{isDuplicate:!1})}catch(u){return o.error("[TalentBankClient] checkDuplicate failed:",u),{isDuplicate:!1}}},async identify(l){try{if(!l.anonymousId)return o.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let p={email:l.email,firstName:l.firstName,lastName:l.lastName,phone:l.phone,anonymousId:l.anonymousId,source:l.source??"sdk"},u=X.safeParse(Ft,p);if(!u.success)return o.error("[TalentBankClient] identify received invalid input"),null;let m=await fetch(`${s}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":n},body:JSON.stringify(u.output)});if(!m.ok)return o.error(`[TalentBankClient] identify failed with status ${m.status}`),null;let S=X.safeParse(Me,await m.json());return S.success?S.output:(o.error("[TalentBankClient] identify returned an invalid response"),null)}catch(p){return o.error("[TalentBankClient] identify failed:",p),null}}}};function Yt(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var c=E(require("valibot"));var He=["DAILY","WEEKLY","MONTHLY"],Cr=c.record(c.string(),c.union([c.string(),c.array(c.string()),c.object({type:c.literal("provided"),lat:c.number(),lng:c.number(),radius:c.number(),unit:c.optional(c.picklist(["miles","km"])),label:c.optional(c.string())})])),jr={pathname:"/job/:id",method:"GET",schema:{response:c.object({id:c.number(),external_id:c.nullish(c.string()),city:c.nullish(c.string()),town:c.nullish(c.string()),category:c.nullish(c.string())})}};async function Zt(t,{contact:n,job:o}){let s={};if(o){let l=await t.request(jr,{params:{id:o.id}});if((o.id_type==="internal"?String(l.id):l.external_id)!==o.id)throw new Error("Job lookup returned a different role");for(let u of["city","town","category"]){let m=l[u]?.trim();m&&(s[u]=[m])}}await t.request(Ke,{body:{contact:n,alerts:"WEEKLY",filters:s}})}var Ke={pathname:"/search/save",method:"POST",schema:{response:O(),body:c.object({contact:c.object({email:c.pipe(c.optional(c.string()),c.string(),c.email()),first_name:c.optional(c.string()),last_name:c.optional(c.string())}),alerts:c.pipe(c.optional(c.string()),c.string(),c.picklist(He)),filters:Cr})}};var x=E(require("valibot"));var Ye=async t=>{let n={method:"GET",pathname:"/search/filters",schema:{response:x.pipe(x.object({country:x.optional(x.array(x.object({value:x.string()})),[])}),x.transform(({country:o})=>o.map(({value:s})=>s))),searchParams:O()}};return t.request(n,{searchParams:{filters:{country:null}}})},_e=new WeakMap,en=t=>(_e.has(t)||(_e.set(t,void 0),Ye(t).then(async n=>{let{jobCountryCodes:o}=await Promise.resolve().then(()=>(ze(),Xt));_e.set(t,o(n).join(",")||void 0)}).catch(()=>{})),_e.get(t)),Ze=(t,n)=>{let o=new Set,s=[];for(let l=0;l<Math.max(t.length,n.length);l++)for(let p of[t[l],n[l]]){if(!p)continue;let u=p.mapbox_id||p.full_address||[p.name,p.place_formatted].filter(Boolean).join(", ");if(!o.has(u)&&(o.add(u),s.push(p),s.length===5))return s}return s},Nr=600,tn=async(t,n,o)=>{if(o?.throwIfAborted(),!n){let s=await t();return o?.throwIfAborted(),s}return new Promise((s,l)=>{let p,u,m,S=!1,I=()=>{S=!0,clearTimeout(m),o?.removeEventListener("abort",K)},K=()=>{I(),l(o?.reason)},D=()=>{I(),p?.status==="fulfilled"&&u?.status==="fulfilled"?s(Ze(p.value,u.value)):p?.status==="fulfilled"?s(p.value):u?.status==="fulfilled"?s(u.value):p?.status==="rejected"&&l(p.reason)},xe=(d,b)=>{S||(d?p=b:u=b,p&&u?D():b.status==="fulfilled"&&b.value.length>0&&(m=setTimeout(D,Nr)))};o?.addEventListener("abort",K,{once:!0});for(let d of[!0,!1])t(d?n:void 0).then(b=>xe(d,{status:"fulfilled",value:b}),b=>xe(d,{status:"rejected",reason:b}))})};ze();0&&(module.exports={ANALYTICS_EVENTS,ApiError,InploiRpcClient,JOB_ALERT_FREQUENCIES,NotFoundError,ParsingError,SchemaValidationError,SdkError,UnauthorisedError,addressSearchCountry,blendAddressSuggestions,consentStorageKey,createPlugin,createTalentBankClient,endpoint,generateUUID,getConsentAcceptance,getJobCountries,getOrCreateAnonymousId,hashConsentConfig,initialiseSdk,inploiBrandedLogger,isApiErrorWithData,isSdkError,jobCountryCodes,noLogging,ready,saveClosedRoleJobAlerts,saveSearchEndpoint,searchAddressSuggestions,setConsentAcceptance,typed,validateEndpointInputs});
13
+ vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,eo=()=>{if(H)return H;H=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let r of Xr.split(/\s+/)){let i=r.slice(0,2),s=t.of(i.toUpperCase());s&&H.set(s.toLowerCase(),i),H.set(i,i),H.set(r.slice(2),i)}return H},sn=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)?t[r]:void 0,an=t=>{let r=t.trim().toLowerCase(),i=sn(Qr,r);if(i)return i;let s=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(r)?r.slice(0,2):r;return eo().get(s)},to=t=>an(t)?.toUpperCase(),ze=t=>[...new Set(t.flatMap(i=>sn(Zr,i.trim().toLowerCase())??an(i)??[]))].sort()});var ro={};tt(ro,{ANALYTICS_EVENTS:()=>St,ApiError:()=>V,InploiRpcClient:()=>Z,JOB_ALERT_FREQUENCIES:()=>He,NotFoundError:()=>U,ParsingError:()=>q,SchemaValidationError:()=>C,SdkError:()=>Ce,UnauthorisedError:()=>F,addressSearchCountry:()=>ln,blendAddressSuggestions:()=>Ze,consentStorageKey:()=>fe,createPlugin:()=>rt,createTalentBankClient:()=>nn,endpoint:()=>ne,generateUUID:()=>Q,getConsentAcceptance:()=>_t,getJobCountries:()=>Qe,getOrCreateAnonymousId:()=>Le,hashConsentConfig:()=>he,initialiseSdk:()=>yt,inploiBrandedLogger:()=>ve,isApiErrorWithData:()=>ot,isSdkError:()=>st,jobCountryCodes:()=>ze,noLogging:()=>ue,ready:()=>rn,saveClosedRoleJobAlerts:()=>on,saveSearchEndpoint:()=>Ke,searchAddressSuggestions:()=>pn,setConsentAcceptance:()=>xt,typed:()=>L,validateEndpointInputs:()=>Ne});module.exports=yn(ro);var pe="%c[inploi SDK]",de="color: #65BC67; font-weight: bold;",ve={warn:(...t)=>console.warn(pe,de,...t),error:(...t)=>console.error(pe,de,...t),info:(...t)=>console.info(pe,de,...t),log:(...t)=>console.log(pe,de,...t)},ue={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var rt=t=>t;function ke(t,r){if(!t)throw new Error(r)}function Y(t,r){return r in t}var mo=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Sn="Unauthenticated",_n="This action is unauthorized.",B=class extends Error{constructor(i,s){super(i);this.status=s,this.name="ErrorWithStatus"}},U=class extends B{constructor(r){super(r??"Not found"),this.name="NotFoundError",this.status=404}},F=class extends B{constructor(r,i){super(r??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=i??401}},C=class extends B{constructor(i,s){let p=s?` in ${s}`:"";super(`Schema validation failed${p}`);this.issues=i;this.source=s;this.name="SchemaValidationError",this.status=400}},V=class extends B{constructor(i,s,p){super(i);this.data=p;this.name="ApiError",this.status=s??500}},ot=t=>t instanceof V&&t.data!==void 0,q=class extends B{constructor(i){super("Error parsing response into JSON.");this.response=i;this.name="ParsingError",this.status=i&&i.status>=300?i.status:500,this.contentType=new Headers(i?.headers).get("content-type")??void 0}};async function Re(t){let i=new Headers(t.headers).get("content-type")?.replace(/;.*/,"").trim().toLowerCase();if(i&&i!=="application/json"&&!i.endsWith("+json"))throw new q(t);return t.json().catch(()=>{throw new q(t)})}var xn=["message","error","errors","exception","exceptions"];function An(t){let r=[];if(typeof t=="object"&&t!==null){for(let i of xn)if(Y(t,i)){let s=t[i];typeof s=="string"&&r.push(s),Array.isArray(s)&&s.every(p=>typeof p=="string")&&r.push(...s)}Y(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&Y(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&Y(t.integration_response.error,"message")&&typeof t.integration_response.error.message=="string"&&r.push(t.integration_response.error.message)}return r.length===0&&r.push("Unknown error"),[...new Set(r)].join(", ")}function Pe(t,r){if(r>=300){let i=An(t);throw r===404?new U(i):i===Sn?new F("You are not authenticated.",r):i===_n?new F(i,r):new V(i,r,t)}}var it=t=>{let r={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(i,s={})=>{let p={...s,headers:{...s.headers,...r}},d=await fetch(`${t.baseUrl}${i}`,p);if(d.status===404)throw new U;let u=await Re(d);return Pe(u,d.status),u}}},Ce={NotFound:U,Unauthorised:F,SchemaValidation:C,Api:V,JsonParsing:q};function st(t){return Object.values(Ce).some(r=>t instanceof r)}var at="3.1.3";var me={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},ct={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},lt=at;var O="isdk_session",pt=`${O}-candidate_id`,dt=`${O}-consent`;var ge=new Map,je={get:t=>{if(ge.has(t))return ge.get(t)??null;try{return window.sessionStorage.getItem(t)}catch{return null}},set:(t,r)=>{try{window.sessionStorage.setItem(t,r),ge.delete(t)}catch{ge.set(t,r)}}};var Q=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16));var ut=7*24*60*60*1e3,mt=t=>{let r=new Date;return r.setTime(r.getTime()+ut),`${O}=${t};expires=${r.toUTCString()};path=/`},In=(t,r)=>{let i=t.get("session_id");if(r||i)return i;let s=je.get(`${O}-session_id`);return typeof s=="string"?s:null},En=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(pt);return typeof t=="string"&&t!==""?t:null}catch{return null}},wn=new RegExp(`(?:^|;\\s*)${O}=([^;]+)`),te=t=>{let r=t?t.headers.get("cookie"):document.cookie;return r?wn.exec(r)?.[1]??null:null},gt=()=>{try{let t=JSON.parse(window.localStorage.getItem(O)??"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch{return null}},vt=()=>te()??(new URL(location.href).searchParams.get("anonymous_id")?null:gt()),kn=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",ht=t=>{if(document.cookie=mt(t)+kn(),te()!==t)try{window.localStorage.setItem(O,JSON.stringify({id:t,expires:Date.now()+ut}))}catch{}},Oe=t=>{let r=t?t.url:location.href,{searchParams:i}=new URL(r);return{anonymous_id:t?te(t)??i.get("anonymous_id"):te()??i.get("anonymous_id")??gt(),session_id:In(i,typeof window>"u")}},Le=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=Oe().anonymous_id;if(t)return t;let r=Q(),i=Oe().anonymous_id;return i||(ht(r),r)},Rn=t=>typeof t!="object"||t===null?null:{anonymous_id:"anonymous_id"in t&&typeof t.anonymous_id=="string"?t.anonymous_id:null,session_id:"session_id"in t&&typeof t.session_id=="string"?t.session_id:null},Pn=t=>t==="about:client"?"":t,Cn={pathname:"/log",method:"POST",schema:{response:L(),body:L()}},ft=({rpcClient:t,logger:r,onEvent:i,persistence:s="device",siteKind:p})=>{let d=null,u=null,h=0,_=0,R=v=>s==="none"?{anonymous_id:null,session_id:v?null:d}:Oe(v),K=async(v,y,ae)=>{try{let z={library:{name:"inploi-sdk",version:lt},page:y},ee=R(v.request),ce=s==="none"?null:En(),S={anonymous_id:ee.anonymous_id,session_id:ee.session_id,candidate_id:ce,event:v.event,sent_at:new Date().toISOString(),context:z,properties:v.properties,custom_properties:{...v.customProperties,...ae}},Ie=s==="none"?null:v.request?te(v.request):vt(),Xe=++h,dn=await t.request(Cn,{body:S,...v.keepalive&&{keepalive:!0}}),P=Rn(dn);if(s==="none")return!v.request&&P?.session_id&&Xe>_&&(_=Xe,P.session_id!==S.session_id&&(d=P.session_id)),S.session_id=v.request?P?.session_id||null:d,i?.(S),{success:!0,data:S};let Ee=v.request?Ie:vt(),vn=Ee!==null&&Ee!==Ie,we=Ee??Ie,et=!vn&&(!we||!P?.anonymous_id||we===P.anonymous_id);return et?(P?.anonymous_id&&(S.anonymous_id=P.anonymous_id),P?.session_id&&(S.session_id=P.session_id)):S.anonymous_id=we,!v.request&&typeof window<"u"&&S.anonymous_id&&(et&&S.session_id&&je.set(`${O}-session_id`,S.session_id.toString()),ht(S.anonymous_id)),i?.(S),{success:!0,data:S}}catch(z){return r.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:z}}},N=Promise.resolve();return{log:async v=>{ke(v.request||typeof window<"u","Cannot log on the server without a request. Please pass a request to `log`.");let y="request"in v&&v.request?{href:v.request.url,referrer:Pn(v.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(v.page_context==="no_query"){let ce=new URL(y.href),S=y.referrer?new URL(y.referrer):void 0;y={href:ce.origin+ce.pathname,referrer:S?S.origin+S.pathname:""}}s==="none"&&v.event==="FLOW_NODE"&&v.properties&&"trigger"in v.properties&&(v.properties.trigger==="pagehide"||v.properties.trigger==="hidden")&&(v={...v,keepalive:!0});let ae={event_id:Q(),consent_lane:s,site_kind:p};if(s==="device"||v.request||d||v.keepalive)return K(v,y,ae);let z=()=>K(v,y,ae),ee=N.then(z,z);return N=ee,ee},supportsNoQueryPageContext:!0,getHeaders:v=>{let y=new Headers;return s==="none"||!v?.anonymous_id||y.append("Set-Cookie",mt(v.anonymous_id)),y},getSessionInfo:R,getOrCreateAnonymousId:()=>s==="none"?u??(u=Q()):Le()}};var bt=require("neoqs");function De(t,r,i){let s=t["~standard"].validate(r);if(s instanceof Promise)throw new TypeError("Async schema");if(s.issues)throw new C(s.issues,i);return s.value}function jn(t,r,i){try{return{success:!0,output:De(t,r,i)}}catch(s){if(s instanceof C)return{success:!1,issues:s.issues,source:s.source};throw s}}var Z=class{constructor(r){if(this.baseUrl=me[r.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),r.apiKey.type==="secret"){if(typeof window<"u")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",r.apiKey.key)}else this.headers.set("x-publishable-key",r.apiKey.key);this.logger=r.logger,this._environment=r.environment}get environment(){return this._environment}getFetchParams(r,i){let s=i.validateIn??!0,{searchParams:p,body:d}=s?Ne(r,i):i,u=new URL(this.baseUrl),h=r.pathname;if("params"in i&&i.params)for(let[_,R]of Object.entries(i.params))h=h.replace(`:${_}`,String(R));return u.pathname=h,r.schema.searchParams&&(u.search=(0,bt.stringify)(p)),[u.toString(),{method:r.method,body:d?JSON.stringify(d):void 0,headers:this.headers,signal:i.signal,...i.keepalive&&{keepalive:!0}}]}async parseResponse(r,i){let s=await Re(i.response);if(Pe(s,i.response.status),!(i.validateOut??!0))return s;let d=jn(r.schema.response,s,"response");if(!d.success)throw new C(d.issues,d.source);return d.output}async request(r,i){try{let s=this.getFetchParams(r,i),p=await fetch(...s);return await this.parseResponse(r,{response:p,validateOut:i.validateOut})}catch(s){throw s instanceof C?this.logger.error(s.message,s.issues):this.logger.error(s),s}}};function L(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function ne(t){return t}function Ne(t,r){let i={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(i.searchParams=De(t.schema.searchParams,"searchParams"in r?r.searchParams:{})),t.schema.body&&(i.body=De(t.schema.body,"body"in r?r.body:{})),i}function yt({publishableKey:t,env:r,logger:i=ve,onEvent:s,persistence:p,siteKind:d}){let u=it({baseUrl:me[r],publishableKey:t}),h=i===!1?ue:i,_=new Z({environment:r,apiKey:{type:"publishable",key:t},logger:h}),R=ft({rpcClient:_,logger:h,onEvent:s,persistence:p,siteKind:d});return{register:N=>N({logger:h,apiClient:u,analytics:R,rpcClient:_,publishableKey:t,env:r}),analytics:R,apiClient:u}}var St={VIEW_PAGE:"A careers-site page shown (not a job page).",VIEW_JOB:"A job's own page shown; one per job id the page names.",PAGE_ENGAGEMENT:"A page view's attention summary, sent when the view is hidden or left.",VIEW_SEARCH:"A job search seen for two seconds.",SEARCH_SETTLE:"A searched query or filter with results, unchanged for five seconds.",SEARCH_RESULTS:"A search whose results returned, zero included; once per distinct query, filters, place and order.",SEARCH_PAGINATE:"A move to another page of search results.",SEARCH_JOB_CLICK:"A job opened from search results.",SAVE_JOB:"A job saved or unsaved by the candidate.",LINK_CLICK:"A tracked link clicked.",INTERACTION:"A tagged interaction (`tag` names it).",FLOW_START:"An application flow started.",FLOW_INTERACT:"The candidate's first answer in a flow.",FLOW_END:"An application flow ended.",FLOW_NODE:"The candidate's path through an application, summarised when it pauses or ends.",FLOW_SUBMIT:"An application submitted, with the outcome.",FLOW_REDIRECT:"A flow sent the candidate to an external apply page.",FEEDBACK:"A rating or comment.",ADDRESS_SHADOW_COMPARED:"Engineering telemetry: the address lookup's shadow comparison.",SUBMIT_FORM:"Declared but sent by nothing."};function he(t){let r=JSON.stringify({message:t.message,acceptLabel:t.acceptLabel??"",declineLabel:t.declineLabel??""}),i=5381;for(let s=0;s<r.length;s++)i=i*33^r.charCodeAt(s);return(i>>>0).toString(36)}function fe(t,r){return`${dt}:${t}:${r}`}function _t(t,r){if(typeof window>"u")return!1;try{let i=fe(t,he(r));return window.localStorage.getItem(i)==="accepted"}catch{return!1}}function xt(t,r){if(!(typeof window>"u"))try{let i=fe(t,he(r));window.localStorage.setItem(i,"accepted")}catch{}}var c=w(require("valibot"),1),On=["agent","sdk","form","integration","migration"],Ln=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var Dn=["screening","cv_match","interview","overall"],Nn=["PENDING","IN_PROGRESS","COMPLETED","CANCELLED"],Bn=["agent"],Un=["job","company"],Fn=["created_at","updated_at","score","interview_score"],Vn=["asc","desc"],qn=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Mn=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written","ats_submission_attempted","ats_submission_succeeded","ats_submission_failed","ats_retry_payload_purged","note","share","verdict","offer_terms","offer_sent","offer_accepted","offer_declined","offer_withdrawn","exported","message_held","message_sent","message_delivered","message_failed","message_uncertain","message_cancelled","message_not_sent","score_override"],Gn=["interview","not_for_me"],At=c.picklist(Gn),Jn=["accept","reject"],Tt=c.picklist(Jn),$n=["transient_pass_through","failed_ats_submission_hold","retention","erasure","demo_reset"],Ho=c.picklist($n),Wn=["pending","submitted","failed","not_required"],Hn=["user","system","automation","integration","candidate"],be=c.picklist(On),I=c.picklist(Ln),x=c.pipe(c.string(),c.trim(),c.minLength(1),c.maxLength(100)),ye=c.picklist(Dn),It=c.picklist(Nn),Et=c.picklist(Bn),wt=c.picklist(Un),kt=c.picklist(Fn),Rt=c.picklist(Vn),re=c.pipe(c.string(),c.trim(),c.minLength(1),c.maxLength(100)),Se=c.picklist(qn),oe=c.picklist(Mn),Pt=c.picklist(Hn),M=c.picklist(Wn);var b=c.variant("type",[c.object({type:c.literal("user"),id:c.pipe(c.string(),c.minLength(1)),email:c.pipe(c.string(),c.minLength(1)),name:c.pipe(c.string(),c.minLength(1))}),c.object({type:c.literal("system"),id:c.pipe(c.string(),c.minLength(1)),name:c.optional(c.string())}),c.object({type:c.literal("automation"),id:c.pipe(c.string(),c.minLength(1)),name:c.optional(c.string())}),c.object({type:c.literal("integration"),id:c.pipe(c.string(),c.minLength(1)),name:c.optional(c.string())}),c.object({type:c.literal("candidate"),id:c.pipe(c.string(),c.minLength(1)),email:c.optional(c.string())})]);var j=w(require("valibot"),1),Kn=j.object({total:j.number(),page:j.number(),perPage:j.number(),lastPage:j.number()});function Ct(t){return j.object({data:j.array(t),pagination:Kn})}var o=w(require("valibot"),1);var m=w(require("valibot"),1),E=m.pipe(m.string(),m.minLength(1)),G=m.pipe(m.number(),m.integer(),m.minValue(1)),k=m.record(m.string(),m.unknown()),D=m.pipe(E,m.maxLength(255)),zn="(?!\\.{1,2}(?:/|$))[A-Za-z0-9._-]{1,128}",Yo=m.pipe(m.string(),m.regex(new RegExp(`^${zn}$`))),A=m.pipe(m.string(),m.regex(/^\d{4}-\d{2}-\d{2}$/),m.check(t=>{let r=new Date(`${t}T00:00:00Z`);return!Number.isNaN(r.getTime())&&r.toISOString().slice(0,10)===t},"must be a real calendar day"));function jt(t){return/^\p{Zs}*\(?\p{Zs}*(\+|00)[\p{Zs}().-]*\d/u.test(t)}var Be=o.object({id:o.string(),email:o.nullable(o.string()),firstName:o.nullable(o.string()),lastName:o.nullable(o.string()),phone:o.nullable(o.string()),source:o.nullable(be),identifiedAt:o.nullable(o.string()),createdAt:o.string(),updatedAt:o.string()}),Yn=o.pipe(o.string(),o.trim(),o.minLength(1)),Ot=64*1024,ie=o.pipe(o.string(),o.trim(),o.minLength(1),o.maxLength(500)),Qn=o.pipe(o.string(),o.regex(/^[A-Z]{2}$/)),Zn=o.pipe(o.string(),o.maxLength(500),o.check(t=>jt(t.trim()),"phone must start with its country code (+ or 00)")),Xn=o.pipe(o.string(),o.regex(/^[\w:-]+$/)),er=new Set(["__proto__","constructor","prototype"]),tr=o.custom(t=>sr(t),"custom answer must be a JSON value"),nr=["full_time","part_time","weekends","evenings","flexible","bank"],Dt=o.picklist(nr),ni=o.strictObject({firstName:o.nullable(o.string()),lastName:o.nullable(o.string()),email:o.string(),phone:o.nullable(o.string()),country:o.nullable(o.string()),postcode:o.nullable(o.string()),currentTitle:o.nullable(o.string()),currentEmployer:o.nullable(o.string()),openToRelocation:o.nullable(o.boolean()),availableFrom:o.nullable(o.string()),workingPatterns:o.array(Dt),custom:o.record(o.string(),o.unknown())});var Lt=o.strictObject({firstName:o.optional(ie),lastName:o.optional(ie),phone:o.optional(o.nullable(Zn)),country:o.optional(o.nullable(Qn)),postcode:o.optional(o.nullable(ie)),currentTitle:o.optional(o.nullable(ie)),currentEmployer:o.optional(o.nullable(ie)),openToRelocation:o.optional(o.nullable(o.boolean())),availableFrom:o.optional(o.nullable(A)),workingPatterns:o.optional(o.nullable(o.array(Dt))),custom:o.optional(o.pipe(o.custom(t=>Ue(t)&&Object.keys(t).every(r=>!er.has(r))&&ar(t)<=Ot,`custom must be a JSON object of at most ${Ot} bytes`),o.record(Xn,o.nullable(tr))))}),rr=o.pipe(o.custom(t=>Ue(t)&&Object.keys(t).every(r=>Object.hasOwn(Lt.entries,r)),"set must be an object of profile fields"),Lt),or=o.strictObject({email:Yn}),ri=o.strictObject({talentPool:o.optional(o.boolean())}),oi=o.strictObject({identity:or,set:rr,ifVersion:o.optional(o.pipe(o.number(),o.integer(),o.minValue(0))),disclosures:o.optional(o.unknown())}),ir=o.strictObject({noticeId:o.pipe(o.string(),o.minLength(1),o.maxLength(200)),version:o.pipe(o.string(),o.minLength(1),o.maxLength(64)),wordingHash:o.pipe(o.string(),o.minLength(1),o.maxLength(128))}),ii=o.variant("withdrawTalentPool",[o.strictObject({withdrawTalentPool:o.literal(!1),actorUserId:o.optional(o.pipe(o.string(),o.minLength(1),o.maxLength(200)))}),o.strictObject({withdrawTalentPool:o.literal(!0),notice:ir})]);function Ue(t){if(typeof t!="object"||t===null)return!1;let r=Object.getPrototypeOf(t);return r===Object.prototype||r===null}function sr(t){try{return Nt(t,JSON.parse(JSON.stringify(t)))}catch{return!1}}function Nt(t,r){if(t===r)return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null||Array.isArray(t)!==Array.isArray(r)||!Array.isArray(t)&&!Ue(t))return!1;let i=Object.keys(t);return i.length!==Object.keys(r).length?!1:i.every(s=>Object.hasOwn(r,s)&&Nt(t[s],r[s]))}function ar(t){try{return new TextEncoder().encode(JSON.stringify(t)).length}catch{return Number.POSITIVE_INFINITY}}var n=w(require("valibot"),1);var a=w(require("valibot"),1);var Ut=a.object({id:a.string(),applicationId:a.string(),status:It,conductedBy:Et,agentInterviewId:a.nullable(a.string()),generatedScore:a.nullable(a.number()),completedAt:a.nullable(a.string()),meta:a.nullable(k),createdAt:a.string(),updatedAt:a.string()}),cr=/^[A-Za-z0-9_.:-]{1,128}$/,se=a.pipe(a.string(),a.regex(cr)),lr=["audio/webm","audio/ogg","audio/mp4","audio/mpeg","audio/wav"],Ft=a.pipe(a.string(),a.maxLength(255),a.regex(/^[\x20-\x7e]+$/),a.check(t=>lr.includes(t.split(";")[0].trim().toLowerCase()))),Vt=30*1024*1024,pr=100,li=1.5*1024*1024,qt=a.pipe(a.string(),a.regex(/^[0-9a-f]{64}$/)),pi=a.object({questionId:se,contentType:Ft,sha256:qt,body:a.pipe(a.instance(ArrayBuffer),a.check(t=>t.byteLength>=1&&t.byteLength<=Vt))}),dr=a.object({questionId:se,text:a.string(),questionType:a.string(),isFollowUp:a.boolean(),parentQuestionId:a.nullable(se)}),vr=a.object({questionId:se,transcript:a.string(),evaluation:a.nullable(k)}),ur=a.object({questionId:se,contentType:Ft,byteLength:a.pipe(a.number(),a.integer(),a.minValue(1),a.maxValue(Vt)),sha256:qt}),Bt=t=>new Set(t.map(r=>r.questionId)).size===t.length,di=a.pipe(a.object({questions:a.pipe(a.array(dr),a.maxLength(pr)),answers:a.array(vr),evaluation:a.nullable(k),generatedScore:a.nullable(a.pipe(a.number(),a.minValue(0),a.maxValue(100))),display:a.object({jobTitle:a.string(),companyName:a.string()}),recordings:a.array(ur),recordingsWithheld:a.nullable(a.literal("jurisdiction")),completedAt:a.pipe(a.string(),a.isoTimestamp())}),a.check(t=>{let r=new Set(t.questions.map(i=>i.questionId));return r.size===t.questions.length&&Bt(t.answers)&&Bt(t.recordings)&&[...t.answers,...t.recordings].every(i=>r.has(i.questionId))}));var mr=n.object({quote:n.string(),source:n.picklist(["cv","answer"])}),Fe=n.object({score:n.number(),reason:n.string(),confidence:n.number(),share:n.optional(n.number()),evidence:n.optional(n.array(mr))}),Ve=n.object({categoryId:n.string(),answerKey:n.string(),reason:n.picklist(["unanswered","unrecognised"])}),Gt=n.object({id:n.string(),candidateId:n.string(),jobId:n.number(),stage:x,stageGroup:I,stageEnteredAt:n.string(),rating:n.nullable(n.number()),disqualifiedAt:n.nullable(n.string()),disqualificationReason:n.nullable(re),disqualificationNote:n.nullable(n.string()),source:Se,sourceDetail:n.nullable(n.string()),sessionId:n.nullable(n.number()),externalApplicationId:n.nullable(n.string()),meta:n.nullable(k),context:n.nullable(k),scoredAt:n.nullable(n.string()),atsSubmissionStatus:n.optional(n.nullable(M)),atsSubmissionAttempts:n.optional(n.number()),atsNextAttemptAt:n.optional(n.nullable(n.string())),atsSubmittedAt:n.optional(n.nullable(n.string())),atsLastErrorCode:n.optional(n.nullable(n.string())),atsLastErrorMessage:n.optional(n.nullable(n.string())),createdAt:n.string(),updatedAt:n.string()}),gr=n.object({id:n.string(),applicationId:n.string(),scoreType:ye,score:n.nullable(n.number()),reason:n.nullable(n.string()),categories:n.nullable(n.record(n.string(),Fe)),leftOut:n.optional(n.array(Ve)),reasonsWrittenBlind:n.optional(n.literal(!0)),scoredBy:n.nullable(n.string()),createdAt:n.string()}),J=n.object({...Gt.entries,candidate:n.nullable(Be),score:n.nullable(gr),interview:n.nullable(Ut)}),fi=n.object({...Be.entries,applications:n.array(Gt)}),Jt=n.object({id:n.string(),applicationId:n.string(),action:oe,fromStage:n.nullable(x),fromStageGroup:n.nullable(I),toStage:n.nullable(x),toStageGroup:n.nullable(I),disqualificationReason:n.nullable(re),disqualificationNote:n.nullable(n.string()),actorId:n.nullable(n.string()),actorType:Pt,actorEmail:n.nullable(n.string()),actorName:n.nullable(n.string()),meta:n.nullable(k),schemaVersion:n.number(),createdAt:n.string()}),hr=500,$t=n.object({scoreId:n.pipe(n.string(),n.minLength(1),n.maxLength(255)),scoredBy:n.pipe(n.string(),n.regex(/^scoring:[^:\s]{1,128}:[^:\s]{1,128}$/)),decision:Tt,reason:n.pipe(n.string(),n.maxLength(hr),n.check(t=>t.trim().length>0,"reason must not be blank")),score:n.pipe(n.number(),n.finite())}),fr=500,br=200,Mt={from:n.pipe(n.string(),n.isoTimestamp()),to:n.pipe(n.string(),n.isoTimestamp()),actions:n.optional(n.pipe(n.array(oe),n.minLength(1))),cursor:n.nullable(n.pipe(n.string(),n.regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\|.{1,255}$/))),limit:n.pipe(n.number(),n.integer(),n.minValue(1),n.maxValue(br))},bi=n.union([n.strictObject({...Mt,jobIds:n.pipe(n.array(n.pipe(n.number(),n.integer(),n.minValue(1))),n.minLength(1),n.maxLength(fr))}),n.strictObject({...Mt,allJobs:n.literal(!0)})]),yr=500,yi=n.pipe(n.number(),n.integer(),n.minValue(1)),Si=n.strictObject({cursor:n.nullable(n.pipe(n.string(),n.regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\|.{1,255}$/))),limit:n.pipe(n.number(),n.integer(),n.minValue(1),n.maxValue(yr)),actions:n.optional(n.pipe(n.array(oe),n.minLength(1))),maxApplications:n.optional(n.pipe(n.number(),n.integer(),n.minValue(0)))}),Sr=n.object({id:n.string(),applicationId:n.string(),action:oe,fromStage:n.nullable(x),fromStageGroup:n.nullable(I),toStage:n.nullable(x),toStageGroup:n.nullable(I),createdAt:n.string()}),_i=n.object({rows:n.array(Sr),nextCursor:n.nullable(n.string()),total:n.nullable(n.pipe(n.number(),n.integer(),n.minValue(0))),applications:n.pipe(n.number(),n.integer(),n.minValue(0))});var f=w(require("valibot"),1);var Wt=f.object({anonymousId:E,email:E,firstName:f.nullish(f.string()),lastName:f.nullish(f.string()),phone:f.nullish(f.string()),source:f.nullish(be),updateExisting:f.optional(f.boolean())}),qe=f.object({candidateId:f.string(),isNew:f.boolean()}),Ii=f.union([f.object({ok:f.literal(!0)}),qe]);var e=w(require("valibot"),1);var _r=["note","share","verdict","offer_terms","offer_sent","offer_accepted","offer_declined","offer_withdrawn","exported","score_override"],xr=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate",..._r],xe=e.picklist(xr),Me=e.pipe(e.string(),e.transform(t=>t.split(",").map(r=>r.trim()).filter(r=>r.length>0))),Ar=e.pipe(Me,e.array(x)),Tr=e.pipe(Me,e.array(I)),Ht=e.pipe(e.string(),e.transform(t=>t.split(",").map(r=>Number(r.trim())).filter(r=>Number.isInteger(r)&&r>0))),Ir=e.pipe(Me,e.array(M)),Kt=e.object({stages:e.optional(Ar),stage_groups:e.optional(Tr),job_id:e.optional(e.string()),job_ids:e.optional(Ht),candidate_id:e.optional(e.string()),is_disqualified:e.optional(e.picklist(["true","false"])),created_from:e.optional(e.string()),created_to:e.optional(e.string()),updated_from:e.optional(e.string()),updated_to:e.optional(e.string()),entered_stage_from:e.optional(e.string()),entered_stage_to:e.optional(e.string()),from:e.optional(e.string()),to:e.optional(e.string()),q:e.optional(e.string()),scored:e.optional(e.picklist(["true","false"])),ats_submission_status:e.optional(Ir),sort:e.optional(kt),order:e.optional(Rt),page:e.optional(e.string()),per_page:e.optional(e.string())}),Er=e.object({status:e.picklist(["pending","not_required"]),integrationId:e.nullish(D)}),Ci=e.pipe(e.object({candidateId:E,disclosures:e.optional(e.unknown()),jobLocation:e.optional(e.unknown()),jobId:G,meta:e.nullish(k),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),externalJobId:e.nullish(e.pipe(E,e.maxLength(255))),context:e.nullish(k),source:e.nullish(Se),sourceDetail:e.nullish(e.string()),stage:e.nullish(x),stageGroup:e.nullish(I),actor:e.nullish(b),atsSubmission:e.nullish(Er),duplicateScope:e.nullish(e.picklist(["job","attempt"])),anonymousId:e.nullish(D)}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together"),e.check(t=>t.duplicateScope!=="attempt"||typeof t.meta?.attempt_id=="string"&&t.meta.attempt_id!=="","duplicateScope attempt needs meta.attempt_id")),zt=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),ji=e.union([e.object({ok:e.literal(!0),duplicate:e.literal(!1),applicationId:e.string(),candidateId:e.string(),atsHeld:e.optional(e.boolean())}),e.object({ok:e.literal(!0),duplicate:e.literal(!0),existingApplication:zt,atsHeld:e.optional(e.boolean())}),e.object({ok:e.literal(!1),refused:e.literal("pass_through_untracked")})]),Yt=e.object({email:e.pipe(e.string(),e.minLength(1),e.maxLength(320)),scope:e.optional(wt,"job"),jobId:e.optional(e.union([e.string(),e.number()]))}),Qt=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(zt)}),wr=Date.UTC(1e4,0,1),Zt=e.pipe(e.string(),e.regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})$/),e.check(t=>{let[r,i,s]=t.slice(0,10).split("-").map(Number),p=new Date(Date.UTC(r,i-1,s)),d=Date.parse(t);return p.getUTCMonth()===i-1&&p.getUTCDate()===s&&d>=0&&d<wr},"must be a real time")),Ge=e.pipe(e.string(),e.regex(/^[A-Za-z0-9_.:-]{1,100}$/)),Oi=e.object({status:e.picklist(["pending","submitted","failed"]),nextAttemptAt:e.nullish(Zt),errorCode:e.nullish(Ge),errorMessage:e.nullish(e.pipe(e.string(),e.maxLength(1e4))),externalApplicationId:e.nullish(D),externalRunId:e.nullish(D),integrationId:e.nullish(D),answeredPending:e.optional(e.boolean())}),kr=e.picklist(["invalid_transition","next_attempt_required","retry_hold_expired"]),Li=e.variant("kind",[e.object({kind:e.literal("recorded"),application:J}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(M),to:M,reason:kr})]),Rr=e.object({integrationId:e.string(),state:e.picklist(["closed","open","half_open"]),coolingUntil:e.nullable(e.string()),transientCount:e.number(),held:e.boolean()}),Di=e.object({groups:e.array(e.object({integrationId:e.nullable(e.string()),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),count:e.number(),retryable:e.number(),sendable:e.optional(e.number()),nextRetryUntil:e.optional(e.nullable(e.string()))})),oldestPendingAgeSeconds:e.nullable(e.number()),breakers:e.array(Rr),restoreHold:e.optional(e.boolean())}),Ni=e.object({status:e.picklist(["pending","failed"]),integrationId:e.nullable(D),errorCode:e.nullable(Ge)}),Bi=e.object({rows:e.array(e.object({id:e.string(),jobId:e.number(),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),errorMessage:e.nullable(e.string()),attempts:e.number(),nextAttemptAt:e.nullable(e.string()),payloadHeld:e.boolean(),receivedAt:e.nullable(e.string()),retryUntil:e.nullable(e.string()),updatedAt:e.string()})),truncated:e.boolean()}),Ui=e.object({actor:b,expectedAtsLogCount:e.optional(e.pipe(e.number(),e.integer(),e.minValue(0)))}),Pr=e.picklist(["invalid_transition","retry_payload_missing","retry_hold_expired","stale"]),Fi=e.variant("kind",[e.object({kind:e.literal("retried"),application:J}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(M),reason:Pr})]),Vi=e.object({status:e.optional(e.picklist(["pending","failed"])),integrationId:e.nullable(D),errorCode:e.nullable(Ge),actor:b}),qi=e.object({retried:e.number()}),Cr=D,Mi=e.object({integrationIds:e.optional(e.pipe(e.array(Cr),e.maxLength(100)))}),Gi=e.object({integrationId:e.string(),wasOpen:e.boolean()}),Ji=e.object({integrationId:e.string(),wasHeld:e.boolean()}),$i=e.object({applicationId:E,scoreType:ye,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Fe)),leftOut:e.nullish(e.array(Ve)),reasonsWrittenBlind:e.nullish(e.boolean()),scoredBy:e.nullish(e.string()),actor:e.nullish(b),idempotencyKey:e.nullish(e.pipe(e.string(),e.maxLength(255)))}),Wi=e.object({scoreId:e.string()}),Hi=Ct(J);var Ki=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),zi=e.array(Jt),_e=e.object({stage:e.nullish(x),note:e.nullish(e.string())}),jr=e.object({stage:e.nullish(x),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),Or=e.pipe(e.string(),e.regex(/^[a-z0-9_.:-]{1,64}$/));var $=e.pipe(e.object({mode:e.picklist(["send","hold","none"]),templateKey:e.pipe(e.string(),e.regex(/^(received|rejection|interest_confirmation|campaign:invite|stage:[a-z0-9_-]{1,48})$/)),templateVersion:e.pipe(e.number(),e.integer(),e.minValue(1)),configVersionId:E,voice:e.optional(e.picklist(["casual","formal"])),holdUntil:e.optional(e.pipe(Zt,e.endsWith("Z","must be UTC with a Z suffix"),e.check(t=>Date.parse(t)>Date.now(),"must be in the future"))),subject:e.optional(e.pipe(e.string(),e.maxLength(200))),body:e.optional(e.pipe(e.string(),e.maxLength(2e4)))}),e.check(t=>t.mode==="hold"||t.holdUntil===void 0,"holdUntil is only for hold mode"),e.transform(({subject:t,body:r,...i})=>({...i,...t===void 0||t===""?{}:{subject:t},...r===void 0||r===""?{}:{body:r}}))),Lr=e.variant("action",[e.object({action:e.literal("note"),actor:b,message:e.optional(e.never()),meta:e.object({note:E})}),e.object({action:e.literal("share"),actor:b,message:e.optional(e.never()),meta:e.object({subjectUserIds:e.pipe(e.array(E),e.minLength(1),e.maxLength(20)),comment:e.optional(e.string())})}),e.object({action:e.literal("verdict"),actor:b,message:e.optional(e.never()),meta:e.object({code:At,comment:e.optional(e.string())})}),e.object({action:e.literal("offer_terms"),actor:b,message:e.optional(e.never()),meta:e.object({salary:e.optional(e.string()),startDate:e.optional(e.string()),hours:e.optional(e.string())})}),...["offer_sent","offer_accepted","offer_declined","offer_withdrawn"].map(t=>e.object({action:e.literal(t),actor:b,message:e.optional(e.never()),meta:e.object({reason:e.optional(e.string())})})),e.object({action:e.literal("exported"),actor:b,message:e.optional(e.never()),meta:e.object({presetId:Or,exportId:E})}),e.object({action:e.literal("score_override"),actor:b,message:e.optional(e.never()),meta:e.pipe($t,e.transform(t=>({...t,reason:t.reason.trim()})))})]),Dr=e.variant("action",[Lr,e.object({action:e.literal("shortlist"),actor:b,message:e.optional($),meta:e.nullish(_e)}),e.object({action:e.literal("move_to_interview"),actor:b,message:e.optional($),meta:e.nullish(_e)}),e.object({action:e.literal("make_offer"),actor:b,message:e.optional($),meta:e.nullish(_e)}),e.object({action:e.literal("hire"),actor:b,message:e.optional($),meta:e.nullish(jr)}),e.object({action:e.literal("withdraw"),actor:b,message:e.optional(e.never()),meta:e.nullish(_e)}),e.object({action:e.literal("move_to_stage"),actor:b,message:e.optional(e.never()),meta:e.object({stage:x,stageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:b,message:e.optional($),meta:e.object({toStage:x,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:b,message:e.optional($),meta:e.object({reason:re,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:b,message:e.optional($),meta:e.object({toStage:x,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("rate"),actor:b,message:e.optional(e.never()),meta:e.object({rating:e.nullable(e.pipe(e.number(),e.integer(),e.minValue(1),e.maxValue(5)))})})]),Yi=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:Dr}),Xt=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),Qi=e.variant("kind",[e.object({kind:e.literal("updated"),action:xe,application:J}),e.object({kind:e.literal("skipped"),action:xe,applicationId:e.string(),reason:Xt})]),Zi=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:xe,application:J})),skipped:e.array(e.object({kind:e.literal("skipped"),action:xe,applicationId:e.string(),reason:Xt})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),g=e.pipe(e.number(),e.integer(),e.minValue(0)),en=e.object({APPLIED:g,SHORTLISTED:g,INTERVIEWED:g,OFFERED:g,HIRED:g,REJECTED:g,WITHDRAWN:g}),Nr=e.pipe(e.string(),e.minLength(1),e.maxLength(255)),Xi=e.object({pendingShares:e.optional(e.boolean())}),es=e.object({job_ids:Ht,verdict_by:e.optional(Nr),pending_shares:e.optional(e.literal("1"))}),ts=e.object({counts:e.record(e.string(),en),existingAppliedCounts:e.optional(e.record(e.string(),g)),awaitingVerdictCounts:e.optional(e.record(e.string(),g)),pendingShareCounts:e.optional(e.record(e.string(),g))}),ns=e.omit(Kt,["sort","order","page","per_page"]),rs=e.object({counts:en}),tn=92,Br=864e5;function Je({from:t,to:r}){let i=(Date.parse(`${r}T00:00:00Z`)-Date.parse(`${t}T00:00:00Z`))/Br+1;return i>=1&&i<=tn}var $e=`to must be on or after from, and the range must span at most ${tn} days`,os=e.pipe(e.object({from:A,to:A}),e.check(Je,$e)),Ur=e.object({job_id:G,date:A,received:g,scored:g,shortlisted:g}),is=e.object({rows:e.array(Ur)}),Fr=5e3,ss=e.pipe(e.object({from:A,to:A,jobIds:e.pipe(e.array(G),e.maxLength(Fr))}),e.check(Je,$e)),Vr=e.object({job_id:G,date:A,received:g}),as=e.object({rows:e.array(Vr)}),qr=5e3,Mr=e.pipe(e.object({from:A,to:A,jobIds:e.optional(e.pipe(e.array(G),e.maxLength(qr)))}),e.check(Je,$e)),cs=e.pipe(e.object({from:e.string(),to:e.string(),job_ids:e.optional(e.string())}),e.transform(({from:t,to:r,job_ids:i})=>({from:t,to:r,jobIds:i===void 0?void 0:i===""?[]:i.split(",").map(s=>/^\d+$/.test(s.trim())?Number(s):Number.NaN)})),Mr),We=e.pipe(e.array(g),e.length(5)),Gr=e.object({received:g,scored:g,shortlisted:g,histogram:e.pipe(e.array(g),e.length(101)),median_lag_minutes:e.nullable(e.number()),scored_same_day:g}),Jr=e.object({job_id:G,received:g,scored:g,shortlisted:g,score_sum:e.number(),bands:We}),$r=e.object({date:A,received:g,scored:g,score_sum:e.number(),bands:We,scored_on_day:g}),Wr=e.object({id:e.string(),label:e.nullable(e.string()),sum:e.number(),count:g}),Hr=e.object({template_id:e.string(),scored:g,criteria:e.array(Wr)}),ls=e.object({totals:Gr,by_job:e.array(Jr),by_day:e.array($r),criteria:e.array(Hr)}),Kr=e.object({date:A,scored:g,bands:We}),ps=e.object({rows:e.array(Kr)});var ds=e.object({...e.omit(Kt,["page","per_page"]).entries,per_group:e.optional(e.string())}),W=e.object({data:e.array(J),total:g}),vs=e.object({board:e.object({APPLIED:W,SHORTLISTED:W,INTERVIEWED:W,OFFERED:W,HIRED:W,REJECTED:W,WITHDRAWN:W})});var X=w(require("valibot"));var nn=({environment:t,publishableKey:r,logger:i})=>{let s=ct[t];return{async checkDuplicate(p){let d;try{d=X.parse(Yt,{email:p.email,scope:p.scope,...p.scope==="job"&&p.jobId!=null?{jobId:p.jobId}:{}})}catch{return i.error("[TalentBankClient] checkDuplicate input failed validation"),{isDuplicate:!1}}try{let u=await fetch(`${s}/applications/check-duplicate`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":r},body:JSON.stringify(d)});if(!u.ok)return i.error(`[TalentBankClient] checkDuplicate failed with status ${u.status}`),{isDuplicate:!1};let h=await u.json(),_=X.safeParse(Qt,h);return _.success?_.output:(i.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof h=="object"&&h!=null&&typeof h.isDuplicate=="boolean"?{isDuplicate:h.isDuplicate}:{isDuplicate:!1})}catch(u){return i.error("[TalentBankClient] checkDuplicate failed:",u),{isDuplicate:!1}}},async identify(p){try{if(!p.anonymousId)return i.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let d={email:p.email,firstName:p.firstName,lastName:p.lastName,phone:p.phone,anonymousId:p.anonymousId,source:p.source??"sdk"},u=X.safeParse(Wt,d);if(!u.success)return i.error("[TalentBankClient] identify received invalid input"),null;let h=await fetch(`${s}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":r},body:JSON.stringify(u.output)});if(!h.ok)return i.error(`[TalentBankClient] identify failed with status ${h.status}`),null;let _=X.safeParse(qe,await h.json());return _.success?_.output:(i.error("[TalentBankClient] identify returned an invalid response"),null)}catch(d){return i.error("[TalentBankClient] identify failed:",d),null}}}};function rn(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var l=w(require("valibot"));var He=["DAILY","WEEKLY","MONTHLY"],zr=l.record(l.string(),l.union([l.string(),l.array(l.string()),l.object({type:l.literal("provided"),lat:l.number(),lng:l.number(),radius:l.number(),unit:l.optional(l.picklist(["miles","km"])),label:l.optional(l.string())})])),Yr={pathname:"/job/:id",method:"GET",schema:{response:l.object({id:l.number(),external_id:l.nullish(l.string()),city:l.nullish(l.string()),town:l.nullish(l.string()),category:l.nullish(l.string())})}};async function on(t,{contact:r,job:i}){let s={};if(i){let p=await t.request(Yr,{params:{id:i.id}});if((i.id_type==="internal"?String(p.id):p.external_id)!==i.id)throw new Error("Job lookup returned a different role");for(let u of["city","town","category"]){let h=p[u]?.trim();h&&(s[u]=[h])}}await t.request(Ke,{body:{contact:r,alerts:"WEEKLY",filters:s}})}var Ke={pathname:"/search/save",method:"POST",schema:{response:L(),body:l.object({contact:l.object({email:l.pipe(l.optional(l.string()),l.string(),l.email()),first_name:l.optional(l.string()),last_name:l.optional(l.string())}),alerts:l.pipe(l.optional(l.string()),l.string(),l.picklist(He)),filters:zr})}};var T=w(require("valibot"));var Qe=async t=>{let r={method:"GET",pathname:"/search/filters",schema:{response:T.pipe(T.object({country:T.optional(T.array(T.object({value:T.string()})),[])}),T.transform(({country:i})=>i.map(({value:s})=>s))),searchParams:L()}};return t.request(r,{searchParams:{filters:{country:null}}})},Ae=new WeakMap,ln=t=>(Ae.has(t)||(Ae.set(t,void 0),Qe(t).then(async r=>{let{jobCountryCodes:i}=await Promise.resolve().then(()=>(Ye(),cn));Ae.set(t,i(r).join(",")||void 0)}).catch(()=>{})),Ae.get(t)),Ze=(t,r)=>{let i=new Set,s=[];for(let p=0;p<Math.max(t.length,r.length);p++)for(let d of[t[p],r[p]]){if(!d)continue;let u=d.mapbox_id||d.full_address||[d.name,d.place_formatted].filter(Boolean).join(", ");if(!i.has(u)&&(i.add(u),s.push(d),s.length===5))return s}return s},no=600,pn=async(t,r,i)=>{if(i?.throwIfAborted(),!r){let s=await t();return i?.throwIfAborted(),s}return new Promise((s,p)=>{let d,u,h,_=!1,R=()=>{_=!0,clearTimeout(h),i?.removeEventListener("abort",K)},K=()=>{R(),p(i?.reason)},N=()=>{R(),d?.status==="fulfilled"&&u?.status==="fulfilled"?s(Ze(d.value,u.value)):d?.status==="fulfilled"?s(d.value):u?.status==="fulfilled"?s(u.value):d?.status==="rejected"&&p(d.reason)},Te=(v,y)=>{_||(v?d=y:u=y,d&&u?N():y.status==="fulfilled"&&y.value.length>0&&(h=setTimeout(N,no)))};i?.addEventListener("abort",K,{once:!0});for(let v of[!0,!1])t(v?r:void 0).then(y=>Te(v,{status:"fulfilled",value:y}),y=>Te(v,{status:"rejected",reason:y}))})};Ye();0&&(module.exports={ANALYTICS_EVENTS,ApiError,InploiRpcClient,JOB_ALERT_FREQUENCIES,NotFoundError,ParsingError,SchemaValidationError,SdkError,UnauthorisedError,addressSearchCountry,blendAddressSuggestions,consentStorageKey,createPlugin,createTalentBankClient,endpoint,generateUUID,getConsentAcceptance,getJobCountries,getOrCreateAnonymousId,hashConsentConfig,initialiseSdk,inploiBrandedLogger,isApiErrorWithData,isSdkError,jobCountryCodes,noLogging,ready,saveClosedRoleJobAlerts,saveSearchEndpoint,searchAddressSuggestions,setConsentAcceptance,typed,validateEndpointInputs});
14
14
  //# sourceMappingURL=index.js.map