@encheres-immo/auction-widget
Advanced tools
Comparing version 0.3.0 to 0.3.1
# @encheres-immo/auction-widget | ||
## 0.3.1 | ||
### Patch Changes | ||
- 26bfc84: Improving logging and error handling. Behind the scenes, we also deeply refactored the codebase to improve reliability and maintainability. | ||
- 2cae24d: Display a warning message when a bid seems too high. | ||
- 08adb49: Modified the environment prop to accept specific values ("local", "staging", "production") and set a default value of "production". If you are an external user, please only use "production". | ||
- Updated dependencies [08adb49] | ||
- @encheres-immo/widget-client@0.3.1 | ||
## 0.3.0 | ||
@@ -4,0 +14,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";(()=>{var D={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return yt(this.context.count)},getNextContextId(){return yt(this.context.count++)}};function yt(e){let t=String(e),n=t.length-1;return D.context.id+(n?String.fromCharCode(96+n):"")+t}function vt(e){D.context=e}function dn(){return{...D.context,id:D.getNextContextId(),count:0}}var hn=(e,t)=>e===t,te=Symbol("solid-proxy");var Ie=Symbol("solid-track"),Li=Symbol("solid-dev-component"),De={equals:hn},$t=null,gn=Ot,z=1,$e=2,At={owned:null,cleanups:null,context:null,owner:null};var y=null,d=null,xe=null,de=null,$=null,P=null,I=null,Me=0;function ve(e,t){let n=$,i=y,s=e.length===0,r=t===void 0?i:t,o=s?At:{owned:null,cleanups:null,context:r?r.context:null,owner:r},l=s?e:()=>e(()=>N(()=>ee(o)));y=o,$=null;try{return q(l,!0)}finally{$=n,y=i}}function x(e,t){t=t?Object.assign({},De,t):De;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},i=s=>(typeof s=="function"&&(d&&d.running&&d.sources.has(n)?s=s(n.tValue):s=s(n.value)),Et(n,s));return[Tt.bind(n),i]}function F(e,t,n){let i=Pt(e,t,!1,z);xe&&d&&d.running?P.push(i):Ne(i)}function _(e,t,n){n=n?Object.assign({},De,n):De;let i=Pt(e,t,!0,0);return i.observers=null,i.observerSlots=null,i.comparator=n.equals||void 0,xe&&d&&d.running?(i.tState=z,P.push(i)):Ne(i),Tt.bind(i)}function kt(e){return q(e,!1)}function N(e){if(!de&&$===null)return e();let t=$;$=null;try{return de?de.untrack(e):e()}finally{$=t}}function Ze(e){return y===null||(y.cleanups===null?y.cleanups=[e]:y.cleanups.push(e)),e}function Be(){return $}function mn(e){if(d&&d.running)return e(),d.done;let t=$,n=y;return Promise.resolve().then(()=>{$=t,y=n;let i;return(xe||wn)&&(i=d||(d={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),i.done||(i.done=new Promise(s=>i.resolve=s)),i.running=!0),q(e,!1),$=y=null,i?i.done:void 0})}var[Ii,xt]=x(!1);function pn(e){let t=_(e),n=_(()=>Qe(t()));return n.toArray=()=>{let i=n();return Array.isArray(i)?i:i!=null?[i]:[]},n}var wn;function Tt(){let e=d&&d.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===z)Ne(this);else{let t=P;P=null,q(()=>Le(this),!1),P=t}if($){let t=this.observers?this.observers.length:0;$.sources?($.sources.push(this),$.sourceSlots.push(t)):($.sources=[this],$.sourceSlots=[t]),this.observers?(this.observers.push($),this.observerSlots.push($.sources.length-1)):(this.observers=[$],this.observerSlots=[$.sources.length-1])}return e&&d.sources.has(this)?this.tValue:this.value}function Et(e,t,n){let i=d&&d.running&&d.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(i,t)){if(d){let s=d.running;(s||!n&&d.sources.has(e))&&(d.sources.add(e),e.tValue=t),s||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&q(()=>{for(let s=0;s<e.observers.length;s+=1){let r=e.observers[s],o=d&&d.running;o&&d.disposed.has(r)||((o?!r.tState:!r.state)&&(r.pure?P.push(r):I.push(r),r.observers&&jt(r)),o?r.tState=z:r.state=z)}if(P.length>1e6)throw P=[],new Error},!1)}return t}function Ne(e){if(!e.fn)return;ee(e);let t=Me;St(e,d&&d.running&&d.sources.has(e)?e.tValue:e.value,t),d&&!d.running&&d.sources.has(e)&&queueMicrotask(()=>{q(()=>{d&&(d.running=!0),$=y=e,St(e,e.tValue,t),$=y=null},!1)})}function St(e,t,n){let i,s=y,r=$;$=y=e;try{i=e.fn(t)}catch(o){return e.pure&&(d&&d.running?(e.tState=z,e.tOwned&&e.tOwned.forEach(ee),e.tOwned=void 0):(e.state=z,e.owned&&e.owned.forEach(ee),e.owned=null)),e.updatedAt=n+1,tt(o)}finally{$=r,y=s}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Et(e,i,!0):d&&d.running&&e.pure?(d.sources.add(e),e.tValue=i):e.value=i,e.updatedAt=n)}function Pt(e,t,n,i=z,s){let r={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:y,context:y?y.context:null,pure:n};if(d&&d.running&&(r.state=0,r.tState=i),y===null||y!==At&&(d&&d.running&&y.pure?y.tOwned?y.tOwned.push(r):y.tOwned=[r]:y.owned?y.owned.push(r):y.owned=[r]),de&&r.fn){let[o,l]=x(void 0,{equals:!1}),a=de.factory(r.fn,l);Ze(()=>a.dispose());let c=()=>mn(l).then(()=>f.dispose()),f=de.factory(r.fn,c);r.fn=u=>(o(),d&&d.running?f.track(u):a.track(u))}return r}function et(e){let t=d&&d.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===$e)return Le(e);if(e.suspense&&N(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Me);){if(t&&d.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let i=n.length-1;i>=0;i--){if(e=n[i],t){let s=e,r=n[i+1];for(;(s=s.owner)&&s!==r;)if(d.disposed.has(s))return}if((t?e.tState:e.state)===z)Ne(e);else if((t?e.tState:e.state)===$e){let s=P;P=null,q(()=>Le(e,n[0]),!1),P=s}}}function q(e,t){if(P)return e();let n=!1;t||(P=[]),I?n=!0:I=[],Me++;try{let i=e();return bn(n),i}catch(i){n||(I=null),P=null,tt(i)}}function bn(e){if(P&&(xe&&d&&d.running?yn(P):Ot(P),P=null),e)return;let t;if(d){if(!d.promises.size&&!d.queue.size){let i=d.sources,s=d.disposed;I.push.apply(I,d.effects),t=d.resolve;for(let r of I)"tState"in r&&(r.state=r.tState),delete r.tState;d=null,q(()=>{for(let r of s)ee(r);for(let r of i){if(r.value=r.tValue,r.owned)for(let o=0,l=r.owned.length;o<l;o++)ee(r.owned[o]);r.tOwned&&(r.owned=r.tOwned),delete r.tValue,delete r.tOwned,r.tState=0}xt(!1)},!1)}else if(d.running){d.running=!1,d.effects.push.apply(d.effects,I),I=null,xt(!0);return}}let n=I;I=null,n.length&&q(()=>gn(n),!1),t&&t()}function Ot(e){for(let t=0;t<e.length;t++)et(e[t])}function yn(e){for(let t=0;t<e.length;t++){let n=e[t],i=d.queue;i.has(n)||(i.add(n),xe(()=>{i.delete(n),q(()=>{d.running=!0,et(n)},!1),d&&(d.running=!1)}))}}function Le(e,t){let n=d&&d.running;n?e.tState=0:e.state=0;for(let i=0;i<e.sources.length;i+=1){let s=e.sources[i];if(s.sources){let r=n?s.tState:s.state;r===z?s!==t&&(!s.updatedAt||s.updatedAt<Me)&&et(s):r===$e&&Le(s,t)}}}function jt(e){let t=d&&d.running;for(let n=0;n<e.observers.length;n+=1){let i=e.observers[n];(t?!i.tState:!i.state)&&(t?i.tState=$e:i.state=$e,i.pure?P.push(i):I.push(i),i.observers&&jt(i))}}function ee(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),i=e.sourceSlots.pop(),s=n.observers;if(s&&s.length){let r=s.pop(),o=n.observerSlots.pop();i<s.length&&(r.sourceSlots[o]=i,s[i]=r,n.observerSlots[i]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)ee(e.tOwned[t]);delete e.tOwned}if(d&&d.running&&e.pure)Rt(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)ee(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}d&&d.running?e.tState=0:e.state=0}function Rt(e,t){if(t||(e.tState=0,d.disposed.add(e)),e.owned)for(let n=0;n<e.owned.length;n++)Rt(e.owned[n])}function vn(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Ct(e,t,n){try{for(let i of t)i(e)}catch(i){tt(i,n&&n.owner||null)}}function tt(e,t=y){let n=$t&&t&&t.context&&t.context[$t],i=vn(e);if(!n)throw i;I?I.push({fn(){Ct(i,n,t)},state:z}):Ct(i,n,t)}function Qe(e){if(typeof e=="function"&&!e.length)return Qe(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let i=Qe(e[n]);Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}return e}var $n=Symbol("fallback");function _t(e){for(let t=0;t<e.length;t++)e[t]()}function xn(e,t,n={}){let i=[],s=[],r=[],o=0,l=t.length>1?[]:null;return Ze(()=>_t(r)),()=>{let a=e()||[],c=a.length,f,u;return a[Ie],N(()=>{let w,v,k,T,L,E,R,O,S;if(c===0)o!==0&&(_t(r),r=[],i=[],s=[],o=0,l&&(l=[])),n.fallback&&(i=[$n],s[0]=ve(C=>(r[0]=C,n.fallback())),o=1);else if(o===0){for(s=new Array(c),u=0;u<c;u++)i[u]=a[u],s[u]=ve(g);o=c}else{for(k=new Array(c),T=new Array(c),l&&(L=new Array(c)),E=0,R=Math.min(o,c);E<R&&i[E]===a[E];E++);for(R=o-1,O=c-1;R>=E&&O>=E&&i[R]===a[O];R--,O--)k[O]=s[R],T[O]=r[R],l&&(L[O]=l[R]);for(w=new Map,v=new Array(O+1),u=O;u>=E;u--)S=a[u],f=w.get(S),v[u]=f===void 0?-1:f,w.set(S,u);for(f=E;f<=R;f++)S=i[f],u=w.get(S),u!==void 0&&u!==-1?(k[u]=s[f],T[u]=r[f],l&&(L[u]=l[f]),u=v[u],w.set(S,u)):r[f]();for(u=E;u<c;u++)u in k?(s[u]=k[u],r[u]=T[u],l&&(l[u]=L[u],l[u](u))):s[u]=ve(g);s=s.slice(0,o=c),i=a.slice(0)}return s});function g(w){if(r[u]=w,l){let[v,k]=x(u);return l[u]=k,t(a[u],v)}return t(a[u])}}}var Sn=!1;function m(e,t){if(Sn&&D.context){let n=D.context;vt(dn());let i=N(()=>e(t||{}));return vt(n),i}return N(()=>e(t||{}))}var Dt=e=>`Stale read from <${e}>.`;function nt(e){let t="fallback"in e&&{fallback:()=>e.fallback};return _(xn(()=>e.each,e.children,t||void 0))}function A(e){let t=e.keyed,n=_(()=>e.when,void 0,{equals:(i,s)=>t?i===s:!i==!s});return _(()=>{let i=n();if(i){let s=e.children;return typeof s=="function"&&s.length>0?N(()=>s(t?i:()=>{if(!N(n))throw Dt("Show");return e.when})):s}return e.fallback},void 0,void 0)}function it(e){let t=!1,n=(r,o)=>(t?r[1]===o[1]:!r[1]==!o[1])&&r[2]===o[2],i=pn(()=>e.children),s=_(()=>{let r=i();Array.isArray(r)||(r=[r]);for(let o=0;o<r.length;o++){let l=r[o].when;if(l)return t=!!r[o].keyed,[o,l,r[o]]}return[-1]},void 0,{equals:n});return _(()=>{let[r,o,l]=s();if(r<0)return e.fallback;let a=l.children;return typeof a=="function"&&a.length>0?N(()=>a(t?o:()=>{if(N(s)[0]!==r)throw Dt("Match");return l.when})):a},void 0,void 0)}function J(e){return e}var _n=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Gi=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",..._n]);function An(e,t,n){let i=n.length,s=t.length,r=i,o=0,l=0,a=t[s-1].nextSibling,c=null;for(;o<s||l<r;){if(t[o]===n[l]){o++,l++;continue}for(;t[s-1]===n[r-1];)s--,r--;if(s===o){let f=r<i?l?n[l-1].nextSibling:n[r-l]:a;for(;l<r;)e.insertBefore(n[l++],f)}else if(r===l)for(;o<s;)(!c||!c.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[r-1]&&n[l]===t[s-1]){let f=t[--s].nextSibling;e.insertBefore(n[l++],t[o++].nextSibling),e.insertBefore(n[--r],f),t[s]=n[r]}else{if(!c){c=new Map;let u=l;for(;u<r;)c.set(n[u],u++)}let f=c.get(t[o]);if(f!=null)if(l<f&&f<r){let u=o,g=1,w;for(;++u<s&&u<r&&!((w=c.get(t[u]))==null||w!==f+g);)g++;if(g>f-l){let v=t[o];for(;l<f;)e.insertBefore(n[l++],v)}else e.replaceChild(n[l++],t[o++])}else o++;else t[o++].remove()}}}var Lt="_$DX_DELEGATE";function Mt(e,t,n,i={}){let s;return ve(r=>{s=r,t===document?e():h(t,e(),t.firstChild?null:void 0,n)},i.owner),()=>{s(),t.textContent=""}}function p(e,t,n){let i,s=()=>{let o=document.createElement("template");return o.innerHTML=e,n?o.content.firstChild.firstChild:o.content.firstChild},r=t?()=>N(()=>document.importNode(i||(i=s()),!0)):()=>(i||(i=s())).cloneNode(!0);return r.cloneNode=r,r}function Ue(e,t=window.document){let n=t[Lt]||(t[Lt]=new Set);for(let i=0,s=e.length;i<s;i++){let r=e[i];n.has(r)||(n.add(r),t.addEventListener(r,kn))}}function st(e,t,n){ot(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Bt(e,t){ot(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Y(e,t,n,i){if(i)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let s=n[0];e.addEventListener(t,n[0]=r=>s.call(e,n[1],r))}else e.addEventListener(t,n,typeof n!="function"&&n)}function h(e,t,n,i){if(n!==void 0&&!i&&(i=[]),typeof t!="function")return He(e,t,i,n);F(s=>He(e,t(),s,n),i)}function ot(e){return!!D.context&&!D.done&&(!e||e.isConnected)}function kn(e){if(D.registry&&D.events&&D.events.find(([a,c])=>c===e))return;let t=e.target,n=`$$${e.type}`,i=e.target,s=e.currentTarget,r=a=>Object.defineProperty(e,"target",{configurable:!0,value:a}),o=()=>{let a=t[n];if(a&&!t.disabled){let c=t[`${n}Data`];if(c!==void 0?a.call(t,c,e):a.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&r(t.host),!0},l=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),D.registry&&!D.done&&(D.done=_$HY.done=!0),e.composedPath){let a=e.composedPath();r(a[0]);for(let c=0;c<a.length-2&&(t=a[c],!!o());c++){if(t._$host){t=t._$host,l();break}if(t.parentNode===s)break}}else l();r(i)}function He(e,t,n,i,s){let r=ot(e);if(r){!n&&(n=[...e.childNodes]);let a=[];for(let c=0;c<n.length;c++){let f=n[c];f.nodeType===8&&f.data.slice(0,2)==="!$"?f.remove():a.push(f)}n=a}for(;typeof n=="function";)n=n();if(t===n)return n;let o=typeof t,l=i!==void 0;if(e=l&&n[0]&&n[0].parentNode||e,o==="string"||o==="number"){if(r||o==="number"&&(t=t.toString(),t===n))return n;if(l){let a=n[0];a&&a.nodeType===3?a.data!==t&&(a.data=t):a=document.createTextNode(t),n=he(e,n,i,a)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||o==="boolean"){if(r)return n;n=he(e,n,i)}else{if(o==="function")return F(()=>{let a=t();for(;typeof a=="function";)a=a();n=He(e,a,n,i)}),()=>n;if(Array.isArray(t)){let a=[],c=n&&Array.isArray(n);if(rt(a,t,n,s))return F(()=>n=He(e,a,n,i,!0)),()=>n;if(r){if(!a.length)return n;if(i===void 0)return n=[...e.childNodes];let f=a[0];if(f.parentNode!==e)return n;let u=[f];for(;(f=f.nextSibling)!==i;)u.push(f);return n=u}if(a.length===0){if(n=he(e,n,i),l)return n}else c?n.length===0?It(e,a,i):An(e,n,a):(n&&he(e),It(e,a));n=a}else if(t.nodeType){if(r&&t.parentNode)return n=l?[t]:t;if(Array.isArray(n)){if(l)return n=he(e,n,i,t);he(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function rt(e,t,n,i){let s=!1;for(let r=0,o=t.length;r<o;r++){let l=t[r],a=n&&n[e.length],c;if(!(l==null||l===!0||l===!1))if((c=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))s=rt(e,l,a)||s;else if(c==="function")if(i){for(;typeof l=="function";)l=l();s=rt(e,Array.isArray(l)?l:[l],Array.isArray(a)?a:[a])||s}else e.push(l),s=!0;else{let f=String(l);a&&a.nodeType===3&&a.data===f?e.push(a):e.push(document.createTextNode(f))}}return s}function It(e,t,n=null){for(let i=0,s=t.length;i<s;i++)e.insertBefore(t[i],n)}function he(e,t,n,i){if(n===void 0)return e.textContent="";let s=i||document.createTextNode("");if(t.length){let r=!1;for(let o=t.length-1;o>=0;o--){let l=t[o];if(s!==l){let a=l.parentNode===e;!r&&!o?a?e.replaceChild(s,l):e.insertBefore(s,n):a&&l.remove()}else r=!0}}else e.insertBefore(s,n);return[s]}var Ji=Symbol();var lt=Symbol("store-raw"),ge=Symbol("store-node"),X=Symbol("store-has"),Nt=Symbol("store-self");function Ht(e){let t=e[te];if(!t&&(Object.defineProperty(e,te,{value:t=new Proxy(e,Pn)}),!Array.isArray(e))){let n=Object.keys(e),i=Object.getOwnPropertyDescriptors(e);for(let s=0,r=n.length;s<r;s++){let o=n[s];i[o].get&&Object.defineProperty(e,o,{enumerable:i[o].enumerable,get:i[o].get.bind(t)})}}return t}function Ve(e){let t;return e!=null&&typeof e=="object"&&(e[te]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Ce(e,t=new Set){let n,i,s,r;if(n=e!=null&&e[lt])return n;if(!Ve(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let o=0,l=e.length;o<l;o++)s=e[o],(i=Ce(s,t))!==s&&(e[o]=i)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let o=Object.keys(e),l=Object.getOwnPropertyDescriptors(e);for(let a=0,c=o.length;a<c;a++)r=o[a],!l[r].get&&(s=e[r],(i=Ce(s,t))!==s&&(e[r]=i))}return e}function ze(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function _e(e,t,n){if(e[t])return e[t];let[i,s]=x(n,{equals:!1,internal:!0});return i.$=s,e[t]=i}function Tn(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===te||t===ge||(delete n.value,delete n.writable,n.get=()=>e[te][t]),n}function Ut(e){Be()&&_e(ze(e,ge),Nt)()}function En(e){return Ut(e),Reflect.ownKeys(e)}var Pn={get(e,t,n){if(t===lt)return e;if(t===te)return n;if(t===Ie)return Ut(e),n;let i=ze(e,ge),s=i[t],r=s?s():e[t];if(t===ge||t===X||t==="__proto__")return r;if(!s){let o=Object.getOwnPropertyDescriptor(e,t);Be()&&(typeof r!="function"||e.hasOwnProperty(t))&&!(o&&o.get)&&(r=_e(i,t,r)())}return Ve(r)?Ht(r):r},has(e,t){return t===lt||t===te||t===Ie||t===ge||t===X||t==="__proto__"?!0:(Be()&&_e(ze(e,X),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:En,getOwnPropertyDescriptor:Tn};function Fe(e,t,n,i=!1){if(!i&&e[t]===n)return;let s=e[t],r=e.length;n===void 0?(delete e[t],e[X]&&e[X][t]&&s!==void 0&&e[X][t].$()):(e[t]=n,e[X]&&e[X][t]&&s===void 0&&e[X][t].$());let o=ze(e,ge),l;if((l=_e(o,t,s))&&l.$(()=>n),Array.isArray(e)&&e.length!==r){for(let a=e.length;a<r;a++)(l=o[a])&&l.$();(l=_e(o,"length",r))&&l.$(e.length)}(l=o[Nt])&&l.$()}function Vt(e,t){let n=Object.keys(t);for(let i=0;i<n.length;i+=1){let s=n[i];Fe(e,s,t[s])}}function On(e,t){if(typeof t=="function"&&(t=t(e)),t=Ce(t),Array.isArray(t)){if(e===t)return;let n=0,i=t.length;for(;n<i;n++){let s=t[n];e[n]!==s&&Fe(e,n,s)}Fe(e,"length",i)}else Vt(e,t)}function Se(e,t,n=[]){let i,s=e;if(t.length>1){i=t.shift();let o=typeof i,l=Array.isArray(e);if(Array.isArray(i)){for(let a=0;a<i.length;a++)Se(e,[i[a]].concat(t),n);return}else if(l&&o==="function"){for(let a=0;a<e.length;a++)i(e[a],a)&&Se(e,[a].concat(t),n);return}else if(l&&o==="object"){let{from:a=0,to:c=e.length-1,by:f=1}=i;for(let u=a;u<=c;u+=f)Se(e,[u].concat(t),n);return}else if(t.length>1){Se(e[i],t,[i].concat(n));return}s=e[i],n=[i].concat(n)}let r=t[0];typeof r=="function"&&(r=r(s,n),r===s)||i===void 0&&r==null||(r=Ce(r),i===void 0||Ve(s)&&Ve(r)&&!Array.isArray(r)?Vt(s,r):Fe(e,i,r))}function at(...[e,t]){let n=Ce(e||{}),i=Array.isArray(n),s=Ht(n);function r(...o){kt(()=>{i&&o.length===1?On(n,o[0]):Se(n,o)})}return[s,r]}var Zi=Symbol("store-root");var Te=e=>typeof e=="function"?e:function(){return e},jn=typeof self<"u"?self:null,ke=typeof window<"u"?window:null,ce=jn||ke||ce,Rn="2.0.0",W={connecting:0,open:1,closing:2,closed:3},Dn=1e4,Ln=1e3,B={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Q={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ct={longpoll:"longpoll",websocket:"websocket"},In={complete:4},qe=class{constructor(e,t,n,i){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},zt=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Mn=class{constructor(e,t,n){this.state=B.closed,this.topic=e,this.params=Te(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new qe(this,Q.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new zt(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=B.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=B.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=B.closed,this.socket.remove(this)}),this.onError(i=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,i),this.isJoining()&&this.joinPush.reset(),this.state=B.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new qe(this,Q.leave,Te({}),this.timeout).send(),this.state=B.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Q.reply,(i,s)=>{this.trigger(this.replyEventName(s),i)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(Q.close,e)}onError(e){return this.on(Q.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new qe(this,e,function(){return t},n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=B.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Q.close,"leave")},n=new qe(this,Q.leave,Te({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,i){return this.topic!==e?!1:i&&i!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:i}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=B.joining,this.joinPush.resend(e))}trigger(e,t,n,i){let s=this.onMessage(e,t,n,i);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(o=>o.event===e);for(let o=0;o<r.length;o++)r[o].callback(s,n,i||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===B.closed}isErrored(){return this.state===B.errored}isJoined(){return this.state===B.joined}isJoining(){return this.state===B.joining}isLeaving(){return this.state===B.leaving}},Ke=class{static request(e,t,n,i,s,r,o){if(ce.XDomainRequest){let l=new ce.XDomainRequest;return this.xdomainRequest(l,e,t,i,s,r,o)}else{let l=new ce.XMLHttpRequest;return this.xhrRequest(l,e,t,n,i,s,r,o)}}static xdomainRequest(e,t,n,i,s,r,o){return e.timeout=s,e.open(t,n),e.onload=()=>{let l=this.parseJSON(e.responseText);o&&o(l)},r&&(e.ontimeout=r),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,n,i,s,r,o,l){return e.open(t,n,!0),e.timeout=r,e.setRequestHeader("Content-Type",i),e.onerror=()=>l&&l(null),e.onreadystatechange=()=>{if(e.readyState===In.complete&&l){let a=this.parseJSON(e.responseText);l(a)}},o&&(e.ontimeout=o),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let s=t?`${t}[${i}]`:i,r=e[i];typeof r=="object"?n.push(this.serialize(r,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},Bn=e=>{let t="",n=new Uint8Array(e),i=n.byteLength;for(let s=0;s<i;s++)t+=String.fromCharCode(n[s]);return btoa(t)},Ae=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=W.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ct.websocket),"$1/"+ct.longpoll)}endpointURL(){return Ke.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=W.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===W.open||this.readyState===W.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:n,messages:i}=e;this.token=n}else t=0;switch(t){case 200:i.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=W.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){typeof e!="string"&&(e=Bn(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join(` | ||
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let s of this.reqs)s.abort();this.readyState=W.closed;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,n,i,s){let r,o=()=>{this.reqs.delete(r),i()};r=Ke.request(e,this.endpointURL(),t,n,this.timeout,o,l=>{this.reqs.delete(r),this.isActive()&&s(l)}),this.reqs.add(r)}};var We={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,i,s,r,o]=JSON.parse(e);return t({join_ref:n,ref:i,topic:s,event:r,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:i,topic:s,payload:r}=e,o=this.META_LENGTH+t.length+n.length+s.length+i.length,l=new ArrayBuffer(this.HEADER_LENGTH+o),a=new DataView(l),c=0;a.setUint8(c++,this.KINDS.push),a.setUint8(c++,t.length),a.setUint8(c++,n.length),a.setUint8(c++,s.length),a.setUint8(c++,i.length),Array.from(t,u=>a.setUint8(c++,u.charCodeAt(0))),Array.from(n,u=>a.setUint8(c++,u.charCodeAt(0))),Array.from(s,u=>a.setUint8(c++,u.charCodeAt(0))),Array.from(i,u=>a.setUint8(c++,u.charCodeAt(0)));var f=new Uint8Array(l.byteLength+r.byteLength);return f.set(new Uint8Array(l),0),f.set(new Uint8Array(r),l.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,l=n.decode(e.slice(o,o+i));o=o+i;let a=n.decode(e.slice(o,o+s));o=o+s;let c=n.decode(e.slice(o,o+r));o=o+r;let f=e.slice(o,e.byteLength);return{join_ref:l,ref:null,topic:a,event:c,payload:f}},decodeReply(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),o=t.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,a=n.decode(e.slice(l,l+i));l=l+i;let c=n.decode(e.slice(l,l+s));l=l+s;let f=n.decode(e.slice(l,l+r));l=l+r;let u=n.decode(e.slice(l,l+o));l=l+o;let g=e.slice(l,e.byteLength),w={status:u,response:g};return{join_ref:a,ref:c,topic:f,event:Q.reply,payload:w}},decodeBroadcast(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=this.HEADER_LENGTH+2,o=n.decode(e.slice(r,r+i));r=r+i;let l=n.decode(e.slice(r,r+s));r=r+s;let a=e.slice(r,e.byteLength);return{join_ref:null,ref:null,topic:o,event:l,payload:a}}},Ft=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||Dn,this.transport=t.transport||ce.WebSocket||Ae,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||ce&&ce.sessionStorage,this.establishedConnections=0,this.defaultEncoder=We.encode.bind(We),this.defaultDecoder=We.decode.bind(We),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Ae?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;ke&&ke.addEventListener&&(ke.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),n=this.connectClock)}),ke.addEventListener("pageshow",i=>{n===this.connectClock&&(n=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=i=>t.rejoinAfterMs?t.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>t.reconnectAfterMs?t.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(i,s,r)=>{console.log(`${i}: ${s}`,r)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Te(t.params||{}),this.endPoint=`${e}/${ct.websocket}`,this.vsn=t.vsn||Rn,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new zt(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return Ae}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Ke.appendParams(Ke.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Te(e)),!this.conn&&(this.longPollFallbackMs&&this.transport!==Ae?this.connectWithFallback(Ae,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(s=>{s.ref===t&&(this.off([i]),e(Date.now()-n))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,i=!0,s,r,o=l=>{this.log("transport",`falling back to ${e.name}...`,l),this.off([s,r]),i=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),r=this.onError(l=>{this.log("transport","error",l),i&&!n&&(clearTimeout(this.fallbackTimer),o(l))}),this.onOpen(()=>{if(n=!0,!i)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Ln,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===W.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,n])=>n(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,i])=>{i(e,t,n)}),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Q.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case W.connecting:return"connecting";case W.open:return"open";case W.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new Mn(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:i,ref:s,join_ref:r}=e;this.log("push",`${t} ${n} (${r}, ${s})`,i)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:i,payload:s,ref:r,join_ref:o}=t;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${s.status||""} ${n} ${i} ${r&&"("+r+")"||""}`,s);for(let l=0;l<this.channels.length;l++){let a=this.channels[l];a.isMember(n,i,s,o)&&a.trigger(i,s,r,o)}for(let l=0;l<this.stateChangeCallbacks.message.length;l++){let[,a]=this.stateChangeCallbacks.message[l];a(t)}})}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};var K="",Ee="",Pe=null,ue=null,H="",ut=null;function Nn(e,t){switch(ut=e,t){case"local":H="localhost:4000",K=`http://${H}`,Ee=`ws://${H}/api/socket`;break;case"staging":H="staging.encheres-immo.com",K=`https://${H}`,Ee=`wss://${H}/api/socket`;break;case"production":H="encheres-immo.com",K=`https://${H}`,Ee=`wss://${H}/api/socket`;break;default:console.log("Widget client: Unknown environment, defaulting to production."),H="encheres-immo.com",K=`https://${H}`,Ee=`wss://${H}/api/socket`;break}}async function Hn(){function e(a){let f=new TextEncoder().encode(a);return window.crypto.subtle.digest("SHA-256",f)}function t(a){return btoa(String.fromCharCode.apply(null,Array.from(new Uint8Array(a)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function n(a){let c=await e(a);return t(c)}function i(){var a=new Uint32Array(28);return window.crypto.getRandomValues(a),Array.from(a,c=>("0"+c.toString(16)).substr(-2)).join("")}let s=window.location.href,o=new URLSearchParams(s.split("?")[1]).get("code"),l=window.location.href;if(o){let a=window.location.href,c=new URL(a);return c.search="",window.history.replaceState({},"",c),fetch(`${K}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",client_id:ut,code:o,redirect_uri:window.location.href,code_verifier:localStorage.getItem("pkce_code_verifier")})}).then(f=>f.json()).then(f=>(localStorage.removeItem("pkce_code_verifier"),Pe=f.access_token,null)).catch(f=>{console.log(f)})}else{let a=i(),c="S256",f=i();localStorage.setItem("pkce_code_verifier",f);let u=await n(f),g=`${K}/oauth/authorize?response_type=code&client_id=${ut}&redirect_uri=${l}&state=${encodeURIComponent(a)}&code_challenge=${encodeURIComponent(u)}&code_challenge_method=${c}`;console.log(g),document.location=g}}function Un(e,t){return new Promise((n,i)=>{ue?.disconnect(),ue=new Ft(Ee,{params:{token:Pe}}),ue.connect();let s=ue.channel(`auction:${e}`,{});s.on("outbid",r=>{console.log("Got message",r),t&&t(r.bid)}),s.join().receive("ok",r=>{console.log("Joined successfully",r),n(s)}).receive("error",r=>{console.log("Unable to join",r),ue?.disconnect(),i(r)})})}async function Vn(){return fetch(`${K}/api/v1/me`,{headers:{Authorization:"Bearer "+Pe}}).then(e=>{if(e.status===401)console.log("Unauthorized");else return e.json()}).then(e=>(console.log(e),{id:e.id})).catch(e=>{throw console.log("err",e),e})}async function zn(e){let t=e.propertyId?`${K}/api/v1/next_auction/${e.propertyId}`:`${K}/api/v1/next_auction/${e.source}/${e.sourceAgencyId}/${e.sourceId}`;return fetch(t,{headers:{Authorization:"Bearer "+Pe}}).then(n=>(n.status===401&&console.log("Unauthorized"),n.json())).then(n=>{console.log(n);let i=n.bids.map(o=>({id:o.id,amount:o.amount,createdAt:o.createdAt,newEndDate:o.newEndDate,userAnonymousId:o.userAnonymousId,participantId:o.participantId})),s=n.bids.reduce((o,l)=>l.amount>o.amount?l:o,{id:"",amount:0,createdAt:"",newEndDate:0,userAnonymousId:""}),r=n.registration?{isUserAllowed:n.registration.isUserAllowed,isRegistrationAccepted:n.registration.isRegistrationAccepted,isParticipant:n.registration.isParticipant}:null;return{id:n.id,startDate:n.startDate,endDate:n.endDate,startingPrice:n.startingPrice,step:n.step,bids:i,highestBid:s,agentEmail:n.agentEmail,agentPhone:n.agentPhone,registration:r,isPrivate:n.isPrivate,currency:{symbol:n.currency.symbol,code:n.currency.code,isBefore:n.currency.isBefore}}}).catch(n=>{throw console.log("err",n),n})}async function Fn(e,t){return console.log(e.id),fetch(`${K}/api/v1/bid`,{method:"POST",body:JSON.stringify({auctionId:e.id,amount:t}),headers:{Authorization:"Bearer "+Pe,"Content-Type":"application/json"}}).then(n=>(n.status===401&&console.log("Unauthorized"),n.status===422?n.json().then(i=>{throw i}):n.json())).then(n=>(console.log(n.id),{id:n.id,amount:n.amount,createdAt:n.createdAt,newEndDate:n.newEndDate,userAnonymousId:n.userAnonymousId,participantId:n.participantId})).catch(n=>{throw console.log("err",n),n})}var Z={initEIClient:Nn,getNextAuctionById:zn,authenticate:Hn,subscribeToAuction:Un,me:Vn,placeBidOnAuction:Fn};function ne(e){let t=new Date().setMilliseconds(0),n=new Date(e.startDate).setMilliseconds(0);return t<n}function ie(e){let t=new Date().setMilliseconds(0),n=new Date(e.endDate).setMilliseconds(0),i=new Date(e.startDate).setMilliseconds(0);return t<=n&&t>=i}function me(e){let t=new Date().setMilliseconds(0),n=new Date(e.endDate).setMilliseconds(0);return t>n}function U(e,t){let n=e==null?"--":e.toString();return t?t.isBefore?`${Ge(t)} ${n}`:`${n} ${Ge(t)}`:`${n} \u20AC`}function Ge(e){return e.symbol||e.code||""}function ft(e){return new Date(e)}function pe(e){return ft(e).toLocaleString()}var qn=p("<div><p id=auction-widget-status>D\xE9marre dans</p><p id=auction-widget-countdown>"),Wn=p("<div><p id=auction-widget-status>Se termine dans</p><p id=auction-widget-countdown>"),Kn=p("<p id=auction-widget-status>Vente termin\xE9e"),Gn=p('<p class="auction-widget-detail auction-widget-label">Meilleure offre'),Jn=p('<p class="auction-widget-detail auction-widget-accent">'),Yn=p('<div><div id=auction-widget-header></div><div><div><div id=auction-widget-description><div><p class="auction-widget-detail auction-widget-label">D\xE9but</p><p class=auction-widget-detail> </p></div><div><p class="auction-widget-detail auction-widget-label">Fin</p><p class=auction-widget-detail></p></div><div><p class="auction-widget-detail auction-widget-label">Prix de d\xE9part</p><p class="auction-widget-detail auction-widget-accent"> </p></div><div><p class="auction-widget-detail auction-widget-label">Palier</p><p class="auction-widget-detail auction-widget-accent"></p></div></div><div class="auction-widget-section auction-widget-border-t"><div>'),Xn=p('<div><p class="auction-widget-detail auction-widget-label">Vente priv\xE9e</p><p class=auction-widget-detail>Inscrivez-vous pour voir les participations'),Qn=e=>{let[t,n]=x(""),[i,s]=x(ne(e.auction)),[r,o]=x(ie(e.auction)),[l,a]=x(me(e.auction));function c(g,w){let v=(g.getTime()-w.getTime())/1e3,k=Math.floor(v/(3600*24)),T=Math.floor(v%(3600*24)/3600),L=Math.floor(v%3600/60),E=Math.floor(v%60);return{days:k,hours:T,minutes:L,seconds:E}}function f(g){if(a(me(e.auction)),o(ie(e.auction)),s(ne(e.auction)),me(g)){clearInterval(u);return}let w=ne(g)?g.startDate:g.endDate,v=new Date,k=c(ft(w),v);n(`${k.days}j ${k.hours}h ${k.minutes}m ${k.seconds}s`)}let u=setInterval(()=>{f(e.auction)},1e3);return(()=>{var g=Yn(),w=g.firstChild,v=w.nextSibling,k=v.firstChild,T=k.firstChild,L=T.firstChild,E=L.firstChild,R=E.nextSibling,O=R.firstChild,S=L.nextSibling,C=S.firstChild,j=C.nextSibling,M=S.nextSibling,je=M.firstChild,fe=je.nextSibling,gt=fe.firstChild,Re=M.nextSibling,we=Re.firstChild,mt=we.nextSibling,Ye=T.nextSibling,be=Ye.firstChild;return h(w,m(A,{get when(){return i()},get children(){var G=qn(),oe=G.firstChild,ye=oe.nextSibling;return h(ye,t),G}}),null),h(w,m(A,{get when(){return r()},get children(){var G=Wn(),oe=G.firstChild,ye=oe.nextSibling;return h(ye,t),G}}),null),h(w,m(A,{get when(){return l()},get children(){return Kn()}}),null),h(R,()=>pe(e.auction.startDate),O),h(j,()=>pe(e.auction.endDate)),h(fe,()=>U(e.auction.startingPrice),gt),h(mt,()=>U(e.auction.step)),h(be,m(A,{get when(){return!e.auction.isPrivate||e.auction.isPrivate&&e.auction.registration&&e.auction.registration.isUserAllowed},get fallback(){return Xn()},get children(){return[Gn(),(()=>{var G=Jn();return h(G,(()=>{var oe=_(()=>!!e.auction.highestBid.participantId);return()=>oe()?U(e.auction.highestBid.amount,e.auction.currency):U(null,e.auction.currency)})()),G})()]}})),g})()},qt=Qn;var Zn=p('<div class=auction-widget-icon><i class="fas fa-check">'),ei=p("<div class=auction-widget-icon><i>"),ti=p("<h3>"),ni=p("<div><div id=auction-widget-modal-background></div><div class=auction-widget-modal><div id=auction-widget-modal-content><div><div><div>"),ii=e=>(()=>{var t=ni(),n=t.firstChild,i=n.nextSibling,s=i.firstChild,r=s.firstChild,o=r.firstChild,l=o.firstChild;return h(r,m(A,{get when(){return e.success},get children(){return Zn()}}),o),h(r,m(A,{get when(){return e.icon_class},get children(){var a=ei(),c=a.firstChild;return F(()=>Bt(c,e.icon_class)),a}}),o),h(o,m(A,{get when(){return e.title},get children(){var a=ti();return h(a,()=>e.title),a}}),l),h(l,()=>e.children),t})(),Oe=ii;var ri=p("<tr><td class=auction-widget-td>Offre pr\xE9c\xE9dente</td><td class=auction-widget-amount>"),si=p("<table id=auction-widget-table><tbody><tr><td class=auction-widget-td>Votre offre</td><td class=auction-widget-amount>"),oi=p("<p id=email-error class=auction-widget-modal-note>Vous devez au moins ench\xE9rir <!>."),li=p('<div class=auction-widget-action><button class="auction-widget-btn auction-widget-custom">Confirmer</button><button class=auction-widget-btn>Annuler'),ai=p('<div class="auction-widget-section auction-widget-border-t"><div id=auction-widget-bid><p class="auction-widget-detail auction-widget-label auction-widget-text-left">Ench\xE8re rapide</p><div id=auction-widget-fast-bid><span><button class="auction-widget-btn auction-widget-custom">+ </button></span><span><button class="auction-widget-btn auction-widget-custom">+ </button></span><span><button class="auction-widget-btn auction-widget-custom">+ </button></span></div><div class=auction-widget-history-area><p class="auction-widget-detail auction-widget-label auction-widget-text-left">Votre montant</p><div id=auction-widget-bid-form><input type=number min=0 step=1><div id=auction-widget-currency><span></span></div><button class="auction-widget-btn auction-widget-custom">Ench\xE9rir'),ci=e=>{let t=e.auction.highestBid?e.auction.highestBid.amount+e.auction.step:e.auction.startingPrice,[n,i]=x(t),[s,r]=x(!1),[o,l]=x(!1),[a,c]=x(O(1,!1,e.auction)),[f,u]=x(O(2,!1,e.auction)),[g,w]=x(O(3,!1,e.auction)),[v,k]=x(0);function T(S,C){return()=>{console.log(C.step);let j=C.highestBid?C.highestBid.amount:null,M;j?M=j+S*C.step:M=C.startingPrice+C.step*(S-1),i(M),console.log("Placing bid",n()),console.log("Auction",C),r(!0)}}function L(){return()=>r(!0)}function E(){return()=>{l(!1),r(!1)}}function R(S,C){return()=>{Z.placeBidOnAuction(C,S).then(j=>{r(!1),l(!1),c(O(1,!0,C)),u(O(2,!0,C)),w(O(3,!0,C))}).catch(j=>{j.code=="bid_amount_too_low"&&(l(!0),k(j.min))})}}function O(S,C,j){let M;return C||j.bids&&j.bids.length>0?M=S*j.step:M=(S-1)*j.step,U(M,j.currency)}return(()=>{var S=ai(),C=S.firstChild,j=C.firstChild,M=j.nextSibling,je=M.firstChild,fe=je.firstChild,gt=fe.firstChild,Re=je.nextSibling,we=Re.firstChild,mt=we.firstChild,Ye=Re.nextSibling,be=Ye.firstChild,G=be.firstChild,oe=M.nextSibling,ye=oe.firstChild,on=ye.nextSibling,Xe=on.firstChild,pt=Xe.nextSibling,ln=pt.firstChild,an=pt.nextSibling;return Y(fe,"click",T(1,e.auction),!0),h(fe,a,null),Y(we,"click",T(2,e.auction),!0),h(we,f,null),Y(be,"click",T(3,e.auction),!0),h(be,g,null),Xe.$$input=V=>i(parseInt(V.currentTarget.value)),h(ln,()=>Ge(e.auction.currency)),Y(an,"click",L(),!0),h(S,m(A,{get when(){return s()},get children(){return m(Oe,{title:"Vous \xEAtes sur le point d'ench\xE9rir",success:!1,icon_class:"fas fa-gavel",get children(){return[(()=>{var V=si(),le=V.firstChild,ae=le.firstChild,wt=ae.firstChild,cn=wt.nextSibling;return h(le,m(A,{get when(){return e.auction.highestBid.participantId},get children(){var bt=ri(),un=bt.firstChild,fn=un.nextSibling;return h(fn,()=>U(e.auction.highestBid.amount)),bt}}),ae),h(cn,()=>U(n())),V})(),m(A,{get when(){return o()},get children(){var V=oi(),le=V.firstChild,ae=le.nextSibling,wt=ae.nextSibling;return h(V,()=>U(v()),ae),V}}),(()=>{var V=li(),le=V.firstChild,ae=le.nextSibling;return Y(le,"click",R(n(),e.auction),!0),Y(ae,"click",E(),!0),V})()]}})}}),null),F(()=>Xe.value=n()),S})()},Wt=ci;Ue(["click","input"]);var ui=p('<div class="auction-widget-section auction-widget-border-t"><div id=auction-widget-history-area><p class="auction-widget-label auction-widget-detail">Historique des offres</p><ul id=auction-widget-scroll>'),fi=p('<div><p class=auction-widget-date>Le </p><span class=auction-widget-user><i class="fas fa-user"></i>Vous</span>avez ench\xE9ri'),di=p("<li><p id=auction-widget-bid-amount>"),hi=p('<div><p class=auction-widget-date>Le </p><span class=auction-widget-user><i class="fas fa-user"></i></span>a ench\xE9ri'),gi=e=>(()=>{var t=ui(),n=t.firstChild,i=n.firstChild,s=i.nextSibling;return h(s,m(nt,{get each(){return[...e.bids].sort((r,o)=>o.amount-r.amount)},children:(r,o)=>(()=>{var l=di(),a=l.firstChild;return h(l,m(A,{get when(){return r.participantId===e.user.id},get fallback(){return(()=>{var c=hi(),f=c.firstChild,u=f.firstChild,g=f.nextSibling,w=g.firstChild;return h(f,()=>pe(r.createdAt),null),h(g,()=>r.userAnonymousId,null),c})()},get children(){var c=fi(),f=c.firstChild,u=f.firstChild;return h(f,()=>pe(r.createdAt),null),c}}),a),h(a,()=>U(r.amount,e.auction.currency)),l})()})),t})(),Kt=gi;var mi=p('<div><div class=auction-widget-section><button class="auction-widget-btn auction-widget-custom">Je veux participer'),pi=p('<div class=auction-widget-action><button class="auction-widget-btn auction-widget-custom">Se connecter</button><button class=auction-widget-btn>Annuler'),wi=p("<div id=auction-widget-agent-link><p class=auction-widget-modal-note>Pas encore de compte ?</p><button id=auction-widget-link>Contacter l'agent"),bi=p("<div>"),yi=p('<div class=auction-widget-contact><a class="auction-widget-btn auction-widget-custom"><i class="fas fa-envelope"></i></a><a class="auction-widget-btn auction-widget-custom"><i class="fas fa-phone">'),vi=p("<div class=auction-widget-action><button class=auction-widget-btn>Fermer"),$i=e=>{e.isLogging&&n();function t(){return()=>{console.log("connect"),n()}}function n(){Z.authenticate().then(()=>{e.setterIsLogged(!0),Z.me().then(l=>{e.updateUser(l)})})}let[i,s]=x(!1),[r,o]=x(!1);return(()=>{var l=mi(),a=l.firstChild,c=a.firstChild;return c.$$click=()=>s(!i()),h(l,(()=>{var f=_(()=>!!i());return()=>f()&&(()=>{var u=bi();return h(u,m(Oe,{title:"Vous devez \xEAtre connect\xE9",icon_class:"fas fa-user-lock",success:!1,get children(){return[(()=>{var g=pi(),w=g.firstChild,v=w.nextSibling;return Y(w,"click",t(),!0),v.$$click=()=>s(!1),g})(),(()=>{var g=wi(),w=g.firstChild,v=w.nextSibling;return v.$$click=()=>{o(!0),s(!1)},g})()]}})),u})()})(),null),h(l,(()=>{var f=_(()=>!!r());return()=>f()&&m(Oe,{title:"Demande de participation",icon_class:"fas fa-gavel",success:!1,get children(){return[(()=>{var u=yi(),g=u.firstChild,w=g.firstChild,v=g.nextSibling,k=v.firstChild;return h(g,()=>e.auction.agentEmail,null),h(v,()=>e.auction.agentPhone,null),F(T=>{var L="mailto:"+e.auction.agentEmail,E="tel:"+e.auction.agentPhone;return L!==T.e&&st(g,"href",T.e=L),E!==T.t&&st(v,"href",T.t=E),T},{e:void 0,t:void 0}),u})(),(()=>{var u=vi(),g=u.firstChild;return g.$$click=()=>o(!1),u})()]}})})(),null),l})()},Gt=$i;Ue(["click"]);var xi=p("<p class=auction-widget-note>Vous \xEAtes observateur pour cette vente. Vous ne pouvez pas ench\xE9rir."),Si=p("<p class=auction-widget-note>Votre demande d'observation pour cette vente a \xE9t\xE9 accept\xE9e. Attendez le d\xE9but de l'ench\xE8re pour voir les participations."),Ci=p("<p class=auction-widget-note>Votre demande de participation pour cette vente a \xE9t\xE9 accept\xE9e. Attendez le d\xE9but de l'ench\xE8re pour ench\xE9rir."),_i=p("<p class=auction-widget-note>Votre demande de participation pour cette vente a \xE9t\xE9 refus\xE9e."),Ai=p("<p class=auction-widget-note>Votre demande de participation a \xE9t\xE9 transmise \xE0 l'agent responsable du bien. Vous serez inform\xE9 par email lorsqu'elle sera valid\xE9e."),ki=p("<p class=auction-widget-note>Vous n'\xEAtes pas inscrit \xE0 cette vente, veuillez contacter l'agent responsable."),Ti=p("<div id=auction-widget-box><div><div>"),[re,Ei]=x(!1),[Jt,Qt]=x(!1),[dt,Pi]=x({id:""}),[Je,Yt]=at([]),[b,Xt]=at({id:"",startDate:0,endDate:0,startingPrice:0,step:0,bids:[],registration:{isUserAllowed:!1,isRegistrationAccepted:null,isParticipant:!1},isPrivate:!1,highestBid:{id:"",amount:0,createdAt:0,newEndDate:0,userAnonymousId:"",participantId:""},agentEmail:"",agentPhone:"",currency:{symbol:"",code:"",isBefore:!1}});function Zt(e){Z.getNextAuctionById(e).then(t=>{console.log("Auction:",t),Xt(t),Yt(t.bids),Z.subscribeToAuction(t.id,n=>{console.log("Auction data:",n),Yt([...Je,n]),console.log("Bids:",Je);let i=n.newEndDate||t.endDate;Xt({...t,highestBid:n,endDate:i})}).then(n=>{console.log("Subscribed to auction"),console.log("Channel:",n)}).catch(n=>{console.error("Error subscribing to auction:",n)})})}function Oi(e,t){Pi(e),Zt(t),Qt(!1)}var ji=e=>{let{apiKey:t,propertyInfo:n,environment:i}=e;Z.initEIClient(t,i),Zt(n);let s=window.location.href,o=new URLSearchParams(s.split("?")[1]).get("code");return o!=""&&o!=null&&Qt(!0),(()=>{var l=Ti(),a=l.firstChild,c=a.firstChild;return h(c,m(A,{get when(){return b.id!=""},get children(){return[m(qt,{auction:b,get user(){return dt()}}),m(A,{get when(){return _(()=>!!(!re()||Jt()))()&&(ie(b)||ne(b))},get children(){return m(Gt,{setterIsLogged:Ei,get isLogging(){return Jt()},auction:b,get updateUser(){return Oi(dt(),n)}})}}),m(it,{get children(){return[m(J,{get when(){return _(()=>!!(re()&&b.registration&&b.registration.isRegistrationAccepted&&b.registration.isParticipant))()&&ie(b)},get children(){return m(Wt,{auction:b})}}),m(J,{get when(){return _(()=>!!(re()&&b.registration&&b.registration.isRegistrationAccepted&&!b.registration.isParticipant))()&&ie(b)},get children(){return xi()}}),m(J,{get when(){return _(()=>!!(re()&&b.registration&&b.registration.isRegistrationAccepted&&!b.registration.isParticipant))()&&ne(b)},get children(){return Si()}}),m(J,{get when(){return _(()=>!!(re()&&b.registration&&b.registration.isRegistrationAccepted===!0))()&&ne(b)},get children(){return Ci()}}),m(J,{get when(){return re()&&b.registration&&b.registration.isRegistrationAccepted===!1},get children(){return _i()}}),m(J,{get when(){return re()&&b.registration&&b.registration.isRegistrationAccepted==null},get children(){return Ai()}}),m(J,{get when(){return re()&&!b.registration},get children(){return ki()}})]}}),m(A,{get when(){return me(b)||ie(b)&&Je.length>0},get children(){return m(Kt,{bids:Je,auction:b,get user(){return dt()}})}})]}})),l})()},en=ji;var se=document.getElementById("auction-widget"),tn=se?.getAttribute("api-key")||"",Ri=se?.getAttribute("api-env")||"production",ht=se?.getAttribute("property-id")||"",nn=se?.getAttribute("source")||"",rn=se?.getAttribute("source-agency-id")||"",sn=se?.getAttribute("source-id")||"";if(!(se instanceof HTMLElement))throw new Error("Auction widget: No root element found with id 'auction-widget'. Did you forget to add it? Or maybe the id attribute got misspelled?");if(tn=="")throw new Error("Auction widget: No 'api-key' attribute found. Did you forget to add it? Or maybe the attribute got misspelled?");if(ht==""&&(nn==""||rn==""||sn==""))throw new Error("Auction widget: Either 'property-id' or 'source', 'source-agency-id', and 'source-id' must be provided. Did you forget to add them? Or maybe the attributes got misspelled?");var Di=ht?{propertyId:ht}:{source:nn,sourceAgencyId:rn,sourceId:sn};Mt(()=>m(en,{apiKey:tn,propertyInfo:Di,environment:Ri}),se);})(); | ||
"use strict";(()=>{var D={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return gt(this.context.count)},getNextContextId(){return gt(this.context.count++)}};function gt(e){let t=String(e),n=t.length-1;return D.context.id+(n?String.fromCharCode(96+n):"")+t}function mt(e){D.context=e}function mn(){return{...D.context,id:D.getNextContextId(),count:0}}var pn=(e,t)=>e===t,ne=Symbol("solid-proxy");var Re=Symbol("solid-track"),Mi=Symbol("solid-dev-component"),Pe={equals:pn},pt=null,wn=Ct,F=1,ve=2,St={owned:null,cleanups:null,context:null,owner:null};var v=null,f=null,Se=null,fe=null,$=null,O=null,L=null,De=0;function ye(e,t){let n=$,i=v,s=e.length===0,r=t===void 0?i:t,l=s?St:{owned:null,cleanups:null,context:r?r.context:null,owner:r},o=s?e:()=>e(()=>H(()=>te(l)));v=l,$=null;try{return K(o,!0)}finally{$=n,v=i}}function S(e,t){t=t?Object.assign({},Pe,t):Pe;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},i=s=>(typeof s=="function"&&(f&&f.running&&f.sources.has(n)?s=s(n.tValue):s=s(n.value)),_t(n,s));return[$t.bind(n),i]}function q(e,t,n){let i=At(e,t,!1,F);Se&&f&&f.running?O.push(i):Le(i)}function T(e,t,n){n=n?Object.assign({},Pe,n):Pe;let i=At(e,t,!0,0);return i.observers=null,i.observerSlots=null,i.comparator=n.equals||void 0,Se&&f&&f.running?(i.tState=F,O.push(i)):Le(i),$t.bind(i)}function xt(e){return K(e,!1)}function H(e){if(!fe&&$===null)return e();let t=$;$=null;try{return fe?fe.untrack(e):e()}finally{$=t}}function Je(e){return v===null||(v.cleanups===null?v.cleanups=[e]:v.cleanups.push(e)),e}function Ie(){return $}function bn(e){if(f&&f.running)return e(),f.done;let t=$,n=v;return Promise.resolve().then(()=>{$=t,v=n;let i;return(Se||vn)&&(i=f||(f={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),i.done||(i.done=new Promise(s=>i.resolve=s)),i.running=!0),K(e,!1),$=v=null,i?i.done:void 0})}var[Ni,wt]=S(!1);function yn(e){let t=T(e),n=T(()=>Ge(t()));return n.toArray=()=>{let i=n();return Array.isArray(i)?i:i!=null?[i]:[]},n}var vn;function $t(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===F)Le(this);else{let t=O;O=null,K(()=>je(this),!1),O=t}if($){let t=this.observers?this.observers.length:0;$.sources?($.sources.push(this),$.sourceSlots.push(t)):($.sources=[this],$.sourceSlots=[t]),this.observers?(this.observers.push($),this.observerSlots.push($.sources.length-1)):(this.observers=[$],this.observerSlots=[$.sources.length-1])}return e&&f.sources.has(this)?this.tValue:this.value}function _t(e,t,n){let i=f&&f.running&&f.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(i,t)){if(f){let s=f.running;(s||!n&&f.sources.has(e))&&(f.sources.add(e),e.tValue=t),s||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&K(()=>{for(let s=0;s<e.observers.length;s+=1){let r=e.observers[s],l=f&&f.running;l&&f.disposed.has(r)||((l?!r.tState:!r.state)&&(r.pure?O.push(r):L.push(r),r.observers&&kt(r)),l?r.tState=F:r.state=F)}if(O.length>1e6)throw O=[],new Error},!1)}return t}function Le(e){if(!e.fn)return;te(e);let t=De;bt(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{K(()=>{f&&(f.running=!0),$=v=e,bt(e,e.tValue,t),$=v=null},!1)})}function bt(e,t,n){let i,s=v,r=$;$=v=e;try{i=e.fn(t)}catch(l){return e.pure&&(f&&f.running?(e.tState=F,e.tOwned&&e.tOwned.forEach(te),e.tOwned=void 0):(e.state=F,e.owned&&e.owned.forEach(te),e.owned=null)),e.updatedAt=n+1,Xe(l)}finally{$=r,v=s}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?_t(e,i,!0):f&&f.running&&e.pure?(f.sources.add(e),e.tValue=i):e.value=i,e.updatedAt=n)}function At(e,t,n,i=F,s){let r={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:v,context:v?v.context:null,pure:n};if(f&&f.running&&(r.state=0,r.tState=i),v===null||v!==St&&(f&&f.running&&v.pure?v.tOwned?v.tOwned.push(r):v.tOwned=[r]:v.owned?v.owned.push(r):v.owned=[r]),fe&&r.fn){let[l,o]=S(void 0,{equals:!1}),a=fe.factory(r.fn,o);Je(()=>a.dispose());let u=()=>bn(o).then(()=>d.dispose()),d=fe.factory(r.fn,u);r.fn=c=>(l(),f&&f.running?d.track(c):a.track(c))}return r}function Ye(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===ve)return je(e);if(e.suspense&&H(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<De);){if(t&&f.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let i=n.length-1;i>=0;i--){if(e=n[i],t){let s=e,r=n[i+1];for(;(s=s.owner)&&s!==r;)if(f.disposed.has(s))return}if((t?e.tState:e.state)===F)Le(e);else if((t?e.tState:e.state)===ve){let s=O;O=null,K(()=>je(e,n[0]),!1),O=s}}}function K(e,t){if(O)return e();let n=!1;t||(O=[]),L?n=!0:L=[],De++;try{let i=e();return Sn(n),i}catch(i){n||(L=null),O=null,Xe(i)}}function Sn(e){if(O&&(Se&&f&&f.running?xn(O):Ct(O),O=null),e)return;let t;if(f){if(!f.promises.size&&!f.queue.size){let i=f.sources,s=f.disposed;L.push.apply(L,f.effects),t=f.resolve;for(let r of L)"tState"in r&&(r.state=r.tState),delete r.tState;f=null,K(()=>{for(let r of s)te(r);for(let r of i){if(r.value=r.tValue,r.owned)for(let l=0,o=r.owned.length;l<o;l++)te(r.owned[l]);r.tOwned&&(r.owned=r.tOwned),delete r.tValue,delete r.tOwned,r.tState=0}wt(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,L),L=null,wt(!0);return}}let n=L;L=null,n.length&&K(()=>wn(n),!1),t&&t()}function Ct(e){for(let t=0;t<e.length;t++)Ye(e[t])}function xn(e){for(let t=0;t<e.length;t++){let n=e[t],i=f.queue;i.has(n)||(i.add(n),Se(()=>{i.delete(n),K(()=>{f.running=!0,Ye(n)},!1),f&&(f.running=!1)}))}}function je(e,t){let n=f&&f.running;n?e.tState=0:e.state=0;for(let i=0;i<e.sources.length;i+=1){let s=e.sources[i];if(s.sources){let r=n?s.tState:s.state;r===F?s!==t&&(!s.updatedAt||s.updatedAt<De)&&Ye(s):r===ve&&je(s,t)}}}function kt(e){let t=f&&f.running;for(let n=0;n<e.observers.length;n+=1){let i=e.observers[n];(t?!i.tState:!i.state)&&(t?i.tState=ve:i.state=ve,i.pure?O.push(i):L.push(i),i.observers&&kt(i))}}function te(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),i=e.sourceSlots.pop(),s=n.observers;if(s&&s.length){let r=s.pop(),l=n.observerSlots.pop();i<s.length&&(r.sourceSlots[l]=i,s[i]=r,n.observerSlots[i]=l)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)te(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)Tt(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)te(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}f&&f.running?e.tState=0:e.state=0}function Tt(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let n=0;n<e.owned.length;n++)Tt(e.owned[n])}function $n(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function yt(e,t,n){try{for(let i of t)i(e)}catch(i){Xe(i,n&&n.owner||null)}}function Xe(e,t=v){let n=pt&&t&&t.context&&t.context[pt],i=$n(e);if(!n)throw i;L?L.push({fn(){yt(i,n,t)},state:F}):yt(i,n,t)}function Ge(e){if(typeof e=="function"&&!e.length)return Ge(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let i=Ge(e[n]);Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}return e}var _n=Symbol("fallback");function vt(e){for(let t=0;t<e.length;t++)e[t]()}function An(e,t,n={}){let i=[],s=[],r=[],l=0,o=t.length>1?[]:null;return Je(()=>vt(r)),()=>{let a=e()||[],u=a.length,d,c;return a[Re],H(()=>{let b,x,C,j,B,_,R,I,W;if(u===0)l!==0&&(vt(r),r=[],i=[],s=[],l=0,o&&(o=[])),n.fallback&&(i=[_n],s[0]=ye(pe=>(r[0]=pe,n.fallback())),l=1);else if(l===0){for(s=new Array(u),c=0;c<u;c++)i[c]=a[c],s[c]=ye(w);l=u}else{for(C=new Array(u),j=new Array(u),o&&(B=new Array(u)),_=0,R=Math.min(l,u);_<R&&i[_]===a[_];_++);for(R=l-1,I=u-1;R>=_&&I>=_&&i[R]===a[I];R--,I--)C[I]=s[R],j[I]=r[R],o&&(B[I]=o[R]);for(b=new Map,x=new Array(I+1),c=I;c>=_;c--)W=a[c],d=b.get(W),x[c]=d===void 0?-1:d,b.set(W,c);for(d=_;d<=R;d++)W=i[d],c=b.get(W),c!==void 0&&c!==-1?(C[c]=s[d],j[c]=r[d],o&&(B[c]=o[d]),c=x[c],b.set(W,c)):r[d]();for(c=_;c<u;c++)c in C?(s[c]=C[c],r[c]=j[c],o&&(o[c]=B[c],o[c](c))):s[c]=ye(w);s=s.slice(0,l=u),i=a.slice(0)}return s});function w(b){if(r[c]=b,o){let[x,C]=S(c);return o[c]=C,t(a[c],x)}return t(a[c])}}}var Cn=!1;function m(e,t){if(Cn&&D.context){let n=D.context;mt(mn());let i=H(()=>e(t||{}));return mt(n),i}return H(()=>e(t||{}))}var Et=e=>`Stale read from <${e}>.`;function Qe(e){let t="fallback"in e&&{fallback:()=>e.fallback};return T(An(()=>e.each,e.children,t||void 0))}function A(e){let t=e.keyed,n=T(()=>e.when,void 0,{equals:(i,s)=>t?i===s:!i==!s});return T(()=>{let i=n();if(i){let s=e.children;return typeof s=="function"&&s.length>0?H(()=>s(t?i:()=>{if(!H(n))throw Et("Show");return e.when})):s}return e.fallback},void 0,void 0)}function Ze(e){let t=!1,n=(r,l)=>(t?r[1]===l[1]:!r[1]==!l[1])&&r[2]===l[2],i=yn(()=>e.children),s=T(()=>{let r=i();Array.isArray(r)||(r=[r]);for(let l=0;l<r.length;l++){let o=r[l].when;if(o)return t=!!r[l].keyed,[l,o,r[l]]}return[-1]},void 0,{equals:n});return T(()=>{let[r,l,o]=s();if(r<0)return e.fallback;let a=o.children;return typeof a=="function"&&a.length>0?H(()=>a(t?l:()=>{if(H(s)[0]!==r)throw Et("Match");return o.when})):a},void 0,void 0)}function Y(e){return e}var Tn=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Xi=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Tn]);function En(e,t,n){let i=n.length,s=t.length,r=i,l=0,o=0,a=t[s-1].nextSibling,u=null;for(;l<s||o<r;){if(t[l]===n[o]){l++,o++;continue}for(;t[s-1]===n[r-1];)s--,r--;if(s===l){let d=r<i?o?n[o-1].nextSibling:n[r-o]:a;for(;o<r;)e.insertBefore(n[o++],d)}else if(r===o)for(;l<s;)(!u||!u.has(t[l]))&&t[l].remove(),l++;else if(t[l]===n[r-1]&&n[o]===t[s-1]){let d=t[--s].nextSibling;e.insertBefore(n[o++],t[l++].nextSibling),e.insertBefore(n[--r],d),t[s]=n[r]}else{if(!u){u=new Map;let c=o;for(;c<r;)u.set(n[c],c++)}let d=u.get(t[l]);if(d!=null)if(o<d&&d<r){let c=l,w=1,b;for(;++c<s&&c<r&&!((b=u.get(t[c]))==null||b!==d+w);)w++;if(w>d-o){let x=t[l];for(;o<d;)e.insertBefore(n[o++],x)}else e.replaceChild(n[o++],t[l++])}else l++;else t[l++].remove()}}}var Ot="_$DX_DELEGATE";function jt(e,t,n,i={}){let s;return ye(r=>{s=r,t===document?e():g(t,e(),t.firstChild?null:void 0,n)},i.owner),()=>{s(),t.textContent=""}}function p(e,t,n){let i,s=()=>{let l=document.createElement("template");return l.innerHTML=e,n?l.content.firstChild.firstChild:l.content.firstChild},r=t?()=>H(()=>document.importNode(i||(i=s()),!0)):()=>(i||(i=s())).cloneNode(!0);return r.cloneNode=r,r}function Me(e,t=window.document){let n=t[Ot]||(t[Ot]=new Set);for(let i=0,s=e.length;i<s;i++){let r=e[i];n.has(r)||(n.add(r),t.addEventListener(r,On))}}function tt(e,t,n){nt(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Rt(e,t){nt(e)||(t==null?e.removeAttribute("class"):e.className=t)}function X(e,t,n,i){if(i)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let s=n[0];e.addEventListener(t,n[0]=r=>s.call(e,n[1],r))}else e.addEventListener(t,n,typeof n!="function"&&n)}function g(e,t,n,i){if(n!==void 0&&!i&&(i=[]),typeof t!="function")return Be(e,t,i,n);q(s=>Be(e,t(),s,n),i)}function nt(e){return!!D.context&&!D.done&&(!e||e.isConnected)}function On(e){if(D.registry&&D.events&&D.events.find(([a,u])=>u===e))return;let t=e.target,n=`$$${e.type}`,i=e.target,s=e.currentTarget,r=a=>Object.defineProperty(e,"target",{configurable:!0,value:a}),l=()=>{let a=t[n];if(a&&!t.disabled){let u=t[`${n}Data`];if(u!==void 0?a.call(t,u,e):a.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&r(t.host),!0},o=()=>{for(;l()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),D.registry&&!D.done&&(D.done=_$HY.done=!0),e.composedPath){let a=e.composedPath();r(a[0]);for(let u=0;u<a.length-2&&(t=a[u],!!l());u++){if(t._$host){t=t._$host,o();break}if(t.parentNode===s)break}}else o();r(i)}function Be(e,t,n,i,s){let r=nt(e);if(r){!n&&(n=[...e.childNodes]);let a=[];for(let u=0;u<n.length;u++){let d=n[u];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():a.push(d)}n=a}for(;typeof n=="function";)n=n();if(t===n)return n;let l=typeof t,o=i!==void 0;if(e=o&&n[0]&&n[0].parentNode||e,l==="string"||l==="number"){if(r||l==="number"&&(t=t.toString(),t===n))return n;if(o){let a=n[0];a&&a.nodeType===3?a.data!==t&&(a.data=t):a=document.createTextNode(t),n=de(e,n,i,a)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||l==="boolean"){if(r)return n;n=de(e,n,i)}else{if(l==="function")return q(()=>{let a=t();for(;typeof a=="function";)a=a();n=Be(e,a,n,i)}),()=>n;if(Array.isArray(t)){let a=[],u=n&&Array.isArray(n);if(et(a,t,n,s))return q(()=>n=Be(e,a,n,i,!0)),()=>n;if(r){if(!a.length)return n;if(i===void 0)return n=[...e.childNodes];let d=a[0];if(d.parentNode!==e)return n;let c=[d];for(;(d=d.nextSibling)!==i;)c.push(d);return n=c}if(a.length===0){if(n=de(e,n,i),o)return n}else u?n.length===0?Pt(e,a,i):En(e,n,a):(n&&de(e),Pt(e,a));n=a}else if(t.nodeType){if(r&&t.parentNode)return n=o?[t]:t;if(Array.isArray(n)){if(o)return n=de(e,n,i,t);de(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function et(e,t,n,i){let s=!1;for(let r=0,l=t.length;r<l;r++){let o=t[r],a=n&&n[e.length],u;if(!(o==null||o===!0||o===!1))if((u=typeof o)=="object"&&o.nodeType)e.push(o);else if(Array.isArray(o))s=et(e,o,a)||s;else if(u==="function")if(i){for(;typeof o=="function";)o=o();s=et(e,Array.isArray(o)?o:[o],Array.isArray(a)?a:[a])||s}else e.push(o),s=!0;else{let d=String(o);a&&a.nodeType===3&&a.data===d?e.push(a):e.push(document.createTextNode(d))}}return s}function Pt(e,t,n=null){for(let i=0,s=t.length;i<s;i++)e.insertBefore(t[i],n)}function de(e,t,n,i){if(n===void 0)return e.textContent="";let s=i||document.createTextNode("");if(t.length){let r=!1;for(let l=t.length-1;l>=0;l--){let o=t[l];if(s!==o){let a=o.parentNode===e;!r&&!l?a?e.replaceChild(s,o):e.insertBefore(s,n):a&&o.remove()}else r=!0}}else e.insertBefore(s,n);return[s]}var Qi=Symbol();var it=Symbol("store-raw"),he=Symbol("store-node"),Q=Symbol("store-has"),Dt=Symbol("store-self");function It(e){let t=e[ne];if(!t&&(Object.defineProperty(e,ne,{value:t=new Proxy(e,Rn)}),!Array.isArray(e))){let n=Object.keys(e),i=Object.getOwnPropertyDescriptors(e);for(let s=0,r=n.length;s<r;s++){let l=n[s];i[l].get&&Object.defineProperty(e,l,{enumerable:i[l].enumerable,get:i[l].get.bind(t)})}}return t}function Ne(e){let t;return e!=null&&typeof e=="object"&&(e[ne]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function $e(e,t=new Set){let n,i,s,r;if(n=e!=null&&e[it])return n;if(!Ne(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let l=0,o=e.length;l<o;l++)s=e[l],(i=$e(s,t))!==s&&(e[l]=i)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let l=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let a=0,u=l.length;a<u;a++)r=l[a],!o[r].get&&(s=e[r],(i=$e(s,t))!==s&&(e[r]=i))}return e}function Ue(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function _e(e,t,n){if(e[t])return e[t];let[i,s]=S(n,{equals:!1,internal:!0});return i.$=s,e[t]=i}function Pn(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===ne||t===he||(delete n.value,delete n.writable,n.get=()=>e[ne][t]),n}function Lt(e){Ie()&&_e(Ue(e,he),Dt)()}function jn(e){return Lt(e),Reflect.ownKeys(e)}var Rn={get(e,t,n){if(t===it)return e;if(t===ne)return n;if(t===Re)return Lt(e),n;let i=Ue(e,he),s=i[t],r=s?s():e[t];if(t===he||t===Q||t==="__proto__")return r;if(!s){let l=Object.getOwnPropertyDescriptor(e,t);Ie()&&(typeof r!="function"||e.hasOwnProperty(t))&&!(l&&l.get)&&(r=_e(i,t,r)())}return Ne(r)?It(r):r},has(e,t){return t===it||t===ne||t===Re||t===he||t===Q||t==="__proto__"?!0:(Ie()&&_e(Ue(e,Q),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:jn,getOwnPropertyDescriptor:Pn};function He(e,t,n,i=!1){if(!i&&e[t]===n)return;let s=e[t],r=e.length;n===void 0?(delete e[t],e[Q]&&e[Q][t]&&s!==void 0&&e[Q][t].$()):(e[t]=n,e[Q]&&e[Q][t]&&s===void 0&&e[Q][t].$());let l=Ue(e,he),o;if((o=_e(l,t,s))&&o.$(()=>n),Array.isArray(e)&&e.length!==r){for(let a=e.length;a<r;a++)(o=l[a])&&o.$();(o=_e(l,"length",r))&&o.$(e.length)}(o=l[Dt])&&o.$()}function Bt(e,t){let n=Object.keys(t);for(let i=0;i<n.length;i+=1){let s=n[i];He(e,s,t[s])}}function Dn(e,t){if(typeof t=="function"&&(t=t(e)),t=$e(t),Array.isArray(t)){if(e===t)return;let n=0,i=t.length;for(;n<i;n++){let s=t[n];e[n]!==s&&He(e,n,s)}He(e,"length",i)}else Bt(e,t)}function xe(e,t,n=[]){let i,s=e;if(t.length>1){i=t.shift();let l=typeof i,o=Array.isArray(e);if(Array.isArray(i)){for(let a=0;a<i.length;a++)xe(e,[i[a]].concat(t),n);return}else if(o&&l==="function"){for(let a=0;a<e.length;a++)i(e[a],a)&&xe(e,[a].concat(t),n);return}else if(o&&l==="object"){let{from:a=0,to:u=e.length-1,by:d=1}=i;for(let c=a;c<=u;c+=d)xe(e,[c].concat(t),n);return}else if(t.length>1){xe(e[i],t,[i].concat(n));return}s=e[i],n=[i].concat(n)}let r=t[0];typeof r=="function"&&(r=r(s,n),r===s)||i===void 0&&r==null||(r=$e(r),i===void 0||Ne(s)&&Ne(r)&&!Array.isArray(r)?Bt(s,r):He(e,i,r))}function rt(...[e,t]){let n=$e(e||{}),i=Array.isArray(n),s=It(n);function r(...l){xt(()=>{i&&l.length===1?Dn(n,l[0]):xe(n,l)})}return[s,r]}var nr=Symbol("store-root");async function Nt(){let e=window.location.href||"",t=new URL(e),i=t.searchParams.get("code"),s=window.location.href;if(i)return t.search="",window.history.replaceState({},"",t),fetch(`${h.BASE_URL}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",client_id:h.clientId,code:i,redirect_uri:window.location.href,code_verifier:localStorage.getItem("pkce_code_verifier")})}).then(r=>r.json()).then(r=>(localStorage.removeItem("pkce_code_verifier"),h.accessToken=r.access_token,null)).catch(r=>{console.error(r)});{let r=Mt(),l="S256",o=Mt();localStorage.setItem("pkce_code_verifier",o);let a=await Bn(o),u=`${h.BASE_URL}/oauth/authorize?response_type=code&client_id=${h.clientId}&redirect_uri=${s}&state=${encodeURIComponent(r)}&code_challenge=${encodeURIComponent(a)}&code_challenge_method=${l}`;window.location.assign(u)}}async function Ut(){try{let e=await fetch(`${h.BASE_URL}/api/v1/me`,{headers:{Authorization:`Bearer ${h.accessToken}`}});if(!e.ok){let n=await e.json();console.error(n.error||"Error fetching user details");return}let t=await e.json();if(!t||!t.id){console.error("Invalid user data");return}return{id:t.id}}catch(e){console.error("Error fetching user details:",e);return}}function In(e){let n=new TextEncoder().encode(e);return window.crypto.subtle.digest("SHA-256",n)}function Ln(e){return btoa(String.fromCharCode.apply(null,Array.from(new Uint8Array(e)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Bn(e){let t=await In(e);return Ln(t)}function Mt(){let e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,t=>("0"+t.toString(16)).substr(-2)).join("")}var ke=e=>typeof e=="function"?e:function(){return e},Mn=typeof self<"u"?self:null,Ce=typeof window<"u"?window:null,ce=Mn||Ce||ce,Nn="2.0.0",G={connecting:0,open:1,closing:2,closed:3},Un=1e4,Hn=1e3,N={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Z={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},st={longpoll:"longpoll",websocket:"websocket"},Vn={complete:4},Ve=class{constructor(e,t,n,i){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Ht=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},zn=class{constructor(e,t,n){this.state=N.closed,this.topic=e,this.params=ke(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Ve(this,Z.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Ht(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=N.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=N.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=N.closed,this.socket.remove(this)}),this.onError(i=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,i),this.isJoining()&&this.joinPush.reset(),this.state=N.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Ve(this,Z.leave,ke({}),this.timeout).send(),this.state=N.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Z.reply,(i,s)=>{this.trigger(this.replyEventName(s),i)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(Z.close,e)}onError(e){return this.on(Z.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new Ve(this,e,function(){return t},n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=N.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Z.close,"leave")},n=new Ve(this,Z.leave,ke({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,i){return this.topic!==e?!1:i&&i!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:i}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=N.joining,this.joinPush.resend(e))}trigger(e,t,n,i){let s=this.onMessage(e,t,n,i);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(l=>l.event===e);for(let l=0;l<r.length;l++)r[l].callback(s,n,i||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===N.closed}isErrored(){return this.state===N.errored}isJoined(){return this.state===N.joined}isJoining(){return this.state===N.joining}isLeaving(){return this.state===N.leaving}},Fe=class{static request(e,t,n,i,s,r,l){if(ce.XDomainRequest){let o=new ce.XDomainRequest;return this.xdomainRequest(o,e,t,i,s,r,l)}else{let o=new ce.XMLHttpRequest;return this.xhrRequest(o,e,t,n,i,s,r,l)}}static xdomainRequest(e,t,n,i,s,r,l){return e.timeout=s,e.open(t,n),e.onload=()=>{let o=this.parseJSON(e.responseText);l&&l(o)},r&&(e.ontimeout=r),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,n,i,s,r,l,o){return e.open(t,n,!0),e.timeout=r,e.setRequestHeader("Content-Type",i),e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===Vn.complete&&o){let a=this.parseJSON(e.responseText);o(a)}},l&&(e.ontimeout=l),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let s=t?`${t}[${i}]`:i,r=e[i];typeof r=="object"?n.push(this.serialize(r,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},Fn=e=>{let t="",n=new Uint8Array(e),i=n.byteLength;for(let s=0;s<i;s++)t+=String.fromCharCode(n[s]);return btoa(t)},Ae=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=G.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+st.websocket),"$1/"+st.longpoll)}endpointURL(){return Fe.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=G.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===G.open||this.readyState===G.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:n,messages:i}=e;this.token=n}else t=0;switch(t){case 200:i.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=G.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){typeof e!="string"&&(e=Fn(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join(` | ||
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let s of this.reqs)s.abort();this.readyState=G.closed;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,n,i,s){let r,l=()=>{this.reqs.delete(r),i()};r=Fe.request(e,this.endpointURL(),t,n,this.timeout,l,o=>{this.reqs.delete(r),this.isActive()&&s(o)}),this.reqs.add(r)}};var ze={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,i,s,r,l]=JSON.parse(e);return t({join_ref:n,ref:i,topic:s,event:r,payload:l})}},binaryEncode(e){let{join_ref:t,ref:n,event:i,topic:s,payload:r}=e,l=this.META_LENGTH+t.length+n.length+s.length+i.length,o=new ArrayBuffer(this.HEADER_LENGTH+l),a=new DataView(o),u=0;a.setUint8(u++,this.KINDS.push),a.setUint8(u++,t.length),a.setUint8(u++,n.length),a.setUint8(u++,s.length),a.setUint8(u++,i.length),Array.from(t,c=>a.setUint8(u++,c.charCodeAt(0))),Array.from(n,c=>a.setUint8(u++,c.charCodeAt(0))),Array.from(s,c=>a.setUint8(u++,c.charCodeAt(0))),Array.from(i,c=>a.setUint8(u++,c.charCodeAt(0)));var d=new Uint8Array(o.byteLength+r.byteLength);return d.set(new Uint8Array(o),0),d.set(new Uint8Array(r),o.byteLength),d.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),l=this.HEADER_LENGTH+this.META_LENGTH-1,o=n.decode(e.slice(l,l+i));l=l+i;let a=n.decode(e.slice(l,l+s));l=l+s;let u=n.decode(e.slice(l,l+r));l=l+r;let d=e.slice(l,e.byteLength);return{join_ref:o,ref:null,topic:a,event:u,payload:d}},decodeReply(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),l=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,a=n.decode(e.slice(o,o+i));o=o+i;let u=n.decode(e.slice(o,o+s));o=o+s;let d=n.decode(e.slice(o,o+r));o=o+r;let c=n.decode(e.slice(o,o+l));o=o+l;let w=e.slice(o,e.byteLength),b={status:c,response:w};return{join_ref:a,ref:u,topic:d,event:Z.reply,payload:b}},decodeBroadcast(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=this.HEADER_LENGTH+2,l=n.decode(e.slice(r,r+i));r=r+i;let o=n.decode(e.slice(r,r+s));r=r+s;let a=e.slice(r,e.byteLength);return{join_ref:null,ref:null,topic:l,event:o,payload:a}}},Vt=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||Un,this.transport=t.transport||ce.WebSocket||Ae,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||ce&&ce.sessionStorage,this.establishedConnections=0,this.defaultEncoder=ze.encode.bind(ze),this.defaultDecoder=ze.decode.bind(ze),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Ae?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Ce&&Ce.addEventListener&&(Ce.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Ce.addEventListener("pageshow",i=>{n===this.connectClock&&(n=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=i=>t.rejoinAfterMs?t.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>t.reconnectAfterMs?t.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(i,s,r)=>{console.log(`${i}: ${s}`,r)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ke(t.params||{}),this.endPoint=`${e}/${st.websocket}`,this.vsn=t.vsn||Nn,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Ht(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return Ae}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Fe.appendParams(Fe.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ke(e)),!this.conn&&(this.longPollFallbackMs&&this.transport!==Ae?this.connectWithFallback(Ae,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(s=>{s.ref===t&&(this.off([i]),e(Date.now()-n))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,i=!0,s,r,l=o=>{this.log("transport",`falling back to ${e.name}...`,o),this.off([s,r]),i=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),r=this.onError(o=>{this.log("transport","error",o),i&&!n&&(clearTimeout(this.fallbackTimer),l(o))}),this.onOpen(()=>{if(n=!0,!i)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,t),this.ping(o=>{this.log("transport","connected to primary after",o),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Hn,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===G.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,n])=>n(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,i])=>{i(e,t,n)}),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Z.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case G.connecting:return"connecting";case G.open:return"open";case G.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new zn(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:i,ref:s,join_ref:r}=e;this.log("push",`${t} ${n} (${r}, ${s})`,i)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:i,payload:s,ref:r,join_ref:l}=t;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${s.status||""} ${n} ${i} ${r&&"("+r+")"||""}`,s);for(let o=0;o<this.channels.length;o++){let a=this.channels[o];a.isMember(n,i,s,l)&&a.trigger(i,s,r,l)}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,a]=this.stateChangeCallbacks.message[o];a(t)}})}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};async function zt(e){let t=e.propertyId?`${h.BASE_URL}/api/v1/next_auction/${e.propertyId}`:`${h.BASE_URL}/api/v1/next_auction/${e.source}/${e.sourceAgencyId}/${e.sourceId}`;return fetch(t,{headers:{Authorization:"Bearer "+h.accessToken}}).then(n=>{if(n.status===401)throw console.error("Unauthorized"),new Error("Unauthorized");return n.json()}).then(n=>{let s=(Array.isArray(n.bids)?n.bids:[]).map(o=>({id:o.id,amount:o.amount,createdAt:o.createdAt,newEndDate:o.newEndDate,userAnonymousId:o.userAnonymousId,participantId:o.participantId})),r=s.reduce((o,a)=>a.amount>o.amount?a:o,{id:"",amount:0,createdAt:0,newEndDate:0,userAnonymousId:""}),l=n.registration?{isUserAllowed:n.registration.isUserAllowed,isRegistrationAccepted:n.registration.isRegistrationAccepted,isParticipant:n.registration.isParticipant}:null;return{id:n.id,startDate:n.startDate,endDate:n.endDate,startingPrice:n.startingPrice,step:n.step,bids:s,highestBid:r,agentEmail:n.agentEmail,agentPhone:n.agentPhone,registration:l,isPrivate:n.isPrivate,currency:{symbol:n.currency.symbol,code:n.currency.code,isBefore:n.currency.isBefore}}}).catch(n=>{throw console.error("err",n),n})}function Ft(e,t){return new Promise((n,i)=>{h.socket!=null&&h.socket.disconnect(),h.socket=new Vt(h.WS_URL,{params:{token:h.accessToken}}),h.socket.connect();let s=h.socket.channel(`auction:${e}`,{});s.on("outbid",r=>{t&&t(r.bid)}),s.join().receive("ok",r=>{n(s)}).receive("error",r=>{console.error("Unable to join",r),h.socket!=null&&h.socket.disconnect(),i(r)})})}async function qt(e,t){return fetch(`${h.BASE_URL}/api/v1/bid`,{method:"POST",body:JSON.stringify({auctionId:e.id,amount:t}),headers:{Authorization:"Bearer "+h.accessToken,"Content-Type":"application/json"}}).then(n=>{if(n.status===401)throw console.error("Unauthorized"),new Error("Unauthorized");return n.status===422?n.json().then(i=>{throw i}):n.json()}).then(n=>({id:n.id,amount:n.amount,createdAt:n.createdAt,newEndDate:n.newEndDate,userAnonymousId:n.userAnonymousId,participantId:n.participantId})).catch(n=>{throw console.error("err",n),n})}var h={BASE_URL:"",WS_URL:"",accessToken:null,socket:null,DOMAIN:"",clientId:null};function qn(e,t="production"){switch(h.clientId=e,t){case"local":h.DOMAIN="localhost:4000",h.BASE_URL=`http://${h.DOMAIN}`,h.WS_URL=`ws://${h.DOMAIN}/api/socket`;break;case"staging":h.DOMAIN="staging.encheres-immo.com",h.BASE_URL=`https://${h.DOMAIN}`,h.WS_URL=`wss://${h.DOMAIN}/api/socket`;break;case"production":h.DOMAIN="encheres-immo.com",h.BASE_URL=`https://${h.DOMAIN}`,h.WS_URL=`wss://${h.DOMAIN}/api/socket`;break;default:console.log("Widget client: Unknown environment, defaulting to production."),h.DOMAIN="encheres-immo.com",h.BASE_URL=`https://${h.DOMAIN}`,h.WS_URL=`wss://${h.DOMAIN}/api/socket`;break}}var ee={initEIClient:qn,getNextAuctionById:zt,authenticate:Nt,subscribeToAuction:Ft,me:Ut,placeBidOnAuction:qt};function ie(e){let t=new Date().setMilliseconds(0),n=new Date(e.startDate).setMilliseconds(0);return t<n}function re(e){let t=new Date().setMilliseconds(0),n=new Date(e.endDate).setMilliseconds(0),i=new Date(e.startDate).setMilliseconds(0);return t<=n&&t>=i}function ge(e){let t=new Date().setMilliseconds(0),n=new Date(e.endDate).setMilliseconds(0);return t>n}function V(e,t){let n=e==null?"--":e.toString();return t?t.isBefore?`${qe(t)} ${n}`:`${n} ${qe(t)}`:`${n} \u20AC`}function qe(e){return e.symbol||e.code||""}function ot(e){return new Date(e)}function me(e){return ot(e).toLocaleString()}var Wn=p("<div><p id=auction-widget-status>D\xE9marre dans</p><p id=auction-widget-countdown>"),Kn=p("<div><p id=auction-widget-status>Se termine dans</p><p id=auction-widget-countdown>"),Gn=p("<p id=auction-widget-status>Vente termin\xE9e"),Jn=p('<p class="auction-widget-detail auction-widget-label">Meilleure offre'),Yn=p('<p class="auction-widget-detail auction-widget-accent">'),Xn=p('<div><div id=auction-widget-header></div><div><div id=auction-widget-description><div><p class="auction-widget-detail auction-widget-label">D\xE9but</p><p class=auction-widget-detail> </p></div><div><p class="auction-widget-detail auction-widget-label">Fin</p><p class=auction-widget-detail></p></div><div><p class="auction-widget-detail auction-widget-label">Prix de d\xE9part</p><p class="auction-widget-detail auction-widget-accent"> </p></div><div><p class="auction-widget-detail auction-widget-label">Palier</p><p class="auction-widget-detail auction-widget-accent"></p></div></div><div class="auction-widget-section auction-widget-border-t"><div>'),Qn=p('<div><p class="auction-widget-detail auction-widget-label">Vente priv\xE9e</p><p class=auction-widget-detail>Inscrivez-vous pour voir les participations'),Zn=e=>{let[t,n]=S(""),[i,s]=S(ie(e.auction)),[r,l]=S(re(e.auction)),[o,a]=S(ge(e.auction));function u(w,b){let x=(w.getTime()-b.getTime())/1e3,C=Math.floor(x/(3600*24)),j=Math.floor(x%(3600*24)/3600),B=Math.floor(x%3600/60),_=Math.floor(x%60);return{days:C,hours:j,minutes:B,seconds:_}}function d(w){if(a(ge(e.auction)),l(re(e.auction)),s(ie(e.auction)),ge(w)){clearInterval(c);return}let b=ie(w)?w.startDate:w.endDate,x=new Date,C=u(ot(b),x);n(`${C.days}j ${C.hours}h ${C.minutes}m ${C.seconds}s`)}let c=setInterval(()=>{d(e.auction)},1e3);return(()=>{var w=Xn(),b=w.firstChild,x=b.nextSibling,C=x.firstChild,j=C.firstChild,B=j.firstChild,_=B.nextSibling,R=_.firstChild,I=j.nextSibling,W=I.firstChild,pe=W.nextSibling,J=I.nextSibling,E=J.firstChild,k=E.nextSibling,P=k.firstChild,M=J.nextSibling,Ee=M.firstChild,we=Ee.nextSibling,ut=C.nextSibling,Oe=ut.firstChild;return g(b,m(A,{get when(){return i()},get children(){var U=Wn(),ue=U.firstChild,be=ue.nextSibling;return g(be,t),U}}),null),g(b,m(A,{get when(){return r()},get children(){var U=Kn(),ue=U.firstChild,be=ue.nextSibling;return g(be,t),U}}),null),g(b,m(A,{get when(){return o()},get children(){return Gn()}}),null),g(_,()=>me(e.auction.startDate),R),g(pe,()=>me(e.auction.endDate)),g(k,()=>V(e.auction.startingPrice),P),g(we,()=>V(e.auction.step)),g(Oe,m(A,{get when(){return!e.auction.isPrivate||e.auction.isPrivate&&e.auction.registration&&e.auction.registration.isUserAllowed},get fallback(){return Qn()},get children(){return[Jn(),(()=>{var U=Yn();return g(U,(()=>{var ue=T(()=>!!e.auction.highestBid.participantId);return()=>ue()?V(e.auction.highestBid.amount,e.auction.currency):V(null,e.auction.currency)})()),U})()]}})),w})()},Wt=Zn;var ei=p('<div class=auction-widget-icon><i class="fas fa-check">'),ti=p("<div class=auction-widget-icon><i>"),ni=p("<h3>"),ii=p("<div><div id=auction-widget-modal-background></div><div class=auction-widget-modal><div id=auction-widget-modal-content><div><div><div>"),ri=e=>(()=>{var t=ii(),n=t.firstChild,i=n.nextSibling,s=i.firstChild,r=s.firstChild,l=r.firstChild,o=l.firstChild;return g(r,m(A,{get when(){return e.success},get children(){return ei()}}),l),g(r,m(A,{get when(){return e.icon_class},get children(){var a=ti(),u=a.firstChild;return q(()=>Rt(u,e.icon_class)),a}}),l),g(l,m(A,{get when(){return e.title},get children(){var a=ni();return g(a,()=>e.title),a}}),o),g(o,()=>e.children),t})(),Te=ri;var si=p("<tr><td class=auction-widget-td>Offre pr\xE9c\xE9dente</td><td class=auction-widget-amount>"),oi=p("<table id=auction-widget-table><tbody><tr><td class=auction-widget-td>Votre offre</td><td class=auction-widget-amount>"),li=p("<p class=auction-widget-modal-note>Votre offre est sensiblement sup\xE9rieure \xE0 l'offre pr\xE9c\xE9dente. \xCAtes-vous s\xFBr de vouloir continuer ?"),ai=p("<p id=email-error class=auction-widget-modal-note>Vous devez au moins ench\xE9rir <!>."),ci=p('<div class=auction-widget-action><button class="auction-widget-btn auction-widget-custom">Confirmer</button><button class=auction-widget-btn>Annuler'),ui=p('<div class="auction-widget-section auction-widget-border-t"><div id=auction-widget-bid><p class="auction-widget-detail auction-widget-label auction-widget-text-left">Ench\xE8re rapide</p><div id=auction-widget-fast-bid><span><button class="auction-widget-btn auction-widget-custom">+ </button></span><span><button class="auction-widget-btn auction-widget-custom">+ </button></span><span><button class="auction-widget-btn auction-widget-custom">+ </button></span></div><div class=auction-widget-history-area><p class="auction-widget-detail auction-widget-label auction-widget-text-left">Votre montant</p><div id=auction-widget-bid-form><input type=number min=0 step=1><div id=auction-widget-currency><span></span></div><button class="auction-widget-btn auction-widget-custom">Ench\xE9rir'),fi=e=>{let t=e.auction.highestBid?e.auction.highestBid.amount+e.auction.step:e.auction.startingPrice,[n,i]=S(t),[s,r]=S(!1),[l,o]=S(!1),[a,u]=S(!1),[d,c]=S(J(1,!1,e.auction)),[w,b]=S(J(2,!1,e.auction)),[x,C]=S(J(3,!1,e.auction)),[j,B]=S(0);function _(E,k){let P=E.highestBid?E.highestBid.amount:E.startingPrice-E.step;k>P+E.step*3?u(!0):u(!1)}function R(E,k){return()=>{let P=k.highestBid?k.highestBid.amount:null,M;P!==null?M=P+E*k.step:M=k.startingPrice+k.step*(E-1),i(M),_(k,M),r(!0)}}function I(){return()=>{_(e.auction,n()),r(!0)}}function W(){return()=>{o(!1),r(!1)}}function pe(E,k){return()=>{ee.placeBidOnAuction(k,E).then(P=>{r(!1),o(!1),c(J(1,!0,k)),b(J(2,!0,k)),C(J(3,!0,k))}).catch(P=>{P.code=="bid_amount_too_low"&&(o(!0),B(P.min))})}}function J(E,k,P){let M;return k||P.bids&&P.bids.length>0?M=E*P.step:M=(E-1)*P.step,V(M,P.currency)}return(()=>{var E=ui(),k=E.firstChild,P=k.firstChild,M=P.nextSibling,Ee=M.firstChild,we=Ee.firstChild,ut=we.firstChild,Oe=Ee.nextSibling,U=Oe.firstChild,ue=U.firstChild,be=Oe.nextSibling,We=be.firstChild,Bi=We.firstChild,ln=M.nextSibling,an=ln.firstChild,cn=an.nextSibling,Ke=cn.firstChild,ft=Ke.nextSibling,un=ft.firstChild,fn=ft.nextSibling;return X(we,"click",R(1,e.auction),!0),g(we,d,null),X(U,"click",R(2,e.auction),!0),g(U,w,null),X(We,"click",R(3,e.auction),!0),g(We,x,null),Ke.$$input=z=>i(parseInt(z.currentTarget.value)),g(un,()=>qe(e.auction.currency)),X(fn,"click",I(),!0),g(E,m(A,{get when(){return s()},get children(){return m(Te,{title:"Vous \xEAtes sur le point d'ench\xE9rir",success:!1,icon_class:"fas fa-gavel",get children(){return[(()=>{var z=oi(),le=z.firstChild,ae=le.firstChild,dt=ae.firstChild,dn=dt.nextSibling;return g(le,m(A,{get when(){return e.auction.highestBid.participantId},get children(){var ht=si(),hn=ht.firstChild,gn=hn.nextSibling;return g(gn,()=>V(e.auction.highestBid.amount)),ht}}),ae),g(dn,()=>V(n())),z})(),m(A,{get when(){return a()},get children(){return li()}}),m(A,{get when(){return l()},get children(){var z=ai(),le=z.firstChild,ae=le.nextSibling,dt=ae.nextSibling;return g(z,()=>V(j()),ae),z}}),(()=>{var z=ci(),le=z.firstChild,ae=le.nextSibling;return X(le,"click",pe(n(),e.auction),!0),X(ae,"click",W(),!0),z})()]}})}}),null),q(()=>Ke.value=n()),E})()},Kt=fi;Me(["click","input"]);var di=p('<div class="auction-widget-section auction-widget-border-t"><div id=auction-widget-history-area><p class="auction-widget-label auction-widget-detail">Historique des offres</p><ul id=auction-widget-scroll>'),hi=p('<div><p class=auction-widget-date>Le </p><span class=auction-widget-user><i class="fas fa-user"></i>Vous</span>avez ench\xE9ri'),gi=p("<li><p id=auction-widget-bid-amount>"),mi=p('<div><p class=auction-widget-date>Le </p><span class=auction-widget-user><i class="fas fa-user"></i></span>a ench\xE9ri'),pi=e=>(()=>{var t=di(),n=t.firstChild,i=n.firstChild,s=i.nextSibling;return g(s,m(Qe,{get each(){return[...e.bids].sort((r,l)=>l.amount-r.amount)},children:(r,l)=>(()=>{var o=gi(),a=o.firstChild;return g(o,m(A,{get when(){return r.participantId===e.user.id},get fallback(){return(()=>{var u=mi(),d=u.firstChild,c=d.firstChild,w=d.nextSibling,b=w.firstChild;return g(d,()=>me(r.createdAt),null),g(w,()=>r.userAnonymousId,null),u})()},get children(){var u=hi(),d=u.firstChild,c=d.firstChild;return g(d,()=>me(r.createdAt),null),u}}),a),g(a,()=>V(r.amount,e.auction.currency)),o})()})),t})(),Gt=pi;var wi=p('<div><div class=auction-widget-section><button class="auction-widget-btn auction-widget-custom">Je veux participer'),bi=p('<div class=auction-widget-action><button class="auction-widget-btn auction-widget-custom">Se connecter</button><button class=auction-widget-btn>Annuler'),yi=p("<div id=auction-widget-agent-link><p class=auction-widget-modal-note>Pas encore de compte ?</p><button id=auction-widget-link>Contacter l'agent"),vi=p("<div>"),Si=p('<div class=auction-widget-contact><a class="auction-widget-btn auction-widget-custom"><i class="fas fa-envelope"></i></a><a class="auction-widget-btn auction-widget-custom"><i class="fas fa-phone">'),xi=p("<div class=auction-widget-action><button class=auction-widget-btn>Fermer"),$i=e=>{e.isLogging&&n();function t(){return()=>{n()}}function n(){ee.authenticate().then(()=>{e.setterIsLogged(!0),ee.me().then(o=>{e.updateUser(o)})})}let[i,s]=S(!1),[r,l]=S(!1);return(()=>{var o=wi(),a=o.firstChild,u=a.firstChild;return u.$$click=()=>s(!i()),g(o,(()=>{var d=T(()=>!!i());return()=>d()&&(()=>{var c=vi();return g(c,m(Te,{title:"Vous devez \xEAtre connect\xE9",icon_class:"fas fa-user-lock",success:!1,get children(){return[(()=>{var w=bi(),b=w.firstChild,x=b.nextSibling;return X(b,"click",t(),!0),x.$$click=()=>s(!1),w})(),(()=>{var w=yi(),b=w.firstChild,x=b.nextSibling;return x.$$click=()=>{l(!0),s(!1)},w})()]}})),c})()})(),null),g(o,(()=>{var d=T(()=>!!r());return()=>d()&&m(Te,{title:"Demande de participation",icon_class:"fas fa-gavel",success:!1,get children(){return[(()=>{var c=Si(),w=c.firstChild,b=w.firstChild,x=w.nextSibling,C=x.firstChild;return g(w,()=>e.auction.agentEmail,null),g(x,()=>e.auction.agentPhone,null),q(j=>{var B="mailto:"+e.auction.agentEmail,_="tel:"+e.auction.agentPhone;return B!==j.e&&tt(w,"href",j.e=B),_!==j.t&&tt(x,"href",j.t=_),j},{e:void 0,t:void 0}),c})(),(()=>{var c=xi(),w=c.firstChild;return w.$$click=()=>l(!1),c})()]}})})(),null),o})()},Jt=$i;Me(["click"]);var _i=p("<p class=auction-widget-note>Vous \xEAtes observateur pour cette vente. Vous ne pouvez pas ench\xE9rir."),Ai=p("<p class=auction-widget-note>Votre demande d'observation pour cette vente a \xE9t\xE9 accept\xE9e. Attendez le d\xE9but de l'ench\xE8re pour voir les participations."),Ci=p("<p class=auction-widget-note>Votre demande de participation pour cette vente a \xE9t\xE9 accept\xE9e. Attendez le d\xE9but de l'ench\xE8re pour ench\xE9rir."),ki=p("<p class=auction-widget-note>Votre demande de participation pour cette vente a \xE9t\xE9 refus\xE9e."),Ti=p("<p class=auction-widget-note>Votre demande de participation a \xE9t\xE9 transmise \xE0 l'agent responsable du bien. Vous serez inform\xE9 par email lorsqu'elle sera valid\xE9e."),Ei=p("<p class=auction-widget-note>Vous n'\xEAtes pas inscrit \xE0 cette vente, veuillez contacter l'agent responsable."),Oi=p("<div id=auction-widget-box><div><div>"),[se,Pi]=S(!1),[Yt,Zt]=S(!1),[lt,ji]=S({id:""}),[at,Xt]=rt([]),[y,Qt]=rt({id:"",startDate:0,endDate:0,startingPrice:0,step:0,bids:[],registration:{isUserAllowed:!1,isRegistrationAccepted:null,isParticipant:!1},isPrivate:!1,highestBid:{id:"",amount:0,createdAt:0,newEndDate:0,userAnonymousId:"",participantId:""},agentEmail:"",agentPhone:"",currency:{symbol:"",code:"",isBefore:!1}});function en(e){ee.getNextAuctionById(e).then(t=>{Qt(t),Xt(t.bids),ee.subscribeToAuction(t.id,n=>{Xt([...at,n]);let i=n.newEndDate||t.endDate;Qt({...t,highestBid:n,endDate:i})}).catch(n=>{console.error("Error subscribing to auction:",n)})})}function Ri(e,t){ji(e),en(t),Zt(!1)}var Di=e=>{let{apiKey:t,propertyInfo:n,environment:i="production"}=e;ee.initEIClient(t,i),en(n);let s=window.location.href,l=new URLSearchParams(s.split("?")[1]).get("code");return l!=""&&l!=null&&Zt(!0),(()=>{var o=Oi(),a=o.firstChild,u=a.firstChild;return g(u,m(A,{get when(){return y.id!=""},get children(){return[m(Wt,{auction:y,get user(){return lt()}}),m(A,{get when(){return T(()=>!!(!se()||Yt()))()&&(re(y)||ie(y))},get children(){return m(Jt,{setterIsLogged:Pi,get isLogging(){return Yt()},auction:y,get updateUser(){return Ri(lt(),n)}})}}),m(Ze,{get children(){return[m(Y,{get when(){return T(()=>!!(se()&&y.registration&&y.registration.isRegistrationAccepted&&y.registration.isParticipant))()&&re(y)},get children(){return m(Kt,{auction:y})}}),m(Y,{get when(){return T(()=>!!(se()&&y.registration&&y.registration.isRegistrationAccepted&&!y.registration.isParticipant))()&&re(y)},get children(){return _i()}}),m(Y,{get when(){return T(()=>!!(se()&&y.registration&&y.registration.isRegistrationAccepted&&!y.registration.isParticipant))()&&ie(y)},get children(){return Ai()}}),m(Y,{get when(){return T(()=>!!(se()&&y.registration&&y.registration.isRegistrationAccepted===!0))()&&ie(y)},get children(){return Ci()}}),m(Y,{get when(){return se()&&y.registration&&y.registration.isRegistrationAccepted===!1},get children(){return ki()}}),m(Y,{get when(){return se()&&y.registration&&y.registration.isRegistrationAccepted==null},get children(){return Ti()}}),m(Y,{get when(){return se()&&!y.registration},get children(){return Ei()}})]}}),m(A,{get when(){return ge(y)||re(y)&&at.length>0},get children(){return m(Gt,{bids:at,auction:y,get user(){return lt()}})}})]}})),o})()},tn=Di;var oe=document.getElementById("auction-widget"),nn=oe?.getAttribute("api-key")||"",Ii=oe?.getAttribute("api-env")||"production",ct=oe?.getAttribute("property-id")||"",rn=oe?.getAttribute("source")||"",sn=oe?.getAttribute("source-agency-id")||"",on=oe?.getAttribute("source-id")||"";if(!(oe instanceof HTMLElement))throw new Error("Auction widget: No root element found with id 'auction-widget'. Did you forget to add it? Or maybe the id attribute got misspelled?");if(nn=="")throw new Error("Auction widget: No 'api-key' attribute found. Did you forget to add it? Or maybe the attribute got misspelled?");if(ct==""&&(rn==""||sn==""||on==""))throw new Error("Auction widget: Either 'property-id' or 'source', 'source-agency-id', and 'source-id' must be provided. Did you forget to add them? Or maybe the attributes got misspelled?");var Li=ct?{propertyId:ct}:{source:rn,sourceAgencyId:sn,sourceId:on};jt(()=>m(tn,{apiKey:nn,propertyInfo:Li,environment:Ii}),oe);})(); |
{ | ||
"name": "@encheres-immo/auction-widget", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"type": "module", | ||
@@ -16,2 +16,5 @@ "description": "Bring our real-estate auction widget to your website, powered by SolidJS & Enchères Immo's API", | ||
"devDependencies": { | ||
"@solidjs/testing-library": "^0.8.10", | ||
"@testing-library/jest-dom": "^6.6.3", | ||
"@testing-library/user-event": "^14.5.2", | ||
"babel-preset-solid": "^1.9.3", | ||
@@ -23,11 +26,15 @@ "esbuild": "^0.24.0", | ||
"tslib": "^2.8.1", | ||
"typescript": "^5.6.3" | ||
"typescript": "^5.7.2", | ||
"vite": "^6.0.1", | ||
"vite-plugin-solid": "^2.11.0", | ||
"vitest": "^2.1.6" | ||
}, | ||
"dependencies": { | ||
"solid-js": "^1.9.3", | ||
"@encheres-immo/widget-client": "0.3.0" | ||
"@encheres-immo/widget-client": "0.3.1" | ||
}, | ||
"scripts": { | ||
"build": "node esbuild.config.mjs" | ||
"build": "node esbuild.config.mjs", | ||
"test": "vitest" | ||
} | ||
} |
@@ -80,1 +80,11 @@ # Enchères Immo's auction widget | ||
***WORK IN PROGRESS.*** We will soon open-source this widget and provide guidelines on how to contribute. Stay tuned! | ||
### Useful commands | ||
All commands are run from the root of the package. | ||
| Command | Description | | ||
| ---------------- | -------------------- | | ||
| `pnpm install` | Install dependencies | | ||
| `pnpm run build` | Build the widget | | ||
| `pnpm run test` | Run tests | |
@@ -7,4 +7,5 @@ { | ||
"jsx": "preserve", | ||
"jsxImportSource": "solid-js" | ||
"jsxImportSource": "solid-js", | ||
"types": ["@testing-library/jest-dom"] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
131264
22
2116
90
13
+ Added@encheres-immo/widget-client@0.3.1(transitive)
- Removed@encheres-immo/widget-client@0.3.0(transitive)