@qratilabs/qrati-connect 2.7.0-beta.21 → 2.7.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/element/ApyjFWKp.js +1 -0
- package/element/B4hg-Jzn.js +1 -0
- package/element/{DGuOrd-J.js → Bu-UssyO.js} +3 -3
- package/element/C73GNwh3.js +8 -0
- package/element/CoFGfneL.js +1 -0
- package/element/D8g89do5.js +46 -0
- package/element/DJSvG_Nj.js +4 -0
- package/element/DKsx0Y8e.js +1 -0
- package/element/Dp3VaoZ-.js +3 -0
- package/element/Dp5jqmjn.js +4 -0
- package/element/M8Us9cU9.js +2 -0
- package/element/Nlxbxype.js +19 -0
- package/element/V5NTL9Q8.js +8 -0
- package/element/ts3zQh2I.js +3 -0
- package/element/web.es.js +426 -421
- package/element/zVkCODn-.js +1 -0
- package/package.json +1 -1
- package/react/{BiCzDvPj.js → AapCUC-0.js} +1 -1
- package/react/{BMKU_9Dv.js → BA-rmyyP.js} +1 -1
- package/react/{1Ikk7UFc.js → BFeys-t9.js} +1 -1
- package/react/{DE1Dpj--.js → BJuTpMwr.js} +1 -1
- package/react/{B6PQAfDy.js → BNq5z2O6.js} +1 -1
- package/react/{rdtnGUzO.js → BSqusAcm.js} +1 -1
- package/react/{De1I5osG.js → BWSvzAIN.js} +1 -1
- package/react/{lO7A5UtA.js → CH6vqA5t.js} +1 -1
- package/react/{DBByV_MA.js → CIMTZgx2.js} +1 -1
- package/react/{B4OqjpeZ.js → CMNwX5MM.js} +3 -3
- package/react/{DEml42Wf.js → CRqKn_Cg.js} +1 -1
- package/react/CS1Kg8-a.js +1 -0
- package/react/CWGMt62d.js +1 -0
- package/react/{DZCz7kl3.js → CdVkPkqy.js} +1 -1
- package/react/Cn5QS0_5.js +1 -0
- package/react/Cqdhu1W9.js +1 -0
- package/react/{Bv-1NjQE.js → CwlQ8z66.js} +1 -1
- package/react/{Dnp2RfXx.js → DEsmg9S6.js} +1 -1
- package/react/{DDcelZeN.js → DMmZTL_c.js} +1 -1
- package/react/DSiikjS9.js +1 -0
- package/react/{BjBT1ihN.js → DZ_wJszu.js} +1 -1
- package/react/{DJtDMWy2.js → DsQDSY49.js} +1 -1
- package/react/{Bg0TKkPl.js → DyShHlxS.js} +1 -1
- package/react/K73cs4am.js +1 -0
- package/react/RkYXaQ5u.js +1 -0
- package/react/{BNYjlts5.js → Y9MAVRwK.js} +1 -1
- package/react/{CM-f5bOF.js → bAxGEsnX.js} +1 -1
- package/react/{BSXFijrL.js → bia7_YIN.js} +1 -1
- package/react/index.cjs +1 -1
- package/react/index.mjs +114 -109
- package/umd/web.umd.js +1 -1
- package/element/Bl3RFWpg.js +0 -3
- package/element/Bmvot7Mx.js +0 -3
- package/element/C0wQndW7.js +0 -19
- package/element/CCEtowI9.js +0 -46
- package/element/CUGl86v2.js +0 -8
- package/element/CUfhicE8.js +0 -1
- package/element/DCFrvyiS.js +0 -2
- package/element/DCbRXtK8.js +0 -4
- package/element/DI_rRNLa.js +0 -4
- package/element/dcV4od5T.js +0 -8
- package/react/BarCxWTX.js +0 -1
- /package/element/{CMbOX_GS.js → BAMB7Uoo.js} +0 -0
- /package/element/{C6TX_i0I.js → BzIJspY1.js} +0 -0
- /package/element/{DgGPkDRT.js → CjmNvKgB.js} +0 -0
- /package/element/{BxbCvlCo.js → D1zX23l-.js} +0 -0
- /package/element/{CzSmu5XM.js → DUJAMyRv.js} +0 -0
- /package/element/{CIcND0Dg.js → PPVqva_9.js} +0 -0
- /package/element/{Cdux6g1i.js → tPk8Ov5I.js} +0 -0
- /package/react/{Cdux6g1i.js → BJ85RnFv.js} +0 -0
- /package/react/{BvVjd_UK.js → Bp3BRlhW.js} +0 -0
- /package/react/{BCc5Yj_f.js → BszowxAR.js} +0 -0
- /package/react/{BH8UJKb5.js → BtTYXVAR.js} +0 -0
- /package/react/{DJTeOMQR.js → BvT0jQ3V.js} +0 -0
- /package/react/{BAKN93OB.js → Byq3TC8k.js} +0 -0
- /package/react/{qy2OAEht.js → C5dmblnS.js} +0 -0
- /package/react/{fwmxAw7l.js → D2h6qyms.js} +0 -0
- /package/react/{DlCuoz_e.js → D7BzZEsL.js} +0 -0
- /package/react/{C8D6WaBQ.js → DSaIeQ30.js} +0 -0
- /package/react/{DiysJlOc.js → DYeIUbVU.js} +0 -0
- /package/react/{I7IwY3sd.js → Y-mDLYqW.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{St as t,_t as e,at as s,bt as i,ct as a,dt as r,ft as n,gt as o,ht as u,it as h,lt as c,mt as l,ot as d,pt as f,rt as y,st as p,ut as m,vt as g,xt as v,yt as b}from"./BMKU_9Dv.js";function q(t){return{onFetch:(e,s)=>{const i=e.options,n=e.fetchOptions?.meta?.fetchMore?.direction,o=e.state.data?.pages||[],u=e.state.data?.pageParams||[];let h={pages:[],pageParams:[]},l=0;const d=async()=>{let s=!1;const d=r(e.options,e.fetchOptions),f=async(t,i,r)=>{if(s)return Promise.reject();if(null==i&&t.pages.length)return Promise.resolve(t);const n=await d((()=>{const t={client:e.client,queryKey:e.queryKey,pageParam:i,direction:r?"backward":"forward",meta:e.options.meta};return a(t,()=>e.signal,()=>s=!0),t})()),{maxPages:o}=e.options,u=r?m:c;return{pages:u(t.pages,n,o),pageParams:u(t.pageParams,i,o)}};if(n&&o.length){const t="backward"===n,e=t?P:C,s={pages:o,pageParams:u};h=await f(s,e(i,s),t)}else{const e=t??o.length;do{const t=0===l?u[0]??i.initialPageParam:C(i,h);if(l>0&&null==t)break;h=await f(h,t),l++}while(l<e)}return h};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=d}}}function C(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function P(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}function O(t,e){return!!e&&null!=C(t,e)}function w(t,e){return!(!e||!t.getPreviousPageParam)&&null!=P(t,e)}var Q=class extends h{#t;#e;#s;#i;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#a({type:"continue"})},i={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=s({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(/* @__PURE__ */new Error("No mutationFn found")),onFail:(t,e)=>{this.#a({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#a({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const a="pending"===this.state.status,r=!this.#i.canStart();try{if(a)e();else{this.#a({type:"pending",variables:t,isPaused:r}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,i);const e=await(this.options.onMutate?.(t,i));e!==this.state.context&&this.#a({type:"pending",context:e,variables:t,isPaused:r})}const s=await this.#i.start();return await(this.#s.config.onSuccess?.(s,t,this.state.context,this,i)),await(this.options.onSuccess?.(s,t,this.state.context,i)),await(this.#s.config.onSettled?.(s,null,this.state.variables,this.state.context,this,i)),await(this.options.onSettled?.(s,null,t,this.state.context,i)),this.#a({type:"success",data:s}),s}catch(n){try{await(this.#s.config.onError?.(n,t,this.state.context,this,i))}catch(o){Promise.reject(o)}try{await(this.options.onError?.(n,t,this.state.context,i))}catch(o){Promise.reject(o)}try{await(this.#s.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this,i))}catch(o){Promise.reject(o)}try{await(this.options.onSettled?.(void 0,n,t,this.state.context,i))}catch(o){Promise.reject(o)}throw this.#a({type:"error",error:n}),n}finally{this.#s.runNext(this)}}#a(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),p.batch(()=>{this.#e.forEach(e=>{e.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}},D=class extends t{constructor(t={}){super(),this.config=t,this.#r=/* @__PURE__ */new Set,this.#n=/* @__PURE__ */new Map,this.#o=0}#r;#n;#o;build(t,e,s){const i=new Q({client:t,mutationCache:this,mutationId:++this.#o,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#r.add(t);const e=x(t);if("string"==typeof e){const s=this.#n.get(e);s?s.push(t):this.#n.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#r.delete(t)){const e=x(t);if("string"==typeof e){const s=this.#n.get(e);if(s)if(s.length>1){const e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#n.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=x(t);if("string"==typeof e){const s=this.#n.get(e)?.find(t=>"pending"===t.state.status);return!s||s===t}return!0}runNext(t){const e=x(t);return"string"==typeof e?(this.#n.get(e)?.find(e=>e!==t&&e.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){p.batch(()=>{this.#r.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#r.clear(),this.#n.clear()})}getAll(){return Array.from(this.#r)}find(t){const e={exact:!0,...t};return this.getAll().find(t=>u(e,t))}findAll(t={}){return this.getAll().filter(e=>u(t,e))}notify(t){p.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(t=>t.state.isPaused);return p.batch(()=>Promise.all(t.map(t=>t.continue().catch(e))))}};function x(t){return t.options.scope?.id}var M=class extends t{constructor(t={}){super(),this.config=t,this.#u=/* @__PURE__ */new Map}#u;build(t,e,s){const i=e.queryKey,a=e.queryHash??l(i,e);let r=this.get(a);return r||(r=new y({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(r)),r}add(t){this.#u.has(t.queryHash)||(this.#u.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#u.get(t.queryHash);e&&(t.destroy(),e===t&&this.#u.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){p.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#u.get(t)}getAll(){return[...this.#u.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(t=>o(e,t))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(e=>o(t,e)):e}notify(t){p.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){p.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){p.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},A=class{#h;#s;#c;#l;#d;#f;#y;#p;constructor(t={}){this.#h=t.queryCache||new M,this.#s=t.mutationCache||new D,this.#c=t.defaultOptions||{},this.#l=/* @__PURE__ */new Map,this.#d=/* @__PURE__ */new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#y=v.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onFocus())}),this.#p=d.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#y?.(),this.#y=void 0,this.#p?.(),this.#p=void 0)}isFetching(t){return this.#h.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#s.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#h.build(this,e),i=s.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(b(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#h.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#h.get(i.queryHash)?.state.data,r=n(e,a);if(void 0!==r)return this.#h.build(this,i).setData(r,{...s,manual:!0})}setQueriesData(t,e,s){return p.batch(()=>this.#h.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state}removeQueries(t){const e=this.#h;p.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){const s=this.#h;return p.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,s={}){const i={revert:!0,...s},a=p.batch(()=>this.#h.findAll(t).map(t=>t.cancel(i)));return Promise.all(a).then(e).catch(e)}invalidateQueries(t,e={}){return p.batch(()=>(this.#h.findAll(t).forEach(t=>{t.invalidate()}),"none"===t?.refetchType?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,s={}){const i={...s,cancelRefetch:s.cancelRefetch??!0},a=p.batch(()=>this.#h.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let s=t.fetch(void 0,i);return i.throwOnError||(s=s.catch(e)),"paused"===t.state.fetchStatus?Promise.resolve():s}));return Promise.all(a).then(e)}fetchQuery(t){const e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);const s=this.#h.build(this,e);return s.isStaleByTime(b(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(e).catch(e)}fetchInfiniteQuery(t){return t.behavior=q(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(e).catch(e)}ensureInfiniteQueryData(t){return t.behavior=q(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return d.isOnline()?this.#s.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#h}getMutationCache(){return this.#s}getDefaultOptions(){return this.#c}setDefaultOptions(t){this.#c=t}setQueryDefaults(t,e){this.#l.set(f(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#l.values()],s={};return e.forEach(e=>{g(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#d.set(f(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#d.values()],s={};return e.forEach(e=>{g(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#c.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=l(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===i&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#c.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#h.clear(),this.#s.clear()}};export{q as i,O as n,w as r,A as t};
|
|
1
|
+
import{St as t,_t as e,at as s,bt as i,ct as a,dt as r,ft as n,gt as o,ht as u,it as h,lt as c,mt as l,ot as d,pt as f,rt as y,st as p,ut as m,vt as g,xt as v,yt as b}from"./BA-rmyyP.js";function q(t){return{onFetch:(e,s)=>{const i=e.options,n=e.fetchOptions?.meta?.fetchMore?.direction,o=e.state.data?.pages||[],u=e.state.data?.pageParams||[];let h={pages:[],pageParams:[]},l=0;const d=async()=>{let s=!1;const d=r(e.options,e.fetchOptions),f=async(t,i,r)=>{if(s)return Promise.reject();if(null==i&&t.pages.length)return Promise.resolve(t);const n=await d((()=>{const t={client:e.client,queryKey:e.queryKey,pageParam:i,direction:r?"backward":"forward",meta:e.options.meta};return a(t,()=>e.signal,()=>s=!0),t})()),{maxPages:o}=e.options,u=r?m:c;return{pages:u(t.pages,n,o),pageParams:u(t.pageParams,i,o)}};if(n&&o.length){const t="backward"===n,e=t?P:C,s={pages:o,pageParams:u};h=await f(s,e(i,s),t)}else{const e=t??o.length;do{const t=0===l?u[0]??i.initialPageParam:C(i,h);if(l>0&&null==t)break;h=await f(h,t),l++}while(l<e)}return h};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=d}}}function C(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function P(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}function O(t,e){return!!e&&null!=C(t,e)}function w(t,e){return!(!e||!t.getPreviousPageParam)&&null!=P(t,e)}var Q=class extends h{#t;#e;#s;#i;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#a({type:"continue"})},i={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=s({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(/* @__PURE__ */new Error("No mutationFn found")),onFail:(t,e)=>{this.#a({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#a({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const a="pending"===this.state.status,r=!this.#i.canStart();try{if(a)e();else{this.#a({type:"pending",variables:t,isPaused:r}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,i);const e=await(this.options.onMutate?.(t,i));e!==this.state.context&&this.#a({type:"pending",context:e,variables:t,isPaused:r})}const s=await this.#i.start();return await(this.#s.config.onSuccess?.(s,t,this.state.context,this,i)),await(this.options.onSuccess?.(s,t,this.state.context,i)),await(this.#s.config.onSettled?.(s,null,this.state.variables,this.state.context,this,i)),await(this.options.onSettled?.(s,null,t,this.state.context,i)),this.#a({type:"success",data:s}),s}catch(n){try{await(this.#s.config.onError?.(n,t,this.state.context,this,i))}catch(o){Promise.reject(o)}try{await(this.options.onError?.(n,t,this.state.context,i))}catch(o){Promise.reject(o)}try{await(this.#s.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this,i))}catch(o){Promise.reject(o)}try{await(this.options.onSettled?.(void 0,n,t,this.state.context,i))}catch(o){Promise.reject(o)}throw this.#a({type:"error",error:n}),n}finally{this.#s.runNext(this)}}#a(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),p.batch(()=>{this.#e.forEach(e=>{e.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}},D=class extends t{constructor(t={}){super(),this.config=t,this.#r=/* @__PURE__ */new Set,this.#n=/* @__PURE__ */new Map,this.#o=0}#r;#n;#o;build(t,e,s){const i=new Q({client:t,mutationCache:this,mutationId:++this.#o,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#r.add(t);const e=x(t);if("string"==typeof e){const s=this.#n.get(e);s?s.push(t):this.#n.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#r.delete(t)){const e=x(t);if("string"==typeof e){const s=this.#n.get(e);if(s)if(s.length>1){const e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#n.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=x(t);if("string"==typeof e){const s=this.#n.get(e)?.find(t=>"pending"===t.state.status);return!s||s===t}return!0}runNext(t){const e=x(t);return"string"==typeof e?(this.#n.get(e)?.find(e=>e!==t&&e.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){p.batch(()=>{this.#r.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#r.clear(),this.#n.clear()})}getAll(){return Array.from(this.#r)}find(t){const e={exact:!0,...t};return this.getAll().find(t=>u(e,t))}findAll(t={}){return this.getAll().filter(e=>u(t,e))}notify(t){p.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(t=>t.state.isPaused);return p.batch(()=>Promise.all(t.map(t=>t.continue().catch(e))))}};function x(t){return t.options.scope?.id}var M=class extends t{constructor(t={}){super(),this.config=t,this.#u=/* @__PURE__ */new Map}#u;build(t,e,s){const i=e.queryKey,a=e.queryHash??l(i,e);let r=this.get(a);return r||(r=new y({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(r)),r}add(t){this.#u.has(t.queryHash)||(this.#u.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#u.get(t.queryHash);e&&(t.destroy(),e===t&&this.#u.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){p.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#u.get(t)}getAll(){return[...this.#u.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(t=>o(e,t))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(e=>o(t,e)):e}notify(t){p.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){p.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){p.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},A=class{#h;#s;#c;#l;#d;#f;#y;#p;constructor(t={}){this.#h=t.queryCache||new M,this.#s=t.mutationCache||new D,this.#c=t.defaultOptions||{},this.#l=/* @__PURE__ */new Map,this.#d=/* @__PURE__ */new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#y=v.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onFocus())}),this.#p=d.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#y?.(),this.#y=void 0,this.#p?.(),this.#p=void 0)}isFetching(t){return this.#h.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#s.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#h.build(this,e),i=s.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(b(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#h.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#h.get(i.queryHash)?.state.data,r=n(e,a);if(void 0!==r)return this.#h.build(this,i).setData(r,{...s,manual:!0})}setQueriesData(t,e,s){return p.batch(()=>this.#h.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state}removeQueries(t){const e=this.#h;p.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){const s=this.#h;return p.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,s={}){const i={revert:!0,...s},a=p.batch(()=>this.#h.findAll(t).map(t=>t.cancel(i)));return Promise.all(a).then(e).catch(e)}invalidateQueries(t,e={}){return p.batch(()=>(this.#h.findAll(t).forEach(t=>{t.invalidate()}),"none"===t?.refetchType?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,s={}){const i={...s,cancelRefetch:s.cancelRefetch??!0},a=p.batch(()=>this.#h.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let s=t.fetch(void 0,i);return i.throwOnError||(s=s.catch(e)),"paused"===t.state.fetchStatus?Promise.resolve():s}));return Promise.all(a).then(e)}fetchQuery(t){const e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);const s=this.#h.build(this,e);return s.isStaleByTime(b(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(e).catch(e)}fetchInfiniteQuery(t){return t.behavior=q(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(e).catch(e)}ensureInfiniteQueryData(t){return t.behavior=q(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return d.isOnline()?this.#s.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#h}getMutationCache(){return this.#s}getDefaultOptions(){return this.#c}setDefaultOptions(t){this.#c=t}setQueryDefaults(t,e){this.#l.set(f(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#l.values()],s={};return e.forEach(e=>{g(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#d.set(f(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#d.values()],s={};return e.forEach(e=>{g(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#c.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=l(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===i&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#c.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#h.clear(),this.#s.clear()}};export{q as i,O as n,w as r,A as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./Bto__AIV.js";import{At as t,Ct as r,Et as n,V as o,et as s,g as i,jt as l,p as a,r as c,wt as u,y as d}from"./
|
|
1
|
+
import{n as e}from"./Bto__AIV.js";import{At as t,Ct as r,Et as n,V as o,et as s,g as i,jt as l,p as a,r as c,wt as u,y as d}from"./BA-rmyyP.js";import{t as p}from"./BSqusAcm.js";import{a as m,i as f,n as g,o as y,r as h,t as b}from"./BJuTpMwr.js";var v={top:60,bottom:60,left:276,right:60},x="#fb8500",w=new p,L=(e,t,r)=>{l(/* @__PURE__ */d(s,{client:w,children:/* @__PURE__ */d(c,{children:/* @__PURE__ */d(m,{event:e,onExplore:r})})}),t)},C=e=>{const t=document.createElement("div");t.style.cssText=`\n background:${h(e.color,"#fb8500")};color:#fff;border-radius:20px;padding:5px 10px;\n font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;\n box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);\n display:inline-flex;align-items:center;gap:6px;\n `;const r=document.createElement("span");r.textContent=e.folder.name;const n=document.createElement("span");return n.style.cssText="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;",n.textContent=String(e.eventCount),t.appendChild(r),t.appendChild(n),t},z=({apiKey:s,is3D:l,onExplore:c,logoUrl:p})=>{const m=r(null),h=r(null),w=r(null),z=r(l),E=r([]),k=r([]),_=r(null),j=r(!1),T=r(!1),F=r(null),[S,B]=n(l),Z=u(()=>(()=>{try{const e=sessionStorage.getItem(o);if(!e)return null;const t=JSON.parse(e);if(Array.isArray(t?.center)&&"number"==typeof t.zoom)return t}catch{}return null})(),[]),[D,A]=n(!1),[I,M]=n(!0),{folderTree:O,activeFolderId:U,activeFolder:P,visibleEvents:R,setActiveFolderId:W,isLoadingEvents:$}=y(),{organization:q}=a(),J=()=>{E.current.forEach(e=>e.remove()),E.current=[]},N=()=>{k.current.forEach(e=>e.remove()),k.current=[]},K=(e,t)=>{const r=t?"visible":"none";for(const n of["heatmap","event-clusters","cluster-count","unclustered-point"])e.getLayer(n)&&e.setLayoutProperty(n,"visibility",r)};return t(()=>{if(!m.current||h.current)return;let t,r=!1;return(async()=>{try{const n=(await import("./DSaIeQ30.js").then(t=>/* @__PURE__ */e(t.default,1))).default;if(r)return;if(!m.current)return;const i=Z?.center??[0,20],l=Z?.zoom??3,a=new n.Map({container:m.current,style:`https://api.maptiler.com/maps/streets-v2/style.json?key=${s}`,center:i,zoom:l,minZoom:0,pitch:0,bearing:0,renderWorldCopies:!1,projection:z.current?{type:"globe"}:{type:"mercator"},canvasContextAttributes:{antialias:!0}});h.current=a,w.current=n,a.on("load",()=>{if(r)return;const e=a.getStyle()?.layers??[];let t,o;for(const r of e){const e=r;"symbol"===e.type&&e.layout?.["text-field"]&&!t&&(t=r.id),"building"!==e["source-layer"]||o||(o=e.source)}o&&!a.getLayer("3d-buildings")&&a.addLayer({id:"3d-buildings",source:o,"source-layer":"building",filter:["has","render_height"],type:"fill-extrusion",minzoom:2,paint:{"fill-extrusion-color":["interpolate",["linear"],["get","render_height"],0,"lightgray",200,"royalblue",400,"lightblue"],"fill-extrusion-height":["interpolate",["linear"],["zoom"],14,0,15,["get","render_height"]],"fill-extrusion-base":["case",["has","render_min_height"],["get","render_min_height"],0],"fill-extrusion-opacity":.6}},t),a.addSource("all-events",{type:"geojson",data:{type:"FeatureCollection",features:[]},cluster:!0,clusterRadius:50,clusterMaxZoom:14}),a.addSource("heat-events",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),a.addLayer({id:"heatmap",type:"heatmap",source:"heat-events",layout:{visibility:"none"},paint:{"heatmap-weight":["interpolate",["linear"],["get","views"],0,0,200,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"rgb(103,169,207)",.4,"rgb(209,229,240)",.6,"rgb(253,219,199)",.8,"rgb(239,138,98)",1,"rgb(178,24,43)"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,4,9,30],"heatmap-opacity":["interpolate",["linear"],["zoom"],6,.85,11,0]}}),a.addLayer({id:"event-clusters",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],x,10,"#e63946",30,"#9b2226"],"circle-radius":["step",["get","point_count"],16,10,20,30,26],"circle-stroke-width":2,"circle-stroke-color":"#fff"}}),a.addLayer({id:"cluster-count",type:"symbol",source:"all-events",layout:{visibility:"none","text-field":"{point_count_abbreviated}","text-size":12},paint:{"text-color":"#fff"}}),a.addLayer({id:"unclustered-point",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["!",["has","point_count"]],paint:{"circle-radius":7,"circle-color":x,"circle-stroke-color":"#fff","circle-stroke-width":2}}),a.on("click","event-clusters",e=>{const t=a.queryRenderedFeatures(e.point,{layers:["event-clusters"]});if(!t.length)return;const r=t[0].properties?.cluster_id,n=a.getSource("all-events");r&&n?.getClusterExpansionZoom&&n.getClusterExpansionZoom(r,(e,r)=>{e||"number"!=typeof r||a.easeTo({center:t[0].geometry.coordinates,zoom:r,duration:600})})}),a.on("click","unclustered-point",e=>{const t=e.features?.[0];if(!t)return;const r=t.geometry.coordinates.slice(0,2),o=t.properties??{},s={_id:o._id,slug:o.slug,name:o.name,views:o.views,location:{x:r[0],y:r[1],label:o.label},contents:o.thumbnailUrl?[{thumbnailUrl:o.thumbnailUrl}]:[]};F.current&&(F.current.remove(),F.current=null);const i=document.createElement("div");L(s,i,c);const l=new n.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-10]}).setLngLat(r).setDOMContent(i).addTo(a);F.current=l,l.on("close",()=>{F.current===l&&(F.current=null)})}),a.on("click",e=>{!a.queryRenderedFeatures(e.point,{layers:["event-clusters","unclustered-point"]}).length&&F.current&&(F.current.remove(),F.current=null)}),a.on("mouseenter","event-clusters",()=>{a.getCanvas().style.cursor="pointer"}),a.on("mouseleave","event-clusters",()=>{a.getCanvas().style.cursor=""}),a.on("mouseenter","unclustered-point",()=>{a.getCanvas().style.cursor="pointer"}),a.on("mouseleave","unclustered-point",()=>{a.getCanvas().style.cursor=""}),A(!0),M(!1)});const u=()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{try{const e=a.getCenter();sessionStorage.setItem(o,JSON.stringify({center:[e.lng,e.lat],zoom:a.getZoom()}))}catch{}},250)};a.on("zoomend",u),a.on("moveend",u),t=()=>{J(),N(),_.current&&clearTimeout(_.current),a.off("zoomend",u),a.off("moveend",u),a.remove(),h.current=null,w.current=null}}finally{r||M(!1)}})(),()=>{r=!0,t?.()}},[s]),t(()=>{if(!D)return;const e=h.current,t=w.current;if(e&&t)if(J(),N(),null===U&&O.length>0){K(e,!1);const r=n=>{for(const o of n)if(o.centroid){const r=C(o);r.addEventListener("click",()=>W(o.folder._id));const n=new t.Marker({element:r,anchor:"center"}).setLngLat([o.centroid[0],o.centroid[1]]).addTo(e);E.current.push(n)}else o.children.length>0&&r(o.children)};r(O)}else if(0===O.length&&null===U){if(0===R.length)return;const r=R.map(e=>({type:"Feature",geometry:{type:"Point",coordinates:[e.location.x,e.location.y]},properties:{_id:e._id,slug:e.slug,name:e.name,views:e.views??0,label:e.location?.label??"",thumbnailUrl:e.contents?.[0]?.thumbnailUrl??""}})),n={type:"FeatureCollection",features:r};if(e.getSource("all-events")?.setData(n),e.getSource("heat-events")?.setData({...n,features:r.map(e=>({...e,properties:{views:e.properties.views}}))}),K(e,!0),!T.current&&(T.current=!0,!Z)){const r=new t.LngLatBounds;R.forEach(e=>r.extend([e.location.x,e.location.y])),r.isEmpty()||e.fitBounds(r,{padding:v,maxZoom:8,duration:800})}}else{if(0===R.length)return;K(e,!1);const r=P?.color||x,n=new t.LngLatBounds;R.forEach(o=>{const s=o.location.x,i=o.location.y;n.extend([s,i]);const l=((e,t)=>{const r=document.createElement("div");if(r.style.cssText=`\n width:36px;height:36px;cursor:pointer;\n background:${e};border-radius:50% 50% 50% 0;transform:rotate(-45deg);\n border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);\n display:flex;align-items:center;justify-content:center;overflow:hidden;\n `,t){const e=document.createElement("img");e.src=f(t)??"",e.style.cssText="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);",r.appendChild(e)}return r})(r,p);l.addEventListener("click",()=>{F.current&&(F.current.remove(),F.current=null);const r=document.createElement("div");L(o,r,c);const n=new t.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-40]}).setLngLat([s,i]).setDOMContent(r).addTo(e);F.current=n,n.on("close",()=>{F.current===n&&(F.current=null)})});const a=new t.Marker({element:l}).setLngLat([s,i]).addTo(e);k.current.push(a)})}},[U,O,R,D,c,p,W,P,Z]),t(()=>{if(!D)return;const e=h.current;if(!e)return;if(!j.current&&Z)return void(j.current=!0);j.current=!0;const t={padding:v,duration:3e3,essential:!0};if(U){const r=g(O,U);if(!r?.folder.boundary?.length)return;const n=w.current;if(!n)return;const o=new n.LngLatBounds;for(const e of r.folder.boundary)o.extend([e.x,e.y]);o.isEmpty()||e.fitBounds(o,{...t,maxZoom:14})}else if(O.length>0){const r=w.current;if(!r)return;const n=new r.LngLatBounds,o=e=>{for(const t of e)t.centroid?n.extend([t.centroid[0],t.centroid[1]]):o(t.children)};o(O),n.isEmpty()||e.fitBounds(n,{...t,maxZoom:8})}},[U,O,D,Z]),t(()=>{h.current&&(z.current=S,h.current.setProjection(S?{type:"globe"}:{type:"mercator"}),h.current.easeTo({pitch:0,bearing:0,duration:600}))},[S]),/* @__PURE__ */d("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:i(q),children:[
|
|
2
2
|
/* @__PURE__ */d(b,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:O,activeFolderId:U,setActiveFolderId:W}),
|
|
3
3
|
/* @__PURE__ */d("button",{type:"button",onClick:()=>B(e=>!e),class:"bg-background hover:bg-foreground/10 absolute top-4 right-4 z-[1000] rounded-xl px-3 py-2 text-xs font-semibold shadow-lg backdrop-blur-sm",children:S?"2D":"3D"}),$&&/* @__PURE__ */d("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:/* @__PURE__ */d("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),I&&/* @__PURE__ */d("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:/* @__PURE__ */d("div",{class:"flex flex-col items-center gap-3",children:[/* @__PURE__ */d("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),/* @__PURE__ */d("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),
|
|
4
4
|
/* @__PURE__ */d("div",{ref:m,class:"size-full"})]})};export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./CH5eh9L8.js"),r=require("./
|
|
1
|
+
const e=require("./CH5eh9L8.js"),r=require("./Cn5QS0_5.js"),t=require("./BNq5z2O6.js"),n=require("./DMmZTL_c.js");var o=[[90,-180],[-90,180]],i=[20,0],a="#fb8500",s={topLeft:[276,60],bottomRight:[60,60]},l=new t.QueryClient,c=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");exports.default=({onExplore:t,logoUrl:u})=>{const d=r.A(null),f=r.A(null),p=r.A(null),m=r.A(null),g=r.A(null),y=r.A(null),h=r.A(null),x=r.A(!1),v=r.A(!1),b=r.T(()=>(()=>{try{const e=sessionStorage.getItem(r.MAP_STATE_SESSION_STORAGE_PARAM);if(!e)return null;const t=JSON.parse(e);if("number"==typeof t?.center?.lat&&"number"==typeof t?.center?.lng&&"number"==typeof t?.zoom)return t}catch{}return null})(),[]),[L,w]=r.d(!0),[A,S]=r.d(!1),{folderTree:T,activeFolderId:z,activeFolder:C,visibleEvents:E,setActiveFolderId:O,isLoadingEvents:B}=n.useFolderMap(),{organization:R}=r.useSession();return r.y(()=>{if(!d.current||f.current)return;let t,n=!1;return(async()=>{try{const a=await Promise.resolve().then(()=>e.__toESM(require("./BszowxAR.js").default,1));if(n)return;if("undefined"!=typeof window&&(window.L=a),await Promise.all([Promise.resolve().then(()=>e.__toESM(require("./C5dmblnS.js").default,1)),Promise.resolve().then(()=>require("./BtTYXVAR.js"))]),n)return;const s=window.L??a;if(!d.current)return;const l=a.map(d.current,{center:b?.center?[b.center.lat??i[0],b.center.lng??i[1]]:i,zoom:b?.zoom??3,minZoom:3,zoomControl:!0,worldCopyJump:!1,maxBounds:a.latLngBounds(o),maxBoundsViscosity:1});a.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap contributors",maxZoom:19,noWrap:!0}).addTo(l);const c=a.layerGroup().addTo(l),u="function"==typeof s.heatLayer?s.heatLayer([],{radius:30,blur:30,maxZoom:10,minOpacity:.35}):null;u?.addTo(l);const x="function"==typeof s.markerClusterGroup?s.markerClusterGroup({chunkedLoading:!0,showCoverageOnHover:!1,spiderfyOnMaxZoom:!0,zoomToBoundsOnClick:!0,maxClusterRadius:48}):a.layerGroup();x.addTo(l);const v=()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{try{sessionStorage.setItem(r.MAP_STATE_SESSION_STORAGE_PARAM,JSON.stringify({center:l.getCenter(),zoom:l.getZoom()}))}catch{}},250)};let L;l.on("zoomend",v),l.on("moveend",v),f.current=l,p.current=s,m.current=c,y.current=u,g.current=x,"undefined"!=typeof ResizeObserver&&d.current&&(L=new ResizeObserver(()=>l.invalidateSize(!1)),L.observe(d.current)),requestAnimationFrame(()=>l.invalidateSize(!1)),S(!0),w(!1),t=()=>{L?.disconnect(),h.current&&clearTimeout(h.current),l.off("zoomend",v),l.off("moveend",v),l.remove(),p.current=null,f.current=null,m.current=null,y.current=null,g.current=null}}finally{n||w(!1)}})(),()=>{n=!0,t?.()}},[b]),r.y(()=>{if(!A)return;const e=p.current;if(!e)return;const o=f.current;if(m.current?.clearLayers(),g.current?.clearLayers(),null===z&&T.length>0){o&&y.current&&(y.current.setLatLngs?.([]),o.hasLayer(y.current)&&o.removeLayer(y.current));const r=t=>{for(const o of t)if(o.centroid){const[r,t]=o.centroid,i=e.divIcon({className:"",html:`<div style="transform:translate(-50%,-50%);background:${n.safeCssColor(o.color,a)};color:#fff;border-radius:20px;padding:5px 10px;font-size:12px;font-weight:600;white-space:nowrap;box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);cursor:pointer;display:inline-flex;align-items:center;gap:6px;"><span>${c(o.folder.name)}</span><span style="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;">${o.eventCount}</span></div>`,iconSize:[0,0],iconAnchor:[0,0]});e.marker([t,r],{icon:i}).on("click",()=>O(o.folder._id)).addTo(m.current)}else o.children.length>0&&r(o.children)};r(T)}else{if(0===E.length)return;const i=0===T.length&&null===z,c=n.safeCssColor(C?.color,a);if(o&&y.current&&(i&&!o.hasLayer(y.current)?y.current.addTo(o):i||(y.current.setLatLngs?.([]),o.hasLayer(y.current)&&o.removeLayer(y.current))),E.forEach(o=>{const i=o.location.x,a=o.location.y,s=e.divIcon({className:"qrati-leaflet-marker-wrapper",html:`<div style="width:36px;height:36px;cursor:pointer;background:${c};border-radius:50% 50% 50% 0;transform:rotate(-45deg);border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);display:flex;align-items:center;justify-content:center;overflow:hidden;">${n.safeImageUrl(u)?`<img src="${n.safeImageUrl(u)}" style="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);" />`:""}</div>`,iconSize:[36,36],iconAnchor:[18,36],popupAnchor:[0,-36]}),d=e.marker([a,i],{icon:s}),f=document.createElement("div");f.style.width="fit-content",((e,t,o)=>{r.R(r.u(r.QueryClientProvider,{client:l,children:r.u(r.MemoryRouter,{children:r.u(n.EventPreviewCard,{event:e,onExplore:o})})}),t)})(o,f,t),d.bindPopup(f,{closeButton:!0,maxWidth:256}),g.current?.addLayer(d)}),i&&y.current){const e=E.reduce((e,r)=>Math.max(e,r.views??0),1),r=E.map(e=>[e.location.y,e.location.x,e.views??1]);y.current.setOptions?.({radius:30,blur:30,maxZoom:10,minOpacity:.35,max:e}),y.current.setLatLngs?.(r)}if(i&&!v.current&&o&&(v.current=!0,!b)){const r=e.latLngBounds([]);E.forEach(e=>r.extend([e.location.y,e.location.x])),r.isValid()&&o.fitBounds(r,{paddingTopLeft:s.topLeft,paddingBottomRight:s.bottomRight,maxZoom:8})}}},[z,T,E,A,t,u,O,C,b]),r.y(()=>{if(!A)return;const e=f.current,r=p.current;if(!e||!r)return;if(!x.current&&b)return void(x.current=!0);x.current=!0;const t={paddingTopLeft:s.topLeft,paddingBottomRight:s.bottomRight,duration:3,easeLinearity:1};if(z){const o=n.findNodeById(T,z);if(!o?.folder.boundary?.length)return;const i=r.latLngBounds([]);for(const e of o.folder.boundary)i.extend([e.y,e.x]);i.isValid()&&e.flyToBounds(i,{...t,maxZoom:14})}else{const n=r.latLngBounds([]),o=e=>{for(const r of e)r.centroid?n.extend([r.centroid[1],r.centroid[0]]):o(r.children)};o(T),n.isValid()&&e.flyToBounds(n,{...t,maxZoom:8})}},[z,T,A,b]),r.u("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:r.getStyleObject(R),children:[r.u(n.FolderTreeSidebar,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:T,activeFolderId:z,setActiveFolderId:O}),B&&r.u("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:r.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),L&&r.u("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:r.u("div",{class:"flex flex-col items-center gap-3",children:[r.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),r.u("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),r.u("div",{ref:d,class:"h-full w-full rounded-xl border border-slate-200"})]})};
|