@nice2dev/erp-adapter 1.0.8 → 1.0.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ErpAuthAdapter.d.ts","sourceRoot":"","sources":["../src/ErpAuthAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEvF,MAAM,WAAW,oBAAoB;IACjC,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACxD;AAED,qBAAa,cAAc;IACvB,OAAO,CAAC,GAAG,CAAuB;IAClC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,YAAY,CAAuB;gBAE/B,MAAM,EAAE,oBAAoB;IAIxC,sCAAsC;IACtC,cAAc,IAAI,MAAM,GAAG,IAAI;IAI/B,8DAA8D;IAC9D,YAAY,QAAa,OAAO,CAAC,MAAM,CAAC,CAGtC;YAEY,IAAI;IAWlB,oCAAoC;IAC9B,KAAK,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAU5D,gCAAgC;IAC1B,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAW1C,6BAA6B;IACvB,EAAE,IAAI,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IASzC,4CAA4C;IACtC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAYhC"}
1
+ {"version":3,"file":"ErpAuthAdapter.d.ts","sourceRoot":"","sources":["../src/ErpAuthAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,E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GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAkB5E,6BAA6B;IACvB,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC;IAkBzF,+BAA+B;IACzB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAW5D,mDAAmD;IAC7C,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYjD,yBAAyB;IACnB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAYpD;;;OAGG;IACG,kBAAkB,CACtB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,sBAAsB,EAClC,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAuDpC;;;OAGG;IACG,0BAA0B,CAC9B,KAAK,EAAE,IAAI,EAAE,EACb,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,KAAK,IAAI,EACnE,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;CAgBvC"}
@@ -1,14 +1,14 @@
1
- import { ErpResponse } from './types';
2
1
  import { ErpDataAdapter } from './ErpDataAdapter';
2
+ import { ErpResponse } from './types';
3
3
  /** Pending mutation waiting for server confirmation. */
4
4
  export interface PendingMutation<T = unknown> {
5
5
  id: string;
6
- type: "create" | "update" | "delete";
6
+ type: 'create' | 'update' | 'delete';
7
7
  entityId?: string | number;
8
8
  optimisticData?: T;
9
9
  previousData?: T;
10
10
  timestamp: number;
11
- status: "pending" | "confirmed" | "failed";
11
+ status: 'pending' | 'confirmed' | 'failed';
12
12
  error?: string;
13
13
  }
14
14
  export type OptimisticListener<T> = (items: T[], pending: PendingMutation<T>[]) => void;
@@ -30,7 +30,7 @@ export declare class ErpOptimisticStore<T extends Record<string, unknown> = Reco
30
30
  /** Set initial data (e.g. after load()). */
31
31
  setItems(items: T[]): void;
32
32
  /** Load data from server and replace local state. */
33
- load(...args: Parameters<ErpDataAdapter<T>["load"]>): Promise<ErpResponse<T[]>>;
33
+ load(...args: Parameters<ErpDataAdapter<T>['load']>): Promise<ErpResponse<T[]>>;
34
34
  /** Optimistically create an item. */
35
35
  create(item: Partial<T>): Promise<ErpResponse<T>>;
36
36
  /** Optimistically update an item. */
@@ -1 +1 @@
1
- {"version":3,"file":"ErpOptimisticStore.d.ts","sourceRoot":"","sources":["../src/ErpOptimisticStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,wDAAwD;AACxD,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,CAAC,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC;AAExF,qBAAa,kBA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,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAOtE,yDAAyD;IACzD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,8CAA8C;IAC9C,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,OAAO,CAAC,KAAK;CAkEd"}
@@ -1,5 +1,5 @@
1
1
  import { ErpSignalRConfig } from './types';
2
- export type SignalRStatus = "disconnected" | "connecting" | "connected" | "reconnecting";
2
+ export type SignalRStatus = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
3
3
  export interface ErpSignalRAdapter {
4
4
  readonly status: SignalRStatus;
5
5
  start(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"ErpSignalRAdapter.d.ts","sourceRoot":"","sources":["../src/ErpSignalRAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;AAEzF,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3D,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAC5D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACrD,cAAc,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACnE;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAsD/F"}
1
+ {"version":3,"file":"ErpSignalRAdapter.d.ts","sourceRoot":"","sources":["../src/ErpSignalRAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;AAEzF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3D,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAC5D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACrD,cAAc,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACjE;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAsD/F"}
@@ -1 +1 @@
1
- {"version":3,"file":"useLoanApi.d.ts","sourceRoot":"","sources":["../../src/finance/useLoanApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;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mB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOhF,gBAAgB,CAAC,SAAS,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAOjF,iBAAiB,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAOrF,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAI1E,kBAAkB,CACtB,aAAa,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAO3B,qBAAqB,CACzB,KAAK,EAAE,QAAQ,EAAE,EACjB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,uBAAuB,CAAC;IAO7B,cAAc,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;CAG9C;AAED,eAAe,UAAU,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var we=Object.create;var ie=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var Ee=(u,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ke(e))!Ce.call(u,a)&&a!==t&&ie(u,a,{get:()=>e[a],enumerable:!(n=Se(e,a))||n.enumerable});return u};var Te=(u,e,t)=>(t=u!=null?we(ve(u)):{},Ee(e||!u||!u.__esModule?ie(t,"default",{value:u,enumerable:!0}):t,u));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react");class Pe{constructor(e){this.cfg=typeof e=="string"?{baseUrl:e}:e}async request(e,t){const n=this.cfg.fetch??globalThis.fetch,a={"Content-Type":"application/json",...this.cfg.headers};if(this.cfg.tokenFactory){const o=await this.cfg.tokenFactory();a.Authorization=`Bearer ${o}`}const l=await n(`${this.cfg.baseUrl}${e}`,{...t,headers:{...a,...t==null?void 0:t.headers}});if(!l.ok)throw new Error(`ERP request failed: ${l.status} ${l.statusText}`);return l.json()}async load(e){var a,l;const t=new URLSearchParams;(e==null?void 0:e.skip)!=null&&t.set("skip",String(e.skip)),(e==null?void 0:e.take)!=null&&t.set("take",String(e.take)),e!=null&&e.search&&t.set("search",e.search),(a=e==null?void 0:e.sort)!=null&&a.length&&t.set("sort",JSON.stringify(e.sort)),(l=e==null?void 0:e.filters)!=null&&l.length&&t.set("filters",JSON.stringify(e.filters));const n=t.toString();return this.request(n?`?${n}`:"")}async getById(e){return this.request(`/${e}`)}async create(e){return this.request("",{method:"POST",body:JSON.stringify(e)})}async update(e,t){return this.request(`/${e}`,{method:"PUT",body:JSON.stringify(t)})}async remove(e){return this.request(`/${e}`,{method:"DELETE"})}async removeBatch(e){return this.request("/batch-delete",{method:"POST",body:JSON.stringify({ids:e})})}async createBatch(e){return this.request("/batch",{method:"POST",body:JSON.stringify({items:e})})}async updateBatch(e){return this.request("/batch",{method:"PUT",body:JSON.stringify({items:e})})}async patch(e,t){return this.request(`/${e}`,{method:"PATCH",body:JSON.stringify(t)})}}async function Ve(u){const e=await import("@microsoft/signalr");let t="disconnected";const n=new Set,a=d=>{t=d,n.forEach(g=>g(d))},o=new e.HubConnectionBuilder().withUrl(u.hubUrl,{accessTokenFactory:u.accessTokenFactory?()=>u.accessTokenFactory():void 0}).withAutomaticReconnect().build();return o.onreconnecting(()=>a("reconnecting")),o.onreconnected(()=>a("connected")),o.onclose(()=>a("disconnected")),{get status(){return t},async start(){a("connecting"),await o.start(),a("connected")},async stop(){await o.stop(),a("disconnected")},on(d,g){o.on(d,g)},off(d,g){o.off(d,g)},invoke(d,...g){return o.invoke(d,...g)},onStatusChange(d){return n.add(d),()=>n.delete(d)}}}function ue(u){const{adapter:e,entityName:t,keyField:n,initialData:a=[],onBeforeChange:l,onAfterChange:o,onConflict:i,subscribeMethod:d="SubscribeToEntity",unsubscribeMethod:g="UnsubscribeFromEntity",changeEventName:S="EntityChanged",flashChanges:w=!0,flashDuration:T=500,optimisticUpdates:A=!0}=u,[W,D]=r.useState(a),[Q,G]=r.useState(e.status),[_,N]=r.useState(new Set),[q,O]=r.useState(new Set),[Z,ee]=r.useState(null),z=r.useRef(new Map),$=r.useRef(new Map),X=r.useCallback((y,v)=>{const{operation:P,key:E,data:k,changes:M}=v;switch(P){case"insert":return!k||y.some(x=>x[n]===E)?y:[...y,k];case"update":return y.map(x=>{if(x[n]!==E)return x;const K=z.current.get(E);if(K&&i){const ae=i({...x,...K.changes},k??{...x,...M},v);return ae==="local"?{...x,...K.changes}:ae==="remote"?(z.current.delete(E),k??{...x,...M}):ae==="merge"?{...x,...M,...K.changes}:ae}return k||{...x,...M}});case"delete":return y.filter(x=>x[n]!==E);default:return y}},[n,i]),R=r.useCallback(y=>{if(!w)return;const v=$.current.get(y);v&&clearTimeout(v),N(E=>new Set([...E,y]));const P=setTimeout(()=>{N(E=>{const k=new Set(E);return k.delete(y),k}),$.current.delete(y)},T);$.current.set(y,P)},[w,T]),B=r.useCallback(async y=>{y.entityName===t&&(l&&!await l(y)||(D(v=>{const P=X(v,y);return o==null||o(y,P),P}),R(y.key)))},[t,l,X,o,R]),p=r.useCallback(y=>{B(y)},[B]),se=r.useCallback((y,v)=>{if(!A)return;const P=W.find(E=>E[n]===y);P&&(z.current.set(y,{original:P,changes:v}),O(E=>new Set([...E,y])))},[W,n,A]),j=r.useCallback(y=>{z.current.delete(y),O(v=>{const P=new Set(v);return P.delete(y),P})},[]),U=r.useCallback(y=>{const v=z.current.get(y);v&&(D(P=>P.map(E=>E[n]===y?v.original:E)),z.current.delete(y),O(P=>{const E=new Set(P);return E.delete(y),E}))},[n]),te=r.useCallback(async()=>{if(e.status==="connected")try{await e.invoke(d,t),ee(null)}catch(y){ee(y instanceof Error?y:new Error(String(y)))}},[e,d,t]),ne=r.useCallback(async()=>{if(e.status==="connected")try{await e.invoke(g,t)}catch{}},[e,g,t]);return r.useEffect(()=>{const y=e.onStatusChange(v=>{G(v),v==="connected"&&te()});return e.on(S,B),e.status==="connected"&&te(),()=>{y(),e.off(S,B),ne(),$.current.forEach(v=>clearTimeout(v)),$.current.clear()}},[e,S,B,te,ne]),r.useEffect(()=>{D(a)},[a]),{data:W,status:Q,flashedKeys:_,pendingKeys:q,error:Z,applyRemoteUpdate:p,registerPendingChange:se,confirmPendingChange:j,rollbackPendingChange:U,resubscribe:te}}function Ae(u){const{adapter:e,entityName:t,keyField:n,fetchMethod:a="GetEntities",insertMethod:l="InsertEntity",updateMethod:o="UpdateEntity",deleteMethod:i="DeleteEntity"}=u;return{async fetchAll(d){return e.invoke(a,t,d)},async insert(d){return e.invoke(l,t,d)},async update(d,g){return e.invoke(o,t,d,g)},async remove(d){return e.invoke(i,t,d)},getKeyField(){return n}}}function Oe(u,e,t){const n=new Map(u.map(a=>[a[t],a]));for(const a of e)switch(a.operation){case"insert":a.data&&!n.has(a.key)&&n.set(a.key,a.data);break;case"update":if(n.has(a.key)){const l=n.get(a.key);n.set(a.key,a.data??{...l,...a.changes})}break;case"delete":n.delete(a.key);break}return Array.from(n.values())}function ce(u){const{adapter:e,entityType:t,entityId:n,currentUser:a,initialStatus:l="viewing",heartbeatInterval:o=3e4,idleTimeout:i=6e4,awayTimeout:d=3e5,joinMethod:g="JoinEntityView",leaveMethod:S="LeaveEntityView",updateMethod:w="UpdateEntityPresence",presenceEventName:T="EntityPresenceChanged",joinedEventName:A="EntityUserJoined",leftEventName:W="EntityUserLeft",onPresenceChange:D,onEditConflict:Q}=u,[G,_]=r.useState([]),[N,q]=r.useState(l),[O,Z]=r.useState(),[ee,z]=r.useState(e.status),$=r.useRef(Date.now()),X=r.useRef(null),R=r.useRef(null),B=r.useRef(null),p=Array.isArray(n)?n:[n],se=`${t}:${p.sort().join(",")}`,j=r.useCallback(async(f,C,s)=>{if(e.status==="connected")try{await e.invoke(w,{entityType:t,entityIds:p,userId:a.id,status:f,editingField:C,selection:s,timestamp:new Date().toISOString()})}catch{}},[e,w,t,p,a.id]),U=r.useCallback((f,C)=>{q(f),Z(C),j(f,C),$.current=Date.now()},[j]),te=r.useCallback(f=>{const C=G.find(s=>s.user.id!==a.id&&s.status==="editing"&&s.editingField===f);C&&(Q==null||Q(C.user,f)),U("editing",f)},[G,a.id,Q,U]),ne=r.useCallback(()=>{U("viewing",void 0)},[U]),y=r.useCallback(f=>{j(N,O,f),$.current=Date.now()},[j,N,O]),v=r.useCallback(f=>{const C=G.find(s=>s.user.id!==a.id&&s.status==="editing"&&s.editingField===f);return(C==null?void 0:C.user)??null},[G,a.id]),P=r.useCallback(f=>{const C=G.find(s=>s.status==="editing"&&s.editingField===f);return(C==null?void 0:C.user)??null},[G]),E=r.useCallback(async()=>{if(e.status==="connected")try{const f=await e.invoke("GetEntityPresence",t,p);Array.isArray(f)&&(_(f),D==null||D(f))}catch{}},[e,t,p,D]),k=r.useCallback(()=>{$.current=Date.now(),R.current&&clearTimeout(R.current),B.current&&clearTimeout(B.current),(N==="idle"||N==="away")&&U(O?"editing":"viewing",O),R.current=setTimeout(()=>{U("idle",O)},i),B.current=setTimeout(()=>{U("away",O)},d)},[N,O,i,d,U]),M=r.useCallback(f=>{f.entityType!==t||!f.entityIds.some(s=>p.includes(s))||(_(f.presence.filter(s=>s.user.id!==a.id)),D==null||D(f.presence))},[t,p,a.id,D]),x=r.useCallback(f=>{f.entityType!==t||!f.entityIds.some(s=>p.includes(s))||f.presence.user.id===a.id||_(s=>{const b=s.findIndex(I=>I.user.id===f.presence.user.id);if(b>=0){const I=[...s];return I[b]=f.presence,I}return[...s,f.presence]})},[t,p,a.id]),K=r.useCallback(f=>{f.entityType!==t||!f.entityIds.some(s=>p.includes(s))||_(s=>s.filter(b=>b.user.id!==f.userId))},[t,p]);r.useEffect(()=>{const f=e.onStatusChange(z);e.on(T,M),e.on(A,x),e.on(W,K);const C=async()=>{if(e.status==="connected")try{await e.invoke(g,{entityType:t,entityIds:p,user:a,status:N}),await E()}catch{}};return e.status==="connected"&&C(),()=>{f(),e.off(T,M),e.off(A,x),e.off(W,K),e.status==="connected"&&e.invoke(S,{entityType:t,entityIds:p,userId:a.id}).catch(()=>{})}},[e,se,g,S,T,A,W,M,x,K,E,a,N,t,p]),r.useEffect(()=>(X.current=setInterval(()=>{j(N,O)},o),()=>{X.current&&clearInterval(X.current)}),[o,j,N,O]),r.useEffect(()=>{const f=["mousemove","keydown","mousedown","touchstart","scroll"];return f.forEach(C=>window.addEventListener(C,k,{passive:!0})),R.current=setTimeout(()=>{U("idle",O)},i),B.current=setTimeout(()=>{U("away",O)},d),()=>{f.forEach(C=>window.removeEventListener(C,k)),R.current&&clearTimeout(R.current),B.current&&clearTimeout(B.current)}},[k,i,d,O,U]);const ae=G.filter(f=>f.status==="viewing"||f.status==="idle").map(f=>f.user),re=G.filter(f=>f.status==="editing").map(f=>f.user),oe=re.length>0;return{presence:G,viewers:ae,editors:re,myStatus:N,setMyStatus:U,startEditing:te,stopEditing:ne,updateSelection:y,connectionStatus:ee,isFieldLocked:v,hasActiveEditors:oe,getFieldEditor:P,refresh:E}}function de(u){const e=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#84cc16","#f97316","#14b8a6"];let t=0;for(let n=0;n<u.length;n++)t=u.charCodeAt(n)+((t<<5)-t);return e[Math.abs(t)%e.length]}function Re(u){switch(u){case"viewing":return"Viewing";case"editing":return"Editing";case"idle":return"Idle";case"away":return"Away";default:return"Unknown"}}function xe(u){const{adapter:e,entityType:t,currentUser:n,batchEventName:a="BatchPresenceUpdate"}=u,[l,o]=r.useState(new Map),i=r.useCallback(w=>{w.entityType===t&&o(new Map(Object.entries(w.presenceByEntity)))},[t]);r.useEffect(()=>(e.on(a,i),()=>{e.off(a,i)}),[e,a,i]);const d=r.useCallback(w=>l.get(w)??[],[l]),g=r.useCallback(w=>{const T=l.get(w);return(T==null?void 0:T.some(A=>A.status==="editing"&&A.user.id!==n.id))??!1},[l,n.id]),S=r.useCallback(w=>{const T=l.get(w);return(T==null?void 0:T.filter(A=>A.status==="editing").map(A=>A.user))??[]},[l]);return{presenceByEntity:l,getPresence:d,isEntityBeingEdited:g,getEntityEditors:S}}function J(u){return`${String(u.rowKey)}:${u.field}`}function Le(u){return u?typeof u=="number"?u:new Date(u).getTime():Date.now()}function De(u){const{adapter:e,entityType:t,keyField:n,currentUser:a,initialData:l=[],conflictStrategy:o="last-write-wins",mergeFunction:i,onConflict:d,onBeforeCommit:g,onAfterCommit:S,enableCellLocking:w=!0,lockTimeout:T=6e4,enableCursorSharing:A=!0,cursorDebounce:W=50,optimisticUpdates:D=!0,flashChanges:Q=!0,flashDuration:G=500,liveDataOptions:_={}}=u,[N,q]=r.useState(new Map),[O,Z]=r.useState(new Map),[ee,z]=r.useState([]),[$,X]=r.useState(null),[R,B]=r.useState([]),[p,se]=r.useState([]),[j,U]=r.useState(null),[te,ne]=r.useState([]),y=r.useRef(null),v=r.useRef(new Map),P=r.useCallback(c=>(v.current.has(c)||v.current.set(c,de(c)),v.current.get(c)),[]),E=r.useCallback((c,m,h)=>{if(!h.changes)return m;const V=O.get(J({rowKey:h.key,field:Object.keys(h.changes)[0]}));if(!V)return m;const F=V.timestamp,L=Le(h.timestamp);switch(o){case"last-write-wins":return F>L?"local":"remote";case"first-write-wins":return F<L?"local":"remote";case"merge":return i?i(c,m,Object.keys(h.changes)[0]):"merge";case"ask-user":const H={cell:{rowKey:h.key,field:Object.keys(h.changes)[0]},localValue:V.newValue,remoteValue:h.changes[Object.keys(h.changes)[0]],localUser:a,remoteUser:h.changedBy?{id:h.changedBy,name:h.changedBy}:{id:"unknown",name:"Unknown"},localTimestamp:F,remoteTimestamp:L};return z(le=>[...le,H]),"local";case"reject":return"remote";default:return"remote"}},[O,o,i,a]),k=ue({adapter:e,entityName:t,keyField:n,initialData:l,flashChanges:Q,flashDuration:G,optimisticUpdates:D,onConflict:E,..._}),M=ce({adapter:e,entityType:t,entityId:"grid",currentUser:a,initialStatus:"viewing"}),x=r.useCallback(()=>{!A||e.status!=="connected"||e.invoke("UpdateGridSelection",{entityType:t,userId:a.id,focusedCell:$,selectedCells:R,selectedRows:p,editingCell:j}).catch(()=>{})},[e,A,t,a.id,$,R,p,j]);r.useEffect(()=>{if(A)return y.current&&clearTimeout(y.current),y.current=setTimeout(x,W),()=>{y.current&&clearTimeout(y.current)}},[A,x,W,$,R,p,j]),r.useEffect(()=>{if(!A)return;const c=m=>{m.entityType!==t||m.userId===a.id||ne(h=>{const V=h.findIndex(L=>L.user.id===m.userId),F={user:{id:m.userId,name:m.userName,avatarUrl:m.avatarUrl},focusedCell:m.focusedCell,selectedCells:m.selectedCells,selectedRows:m.selectedRows,editingCell:m.editingCell,color:P(m.userId)};if(V>=0){const L=[...h];return L[V]=F,L}return[...h,F]})};return e.on("GridSelectionUpdated",c),()=>{e.off("GridSelectionUpdated",c)}},[e,A,t,a.id,P]),r.useEffect(()=>{if(!w)return;const c=h=>{h.entityType===t&&q(V=>{const F=new Map(V);return F.set(J(h.cell),{user:h.user,timestamp:h.timestamp}),F})},m=h=>{h.entityType===t&&q(V=>{const F=new Map(V);return F.delete(J(h.cell)),F})};return e.on("CellLocked",c),e.on("CellUnlocked",m),()=>{e.off("CellLocked",c),e.off("CellUnlocked",m)}},[e,w,t]),r.useEffect(()=>{if(!w)return;const c=setInterval(()=>{const m=Date.now();q(h=>{const V=new Map(h);let F=!1;for(const[L,H]of V)m-H.timestamp>T&&(V.delete(L),F=!0);return F?V:h})},1e4);return()=>clearInterval(c)},[w,T]);const K=r.useCallback(c=>{if(!w)return!1;const m=N.get(J(c));return m?m.user.id!==a.id&&Date.now()-m.timestamp<T:!1},[w,N,a.id,T]),ae=r.useCallback(c=>{const m=N.get(J(c));return!m||Date.now()-m.timestamp>T?null:m.user},[N,T]),re=r.useCallback(c=>K(c)?!1:(U(c),M.startEditing(`${c.rowKey}:${c.field}`),w&&e.status==="connected"&&(e.invoke("AcquireCellLock",{entityType:t,cell:c,user:a,timestamp:Date.now()}).catch(()=>{}),q(m=>{const h=new Map(m);return h.set(J(c),{user:a,timestamp:Date.now()}),h})),!0),[K,M,w,e,t,a]),oe=r.useCallback(async(c,m)=>{const h=k.data.find(L=>L[n]===c.rowKey);if(!h)return!1;const V=h[c.field];if(g&&!await g(c,V,m))return f(c),!1;const F={cell:c,originalValue:V,newValue:m,timestamp:Date.now()};Z(L=>{const H=new Map(L);return H.set(J(c),F),H}),D&&k.registerPendingChange(c.rowKey,{[c.field]:m});try{return await e.invoke("UpdateEntityField",{entityType:t,entityId:c.rowKey,field:c.field,value:m,userId:a.id,timestamp:F.timestamp}),k.confirmPendingChange(c.rowKey),Z(L=>{const H=new Map(L);return H.delete(J(c)),H}),S==null||S(c,m),w&&(e.invoke("ReleaseCellLock",{entityType:t,cell:c}).catch(()=>{}),q(L=>{const H=new Map(L);return H.delete(J(c)),H})),U(null),M.stopEditing(),!0}catch(L){throw k.rollbackPendingChange(c.rowKey),Z(H=>{const le=new Map(H);return le.delete(J(c)),le}),L}},[k,n,g,D,e,t,a.id,S,w,M]),f=r.useCallback(c=>{U(null),M.stopEditing(),w&&e.status==="connected"&&(e.invoke("ReleaseCellLock",{entityType:t,cell:c}).catch(()=>{}),q(m=>{const h=new Map(m);return h.delete(J(c)),h})),Z(m=>{const h=new Map(m);return h.delete(J(c)),h})},[M,w,e,t]),C=r.useCallback((c,m)=>{const h=ee.find(V=>J(V.cell)===J(c));h&&(m==="remote"&&k.applyRemoteUpdate({operation:"update",entityName:t,key:c.rowKey,changes:{[c.field]:h.remoteValue}}),z(V=>V.filter(F=>J(F.cell)!==J(c))))},[ee,k,t]),s=r.useCallback(async c=>{await e.invoke("InsertEntity",t,c)},[e,t]),b=r.useCallback(async(c,m)=>{D&&k.registerPendingChange(c,m);try{await e.invoke("UpdateEntity",t,c,m),k.confirmPendingChange(c)}catch(h){throw k.rollbackPendingChange(c),h}},[e,t,D,k]),I=r.useCallback(async c=>{await e.invoke("DeleteEntity",t,c)},[e,t]),Y=r.useMemo(()=>({user:a,focusedCell:$,selectedCells:R,selectedRows:p,editingCell:j,color:P(a.id)}),[a,$,R,p,j,P]);return{data:k.data,presence:M.presence,userSelections:te,mySelection:Y,flashedKeys:k.flashedKeys,pendingEdits:O,connectionStatus:k.status,myPresenceStatus:M.myStatus,setFocusedCell:X,setSelectedCells:B,setSelectedRows:se,startCellEdit:re,commitCellEdit:oe,cancelCellEdit:f,isCellLocked:K,getCellEditor:ae,getUserColor:P,insertRow:s,updateRow:b,deleteRow:I,resolveConflict:C,conflicts:ee}}class Ne{constructor(e){this.accessToken=null,this.refreshToken=null,this.tokenFactory=async()=>{if(!this.accessToken)throw new Error("Not authenticated");return this.accessToken},this.cfg=e}getAccessToken(){return this.accessToken}async post(e,t){const a=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(`Auth request failed: ${a.status}`);return a.json()}async login(e){var n,a;const t=await this.post("/login",e);return t.token&&(this.accessToken=t.token,this.refreshToken=t.refreshToken??null,(a=(n=this.cfg).onTokens)==null||a.call(n,t.token,t.refreshToken??"")),t}async refresh(){var t,n;if(!this.refreshToken)throw new Error("No refresh token");const e=await this.post("/refresh",{refreshToken:this.refreshToken});return e.token&&(this.accessToken=e.token,this.refreshToken=e.refreshToken??this.refreshToken,(n=(t=this.cfg).onTokens)==null||n.call(t,e.token,this.refreshToken)),e}async me(){const t=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/me`,{headers:{Authorization:`Bearer ${this.accessToken}`}});if(!t.ok)throw new Error(`Auth /me failed: ${t.status}`);return t.json()}async logout(){try{await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/logout`,{method:"POST",headers:{Authorization:`Bearer ${this.accessToken}`}})}finally{this.accessToken=null,this.refreshToken=null}}}class Ue{constructor(e){this.cfg=e}async headers(){const e={};return this.cfg.tokenFactory&&(e.Authorization=`Bearer ${await this.cfg.tokenFactory()}`),e}async upload(e,t){const n=this.cfg.fetch??globalThis.fetch,a=new FormData;a.append("file",e),t&&a.append("folder",t);const l=await n(this.cfg.baseUrl,{method:"POST",headers:await this.headers(),body:a});if(!l.ok)throw new Error(`File upload failed: ${l.status}`);return l.json()}async uploadMultiple(e,t){const n=this.cfg.fetch??globalThis.fetch,a=new FormData;e.forEach(o=>a.append("files",o)),t&&a.append("folder",t);const l=await n(`${this.cfg.baseUrl}/batch`,{method:"POST",headers:await this.headers(),body:a});if(!l.ok)throw new Error(`Batch upload failed: ${l.status}`);return l.json()}async getInfo(e){const n=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/${e}/info`,{headers:{...await this.headers(),"Content-Type":"application/json"}});if(!n.ok)throw new Error(`File info failed: ${n.status}`);return n.json()}async getDownloadUrl(e){const n=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/${e}`,{headers:await this.headers()});if(!n.ok)throw new Error(`File download failed: ${n.status}`);const a=await n.blob();return URL.createObjectURL(a)}async remove(e){const n=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/${e}`,{method:"DELETE",headers:{...await this.headers(),"Content-Type":"application/json"}});if(!n.ok)throw new Error(`File delete failed: ${n.status}`);return n.json()}uploadWithProgress(e,t,n,a){return typeof XMLHttpRequest>"u"?this.upload(e,n):new Promise(async(l,o)=>{const i=new XMLHttpRequest,d=new FormData;if(d.append("file",e),n&&d.append("folder",n),a){if(a.aborted){o(new DOMException("Aborted","AbortError"));return}a.addEventListener("abort",()=>{i.abort(),o(new DOMException("Aborted","AbortError"))})}i.upload.addEventListener("progress",S=>{t({loaded:S.loaded,total:S.total,percent:S.lengthComputable?S.loaded/S.total:NaN})}),i.addEventListener("load",()=>{if(i.status>=200&&i.status<300)try{l(JSON.parse(i.responseText))}catch{o(new Error("Invalid JSON response"))}else o(new Error(`File upload failed: ${i.status}`))}),i.addEventListener("error",()=>o(new Error("Network error during upload"))),i.addEventListener("abort",()=>o(new DOMException("Aborted","AbortError"))),i.open("POST",this.cfg.baseUrl);const g=await this.headers();Object.entries(g).forEach(([S,w])=>i.setRequestHeader(S,w)),i.send(d)})}async uploadMultipleWithProgress(e,t,n,a){const l=[];for(let o=0;o<e.length;o++){if(a!=null&&a.aborted)throw new DOMException("Aborted","AbortError");const i=await this.uploadWithProgress(e[o],d=>t(o,d),n,a);l.push(i)}return l}}class Fe{constructor(e){this.cfg=e}async headers(){const e={"Content-Type":"application/json"};return this.cfg.tokenFactory&&(e.Authorization=`Bearer ${await this.cfg.tokenFactory()}`),e}async requestExport(e){const n=await(this.cfg.fetch??globalThis.fetch)(this.cfg.baseUrl,{method:"POST",headers:await this.headers(),body:JSON.stringify(e)});if(!n.ok)throw new Error(`Export request failed: ${n.status}`);return n.json()}async download(e){const n=await(this.cfg.fetch??globalThis.fetch)(e,{headers:await this.headers()});if(!n.ok)throw new Error(`Export download failed: ${n.status}`);return n.blob()}async downloadToFile(e,t){var i;const n=await this.requestExport(e);if(!((i=n.data)!=null&&i.downloadUrl))throw new Error("No download URL returned");const a=await this.download(n.data.downloadUrl),l=URL.createObjectURL(a),o=document.createElement("a");o.href=l,o.download=t??`export.${e.format}`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(l)}}function Me(u){return e=>{const t=e??globalThis.fetch;return(a,l)=>{const d={url:typeof a=="string"?a:a instanceof URL?a.toString():a.url,init:l??{},meta:{}};let g=S=>t(S.url,S.init);for(let S=u.length-1;S>=0;S--){const w=u[S],T=g;g=A=>w(A,T)}return g(d)}}}function Ie(){return async(u,e)=>{const t=performance.now(),n=(u.init.method??"GET").toUpperCase();try{const a=await e(u),l=(performance.now()-t).toFixed(1);return console.debug(`[ERP] ${n} ${u.url} → ${a.status} (${l}ms)`),a}catch(a){const l=(performance.now()-t).toFixed(1);throw console.error(`[ERP] ${n} ${u.url} FAILED (${l}ms)`,a),a}}}function $e(u){const e=(u==null?void 0:u.maxRetries)??3,t=(u==null?void 0:u.baseDelay)??500,n=new Set((u==null?void 0:u.retryOn)??[408,429,500,502,503,504]);return async(a,l)=>{let o;for(let i=0;i<=e;i++){try{const g=await l(a);if(g.ok||!n.has(g.status)||i===e)return g;o=new Error(`HTTP ${g.status}`)}catch(g){if(o=g,i===e)throw g}const d=t*Math.pow(2,i)*(.5+Math.random()*.5);await new Promise(g=>setTimeout(g,d))}throw o}}function Be(u){return async(e,t)=>{const n=typeof u=="function"?await u():u;return e.init.headers={...e.init.headers,...n},t(e)}}class ze{constructor(e){this.inFlight=0,this.timestamps=[],this.queue=[],this.processing=!1,this.backingOff=!1,this.maxConcurrent=(e==null?void 0:e.maxConcurrent)??6,this.maxPerSecond=(e==null?void 0:e.maxPerSecond)??20,this.backoffDelay=(e==null?void 0:e.backoffDelay)??2e3,this.baseFetch=(e==null?void 0:e.baseFetch)??globalThis.fetch.bind(globalThis),this.fetch=this.fetch.bind(this)}fetch(e,t){return new Promise((n,a)=>{this.queue.push({resolve:n,reject:a,input:e,init:t}),this.drain()})}get pending(){return this.queue.length}get active(){return this.inFlight}drain(){if(this.processing)return;this.processing=!0;const e=()=>{if(this.queue.length===0||this.backingOff){this.processing=!1;return}if(this.inFlight>=this.maxConcurrent){this.processing=!1;return}const t=Date.now();if(this.timestamps=this.timestamps.filter(a=>t-a<1e3),this.timestamps.length>=this.maxPerSecond){const a=this.timestamps[0],l=1e3-(t-a)+1;setTimeout(()=>{this.processing=!1,this.drain()},l);return}const n=this.queue.shift();this.inFlight++,this.timestamps.push(t),this.baseFetch(n.input,n.init).then(a=>{if(this.inFlight--,a.status===429){this.queue.unshift(n),this.inFlight++,this.inFlight--,this.backingOff=!0,setTimeout(()=>{this.backingOff=!1,this.drain()},this.backoffDelay);return}n.resolve(a),queueMicrotask(e)}).catch(a=>{this.inFlight--,n.reject(a),queueMicrotask(e)}),queueMicrotask(e)};e()}}class je{constructor(e,t="id"){this.items=[],this.mutations=[],this.listeners=new Set,this.nextMutationId=1,this.adapter=e,this.keyField=t}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){const e=[...this.items],t=[...this.mutations];this.listeners.forEach(n=>n(e,t))}getItems(){return[...this.items]}getPending(){return this.mutations.filter(e=>e.status==="pending")}setItems(e){this.items=[...e],this.notify()}async load(...e){const t=await this.adapter.load(...e);return t.success&&(this.items=t.data,this.mutations=[],this.notify()),t}async create(e){const t=`__temp_${this.nextMutationId}`,n={...e,[this.keyField]:t},l={id:String(this.nextMutationId++),type:"create",optimisticData:n,timestamp:Date.now(),status:"pending"};this.items=[...this.items,n],this.mutations.push(l),this.notify();try{const o=await this.adapter.create(e);return o.success?(this.items=this.items.map(i=>i[this.keyField]===t?o.data:i),l.status="confirmed",l.entityId=o.data[this.keyField]):(this.items=this.items.filter(i=>i[this.keyField]!==t),l.status="failed",l.error=o.error),this.notify(),o}catch(o){throw this.items=this.items.filter(i=>i[this.keyField]!==t),l.status="failed",l.error=o instanceof Error?o.message:String(o),this.notify(),o}}async update(e,t){const n=this.items.findIndex(i=>i[this.keyField]===e),a=n>=0?{...this.items[n]}:void 0,o={id:String(this.nextMutationId++),type:"update",entityId:e,previousData:a,timestamp:Date.now(),status:"pending"};n>=0&&(this.items=this.items.map((i,d)=>d===n?{...i,...t}:i)),this.mutations.push(o),this.notify();try{const i=await this.adapter.update(e,t);return i.success?(this.items=this.items.map(d=>d[this.keyField]===e?i.data:d),o.status="confirmed"):(a&&n>=0&&(this.items=this.items.map(d=>d[this.keyField]===e?a:d)),o.status="failed",o.error=i.error),this.notify(),i}catch(i){throw a&&n>=0&&(this.items=this.items.map(d=>d[this.keyField]===e?a:d)),o.status="failed",o.error=i instanceof Error?i.message:String(i),this.notify(),i}}async remove(e){const t=this.items.findIndex(o=>o[this.keyField]===e),n=t>=0?{...this.items[t]}:void 0,l={id:String(this.nextMutationId++),type:"delete",entityId:e,previousData:n,timestamp:Date.now(),status:"pending"};this.items=this.items.filter(o=>o[this.keyField]!==e),this.mutations.push(l),this.notify();try{const o=await this.adapter.remove(e);return o.success?l.status="confirmed":(n&&this.items.splice(t,0,n),l.status="failed",l.error=o.error),this.notify(),o}catch(o){throw n&&this.items.splice(t,0,n),l.status="failed",l.error=o instanceof Error?o.message:String(o),this.notify(),o}}}class Je{constructor(e){this.queue=[],this.syncing=!1,this.nextId=1,this.config=e??{},this.baseFetch=(e==null?void 0:e.baseFetch)??globalThis.fetch.bind(globalThis),this.storageKey=(e==null?void 0:e.storageKey)??"erp_offline_",this.fetch=this.fetch.bind(this),this.restoreQueue(),this.boundOnline=()=>{var t,n;(n=(t=this.config).onStatusChange)==null||n.call(t,!0),this.sync()},this.boundOffline=()=>{var t,n;(n=(t=this.config).onStatusChange)==null||n.call(t,!1)},typeof window<"u"&&(window.addEventListener("online",this.boundOnline),window.addEventListener("offline",this.boundOffline))}fetch(e,t){var o,i;const n=typeof e=="string"?e:e instanceof URL?e.toString():e.url,a=((t==null?void 0:t.method)??"GET").toUpperCase();if(this.isOnline())return this.baseFetch(e,t);if(a==="GET"||a==="HEAD")return Promise.reject(new Error("Offline: GET requests are not queued"));const l={id:`q_${this.nextId++}`,url:n,method:a,headers:{...t==null?void 0:t.headers},body:typeof(t==null?void 0:t.body)=="string"?t.body:void 0,timestamp:Date.now()};return this.queue.push(l),this.persistQueue(),(i=(o=this.config).onQueued)==null||i.call(o,l),Promise.resolve(new Response(JSON.stringify({queued:!0,queueId:l.id}),{status:202,headers:{"Content-Type":"application/json"}}))}isOnline(){return typeof navigator>"u"||navigator.onLine}get pendingCount(){return this.queue.length}getQueue(){return[...this.queue]}clear(){this.queue=[],this.persistQueue()}async sync(){var t,n;if(this.syncing||this.queue.length===0||!this.isOnline())return[];this.syncing=!0;const e=[];for(;this.queue.length>0&&this.isOnline();){const a=this.queue[0];try{const l=await this.baseFetch(a.url,{method:a.method,headers:a.headers,body:a.body});e.push({entry:a,success:l.ok,status:l.status,error:l.ok?void 0:`HTTP ${l.status}`}),this.queue.shift()}catch(l){e.push({entry:a,success:!1,error:l instanceof Error?l.message:String(l)});break}}return this.persistQueue(),this.syncing=!1,e.length>0&&((n=(t=this.config).onSync)==null||n.call(t,e)),e}destroy(){typeof window<"u"&&(window.removeEventListener("online",this.boundOnline),window.removeEventListener("offline",this.boundOffline))}persistQueue(){try{typeof localStorage<"u"&&localStorage.setItem(`${this.storageKey}queue`,JSON.stringify(this.queue))}catch{}}restoreQueue(){try{if(typeof localStorage<"u"){const e=localStorage.getItem(`${this.storageKey}queue`);e&&(this.queue=JSON.parse(e),this.nextId=this.queue.reduce((t,n)=>Math.max(t,parseInt(n.id.replace("q_",""),10)||0),0)+1)}}catch{this.queue=[]}}}const he=[{type:"NiceAudioPlayer",label:"Audio Player",category:"Audio",icon:"music",defaultProps:{src:"",autoplay:!1,showWaveform:!0},propDescriptors:[{name:"src",type:"string",label:"Audio source URL"},{name:"autoplay",type:"boolean",label:"Auto-play",defaultValue:!1},{name:"loop",type:"boolean",label:"Loop",defaultValue:!1},{name:"showWaveform",type:"boolean",label:"Show waveform",defaultValue:!0},{name:"showPlaylist",type:"boolean",label:"Show playlist",defaultValue:!1},{name:"visualizerMode",type:"select",label:"Visualizer mode",options:[{label:"None",value:"none"},{label:"Bars",value:"bars"},{label:"Wave",value:"wave"},{label:"Circle",value:"circle"}],defaultValue:"bars"},{name:"height",type:"size",label:"Height",group:"Layout"}]},{type:"NiceWaveform",label:"Waveform",category:"Audio",icon:"waveform",defaultProps:{peaks:[],color:"#4a90d9"},propDescriptors:[{name:"peaks",type:"json",label:"Peak data (JSON array)"},{name:"color",type:"color",label:"Waveform color",defaultValue:"#4a90d9"},{name:"progressColor",type:"color",label:"Progress color",defaultValue:"#1b5e20"},{name:"barWidth",type:"number",label:"Bar width (px)",min:1,max:10,step:1,defaultValue:2},{name:"height",type:"size",label:"Height",group:"Layout"},{name:"interactive",type:"boolean",label:"Allow seeking",defaultValue:!0}]},{type:"NicePianoRoll",label:"Piano Roll",category:"Audio",icon:"piano",defaultProps:{notes:[],octaves:4,startOctave:3},propDescriptors:[{name:"notes",type:"json",label:"MIDI notes (JSON)"},{name:"octaves",type:"number",label:"Visible octaves",min:1,max:8,defaultValue:4},{name:"startOctave",type:"number",label:"Start octave",min:0,max:8,defaultValue:3},{name:"quantize",type:"select",label:"Quantize",options:[{label:"1/4",value:"4"},{label:"1/8",value:"8"},{label:"1/16",value:"16"},{label:"1/32",value:"32"}],defaultValue:"16"},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1},{name:"height",type:"size",label:"Height",group:"Layout"}]},{type:"NiceKaraoke",label:"Karaoke",category:"Audio",icon:"microphone",defaultProps:{lyrics:[],audioSrc:""},propDescriptors:[{name:"audioSrc",type:"string",label:"Audio source URL"},{name:"lyrics",type:"json",label:"Lyrics (JSON array of {time, text})"},{name:"showScore",type:"boolean",label:"Show score",defaultValue:!0},{name:"pitchDetection",type:"boolean",label:"Pitch detection",defaultValue:!0},{name:"highlightColor",type:"color",label:"Highlight color",defaultValue:"#ffd700"},{name:"fontSize",type:"size",label:"Font size",group:"Typography"}]}],pe=[{type:"NicePixelEditor",label:"Pixel Editor",category:"Graphics",icon:"grid",defaultProps:{width:32,height:32,palette:[]},propDescriptors:[{name:"width",type:"number",label:"Canvas width (px)",min:1,max:256,defaultValue:32},{name:"height",type:"number",label:"Canvas height (px)",min:1,max:256,defaultValue:32},{name:"palette",type:"json",label:"Color palette (JSON array)"},{name:"gridVisible",type:"boolean",label:"Show grid",defaultValue:!0},{name:"zoom",type:"number",label:"Zoom level",min:1,max:32,step:1,defaultValue:8},{name:"layers",type:"boolean",label:"Enable layers",defaultValue:!0},{name:"onion",type:"boolean",label:"Onion skin (animation)",defaultValue:!1}]},{type:"NiceVectorEditor",label:"Vector Editor",category:"Graphics",icon:"pen-tool",defaultProps:{width:800,height:600},propDescriptors:[{name:"width",type:"number",label:"Canvas width",min:100,max:4096,defaultValue:800,group:"Layout"},{name:"height",type:"number",label:"Canvas height",min:100,max:4096,defaultValue:600,group:"Layout"},{name:"showRulers",type:"boolean",label:"Show rulers",defaultValue:!0},{name:"snapToGrid",type:"boolean",label:"Snap to grid",defaultValue:!0},{name:"gridSize",type:"number",label:"Grid size",min:1,max:100,defaultValue:10},{name:"fillColor",type:"color",label:"Default fill",defaultValue:"#ffffff"},{name:"strokeColor",type:"color",label:"Default stroke",defaultValue:"#000000"},{name:"strokeWidth",type:"number",label:"Stroke width",min:0,max:20,step:.5,defaultValue:1}]},{type:"NicePhotoEditor",label:"Photo Editor",category:"Graphics",icon:"image",defaultProps:{src:""},propDescriptors:[{name:"src",type:"string",label:"Image source URL"},{name:"crop",type:"boolean",label:"Allow crop",defaultValue:!0},{name:"rotate",type:"boolean",label:"Allow rotate",defaultValue:!0},{name:"filters",type:"boolean",label:"Show filters",defaultValue:!0},{name:"adjustments",type:"boolean",label:"Show adjustments",defaultValue:!0},{name:"text",type:"boolean",label:"Allow text overlay",defaultValue:!0},{name:"outputFormat",type:"select",label:"Output format",options:[{label:"PNG",value:"png"},{label:"JPEG",value:"jpeg"},{label:"WebP",value:"webp"}],defaultValue:"png"},{name:"maxWidth",type:"number",label:"Max output width",min:100,max:8192,group:"Output"}]}],fe=[{type:"NiceModelEditor",label:"3D Model Editor",category:"3D",icon:"cube",defaultProps:{modelUrl:""},propDescriptors:[{name:"modelUrl",type:"string",label:"Model URL (.glb / .gltf)"},{name:"environmentMap",type:"select",label:"Environment",options:[{label:"Studio",value:"studio"},{label:"Outdoor",value:"outdoor"},{label:"Warehouse",value:"warehouse"},{label:"None",value:"none"}],defaultValue:"studio"},{name:"showGrid",type:"boolean",label:"Show grid",defaultValue:!0},{name:"showAxes",type:"boolean",label:"Show axes",defaultValue:!0},{name:"enablePhysics",type:"boolean",label:"Enable physics",defaultValue:!1},{name:"wireframe",type:"boolean",label:"Wireframe mode",defaultValue:!1},{name:"backgroundColor",type:"color",label:"Background",defaultValue:"#1a1a2e"},{name:"height",type:"size",label:"Viewport height",group:"Layout"}]},{type:"NiceModelViewer",label:"3D Model Viewer",category:"3D",icon:"eye",defaultProps:{modelUrl:"",autoRotate:!0},propDescriptors:[{name:"modelUrl",type:"string",label:"Model URL (.glb / .gltf)"},{name:"autoRotate",type:"boolean",label:"Auto-rotate",defaultValue:!0},{name:"rotateSpeed",type:"number",label:"Rotate speed",min:.1,max:10,step:.1,defaultValue:1},{name:"zoom",type:"boolean",label:"Allow zoom",defaultValue:!0},{name:"pan",type:"boolean",label:"Allow pan",defaultValue:!0},{name:"environmentMap",type:"select",label:"Environment",options:[{label:"Studio",value:"studio"},{label:"Outdoor",value:"outdoor"},{label:"Warehouse",value:"warehouse"},{label:"None",value:"none"}],defaultValue:"studio"},{name:"backgroundColor",type:"color",label:"Background",defaultValue:"#1a1a2e"},{name:"showAnnotations",type:"boolean",label:"Show annotations",defaultValue:!1},{name:"height",type:"size",label:"Viewport height",group:"Layout"}]}],me=[{type:"NiceLeaderboard",label:"Leaderboard",category:"Gamification",icon:"trophy",defaultProps:{dataSource:[],maxRows:10},propDescriptors:[{name:"dataSource",type:"json",label:"Data source (JSON)"},{name:"maxRows",type:"number",label:"Max visible rows",min:3,max:100,defaultValue:10},{name:"showRank",type:"boolean",label:"Show rank column",defaultValue:!0},{name:"showAvatar",type:"boolean",label:"Show avatar",defaultValue:!0},{name:"highlightCurrentUser",type:"boolean",label:"Highlight current user",defaultValue:!0},{name:"scoreField",type:"string",label:"Score field name",defaultValue:"score"},{name:"nameField",type:"string",label:"Name field name",defaultValue:"name"},{name:"variant",type:"variant",label:"Visual style",defaultValue:"default"}]},{type:"NiceAchievement",label:"Achievement Badge",category:"Gamification",icon:"award",defaultProps:{title:"Achievement",unlocked:!1},propDescriptors:[{name:"title",type:"string",label:"Achievement title",defaultValue:"Achievement"},{name:"description",type:"string",label:"Description"},{name:"icon",type:"string",label:"Icon URL"},{name:"unlocked",type:"boolean",label:"Unlocked",defaultValue:!1},{name:"progress",type:"number",label:"Progress (0-100)",min:0,max:100,defaultValue:0},{name:"rarity",type:"select",label:"Rarity",options:[{label:"Common",value:"common"},{label:"Rare",value:"rare"},{label:"Epic",value:"epic"},{label:"Legendary",value:"legendary"}],defaultValue:"common"},{name:"size",type:"size",label:"Badge size",group:"Layout"}]},{type:"NiceQuest",label:"Quest Tracker",category:"Gamification",icon:"map",defaultProps:{title:"Quest",steps:[]},propDescriptors:[{name:"title",type:"string",label:"Quest title",defaultValue:"Quest"},{name:"description",type:"string",label:"Quest description"},{name:"steps",type:"json",label:"Steps (JSON array of {title, completed})"},{name:"reward",type:"string",label:"Reward description"},{name:"rewardXP",type:"number",label:"Reward XP",min:0,defaultValue:100},{name:"showProgress",type:"boolean",label:"Show progress bar",defaultValue:!0},{name:"variant",type:"variant",label:"Visual style",defaultValue:"default"}]},{type:"NiceXPBar",label:"XP Progress Bar",category:"Gamification",icon:"zap",defaultProps:{currentXP:0,maxXP:1e3,level:1},propDescriptors:[{name:"currentXP",type:"number",label:"Current XP",min:0,defaultValue:0},{name:"maxXP",type:"number",label:"Max XP (next level)",min:1,defaultValue:1e3},{name:"level",type:"number",label:"Current level",min:1,defaultValue:1},{name:"showLabel",type:"boolean",label:"Show XP label",defaultValue:!0},{name:"showLevel",type:"boolean",label:"Show level badge",defaultValue:!0},{name:"color",type:"color",label:"Bar color",defaultValue:"#4caf50"},{name:"animated",type:"boolean",label:"Animate changes",defaultValue:!0},{name:"height",type:"size",label:"Bar height",group:"Layout"}]}],ye=[{type:"NiceAddress",label:"Address Editor",category:"Business",icon:"map-pin",defaultProps:{country:"PL"},propDescriptors:[{name:"street",type:"string",label:"Street",group:"Address"},{name:"city",type:"string",label:"City",group:"Address"},{name:"postalCode",type:"string",label:"Postal code",group:"Address"},{name:"country",type:"select",label:"Country",options:[{label:"Poland",value:"PL"},{label:"Germany",value:"DE"},{label:"USA",value:"US"},{label:"UK",value:"GB"},{label:"France",value:"FR"}],defaultValue:"PL",group:"Address"},{name:"showMap",type:"boolean",label:"Show map preview",defaultValue:!1},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NicePhone",label:"Phone Input",category:"Business",icon:"phone",defaultProps:{countryCode:"+48"},propDescriptors:[{name:"value",type:"string",label:"Phone number"},{name:"countryCode",type:"string",label:"Default country code",defaultValue:"+48"},{name:"showFlag",type:"boolean",label:"Show country flag",defaultValue:!0},{name:"format",type:"select",label:"Format",options:[{label:"International",value:"international"},{label:"National",value:"national"},{label:"E.164",value:"e164"}],defaultValue:"international"},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceCurrency",label:"Currency Input",category:"Business",icon:"dollar-sign",defaultProps:{currency:"PLN",decimals:2},propDescriptors:[{name:"value",type:"number",label:"Amount",defaultValue:0},{name:"currency",type:"select",label:"Currency",options:[{label:"PLN",value:"PLN"},{label:"EUR",value:"EUR"},{label:"USD",value:"USD"},{label:"GBP",value:"GBP"}],defaultValue:"PLN"},{name:"decimals",type:"number",label:"Decimal places",min:0,max:4,defaultValue:2},{name:"showCurrencySymbol",type:"boolean",label:"Show symbol",defaultValue:!0},{name:"thousandSeparator",type:"boolean",label:"Thousand separator",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceVAT",label:"VAT Input",category:"Business",icon:"percent",defaultProps:{rate:23,country:"PL"},propDescriptors:[{name:"netValue",type:"number",label:"Net value",defaultValue:0,group:"Values"},{name:"rate",type:"number",label:"VAT rate (%)",min:0,max:100,defaultValue:23,group:"Values"},{name:"country",type:"select",label:"Country",options:[{label:"Poland",value:"PL"},{label:"Germany",value:"DE"},{label:"France",value:"FR"}],defaultValue:"PL"},{name:"showGross",type:"boolean",label:"Show gross value",defaultValue:!0},{name:"showVatAmount",type:"boolean",label:"Show VAT amount",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceInvoiceLines",label:"Invoice Lines",category:"Business",icon:"file-text",defaultProps:{lines:[],currency:"PLN"},propDescriptors:[{name:"lines",type:"json",label:"Invoice lines (JSON)"},{name:"currency",type:"select",label:"Currency",options:[{label:"PLN",value:"PLN"},{label:"EUR",value:"EUR"},{label:"USD",value:"USD"}],defaultValue:"PLN"},{name:"showVAT",type:"boolean",label:"Show VAT column",defaultValue:!0},{name:"showDiscount",type:"boolean",label:"Show discount column",defaultValue:!1},{name:"showTotal",type:"boolean",label:"Show totals row",defaultValue:!0},{name:"editable",type:"boolean",label:"Editable",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]}],be=[{type:"NiceLoginForm",label:"Login Form",category:"Auth",icon:"log-in",defaultProps:{showRemember:!0,showForgotPassword:!0},propDescriptors:[{name:"title",type:"string",label:"Form title",defaultValue:"Sign In"},{name:"showRemember",type:"boolean",label:"Show 'Remember me'",defaultValue:!0},{name:"showForgotPassword",type:"boolean",label:"Show 'Forgot password'",defaultValue:!0},{name:"showRegisterLink",type:"boolean",label:"Show register link",defaultValue:!1},{name:"showLogo",type:"boolean",label:"Show logo",defaultValue:!0},{name:"logoUrl",type:"string",label:"Logo URL",group:"Branding"},{name:"primaryColor",type:"color",label:"Primary color",defaultValue:"#1976d2",group:"Branding"},{name:"variant",type:"variant",label:"Visual style",defaultValue:"card"}]},{type:"NiceCaptcha",label:"Captcha",category:"Auth",icon:"shield",defaultProps:{provider:"recaptcha",size:"normal"},propDescriptors:[{name:"provider",type:"select",label:"Provider",options:[{label:"reCAPTCHA v2",value:"recaptcha"},{label:"reCAPTCHA v3",value:"recaptcha-v3"},{label:"hCaptcha",value:"hcaptcha"},{label:"Turnstile",value:"turnstile"}],defaultValue:"recaptcha"},{name:"siteKey",type:"string",label:"Site key"},{name:"size",type:"select",label:"Size",options:[{label:"Normal",value:"normal"},{label:"Compact",value:"compact"},{label:"Invisible",value:"invisible"}],defaultValue:"normal"},{name:"theme",type:"select",label:"Theme",options:[{label:"Light",value:"light"},{label:"Dark",value:"dark"}],defaultValue:"light"}]},{type:"Nice2FASetup",label:"2FA Setup",category:"Auth",icon:"key",defaultProps:{method:"totp"},propDescriptors:[{name:"method",type:"select",label:"2FA method",options:[{label:"TOTP (Authenticator)",value:"totp"},{label:"SMS",value:"sms"},{label:"Email",value:"email"}],defaultValue:"totp"},{name:"issuer",type:"string",label:"Issuer name",defaultValue:"OmniVerk"},{name:"showBackupCodes",type:"boolean",label:"Show backup codes",defaultValue:!0},{name:"showQR",type:"boolean",label:"Show QR code",defaultValue:!0},{name:"codeLength",type:"number",label:"Code length",min:4,max:8,defaultValue:6}]}],ge=[{type:"NiceComments",label:"Comments",category:"Social",icon:"message-circle",defaultProps:{threadId:"",allowReplies:!0},propDescriptors:[{name:"threadId",type:"string",label:"Thread ID / entity ID"},{name:"allowReplies",type:"boolean",label:"Allow replies (nested)",defaultValue:!0},{name:"maxDepth",type:"number",label:"Max nesting depth",min:1,max:10,defaultValue:3},{name:"sortOrder",type:"select",label:"Default sort",options:[{label:"Newest first",value:"newest"},{label:"Oldest first",value:"oldest"},{label:"Most liked",value:"popular"}],defaultValue:"newest"},{name:"allowReactions",type:"boolean",label:"Allow reactions",defaultValue:!0},{name:"showAvatar",type:"boolean",label:"Show avatars",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceRatings",label:"Ratings",category:"Social",icon:"star",defaultProps:{maxStars:5,allowHalf:!0},propDescriptors:[{name:"value",type:"number",label:"Current rating",min:0,max:10,step:.5,defaultValue:0},{name:"maxStars",type:"number",label:"Maximum stars",min:3,max:10,defaultValue:5},{name:"allowHalf",type:"boolean",label:"Allow half stars",defaultValue:!0},{name:"showCount",type:"boolean",label:"Show vote count",defaultValue:!0},{name:"showAverage",type:"boolean",label:"Show average",defaultValue:!0},{name:"color",type:"color",label:"Star color",defaultValue:"#ffc107"},{name:"size",type:"size",label:"Star size",group:"Layout"},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceWiki",label:"Wiki Editor",category:"Social",icon:"book",defaultProps:{content:"",showTOC:!0},propDescriptors:[{name:"content",type:"string",label:"Initial content (Markdown)"},{name:"showTOC",type:"boolean",label:"Show table of contents",defaultValue:!0},{name:"showHistory",type:"boolean",label:"Show version history",defaultValue:!0},{name:"allowEdit",type:"boolean",label:"Allow editing",defaultValue:!0},{name:"showToolbar",type:"boolean",label:"Show Markdown toolbar",defaultValue:!0},{name:"previewMode",type:"select",label:"Preview mode",options:[{label:"Side by side",value:"split"},{label:"Tab switch",value:"tabs"},{label:"Live preview",value:"live"}],defaultValue:"split"},{name:"maxLength",type:"number",label:"Max content length",min:0,defaultValue:0}]}],Ge=[...he,...pe,...fe,...me,...ye,...be,...ge];async function qe(u,e){const t=await fetch(u,{...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}});if(!t.ok){const n=await t.text();let a={};try{a=JSON.parse(n)}catch{}throw{code:a.code||`HTTP_${t.status}`,message:a.message||t.statusText,statusCode:t.status}}return t.json()}function Ke(u){const{baseUrl:e,currency:t="PLN",timeout:n=3e4,fetcher:a=qe,getAuthToken:l,onError:o}=u,[i,d]=r.useState([]),[g,S]=r.useState(null),[w,T]=r.useState(null),[A,W]=r.useState(null),[D,Q]=r.useState(null),[G,_]=r.useState(null),[N,q]=r.useState([]),[O,Z]=r.useState([]),[ee,z]=r.useState(null),[$,X]=r.useState({offers:!1,calculate:!1,compare:!1,apply:!1,creditCheck:!1,refinancing:!1,consolidation:!1,savedCalculations:!1}),R=r.useRef(new Map),B=r.useCallback(()=>{const s={"Content-Type":"application/json"},b=l==null?void 0:l();return b&&(s.Authorization=`Bearer ${b}`),s},[l]),p=r.useCallback(async(s,b={},I)=>{const Y=R.current.get(s);Y&&Y.abort();const c=new AbortController;R.current.set(s,c);const m=setTimeout(()=>c.abort(),n);X(h=>({...h,[I]:!0})),z(null);try{const h=`${e}${s}`;return await a(h,{...b,headers:{...B(),...b.headers},signal:c.signal})}catch(h){const V={code:h.code||"UNKNOWN_ERROR",message:h.message||"An unknown error occurred",details:h.details,endpoint:s,statusCode:h.statusCode};throw h.name!=="AbortError"&&(z(V),o==null||o(V)),V}finally{clearTimeout(m),R.current.delete(s),X(h=>({...h,[I]:!1}))}},[e,n,a,B,o]),se=r.useCallback(async s=>{var m,h;const b=new URLSearchParams;s!=null&&s.loanType&&b.set("loanType",s.loanType),s!=null&&s.minAmount&&b.set("minAmount",String(s.minAmount)),s!=null&&s.maxAmount&&b.set("maxAmount",String(s.maxAmount)),s!=null&&s.minTerm&&b.set("minTerm",String(s.minTerm)),s!=null&&s.maxTerm&&b.set("maxTerm",String(s.maxTerm)),s!=null&&s.maxApr&&b.set("maxApr",String(s.maxApr)),(m=s==null?void 0:s.banks)!=null&&m.length&&b.set("banks",s.banks.join(",")),(h=s==null?void 0:s.features)!=null&&h.length&&b.set("features",s.features.join(",")),b.set("currency",(s==null?void 0:s.currency)||t);const I=b.toString(),Y=`/offers${I?`?${I}`:""}`,c=await p(Y,{method:"GET"},"offers");return d(c),c},[p,t]),j=r.useCallback(s=>{S(s)},[]),U=r.useCallback(async s=>p(`/offers/${s}`,{method:"GET"},"offers"),[p]),te=r.useCallback(async s=>{const b=await p("/calculate/amortization",{method:"POST",body:JSON.stringify({...s,currency:s.currency||t})},"calculate");return T(b),b},[p,t]),ne=r.useCallback(async s=>{const b=await p("/calculate/compare",{method:"POST",body:JSON.stringify({scenarios:s,currency:t})},"compare");return W(b),b},[p,t]),y=r.useCallback(async(s,b,I)=>{const Y=await p("/credit/analyze",{method:"POST",body:JSON.stringify({monthlyIncome:s,monthlyDebts:b,requestedAmount:I,currency:t})},"creditCheck");return _(Y),Y},[p,t]),v=r.useCallback(async s=>{const b=await p("/applications",{method:"POST",body:JSON.stringify(s)},"apply");return Q(b),b},[p]),P=r.useCallback(async s=>{const b=await p(`/applications/${s}`,{method:"GET"},"apply");return Q(b),b},[p]),E=r.useCallback(async s=>{await p(`/applications/${s}/cancel`,{method:"POST"},"apply"),Q(null)},[p]),k=r.useCallback(async(s,b,I,Y)=>{const c=await p("/calculations",{method:"POST",body:JSON.stringify({name:s,config:b,result:I,notes:Y})},"savedCalculations");return q(m=>[...m,c]),c},[p]),M=r.useCallback(async s=>p(`/calculations/${s}`,{method:"GET"},"savedCalculations"),[p]),x=r.useCallback(async s=>{await p(`/calculations/${s}`,{method:"DELETE"},"savedCalculations"),q(b=>b.filter(I=>I.id!==s))},[p]),K=r.useCallback(async()=>{const s=await p("/calculations",{method:"GET"},"savedCalculations");return q(s),s},[p]),ae=r.useCallback(async(s,b)=>p("/refinancing/analyze",{method:"POST",body:JSON.stringify({currentLoanId:s,newOfferIds:b})},"refinancing"),[p]),re=r.useCallback(async(s,b)=>p("/consolidation/simulate",{method:"POST",body:JSON.stringify({debts:s,targetRate:b,currency:t})},"consolidation"),[p,t]),oe=r.useCallback(async()=>{const s=await p("/active",{method:"GET"},"offers");return Z(s),s},[p]),f=r.useCallback(()=>{z(null)},[]),C=r.useCallback(()=>{d([]),S(null),T(null),W(null),Q(null),_(null),q([]),Z([]),z(null),X({offers:!1,calculate:!1,compare:!1,apply:!1,creditCheck:!1,refinancing:!1,consolidation:!1,savedCalculations:!1})},[]);return r.useEffect(()=>()=>{R.current.forEach(s=>s.abort()),R.current.clear()},[]),{offers:i,selectedOffer:g,latestCalculation:w,latestComparison:A,applicationState:D,creditAnalysis:G,savedCalculations:N,activeLoans:O,loading:$,error:ee,fetchOffers:se,selectOffer:j,getOfferDetails:U,calculateAmortization:te,compareLoanScenarios:ne,runCreditAnalysis:y,submitApplication:v,getApplicationStatus:P,cancelApplication:E,saveCalculation:k,loadCalculation:M,deleteSavedCalculation:x,fetchSavedCalculations:K,analyzeRefinancing:ae,simulateConsolidation:re,fetchActiveLoans:oe,clearError:f,reset:C}}class He{constructor(e){this.baseUrl=e.baseUrl,this.currency=e.currency||"PLN",this.timeout=e.timeout||3e4,this.getAuthToken=e.getAuthToken}async request(e,t={}){var i;const n=new AbortController,a=setTimeout(()=>n.abort(),this.timeout),l={"Content-Type":"application/json"},o=(i=this.getAuthToken)==null?void 0:i.call(this);o&&(l.Authorization=`Bearer ${o}`);try{const d=await fetch(`${this.baseUrl}${e}`,{...t,headers:{...l,...t.headers},signal:n.signal});if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);return d.json()}finally{clearTimeout(a)}}async getOffers(e){const t=new URLSearchParams;e!=null&&e.loanType&&t.set("loanType",e.loanType),e!=null&&e.minAmount&&t.set("minAmount",String(e.minAmount)),e!=null&&e.maxAmount&&t.set("maxAmount",String(e.maxAmount)),t.set("currency",(e==null?void 0:e.currency)||this.currency);const n=t.toString();return this.request(`/offers${n?`?${n}`:""}`)}async getOfferById(e){return this.request(`/offers/${e}`)}async calculateAmortization(e){return this.request("/calculate/amortization",{method:"POST",body:JSON.stringify({...e,currency:e.currency||this.currency})})}async compareScenarios(e){return this.request("/calculate/compare",{method:"POST",body:JSON.stringify({scenarios:e,currency:this.currency})})}async submitApplication(e){return this.request("/applications",{method:"POST",body:JSON.stringify(e)})}async getApplicationStatus(e){return this.request(`/applications/${e}`)}async analyzeRefinancing(e,t){return this.request("/refinancing/analyze",{method:"POST",body:JSON.stringify({currentLoanId:e,newOfferIds:t})})}async simulateConsolidation(e,t){return this.request("/consolidation/simulate",{method:"POST",body:JSON.stringify({debts:e,targetRate:t,currency:this.currency})})}async getActiveLoans(){return this.request("/active")}}exports.ErpAuthAdapter=Ne;exports.ErpDataAdapter=Pe;exports.ErpExportAdapter=Fe;exports.ErpFileAdapter=Ue;exports.ErpOfflineQueue=Je;exports.ErpOptimisticStore=je;exports.ErpRateLimiter=ze;exports.LoanService=He;exports.allControlRegistries=Ge;exports.applyBatchChanges=Oe;exports.audioControlRegistry=he;exports.authControlRegistry=be;exports.businessControlRegistry=ye;exports.createMiddlewarePipeline=Me;exports.createSignalRAdapter=Ve;exports.createSignalRDataOperations=Ae;exports.formatPresenceStatus=Re;exports.gamificationControlRegistry=me;exports.generateUserColor=de;exports.graphicControlRegistry=pe;exports.headerMiddleware=Be;exports.loggingMiddleware=Ie;exports.retryMiddleware=$e;exports.socialControlRegistry=ge;exports.threeControlRegistry=fe;exports.useCollaborativeDataGrid=De;exports.useEntityPresence=ce;exports.useLoanApi=Ke;exports.useMultiEntityPresence=xe;exports.useSignalRLiveData=ue;
1
+ "use strict";var we=Object.create;var ie=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var Ee=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ke(e))!Ce.call(i,a)&&a!==t&&ie(i,a,{get:()=>e[a],enumerable:!(n=Se(e,a))||n.enumerable});return i};var Te=(i,e,t)=>(t=i!=null?we(ve(i)):{},Ee(e||!i||!i.__esModule?ie(t,"default",{value:i,enumerable:!0}):t,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react");class Pe{constructor(e){this.cfg=typeof e=="string"?{baseUrl:e}:e}async request(e,t){const n=this.cfg.fetch??globalThis.fetch,a={"Content-Type":"application/json",...this.cfg.headers};if(this.cfg.tokenFactory){const l=await this.cfg.tokenFactory();a.Authorization=`Bearer ${l}`}const o=await n(`${this.cfg.baseUrl}${e}`,{...t,headers:{...a,...t==null?void 0:t.headers}});if(!o.ok)throw new Error(`ERP request failed: ${o.status} ${o.statusText}`);return o.json()}async load(e){var a,o;const t=new URLSearchParams;(e==null?void 0:e.skip)!=null&&t.set("skip",String(e.skip)),(e==null?void 0:e.take)!=null&&t.set("take",String(e.take)),e!=null&&e.search&&t.set("search",e.search),(a=e==null?void 0:e.sort)!=null&&a.length&&t.set("sort",JSON.stringify(e.sort)),(o=e==null?void 0:e.filters)!=null&&o.length&&t.set("filters",JSON.stringify(e.filters));const n=t.toString();return this.request(n?`?${n}`:"")}async getById(e){return this.request(`/${e}`)}async create(e){return this.request("",{method:"POST",body:JSON.stringify(e)})}async update(e,t){return this.request(`/${e}`,{method:"PUT",body:JSON.stringify(t)})}async remove(e){return this.request(`/${e}`,{method:"DELETE"})}async removeBatch(e){return this.request("/batch-delete",{method:"POST",body:JSON.stringify({ids:e})})}async createBatch(e){return this.request("/batch",{method:"POST",body:JSON.stringify({items:e})})}async updateBatch(e){return this.request("/batch",{method:"PUT",body:JSON.stringify({items:e})})}async patch(e,t){return this.request(`/${e}`,{method:"PATCH",body:JSON.stringify(t)})}}async function Ve(i){const e=await import("@microsoft/signalr");let t="disconnected";const n=new Set,a=d=>{t=d,n.forEach(g=>g(d))},l=new e.HubConnectionBuilder().withUrl(i.hubUrl,{accessTokenFactory:i.accessTokenFactory?()=>i.accessTokenFactory():void 0}).withAutomaticReconnect().build();return l.onreconnecting(()=>a("reconnecting")),l.onreconnected(()=>a("connected")),l.onclose(()=>a("disconnected")),{get status(){return t},async start(){a("connecting"),await l.start(),a("connected")},async stop(){await l.stop(),a("disconnected")},on(d,g){l.on(d,g)},off(d,g){l.off(d,g)},invoke(d,...g){return l.invoke(d,...g)},onStatusChange(d){return n.add(d),()=>n.delete(d)}}}function ue(i){const{adapter:e,entityName:t,keyField:n,initialData:a=[],onBeforeChange:o,onAfterChange:l,onConflict:c,subscribeMethod:d="SubscribeToEntity",unsubscribeMethod:g="UnsubscribeFromEntity",changeEventName:S="EntityChanged",flashChanges:w=!0,flashDuration:T=500,optimisticUpdates:A=!0}=i,[W,D]=r.useState(a),[Q,G]=r.useState(e.status),[_,N]=r.useState(new Set),[q,O]=r.useState(new Set),[Z,ee]=r.useState(null),z=r.useRef(new Map),$=r.useRef(new Map),X=r.useCallback((y,v)=>{const{operation:P,key:E,data:k,changes:M}=v;switch(P){case"insert":return!k||y.some(x=>x[n]===E)?y:[...y,k];case"update":return y.map(x=>{if(x[n]!==E)return x;const K=z.current.get(E);if(K&&c){const ae=c({...x,...K.changes},k??{...x,...M},v);return ae==="local"?{...x,...K.changes}:ae==="remote"?(z.current.delete(E),k??{...x,...M}):ae==="merge"?{...x,...M,...K.changes}:ae}return k||{...x,...M}});case"delete":return y.filter(x=>x[n]!==E);default:return y}},[n,c]),R=r.useCallback(y=>{if(!w)return;const v=$.current.get(y);v&&clearTimeout(v),N(E=>new Set([...E,y]));const P=setTimeout(()=>{N(E=>{const k=new Set(E);return k.delete(y),k}),$.current.delete(y)},T);$.current.set(y,P)},[w,T]),B=r.useCallback(async y=>{y.entityName===t&&(o&&!await o(y)||(D(v=>{const P=X(v,y);return l==null||l(y,P),P}),R(y.key)))},[t,o,X,l,R]),p=r.useCallback(y=>{B(y)},[B]),se=r.useCallback((y,v)=>{if(!A)return;const P=W.find(E=>E[n]===y);P&&(z.current.set(y,{original:P,changes:v}),O(E=>new Set([...E,y])))},[W,n,A]),j=r.useCallback(y=>{z.current.delete(y),O(v=>{const P=new Set(v);return P.delete(y),P})},[]),U=r.useCallback(y=>{const v=z.current.get(y);v&&(D(P=>P.map(E=>E[n]===y?v.original:E)),z.current.delete(y),O(P=>{const E=new Set(P);return E.delete(y),E}))},[n]),te=r.useCallback(async()=>{if(e.status==="connected")try{await e.invoke(d,t),ee(null)}catch(y){ee(y instanceof Error?y:new Error(String(y)))}},[e,d,t]),ne=r.useCallback(async()=>{if(e.status==="connected")try{await e.invoke(g,t)}catch{}},[e,g,t]);return r.useEffect(()=>{const y=e.onStatusChange(v=>{G(v),v==="connected"&&te()});return e.on(S,B),e.status==="connected"&&te(),()=>{y(),e.off(S,B),ne(),$.current.forEach(v=>clearTimeout(v)),$.current.clear()}},[e,S,B,te,ne]),r.useEffect(()=>{D(a)},[a]),{data:W,status:Q,flashedKeys:_,pendingKeys:q,error:Z,applyRemoteUpdate:p,registerPendingChange:se,confirmPendingChange:j,rollbackPendingChange:U,resubscribe:te}}function Ae(i){const{adapter:e,entityName:t,keyField:n,fetchMethod:a="GetEntities",insertMethod:o="InsertEntity",updateMethod:l="UpdateEntity",deleteMethod:c="DeleteEntity"}=i;return{async fetchAll(d){return e.invoke(a,t,d)},async insert(d){return e.invoke(o,t,d)},async update(d,g){return e.invoke(l,t,d,g)},async remove(d){return e.invoke(c,t,d)},getKeyField(){return n}}}function Oe(i,e,t){const n=new Map(i.map(a=>[a[t],a]));for(const a of e)switch(a.operation){case"insert":a.data&&!n.has(a.key)&&n.set(a.key,a.data);break;case"update":if(n.has(a.key)){const o=n.get(a.key);n.set(a.key,a.data??{...o,...a.changes})}break;case"delete":n.delete(a.key);break}return Array.from(n.values())}function ce(i){const{adapter:e,entityType:t,entityId:n,currentUser:a,initialStatus:o="viewing",heartbeatInterval:l=3e4,idleTimeout:c=6e4,awayTimeout:d=3e5,joinMethod:g="JoinEntityView",leaveMethod:S="LeaveEntityView",updateMethod:w="UpdateEntityPresence",presenceEventName:T="EntityPresenceChanged",joinedEventName:A="EntityUserJoined",leftEventName:W="EntityUserLeft",onPresenceChange:D,onEditConflict:Q}=i,[G,_]=r.useState([]),[N,q]=r.useState(o),[O,Z]=r.useState(),[ee,z]=r.useState(e.status),$=r.useRef(Date.now()),X=r.useRef(null),R=r.useRef(null),B=r.useRef(null),p=Array.isArray(n)?n:[n],se=`${t}:${p.sort().join(",")}`,j=r.useCallback(async(f,C,s)=>{if(e.status==="connected")try{await e.invoke(w,{entityType:t,entityIds:p,userId:a.id,status:f,editingField:C,selection:s,timestamp:new Date().toISOString()})}catch{}},[e,w,t,p,a.id]),U=r.useCallback((f,C)=>{q(f),Z(C),j(f,C),$.current=Date.now()},[j]),te=r.useCallback(f=>{const C=G.find(s=>s.user.id!==a.id&&s.status==="editing"&&s.editingField===f);C&&(Q==null||Q(C.user,f)),U("editing",f)},[G,a.id,Q,U]),ne=r.useCallback(()=>{U("viewing",void 0)},[U]),y=r.useCallback(f=>{j(N,O,f),$.current=Date.now()},[j,N,O]),v=r.useCallback(f=>{const C=G.find(s=>s.user.id!==a.id&&s.status==="editing"&&s.editingField===f);return(C==null?void 0:C.user)??null},[G,a.id]),P=r.useCallback(f=>{const C=G.find(s=>s.status==="editing"&&s.editingField===f);return(C==null?void 0:C.user)??null},[G]),E=r.useCallback(async()=>{if(e.status==="connected")try{const f=await e.invoke("GetEntityPresence",t,p);Array.isArray(f)&&(_(f),D==null||D(f))}catch{}},[e,t,p,D]),k=r.useCallback(()=>{$.current=Date.now(),R.current&&clearTimeout(R.current),B.current&&clearTimeout(B.current),(N==="idle"||N==="away")&&U(O?"editing":"viewing",O),R.current=setTimeout(()=>{U("idle",O)},c),B.current=setTimeout(()=>{U("away",O)},d)},[N,O,c,d,U]),M=r.useCallback(f=>{f.entityType!==t||!f.entityIds.some(s=>p.includes(s))||(_(f.presence.filter(s=>s.user.id!==a.id)),D==null||D(f.presence))},[t,p,a.id,D]),x=r.useCallback(f=>{f.entityType!==t||!f.entityIds.some(s=>p.includes(s))||f.presence.user.id===a.id||_(s=>{const b=s.findIndex(I=>I.user.id===f.presence.user.id);if(b>=0){const I=[...s];return I[b]=f.presence,I}return[...s,f.presence]})},[t,p,a.id]),K=r.useCallback(f=>{f.entityType!==t||!f.entityIds.some(s=>p.includes(s))||_(s=>s.filter(b=>b.user.id!==f.userId))},[t,p]);r.useEffect(()=>{const f=e.onStatusChange(z);e.on(T,M),e.on(A,x),e.on(W,K);const C=async()=>{if(e.status==="connected")try{await e.invoke(g,{entityType:t,entityIds:p,user:a,status:N}),await E()}catch{}};return e.status==="connected"&&C(),()=>{f(),e.off(T,M),e.off(A,x),e.off(W,K),e.status==="connected"&&e.invoke(S,{entityType:t,entityIds:p,userId:a.id}).catch(()=>{})}},[e,se,g,S,T,A,W,M,x,K,E,a,N,t,p]),r.useEffect(()=>(X.current=setInterval(()=>{j(N,O)},l),()=>{X.current&&clearInterval(X.current)}),[l,j,N,O]),r.useEffect(()=>{const f=["mousemove","keydown","mousedown","touchstart","scroll"];return f.forEach(C=>window.addEventListener(C,k,{passive:!0})),R.current=setTimeout(()=>{U("idle",O)},c),B.current=setTimeout(()=>{U("away",O)},d),()=>{f.forEach(C=>window.removeEventListener(C,k)),R.current&&clearTimeout(R.current),B.current&&clearTimeout(B.current)}},[k,c,d,O,U]);const ae=G.filter(f=>f.status==="viewing"||f.status==="idle").map(f=>f.user),re=G.filter(f=>f.status==="editing").map(f=>f.user),oe=re.length>0;return{presence:G,viewers:ae,editors:re,myStatus:N,setMyStatus:U,startEditing:te,stopEditing:ne,updateSelection:y,connectionStatus:ee,isFieldLocked:v,hasActiveEditors:oe,getFieldEditor:P,refresh:E}}function de(i){const e=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#84cc16","#f97316","#14b8a6"];let t=0;for(let n=0;n<i.length;n++)t=i.charCodeAt(n)+((t<<5)-t);return e[Math.abs(t)%e.length]}function Re(i){switch(i){case"viewing":return"Viewing";case"editing":return"Editing";case"idle":return"Idle";case"away":return"Away";default:return"Unknown"}}function xe(i){const{adapter:e,entityType:t,currentUser:n,batchEventName:a="BatchPresenceUpdate"}=i,[o,l]=r.useState(new Map),c=r.useCallback(w=>{w.entityType===t&&l(new Map(Object.entries(w.presenceByEntity)))},[t]);r.useEffect(()=>(e.on(a,c),()=>{e.off(a,c)}),[e,a,c]);const d=r.useCallback(w=>o.get(w)??[],[o]),g=r.useCallback(w=>{const T=o.get(w);return(T==null?void 0:T.some(A=>A.status==="editing"&&A.user.id!==n.id))??!1},[o,n.id]),S=r.useCallback(w=>{const T=o.get(w);return(T==null?void 0:T.filter(A=>A.status==="editing").map(A=>A.user))??[]},[o]);return{presenceByEntity:o,getPresence:d,isEntityBeingEdited:g,getEntityEditors:S}}function J(i){return`${String(i.rowKey)}:${i.field}`}function Le(i){return i?typeof i=="number"?i:new Date(i).getTime():Date.now()}function De(i){const{adapter:e,entityType:t,keyField:n,currentUser:a,initialData:o=[],conflictStrategy:l="last-write-wins",mergeFunction:c,onConflict:d,onBeforeCommit:g,onAfterCommit:S,enableCellLocking:w=!0,lockTimeout:T=6e4,enableCursorSharing:A=!0,cursorDebounce:W=50,optimisticUpdates:D=!0,flashChanges:Q=!0,flashDuration:G=500,liveDataOptions:_={}}=i,[N,q]=r.useState(new Map),[O,Z]=r.useState(new Map),[ee,z]=r.useState([]),[$,X]=r.useState(null),[R,B]=r.useState([]),[p,se]=r.useState([]),[j,U]=r.useState(null),[te,ne]=r.useState([]),y=r.useRef(null),v=r.useRef(new Map),P=r.useCallback(u=>(v.current.has(u)||v.current.set(u,de(u)),v.current.get(u)),[]),E=r.useCallback((u,m,h)=>{if(!h.changes)return m;const V=O.get(J({rowKey:h.key,field:Object.keys(h.changes)[0]}));if(!V)return m;const F=V.timestamp,L=Le(h.timestamp);switch(l){case"last-write-wins":return F>L?"local":"remote";case"first-write-wins":return F<L?"local":"remote";case"merge":return c?c(u,m,Object.keys(h.changes)[0]):"merge";case"ask-user":const H={cell:{rowKey:h.key,field:Object.keys(h.changes)[0]},localValue:V.newValue,remoteValue:h.changes[Object.keys(h.changes)[0]],localUser:a,remoteUser:h.changedBy?{id:h.changedBy,name:h.changedBy}:{id:"unknown",name:"Unknown"},localTimestamp:F,remoteTimestamp:L};return z(le=>[...le,H]),"local";case"reject":return"remote";default:return"remote"}},[O,l,c,a]),k=ue({adapter:e,entityName:t,keyField:n,initialData:o,flashChanges:Q,flashDuration:G,optimisticUpdates:D,onConflict:E,..._}),M=ce({adapter:e,entityType:t,entityId:"grid",currentUser:a,initialStatus:"viewing"}),x=r.useCallback(()=>{!A||e.status!=="connected"||e.invoke("UpdateGridSelection",{entityType:t,userId:a.id,focusedCell:$,selectedCells:R,selectedRows:p,editingCell:j}).catch(()=>{})},[e,A,t,a.id,$,R,p,j]);r.useEffect(()=>{if(A)return y.current&&clearTimeout(y.current),y.current=setTimeout(x,W),()=>{y.current&&clearTimeout(y.current)}},[A,x,W,$,R,p,j]),r.useEffect(()=>{if(!A)return;const u=m=>{m.entityType!==t||m.userId===a.id||ne(h=>{const V=h.findIndex(L=>L.user.id===m.userId),F={user:{id:m.userId,name:m.userName,avatarUrl:m.avatarUrl},focusedCell:m.focusedCell,selectedCells:m.selectedCells,selectedRows:m.selectedRows,editingCell:m.editingCell,color:P(m.userId)};if(V>=0){const L=[...h];return L[V]=F,L}return[...h,F]})};return e.on("GridSelectionUpdated",u),()=>{e.off("GridSelectionUpdated",u)}},[e,A,t,a.id,P]),r.useEffect(()=>{if(!w)return;const u=h=>{h.entityType===t&&q(V=>{const F=new Map(V);return F.set(J(h.cell),{user:h.user,timestamp:h.timestamp}),F})},m=h=>{h.entityType===t&&q(V=>{const F=new Map(V);return F.delete(J(h.cell)),F})};return e.on("CellLocked",u),e.on("CellUnlocked",m),()=>{e.off("CellLocked",u),e.off("CellUnlocked",m)}},[e,w,t]),r.useEffect(()=>{if(!w)return;const u=setInterval(()=>{const m=Date.now();q(h=>{const V=new Map(h);let F=!1;for(const[L,H]of V)m-H.timestamp>T&&(V.delete(L),F=!0);return F?V:h})},1e4);return()=>clearInterval(u)},[w,T]);const K=r.useCallback(u=>{if(!w)return!1;const m=N.get(J(u));return m?m.user.id!==a.id&&Date.now()-m.timestamp<T:!1},[w,N,a.id,T]),ae=r.useCallback(u=>{const m=N.get(J(u));return!m||Date.now()-m.timestamp>T?null:m.user},[N,T]),re=r.useCallback(u=>K(u)?!1:(U(u),M.startEditing(`${u.rowKey}:${u.field}`),w&&e.status==="connected"&&(e.invoke("AcquireCellLock",{entityType:t,cell:u,user:a,timestamp:Date.now()}).catch(()=>{}),q(m=>{const h=new Map(m);return h.set(J(u),{user:a,timestamp:Date.now()}),h})),!0),[K,M,w,e,t,a]),oe=r.useCallback(async(u,m)=>{const h=k.data.find(L=>L[n]===u.rowKey);if(!h)return!1;const V=h[u.field];if(g&&!await g(u,V,m))return f(u),!1;const F={cell:u,originalValue:V,newValue:m,timestamp:Date.now()};Z(L=>{const H=new Map(L);return H.set(J(u),F),H}),D&&k.registerPendingChange(u.rowKey,{[u.field]:m});try{return await e.invoke("UpdateEntityField",{entityType:t,entityId:u.rowKey,field:u.field,value:m,userId:a.id,timestamp:F.timestamp}),k.confirmPendingChange(u.rowKey),Z(L=>{const H=new Map(L);return H.delete(J(u)),H}),S==null||S(u,m),w&&(e.invoke("ReleaseCellLock",{entityType:t,cell:u}).catch(()=>{}),q(L=>{const H=new Map(L);return H.delete(J(u)),H})),U(null),M.stopEditing(),!0}catch(L){throw k.rollbackPendingChange(u.rowKey),Z(H=>{const le=new Map(H);return le.delete(J(u)),le}),L}},[k,n,g,D,e,t,a.id,S,w,M]),f=r.useCallback(u=>{U(null),M.stopEditing(),w&&e.status==="connected"&&(e.invoke("ReleaseCellLock",{entityType:t,cell:u}).catch(()=>{}),q(m=>{const h=new Map(m);return h.delete(J(u)),h})),Z(m=>{const h=new Map(m);return h.delete(J(u)),h})},[M,w,e,t]),C=r.useCallback((u,m)=>{const h=ee.find(V=>J(V.cell)===J(u));h&&(m==="remote"&&k.applyRemoteUpdate({operation:"update",entityName:t,key:u.rowKey,changes:{[u.field]:h.remoteValue}}),z(V=>V.filter(F=>J(F.cell)!==J(u))))},[ee,k,t]),s=r.useCallback(async u=>{await e.invoke("InsertEntity",t,u)},[e,t]),b=r.useCallback(async(u,m)=>{D&&k.registerPendingChange(u,m);try{await e.invoke("UpdateEntity",t,u,m),k.confirmPendingChange(u)}catch(h){throw k.rollbackPendingChange(u),h}},[e,t,D,k]),I=r.useCallback(async u=>{await e.invoke("DeleteEntity",t,u)},[e,t]),Y=r.useMemo(()=>({user:a,focusedCell:$,selectedCells:R,selectedRows:p,editingCell:j,color:P(a.id)}),[a,$,R,p,j,P]);return{data:k.data,presence:M.presence,userSelections:te,mySelection:Y,flashedKeys:k.flashedKeys,pendingEdits:O,connectionStatus:k.status,myPresenceStatus:M.myStatus,setFocusedCell:X,setSelectedCells:B,setSelectedRows:se,startCellEdit:re,commitCellEdit:oe,cancelCellEdit:f,isCellLocked:K,getCellEditor:ae,getUserColor:P,insertRow:s,updateRow:b,deleteRow:I,resolveConflict:C,conflicts:ee}}class Ne{constructor(e){this.accessToken=null,this.refreshToken=null,this.tokenFactory=async()=>{if(!this.accessToken)throw new Error("Not authenticated");return this.accessToken},this.cfg=e}getAccessToken(){return this.accessToken}async post(e,t){const a=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(`Auth request failed: ${a.status}`);return a.json()}async login(e){var n,a;const t=await this.post("/login",e);return t.token&&(this.accessToken=t.token,this.refreshToken=t.refreshToken??null,(a=(n=this.cfg).onTokens)==null||a.call(n,t.token,t.refreshToken??"")),t}async refresh(){var t,n;if(!this.refreshToken)throw new Error("No refresh token");const e=await this.post("/refresh",{refreshToken:this.refreshToken});return e.token&&(this.accessToken=e.token,this.refreshToken=e.refreshToken??this.refreshToken,(n=(t=this.cfg).onTokens)==null||n.call(t,e.token,this.refreshToken)),e}async me(){const t=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/me`,{headers:{Authorization:`Bearer ${this.accessToken}`}});if(!t.ok)throw new Error(`Auth /me failed: ${t.status}`);return t.json()}async logout(){try{await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/logout`,{method:"POST",headers:{Authorization:`Bearer ${this.accessToken}`}})}finally{this.accessToken=null,this.refreshToken=null}}}class Ue{constructor(e){this.cfg=e}async headers(){const e={};return this.cfg.tokenFactory&&(e.Authorization=`Bearer ${await this.cfg.tokenFactory()}`),e}async upload(e,t){const n=this.cfg.fetch??globalThis.fetch,a=new FormData;a.append("file",e),t&&a.append("folder",t);const o=await n(this.cfg.baseUrl,{method:"POST",headers:await this.headers(),body:a});if(!o.ok)throw new Error(`File upload failed: ${o.status}`);return o.json()}async uploadMultiple(e,t){const n=this.cfg.fetch??globalThis.fetch,a=new FormData;e.forEach(l=>a.append("files",l)),t&&a.append("folder",t);const o=await n(`${this.cfg.baseUrl}/batch`,{method:"POST",headers:await this.headers(),body:a});if(!o.ok)throw new Error(`Batch upload failed: ${o.status}`);return o.json()}async getInfo(e){const n=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/${e}/info`,{headers:{...await this.headers(),"Content-Type":"application/json"}});if(!n.ok)throw new Error(`File info failed: ${n.status}`);return n.json()}async getDownloadUrl(e){const n=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/${e}`,{headers:await this.headers()});if(!n.ok)throw new Error(`File download failed: ${n.status}`);const a=await n.blob();return URL.createObjectURL(a)}async remove(e){const n=await(this.cfg.fetch??globalThis.fetch)(`${this.cfg.baseUrl}/${e}`,{method:"DELETE",headers:{...await this.headers(),"Content-Type":"application/json"}});if(!n.ok)throw new Error(`File delete failed: ${n.status}`);return n.json()}async uploadWithProgress(e,t,n,a){if(typeof XMLHttpRequest>"u")return this.upload(e,n);const o=await this.headers();return new Promise((l,c)=>{const d=new XMLHttpRequest,g=new FormData;if(g.append("file",e),n&&g.append("folder",n),a){if(a.aborted){c(new DOMException("Aborted","AbortError"));return}a.addEventListener("abort",()=>{d.abort(),c(new DOMException("Aborted","AbortError"))})}d.upload.addEventListener("progress",S=>{t({loaded:S.loaded,total:S.total,percent:S.lengthComputable?S.loaded/S.total:NaN})}),d.addEventListener("load",()=>{if(d.status>=200&&d.status<300)try{l(JSON.parse(d.responseText))}catch{c(new Error("Invalid JSON response"))}else c(new Error(`File upload failed: ${d.status}`))}),d.addEventListener("error",()=>c(new Error("Network error during upload"))),d.addEventListener("abort",()=>c(new DOMException("Aborted","AbortError"))),d.open("POST",this.cfg.baseUrl),Object.entries(o).forEach(([S,w])=>d.setRequestHeader(S,w)),d.send(g)})}async uploadMultipleWithProgress(e,t,n,a){const o=[];for(let l=0;l<e.length;l++){if(a!=null&&a.aborted)throw new DOMException("Aborted","AbortError");const c=await this.uploadWithProgress(e[l],d=>t(l,d),n,a);o.push(c)}return o}}class Fe{constructor(e){this.cfg=e}async headers(){const e={"Content-Type":"application/json"};return this.cfg.tokenFactory&&(e.Authorization=`Bearer ${await this.cfg.tokenFactory()}`),e}async requestExport(e){const n=await(this.cfg.fetch??globalThis.fetch)(this.cfg.baseUrl,{method:"POST",headers:await this.headers(),body:JSON.stringify(e)});if(!n.ok)throw new Error(`Export request failed: ${n.status}`);return n.json()}async download(e){const n=await(this.cfg.fetch??globalThis.fetch)(e,{headers:await this.headers()});if(!n.ok)throw new Error(`Export download failed: ${n.status}`);return n.blob()}async downloadToFile(e,t){var c;const n=await this.requestExport(e);if(!((c=n.data)!=null&&c.downloadUrl))throw new Error("No download URL returned");const a=await this.download(n.data.downloadUrl),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=t??`export.${e.format}`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(o)}}function Me(i){return e=>{const t=e??globalThis.fetch;return(a,o)=>{const d={url:typeof a=="string"?a:a instanceof URL?a.toString():a.url,init:o??{},meta:{}};let g=S=>t(S.url,S.init);for(let S=i.length-1;S>=0;S--){const w=i[S],T=g;g=A=>w(A,T)}return g(d)}}}function Ie(){return async(i,e)=>{const t=performance.now(),n=(i.init.method??"GET").toUpperCase();try{const a=await e(i),o=(performance.now()-t).toFixed(1);return console.debug(`[ERP] ${n} ${i.url} → ${a.status} (${o}ms)`),a}catch(a){const o=(performance.now()-t).toFixed(1);throw console.error(`[ERP] ${n} ${i.url} FAILED (${o}ms)`,a),a}}}function $e(i){const e=(i==null?void 0:i.maxRetries)??3,t=(i==null?void 0:i.baseDelay)??500,n=new Set((i==null?void 0:i.retryOn)??[408,429,500,502,503,504]);return async(a,o)=>{let l;for(let c=0;c<=e;c++){try{const g=await o(a);if(g.ok||!n.has(g.status)||c===e)return g;l=new Error(`HTTP ${g.status}`)}catch(g){if(l=g,c===e)throw g}const d=t*Math.pow(2,c)*(.5+Math.random()*.5);await new Promise(g=>setTimeout(g,d))}throw l}}function Be(i){return async(e,t)=>{const n=typeof i=="function"?await i():i;return e.init.headers={...e.init.headers,...n},t(e)}}class ze{constructor(e){this.inFlight=0,this.timestamps=[],this.queue=[],this.processing=!1,this.backingOff=!1,this.maxConcurrent=(e==null?void 0:e.maxConcurrent)??6,this.maxPerSecond=(e==null?void 0:e.maxPerSecond)??20,this.backoffDelay=(e==null?void 0:e.backoffDelay)??2e3,this.baseFetch=(e==null?void 0:e.baseFetch)??globalThis.fetch.bind(globalThis),this.fetch=this.fetch.bind(this)}fetch(e,t){return new Promise((n,a)=>{this.queue.push({resolve:n,reject:a,input:e,init:t}),this.drain()})}get pending(){return this.queue.length}get active(){return this.inFlight}drain(){if(this.processing)return;this.processing=!0;const e=()=>{if(this.queue.length===0||this.backingOff){this.processing=!1;return}if(this.inFlight>=this.maxConcurrent){this.processing=!1;return}const t=Date.now();if(this.timestamps=this.timestamps.filter(a=>t-a<1e3),this.timestamps.length>=this.maxPerSecond){const a=this.timestamps[0],o=1e3-(t-a)+1;setTimeout(()=>{this.processing=!1,this.drain()},o);return}const n=this.queue.shift();this.inFlight++,this.timestamps.push(t),this.baseFetch(n.input,n.init).then(a=>{if(this.inFlight--,a.status===429){this.queue.unshift(n),this.inFlight++,this.inFlight--,this.backingOff=!0,setTimeout(()=>{this.backingOff=!1,this.drain()},this.backoffDelay);return}n.resolve(a),queueMicrotask(e)}).catch(a=>{this.inFlight--,n.reject(a),queueMicrotask(e)}),queueMicrotask(e)};e()}}class je{constructor(e,t="id"){this.items=[],this.mutations=[],this.listeners=new Set,this.nextMutationId=1,this.adapter=e,this.keyField=t}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){const e=[...this.items],t=[...this.mutations];this.listeners.forEach(n=>n(e,t))}getItems(){return[...this.items]}getPending(){return this.mutations.filter(e=>e.status==="pending")}setItems(e){this.items=[...e],this.notify()}async load(...e){const t=await this.adapter.load(...e);return t.success&&(this.items=t.data,this.mutations=[],this.notify()),t}async create(e){const t=`__temp_${this.nextMutationId}`,n={...e,[this.keyField]:t},o={id:String(this.nextMutationId++),type:"create",optimisticData:n,timestamp:Date.now(),status:"pending"};this.items=[...this.items,n],this.mutations.push(o),this.notify();try{const l=await this.adapter.create(e);return l.success?(this.items=this.items.map(c=>c[this.keyField]===t?l.data:c),o.status="confirmed",o.entityId=l.data[this.keyField]):(this.items=this.items.filter(c=>c[this.keyField]!==t),o.status="failed",o.error=l.error),this.notify(),l}catch(l){throw this.items=this.items.filter(c=>c[this.keyField]!==t),o.status="failed",o.error=l instanceof Error?l.message:String(l),this.notify(),l}}async update(e,t){const n=this.items.findIndex(c=>c[this.keyField]===e),a=n>=0?{...this.items[n]}:void 0,l={id:String(this.nextMutationId++),type:"update",entityId:e,previousData:a,timestamp:Date.now(),status:"pending"};n>=0&&(this.items=this.items.map((c,d)=>d===n?{...c,...t}:c)),this.mutations.push(l),this.notify();try{const c=await this.adapter.update(e,t);return c.success?(this.items=this.items.map(d=>d[this.keyField]===e?c.data:d),l.status="confirmed"):(a&&n>=0&&(this.items=this.items.map(d=>d[this.keyField]===e?a:d)),l.status="failed",l.error=c.error),this.notify(),c}catch(c){throw a&&n>=0&&(this.items=this.items.map(d=>d[this.keyField]===e?a:d)),l.status="failed",l.error=c instanceof Error?c.message:String(c),this.notify(),c}}async remove(e){const t=this.items.findIndex(l=>l[this.keyField]===e),n=t>=0?{...this.items[t]}:void 0,o={id:String(this.nextMutationId++),type:"delete",entityId:e,previousData:n,timestamp:Date.now(),status:"pending"};this.items=this.items.filter(l=>l[this.keyField]!==e),this.mutations.push(o),this.notify();try{const l=await this.adapter.remove(e);return l.success?o.status="confirmed":(n&&this.items.splice(t,0,n),o.status="failed",o.error=l.error),this.notify(),l}catch(l){throw n&&this.items.splice(t,0,n),o.status="failed",o.error=l instanceof Error?l.message:String(l),this.notify(),l}}}class Je{constructor(e){this.queue=[],this.syncing=!1,this.nextId=1,this.config=e??{},this.baseFetch=(e==null?void 0:e.baseFetch)??globalThis.fetch.bind(globalThis),this.storageKey=(e==null?void 0:e.storageKey)??"erp_offline_",this.fetch=this.fetch.bind(this),this.restoreQueue(),this.boundOnline=()=>{var t,n;(n=(t=this.config).onStatusChange)==null||n.call(t,!0),this.sync()},this.boundOffline=()=>{var t,n;(n=(t=this.config).onStatusChange)==null||n.call(t,!1)},typeof window<"u"&&(window.addEventListener("online",this.boundOnline),window.addEventListener("offline",this.boundOffline))}fetch(e,t){var l,c;const n=typeof e=="string"?e:e instanceof URL?e.toString():e.url,a=((t==null?void 0:t.method)??"GET").toUpperCase();if(this.isOnline())return this.baseFetch(e,t);if(a==="GET"||a==="HEAD")return Promise.reject(new Error("Offline: GET requests are not queued"));const o={id:`q_${this.nextId++}`,url:n,method:a,headers:{...t==null?void 0:t.headers},body:typeof(t==null?void 0:t.body)=="string"?t.body:void 0,timestamp:Date.now()};return this.queue.push(o),this.persistQueue(),(c=(l=this.config).onQueued)==null||c.call(l,o),Promise.resolve(new Response(JSON.stringify({queued:!0,queueId:o.id}),{status:202,headers:{"Content-Type":"application/json"}}))}isOnline(){return typeof navigator>"u"||navigator.onLine}get pendingCount(){return this.queue.length}getQueue(){return[...this.queue]}clear(){this.queue=[],this.persistQueue()}async sync(){var t,n;if(this.syncing||this.queue.length===0||!this.isOnline())return[];this.syncing=!0;const e=[];for(;this.queue.length>0&&this.isOnline();){const a=this.queue[0];try{const o=await this.baseFetch(a.url,{method:a.method,headers:a.headers,body:a.body});e.push({entry:a,success:o.ok,status:o.status,error:o.ok?void 0:`HTTP ${o.status}`}),this.queue.shift()}catch(o){e.push({entry:a,success:!1,error:o instanceof Error?o.message:String(o)});break}}return this.persistQueue(),this.syncing=!1,e.length>0&&((n=(t=this.config).onSync)==null||n.call(t,e)),e}destroy(){typeof window<"u"&&(window.removeEventListener("online",this.boundOnline),window.removeEventListener("offline",this.boundOffline))}persistQueue(){try{typeof localStorage<"u"&&localStorage.setItem(`${this.storageKey}queue`,JSON.stringify(this.queue))}catch{}}restoreQueue(){try{if(typeof localStorage<"u"){const e=localStorage.getItem(`${this.storageKey}queue`);e&&(this.queue=JSON.parse(e),this.nextId=this.queue.reduce((t,n)=>Math.max(t,parseInt(n.id.replace("q_",""),10)||0),0)+1)}}catch{this.queue=[]}}}const he=[{type:"NiceAudioPlayer",label:"Audio Player",category:"Audio",icon:"music",defaultProps:{src:"",autoplay:!1,showWaveform:!0},propDescriptors:[{name:"src",type:"string",label:"Audio source URL"},{name:"autoplay",type:"boolean",label:"Auto-play",defaultValue:!1},{name:"loop",type:"boolean",label:"Loop",defaultValue:!1},{name:"showWaveform",type:"boolean",label:"Show waveform",defaultValue:!0},{name:"showPlaylist",type:"boolean",label:"Show playlist",defaultValue:!1},{name:"visualizerMode",type:"select",label:"Visualizer mode",options:[{label:"None",value:"none"},{label:"Bars",value:"bars"},{label:"Wave",value:"wave"},{label:"Circle",value:"circle"}],defaultValue:"bars"},{name:"height",type:"size",label:"Height",group:"Layout"}]},{type:"NiceWaveform",label:"Waveform",category:"Audio",icon:"waveform",defaultProps:{peaks:[],color:"#4a90d9"},propDescriptors:[{name:"peaks",type:"json",label:"Peak data (JSON array)"},{name:"color",type:"color",label:"Waveform color",defaultValue:"#4a90d9"},{name:"progressColor",type:"color",label:"Progress color",defaultValue:"#1b5e20"},{name:"barWidth",type:"number",label:"Bar width (px)",min:1,max:10,step:1,defaultValue:2},{name:"height",type:"size",label:"Height",group:"Layout"},{name:"interactive",type:"boolean",label:"Allow seeking",defaultValue:!0}]},{type:"NicePianoRoll",label:"Piano Roll",category:"Audio",icon:"piano",defaultProps:{notes:[],octaves:4,startOctave:3},propDescriptors:[{name:"notes",type:"json",label:"MIDI notes (JSON)"},{name:"octaves",type:"number",label:"Visible octaves",min:1,max:8,defaultValue:4},{name:"startOctave",type:"number",label:"Start octave",min:0,max:8,defaultValue:3},{name:"quantize",type:"select",label:"Quantize",options:[{label:"1/4",value:"4"},{label:"1/8",value:"8"},{label:"1/16",value:"16"},{label:"1/32",value:"32"}],defaultValue:"16"},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1},{name:"height",type:"size",label:"Height",group:"Layout"}]},{type:"NiceKaraoke",label:"Karaoke",category:"Audio",icon:"microphone",defaultProps:{lyrics:[],audioSrc:""},propDescriptors:[{name:"audioSrc",type:"string",label:"Audio source URL"},{name:"lyrics",type:"json",label:"Lyrics (JSON array of {time, text})"},{name:"showScore",type:"boolean",label:"Show score",defaultValue:!0},{name:"pitchDetection",type:"boolean",label:"Pitch detection",defaultValue:!0},{name:"highlightColor",type:"color",label:"Highlight color",defaultValue:"#ffd700"},{name:"fontSize",type:"size",label:"Font size",group:"Typography"}]}],pe=[{type:"NiceLoginForm",label:"Login Form",category:"Auth",icon:"log-in",defaultProps:{showRemember:!0,showForgotPassword:!0},propDescriptors:[{name:"title",type:"string",label:"Form title",defaultValue:"Sign In"},{name:"showRemember",type:"boolean",label:"Show 'Remember me'",defaultValue:!0},{name:"showForgotPassword",type:"boolean",label:"Show 'Forgot password'",defaultValue:!0},{name:"showRegisterLink",type:"boolean",label:"Show register link",defaultValue:!1},{name:"showLogo",type:"boolean",label:"Show logo",defaultValue:!0},{name:"logoUrl",type:"string",label:"Logo URL",group:"Branding"},{name:"primaryColor",type:"color",label:"Primary color",defaultValue:"#1976d2",group:"Branding"},{name:"variant",type:"variant",label:"Visual style",defaultValue:"card"}]},{type:"NiceCaptcha",label:"Captcha",category:"Auth",icon:"shield",defaultProps:{provider:"recaptcha",size:"normal"},propDescriptors:[{name:"provider",type:"select",label:"Provider",options:[{label:"reCAPTCHA v2",value:"recaptcha"},{label:"reCAPTCHA v3",value:"recaptcha-v3"},{label:"hCaptcha",value:"hcaptcha"},{label:"Turnstile",value:"turnstile"}],defaultValue:"recaptcha"},{name:"siteKey",type:"string",label:"Site key"},{name:"size",type:"select",label:"Size",options:[{label:"Normal",value:"normal"},{label:"Compact",value:"compact"},{label:"Invisible",value:"invisible"}],defaultValue:"normal"},{name:"theme",type:"select",label:"Theme",options:[{label:"Light",value:"light"},{label:"Dark",value:"dark"}],defaultValue:"light"}]},{type:"Nice2FASetup",label:"2FA Setup",category:"Auth",icon:"key",defaultProps:{method:"totp"},propDescriptors:[{name:"method",type:"select",label:"2FA method",options:[{label:"TOTP (Authenticator)",value:"totp"},{label:"SMS",value:"sms"},{label:"Email",value:"email"}],defaultValue:"totp"},{name:"issuer",type:"string",label:"Issuer name",defaultValue:"OmniVerk"},{name:"showBackupCodes",type:"boolean",label:"Show backup codes",defaultValue:!0},{name:"showQR",type:"boolean",label:"Show QR code",defaultValue:!0},{name:"codeLength",type:"number",label:"Code length",min:4,max:8,defaultValue:6}]}],fe=[{type:"NiceAddress",label:"Address Editor",category:"Business",icon:"map-pin",defaultProps:{country:"PL"},propDescriptors:[{name:"street",type:"string",label:"Street",group:"Address"},{name:"city",type:"string",label:"City",group:"Address"},{name:"postalCode",type:"string",label:"Postal code",group:"Address"},{name:"country",type:"select",label:"Country",options:[{label:"Poland",value:"PL"},{label:"Germany",value:"DE"},{label:"USA",value:"US"},{label:"UK",value:"GB"},{label:"France",value:"FR"}],defaultValue:"PL",group:"Address"},{name:"showMap",type:"boolean",label:"Show map preview",defaultValue:!1},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NicePhone",label:"Phone Input",category:"Business",icon:"phone",defaultProps:{countryCode:"+48"},propDescriptors:[{name:"value",type:"string",label:"Phone number"},{name:"countryCode",type:"string",label:"Default country code",defaultValue:"+48"},{name:"showFlag",type:"boolean",label:"Show country flag",defaultValue:!0},{name:"format",type:"select",label:"Format",options:[{label:"International",value:"international"},{label:"National",value:"national"},{label:"E.164",value:"e164"}],defaultValue:"international"},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceCurrency",label:"Currency Input",category:"Business",icon:"dollar-sign",defaultProps:{currency:"PLN",decimals:2},propDescriptors:[{name:"value",type:"number",label:"Amount",defaultValue:0},{name:"currency",type:"select",label:"Currency",options:[{label:"PLN",value:"PLN"},{label:"EUR",value:"EUR"},{label:"USD",value:"USD"},{label:"GBP",value:"GBP"}],defaultValue:"PLN"},{name:"decimals",type:"number",label:"Decimal places",min:0,max:4,defaultValue:2},{name:"showCurrencySymbol",type:"boolean",label:"Show symbol",defaultValue:!0},{name:"thousandSeparator",type:"boolean",label:"Thousand separator",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceVAT",label:"VAT Input",category:"Business",icon:"percent",defaultProps:{rate:23,country:"PL"},propDescriptors:[{name:"netValue",type:"number",label:"Net value",defaultValue:0,group:"Values"},{name:"rate",type:"number",label:"VAT rate (%)",min:0,max:100,defaultValue:23,group:"Values"},{name:"country",type:"select",label:"Country",options:[{label:"Poland",value:"PL"},{label:"Germany",value:"DE"},{label:"France",value:"FR"}],defaultValue:"PL"},{name:"showGross",type:"boolean",label:"Show gross value",defaultValue:!0},{name:"showVatAmount",type:"boolean",label:"Show VAT amount",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceInvoiceLines",label:"Invoice Lines",category:"Business",icon:"file-text",defaultProps:{lines:[],currency:"PLN"},propDescriptors:[{name:"lines",type:"json",label:"Invoice lines (JSON)"},{name:"currency",type:"select",label:"Currency",options:[{label:"PLN",value:"PLN"},{label:"EUR",value:"EUR"},{label:"USD",value:"USD"}],defaultValue:"PLN"},{name:"showVAT",type:"boolean",label:"Show VAT column",defaultValue:!0},{name:"showDiscount",type:"boolean",label:"Show discount column",defaultValue:!1},{name:"showTotal",type:"boolean",label:"Show totals row",defaultValue:!0},{name:"editable",type:"boolean",label:"Editable",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]}],me=[{type:"NiceLeaderboard",label:"Leaderboard",category:"Gamification",icon:"trophy",defaultProps:{dataSource:[],maxRows:10},propDescriptors:[{name:"dataSource",type:"json",label:"Data source (JSON)"},{name:"maxRows",type:"number",label:"Max visible rows",min:3,max:100,defaultValue:10},{name:"showRank",type:"boolean",label:"Show rank column",defaultValue:!0},{name:"showAvatar",type:"boolean",label:"Show avatar",defaultValue:!0},{name:"highlightCurrentUser",type:"boolean",label:"Highlight current user",defaultValue:!0},{name:"scoreField",type:"string",label:"Score field name",defaultValue:"score"},{name:"nameField",type:"string",label:"Name field name",defaultValue:"name"},{name:"variant",type:"variant",label:"Visual style",defaultValue:"default"}]},{type:"NiceAchievement",label:"Achievement Badge",category:"Gamification",icon:"award",defaultProps:{title:"Achievement",unlocked:!1},propDescriptors:[{name:"title",type:"string",label:"Achievement title",defaultValue:"Achievement"},{name:"description",type:"string",label:"Description"},{name:"icon",type:"string",label:"Icon URL"},{name:"unlocked",type:"boolean",label:"Unlocked",defaultValue:!1},{name:"progress",type:"number",label:"Progress (0-100)",min:0,max:100,defaultValue:0},{name:"rarity",type:"select",label:"Rarity",options:[{label:"Common",value:"common"},{label:"Rare",value:"rare"},{label:"Epic",value:"epic"},{label:"Legendary",value:"legendary"}],defaultValue:"common"},{name:"size",type:"size",label:"Badge size",group:"Layout"}]},{type:"NiceQuest",label:"Quest Tracker",category:"Gamification",icon:"map",defaultProps:{title:"Quest",steps:[]},propDescriptors:[{name:"title",type:"string",label:"Quest title",defaultValue:"Quest"},{name:"description",type:"string",label:"Quest description"},{name:"steps",type:"json",label:"Steps (JSON array of {title, completed})"},{name:"reward",type:"string",label:"Reward description"},{name:"rewardXP",type:"number",label:"Reward XP",min:0,defaultValue:100},{name:"showProgress",type:"boolean",label:"Show progress bar",defaultValue:!0},{name:"variant",type:"variant",label:"Visual style",defaultValue:"default"}]},{type:"NiceXPBar",label:"XP Progress Bar",category:"Gamification",icon:"zap",defaultProps:{currentXP:0,maxXP:1e3,level:1},propDescriptors:[{name:"currentXP",type:"number",label:"Current XP",min:0,defaultValue:0},{name:"maxXP",type:"number",label:"Max XP (next level)",min:1,defaultValue:1e3},{name:"level",type:"number",label:"Current level",min:1,defaultValue:1},{name:"showLabel",type:"boolean",label:"Show XP label",defaultValue:!0},{name:"showLevel",type:"boolean",label:"Show level badge",defaultValue:!0},{name:"color",type:"color",label:"Bar color",defaultValue:"#4caf50"},{name:"animated",type:"boolean",label:"Animate changes",defaultValue:!0},{name:"height",type:"size",label:"Bar height",group:"Layout"}]}],ye=[{type:"NicePixelEditor",label:"Pixel Editor",category:"Graphics",icon:"grid",defaultProps:{width:32,height:32,palette:[]},propDescriptors:[{name:"width",type:"number",label:"Canvas width (px)",min:1,max:256,defaultValue:32},{name:"height",type:"number",label:"Canvas height (px)",min:1,max:256,defaultValue:32},{name:"palette",type:"json",label:"Color palette (JSON array)"},{name:"gridVisible",type:"boolean",label:"Show grid",defaultValue:!0},{name:"zoom",type:"number",label:"Zoom level",min:1,max:32,step:1,defaultValue:8},{name:"layers",type:"boolean",label:"Enable layers",defaultValue:!0},{name:"onion",type:"boolean",label:"Onion skin (animation)",defaultValue:!1}]},{type:"NiceVectorEditor",label:"Vector Editor",category:"Graphics",icon:"pen-tool",defaultProps:{width:800,height:600},propDescriptors:[{name:"width",type:"number",label:"Canvas width",min:100,max:4096,defaultValue:800,group:"Layout"},{name:"height",type:"number",label:"Canvas height",min:100,max:4096,defaultValue:600,group:"Layout"},{name:"showRulers",type:"boolean",label:"Show rulers",defaultValue:!0},{name:"snapToGrid",type:"boolean",label:"Snap to grid",defaultValue:!0},{name:"gridSize",type:"number",label:"Grid size",min:1,max:100,defaultValue:10},{name:"fillColor",type:"color",label:"Default fill",defaultValue:"#ffffff"},{name:"strokeColor",type:"color",label:"Default stroke",defaultValue:"#000000"},{name:"strokeWidth",type:"number",label:"Stroke width",min:0,max:20,step:.5,defaultValue:1}]},{type:"NicePhotoEditor",label:"Photo Editor",category:"Graphics",icon:"image",defaultProps:{src:""},propDescriptors:[{name:"src",type:"string",label:"Image source URL"},{name:"crop",type:"boolean",label:"Allow crop",defaultValue:!0},{name:"rotate",type:"boolean",label:"Allow rotate",defaultValue:!0},{name:"filters",type:"boolean",label:"Show filters",defaultValue:!0},{name:"adjustments",type:"boolean",label:"Show adjustments",defaultValue:!0},{name:"text",type:"boolean",label:"Allow text overlay",defaultValue:!0},{name:"outputFormat",type:"select",label:"Output format",options:[{label:"PNG",value:"png"},{label:"JPEG",value:"jpeg"},{label:"WebP",value:"webp"}],defaultValue:"png"},{name:"maxWidth",type:"number",label:"Max output width",min:100,max:8192,group:"Output"}]}],be=[{type:"NiceComments",label:"Comments",category:"Social",icon:"message-circle",defaultProps:{threadId:"",allowReplies:!0},propDescriptors:[{name:"threadId",type:"string",label:"Thread ID / entity ID"},{name:"allowReplies",type:"boolean",label:"Allow replies (nested)",defaultValue:!0},{name:"maxDepth",type:"number",label:"Max nesting depth",min:1,max:10,defaultValue:3},{name:"sortOrder",type:"select",label:"Default sort",options:[{label:"Newest first",value:"newest"},{label:"Oldest first",value:"oldest"},{label:"Most liked",value:"popular"}],defaultValue:"newest"},{name:"allowReactions",type:"boolean",label:"Allow reactions",defaultValue:!0},{name:"showAvatar",type:"boolean",label:"Show avatars",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceRatings",label:"Ratings",category:"Social",icon:"star",defaultProps:{maxStars:5,allowHalf:!0},propDescriptors:[{name:"value",type:"number",label:"Current rating",min:0,max:10,step:.5,defaultValue:0},{name:"maxStars",type:"number",label:"Maximum stars",min:3,max:10,defaultValue:5},{name:"allowHalf",type:"boolean",label:"Allow half stars",defaultValue:!0},{name:"showCount",type:"boolean",label:"Show vote count",defaultValue:!0},{name:"showAverage",type:"boolean",label:"Show average",defaultValue:!0},{name:"color",type:"color",label:"Star color",defaultValue:"#ffc107"},{name:"size",type:"size",label:"Star size",group:"Layout"},{name:"readOnly",type:"boolean",label:"Read only",defaultValue:!1}]},{type:"NiceWiki",label:"Wiki Editor",category:"Social",icon:"book",defaultProps:{content:"",showTOC:!0},propDescriptors:[{name:"content",type:"string",label:"Initial content (Markdown)"},{name:"showTOC",type:"boolean",label:"Show table of contents",defaultValue:!0},{name:"showHistory",type:"boolean",label:"Show version history",defaultValue:!0},{name:"allowEdit",type:"boolean",label:"Allow editing",defaultValue:!0},{name:"showToolbar",type:"boolean",label:"Show Markdown toolbar",defaultValue:!0},{name:"previewMode",type:"select",label:"Preview mode",options:[{label:"Side by side",value:"split"},{label:"Tab switch",value:"tabs"},{label:"Live preview",value:"live"}],defaultValue:"split"},{name:"maxLength",type:"number",label:"Max content length",min:0,defaultValue:0}]}],ge=[{type:"NiceModelEditor",label:"3D Model Editor",category:"3D",icon:"cube",defaultProps:{modelUrl:""},propDescriptors:[{name:"modelUrl",type:"string",label:"Model URL (.glb / .gltf)"},{name:"environmentMap",type:"select",label:"Environment",options:[{label:"Studio",value:"studio"},{label:"Outdoor",value:"outdoor"},{label:"Warehouse",value:"warehouse"},{label:"None",value:"none"}],defaultValue:"studio"},{name:"showGrid",type:"boolean",label:"Show grid",defaultValue:!0},{name:"showAxes",type:"boolean",label:"Show axes",defaultValue:!0},{name:"enablePhysics",type:"boolean",label:"Enable physics",defaultValue:!1},{name:"wireframe",type:"boolean",label:"Wireframe mode",defaultValue:!1},{name:"backgroundColor",type:"color",label:"Background",defaultValue:"#1a1a2e"},{name:"height",type:"size",label:"Viewport height",group:"Layout"}]},{type:"NiceModelViewer",label:"3D Model Viewer",category:"3D",icon:"eye",defaultProps:{modelUrl:"",autoRotate:!0},propDescriptors:[{name:"modelUrl",type:"string",label:"Model URL (.glb / .gltf)"},{name:"autoRotate",type:"boolean",label:"Auto-rotate",defaultValue:!0},{name:"rotateSpeed",type:"number",label:"Rotate speed",min:.1,max:10,step:.1,defaultValue:1},{name:"zoom",type:"boolean",label:"Allow zoom",defaultValue:!0},{name:"pan",type:"boolean",label:"Allow pan",defaultValue:!0},{name:"environmentMap",type:"select",label:"Environment",options:[{label:"Studio",value:"studio"},{label:"Outdoor",value:"outdoor"},{label:"Warehouse",value:"warehouse"},{label:"None",value:"none"}],defaultValue:"studio"},{name:"backgroundColor",type:"color",label:"Background",defaultValue:"#1a1a2e"},{name:"showAnnotations",type:"boolean",label:"Show annotations",defaultValue:!1},{name:"height",type:"size",label:"Viewport height",group:"Layout"}]}],Ge=[...he,...ye,...ge,...me,...fe,...pe,...be];async function qe(i,e){const t=await fetch(i,{...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}});if(!t.ok){const n=await t.text();let a={};try{a=JSON.parse(n)}catch{}throw{code:a.code||`HTTP_${t.status}`,message:a.message||t.statusText,statusCode:t.status}}return t.json()}function Ke(i){const{baseUrl:e,currency:t="PLN",timeout:n=3e4,fetcher:a=qe,getAuthToken:o,onError:l}=i,[c,d]=r.useState([]),[g,S]=r.useState(null),[w,T]=r.useState(null),[A,W]=r.useState(null),[D,Q]=r.useState(null),[G,_]=r.useState(null),[N,q]=r.useState([]),[O,Z]=r.useState([]),[ee,z]=r.useState(null),[$,X]=r.useState({offers:!1,calculate:!1,compare:!1,apply:!1,creditCheck:!1,refinancing:!1,consolidation:!1,savedCalculations:!1}),R=r.useRef(new Map),B=r.useCallback(()=>{const s={"Content-Type":"application/json"},b=o==null?void 0:o();return b&&(s.Authorization=`Bearer ${b}`),s},[o]),p=r.useCallback(async(s,b={},I)=>{const Y=R.current.get(s);Y&&Y.abort();const u=new AbortController;R.current.set(s,u);const m=setTimeout(()=>u.abort(),n);X(h=>({...h,[I]:!0})),z(null);try{const h=`${e}${s}`;return await a(h,{...b,headers:{...B(),...b.headers},signal:u.signal})}catch(h){const V={code:h.code||"UNKNOWN_ERROR",message:h.message||"An unknown error occurred",details:h.details,endpoint:s,statusCode:h.statusCode};throw h.name!=="AbortError"&&(z(V),l==null||l(V)),V}finally{clearTimeout(m),R.current.delete(s),X(h=>({...h,[I]:!1}))}},[e,n,a,B,l]),se=r.useCallback(async s=>{var m,h;const b=new URLSearchParams;s!=null&&s.loanType&&b.set("loanType",s.loanType),s!=null&&s.minAmount&&b.set("minAmount",String(s.minAmount)),s!=null&&s.maxAmount&&b.set("maxAmount",String(s.maxAmount)),s!=null&&s.minTerm&&b.set("minTerm",String(s.minTerm)),s!=null&&s.maxTerm&&b.set("maxTerm",String(s.maxTerm)),s!=null&&s.maxApr&&b.set("maxApr",String(s.maxApr)),(m=s==null?void 0:s.banks)!=null&&m.length&&b.set("banks",s.banks.join(",")),(h=s==null?void 0:s.features)!=null&&h.length&&b.set("features",s.features.join(",")),b.set("currency",(s==null?void 0:s.currency)||t);const I=b.toString(),Y=`/offers${I?`?${I}`:""}`,u=await p(Y,{method:"GET"},"offers");return d(u),u},[p,t]),j=r.useCallback(s=>{S(s)},[]),U=r.useCallback(async s=>p(`/offers/${s}`,{method:"GET"},"offers"),[p]),te=r.useCallback(async s=>{const b=await p("/calculate/amortization",{method:"POST",body:JSON.stringify({...s,currency:s.currency||t})},"calculate");return T(b),b},[p,t]),ne=r.useCallback(async s=>{const b=await p("/calculate/compare",{method:"POST",body:JSON.stringify({scenarios:s,currency:t})},"compare");return W(b),b},[p,t]),y=r.useCallback(async(s,b,I)=>{const Y=await p("/credit/analyze",{method:"POST",body:JSON.stringify({monthlyIncome:s,monthlyDebts:b,requestedAmount:I,currency:t})},"creditCheck");return _(Y),Y},[p,t]),v=r.useCallback(async s=>{const b=await p("/applications",{method:"POST",body:JSON.stringify(s)},"apply");return Q(b),b},[p]),P=r.useCallback(async s=>{const b=await p(`/applications/${s}`,{method:"GET"},"apply");return Q(b),b},[p]),E=r.useCallback(async s=>{await p(`/applications/${s}/cancel`,{method:"POST"},"apply"),Q(null)},[p]),k=r.useCallback(async(s,b,I,Y)=>{const u=await p("/calculations",{method:"POST",body:JSON.stringify({name:s,config:b,result:I,notes:Y})},"savedCalculations");return q(m=>[...m,u]),u},[p]),M=r.useCallback(async s=>p(`/calculations/${s}`,{method:"GET"},"savedCalculations"),[p]),x=r.useCallback(async s=>{await p(`/calculations/${s}`,{method:"DELETE"},"savedCalculations"),q(b=>b.filter(I=>I.id!==s))},[p]),K=r.useCallback(async()=>{const s=await p("/calculations",{method:"GET"},"savedCalculations");return q(s),s},[p]),ae=r.useCallback(async(s,b)=>p("/refinancing/analyze",{method:"POST",body:JSON.stringify({currentLoanId:s,newOfferIds:b})},"refinancing"),[p]),re=r.useCallback(async(s,b)=>p("/consolidation/simulate",{method:"POST",body:JSON.stringify({debts:s,targetRate:b,currency:t})},"consolidation"),[p,t]),oe=r.useCallback(async()=>{const s=await p("/active",{method:"GET"},"offers");return Z(s),s},[p]),f=r.useCallback(()=>{z(null)},[]),C=r.useCallback(()=>{d([]),S(null),T(null),W(null),Q(null),_(null),q([]),Z([]),z(null),X({offers:!1,calculate:!1,compare:!1,apply:!1,creditCheck:!1,refinancing:!1,consolidation:!1,savedCalculations:!1})},[]);return r.useEffect(()=>()=>{R.current.forEach(s=>s.abort()),R.current.clear()},[]),{offers:c,selectedOffer:g,latestCalculation:w,latestComparison:A,applicationState:D,creditAnalysis:G,savedCalculations:N,activeLoans:O,loading:$,error:ee,fetchOffers:se,selectOffer:j,getOfferDetails:U,calculateAmortization:te,compareLoanScenarios:ne,runCreditAnalysis:y,submitApplication:v,getApplicationStatus:P,cancelApplication:E,saveCalculation:k,loadCalculation:M,deleteSavedCalculation:x,fetchSavedCalculations:K,analyzeRefinancing:ae,simulateConsolidation:re,fetchActiveLoans:oe,clearError:f,reset:C}}class He{constructor(e){this.baseUrl=e.baseUrl,this.currency=e.currency||"PLN",this.timeout=e.timeout||3e4,this.getAuthToken=e.getAuthToken}async request(e,t={}){var c;const n=new AbortController,a=setTimeout(()=>n.abort(),this.timeout),o={"Content-Type":"application/json"},l=(c=this.getAuthToken)==null?void 0:c.call(this);l&&(o.Authorization=`Bearer ${l}`);try{const d=await fetch(`${this.baseUrl}${e}`,{...t,headers:{...o,...t.headers},signal:n.signal});if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);return d.json()}finally{clearTimeout(a)}}async getOffers(e){const t=new URLSearchParams;e!=null&&e.loanType&&t.set("loanType",e.loanType),e!=null&&e.minAmount&&t.set("minAmount",String(e.minAmount)),e!=null&&e.maxAmount&&t.set("maxAmount",String(e.maxAmount)),t.set("currency",(e==null?void 0:e.currency)||this.currency);const n=t.toString();return this.request(`/offers${n?`?${n}`:""}`)}async getOfferById(e){return this.request(`/offers/${e}`)}async calculateAmortization(e){return this.request("/calculate/amortization",{method:"POST",body:JSON.stringify({...e,currency:e.currency||this.currency})})}async compareScenarios(e){return this.request("/calculate/compare",{method:"POST",body:JSON.stringify({scenarios:e,currency:this.currency})})}async submitApplication(e){return this.request("/applications",{method:"POST",body:JSON.stringify(e)})}async getApplicationStatus(e){return this.request(`/applications/${e}`)}async analyzeRefinancing(e,t){return this.request("/refinancing/analyze",{method:"POST",body:JSON.stringify({currentLoanId:e,newOfferIds:t})})}async simulateConsolidation(e,t){return this.request("/consolidation/simulate",{method:"POST",body:JSON.stringify({debts:e,targetRate:t,currency:this.currency})})}async getActiveLoans(){return this.request("/active")}}exports.ErpAuthAdapter=Ne;exports.ErpDataAdapter=Pe;exports.ErpExportAdapter=Fe;exports.ErpFileAdapter=Ue;exports.ErpOfflineQueue=Je;exports.ErpOptimisticStore=je;exports.ErpRateLimiter=ze;exports.LoanService=He;exports.allControlRegistries=Ge;exports.applyBatchChanges=Oe;exports.audioControlRegistry=he;exports.authControlRegistry=pe;exports.businessControlRegistry=fe;exports.createMiddlewarePipeline=Me;exports.createSignalRAdapter=Ve;exports.createSignalRDataOperations=Ae;exports.formatPresenceStatus=Re;exports.gamificationControlRegistry=me;exports.generateUserColor=de;exports.graphicControlRegistry=ye;exports.headerMiddleware=Be;exports.loggingMiddleware=Ie;exports.retryMiddleware=$e;exports.socialControlRegistry=be;exports.threeControlRegistry=ge;exports.useCollaborativeDataGrid=De;exports.useEntityPresence=ce;exports.useLoanApi=Ke;exports.useMultiEntityPresence=xe;exports.useSignalRLiveData=ue;
2
2
  //# sourceMappingURL=index.cjs.map