"use strict";(self["webpackChunkaida"]=self["webpackChunkaida"]||[]).push([[9415],{79415:function(e,t,n){n.r(t),n.d(t,{applyDiff:function(){return i},batchProcess:function(){return O},checkBrowserSupport:function(){return b},createCancellablePromise:function(){return v},debounce:function(){return a},deepClone:function(){return o},deepCompare:function(){return r},delay:function(){return g},formatDuration:function(){return f},formatFileSize:function(){return l},generateId:function(){return c},getObjectDepth:function(){return h},getObjectSize:function(){return m},isPromise:function(){return p},isValidCommand:function(){return s},retry:function(){return w},safeJSONParse:function(){return d},safeJSONStringify:function(){return y},throttle:function(){return u}});n(21703);function r(e,t){const n={};if(e===t)return null;if(null===e||null===t||"object"!==typeof e||"object"!==typeof t)return{_value:t,_oldValue:e};if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{_value:t,_oldValue:e};for(let o=0;o<e.length;o++){const i=r(e[o],t[o]);null!==i&&(n[o]=i)}return Object.keys(n).length>0?n:null}const o=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of o){const o=e[i],u=t[i];if(i in e)if(i in t){const e=r(o,u);null!==e&&(n[i]=e)}else n[i]={_value:void 0,_oldValue:o,_type:"removed"};else n[i]={_value:u,_type:"added"}}return Object.keys(n).length>0?n:null}function o(e){if(null===e||"object"!==typeof e)return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map((e=>o(e)));if("object"===typeof e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n]=o(e[n]));return t}return e}function i(e,t){if(!t)return o(e);if(void 0!==t._value)return t._value;const n=o(e)||{};for(const r in t){const e=t[r];"added"===e._type||"removed"===e._type?"removed"===e._type?delete n[r]:n[r]=e._value:void 0!==e._value?n[r]=e._value:n[r]=i(n[r],e)}return n}function u(e,t){let n,r=0;return function(...o){const i=Date.now(),u=t-(i-r);if(u<=0||u>t)return n&&(clearTimeout(n),n=null),r=i,e.apply(this,o);n||(n=setTimeout((()=>{r=Date.now(),n=null,e.apply(this,o)}),u))}}function a(e,t,n=!1){let r;return function(...o){const i=()=>{r=null,n||e.apply(this,o)},u=n&&!r;clearTimeout(r),r=setTimeout(i,t),u&&e.apply(this,o)}}function c(e="id"){return`${e}_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function l(e){if(0===e)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+n[r]}function f(e){if(e<1e3)return`${e.toFixed(2)}ms`;if(e<6e4)return`${(e/1e3).toFixed(2)}s`;{const t=Math.floor(e/6e4),n=(e%6e4/1e3).toFixed(2);return`${t}m ${n}s`}}function s(e){return e&&"object"===typeof e&&"function"===typeof e.execute}function p(e){return e&&"function"===typeof e.then}function d(e,t=null){try{return JSON.parse(e)}catch(n){return console.warn("JSON解析失败:",n),t}}function y(e,t="{}"){try{return JSON.stringify(e)}catch(n){return console.warn("JSON序列化失败:",n),t}}function h(e){if(null===e||"object"!==typeof e)return 0;let t=0;for(const n in e)if(e.hasOwnProperty(n)){const r=h(e[n]);t=Math.max(t,r)}return t+1}function m(e){const t=y(e,"{}");return new Blob([t]).size}function b(){return{WeakRef:"undefined"!==typeof WeakRef,FinalizationRegistry:"undefined"!==typeof FinalizationRegistry,PerformanceMemory:"undefined"!==typeof performance&&!!performance.memory,RequestIdleCallback:"undefined"!==typeof requestIdleCallback,IntersectionObserver:"undefined"!==typeof IntersectionObserver,ResizeObserver:"undefined"!==typeof ResizeObserver}}function g(e){return new Promise((t=>setTimeout(t,e)))}async function w(e,t={}){const{retries:n=3,delay:r=1e3,backoff:o=1.5,shouldRetry:i=(()=>!0)}=t;let u=0,a=r;while(u<=n)try{return await e()}catch(c){if(u++,u>n||!i(c))throw c;await g(a),a*=o}}async function O(e,t,n={}){const{batchSize:r=10,delay:o=0,onProgress:i=(()=>{})}=n,u=[];for(let a=0;a<e.length;a+=r){const n=e.slice(a,a+r),c=await Promise.all(n.map((e=>t(e))));u.push(...c),i({completed:Math.min(a+r,e.length),total:e.length,percentage:Math.min((a+r)/e.length*100,100)}),o>0&&a+r<e.length&&await g(o)}return u}function v(e){let t=!1,n=null;const r=new Promise(((r,o)=>{const i=e=>{t||r(e)},u=e=>{t||o(e)};n=()=>{t=!0,o(new Error("Promise was cancelled"))},e(i,u)}));return{promise:r,cancel:()=>{n&&n()},isCancelled:()=>t}}t["default"]={deepCompare:r,deepClone:o,applyDiff:i,throttle:u,debounce:a,generateId:c,formatFileSize:l,formatDuration:f,isValidCommand:s,isPromise:p,safeJSONParse:d,safeJSONStringify:y,getObjectDepth:h,getObjectSize:m,checkBrowserSupport:b,delay:g,retry:w,batchProcess:O,createCancellablePromise:v}}}]);