@kedem/okdb 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/okdb-worker-child.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x275d88=_0x3fcd;(function(_0x489f47,_0x158e35){const _0x28483a=_0x3fcd,_0xdf56c4=_0x489f47();while(!![]){try{const _0x279877=parseInt(_0x28483a(0x254))/0x1*(-parseInt(_0x28483a(0x26d))/0x2)+-parseInt(_0x28483a(0x1cf))/0x3*(-parseInt(_0x28483a(0x1ca))/0x4)+parseInt(_0x28483a(0x211))/0x5*(-parseInt(_0x28483a(0x18b))/0x6)+parseInt(_0x28483a(0x2bb))/0x7*(parseInt(_0x28483a(0x1f8))/0x8)+-parseInt(_0x28483a(0x24e))/0x9*(-parseInt(_0x28483a(0x1ef))/0xa)+-parseInt(_0x28483a(0x1e1))/0xb*(-parseInt(_0x28483a(0x223))/0xc)+-parseInt(_0x28483a(0x2ae))/0xd*(-parseInt(_0x28483a(0x24a))/0xe);if(_0x279877===_0x158e35)break;else _0xdf56c4['push'](_0xdf56c4['shift']());}catch(_0x16a59b){_0xdf56c4['push'](_0xdf56c4['shift']());}}}(_0x33bb,0x9f5ed));function _0x3fcd(_0x1ab090,_0xb6640f){_0x1ab090=_0x1ab090-0x189;const _0x33bb37=_0x33bb();let _0x3fcd38=_0x33bb37[_0x1ab090];return _0x3fcd38;}var require$$0$1=require('path'),require$$1$1=require('os'),require$$0=require(_0x275d88(0x1a9)),require$$1=require(_0x275d88(0x27c));function getDefaultExportFromCjs(_0x912fa){const _0x2d597c=_0x275d88;return _0x912fa&&_0x912fa[_0x2d597c(0x239)]&&Object['prototype'][_0x2d597c(0x1b8)]['call'](_0x912fa,_0x2d597c(0x1f5))?_0x912fa[_0x2d597c(0x1f5)]:_0x912fa;}function commonjsRequire(_0x2353d9){const _0x4640ee=_0x275d88;throw new Error(_0x4640ee(0x21b)+_0x2353d9+'\x22.\x20Please\x20configure\x20the\x20dynamicRequireTargets\x20or/and\x20ignoreDynamicRequires\x20option\x20of\x20@rollup/plugin-commonjs\x20appropriately\x20for\x20this\x20require\x20call\x20to\x20work.');}var okdbWorkerChild$1={},okdbEnums,hasRequiredOkdbEnums;function requireOkdbEnums(){const _0x396ce2=_0x275d88;if(hasRequiredOkdbEnums)return okdbEnums;hasRequiredOkdbEnums=0x1;const _0x14b7d3={'PUT':_0x396ce2(0x274),'REMOVE':'remove','INDEX_DROP':'dropIndex','INDEX_REGISTER':_0x396ce2(0x1e2),'INDEX_RESET':_0x396ce2(0x1bb),'TYPE_REGISTER':_0x396ce2(0x195),'TYPE_DROP':_0x396ce2(0x289),'FTS_REGISTER':'registerFts','FTS_DROP':_0x396ce2(0x1b5),'FTS_RESET':'resetFts','SCHEMA_SET':_0x396ce2(0x1df),'SCHEMA_DROP':_0x396ce2(0x1a3),'TTL_SET':_0x396ce2(0x1d7),'TTL_CLEAR':_0x396ce2(0x1de)},_0x3cc775={'SYSTEM_READY':_0x396ce2(0x1d9),'SYSTEM_STOPPED':_0x396ce2(0x2b1),'SYSTEM_CLOCK_CHANGE':_0x396ce2(0x1eb),'SYSTEM_POKE':_0x396ce2(0x1ea),'SYSTEM_DRAIN':_0x396ce2(0x287),'SYSTEM_TYPE_DROP':_0x396ce2(0x25c),'SYSTEM_PROC':_0x396ce2(0x266),'SYSTEM_BUS_STATE_CHANGE':'system:bus_state_change','ITEM_CREATE':_0x396ce2(0x272),'ITEM_UPDATE':_0x396ce2(0x18a),'ITEM_REMOVE':_0x396ce2(0x232),'INDEX_RESET':_0x396ce2(0x1e3),'INDEX_READY':_0x396ce2(0x27d),'INDEX_PROGRESS':_0x396ce2(0x297),'VIEW_PROGRESS':_0x396ce2(0x21f),'INDEX_DROP':'index:drop','INDEX_REGISTERED':_0x396ce2(0x21c),'FTS_REGISTERED':_0x396ce2(0x1f6),'FTS_DROP':_0x396ce2(0x1b3),'FTS_RESET':_0x396ce2(0x224),'SCHEMA_SET':_0x396ce2(0x276),'SCHEMA_DROP':_0x396ce2(0x1d1),'UNIQUE_VIOLATION':_0x396ce2(0x1c0),'UNIQUE_VIOLATION_RESOLVED':_0x396ce2(0x256),'REF_VIOLATION':_0x396ce2(0x2bf),'REF_VIOLATION_RESOLVED':_0x396ce2(0x1e4),'SYNC_APPLY':_0x396ce2(0x20d),'TXN_START':'txn:start','TXN_END':_0x396ce2(0x1ba),'TXN_ROLLBACK':_0x396ce2(0x1b9),'TYPE_REGISTERED':_0x396ce2(0x19c),'TYPE_DROP':'type:drop','ENV_OPENED':_0x396ce2(0x194),'ENV_REMOVED':_0x396ce2(0x207),'TTL_EXPIRED':_0x396ce2(0x290),'TTL_SET':'ttl:set','TTL_CLEAR':_0x396ce2(0x18e),'LICENSE_INVALID':_0x396ce2(0x1a1),'LICENSE_ADDED':_0x396ce2(0x1cd),'LICENSE_ACTIVATED':_0x396ce2(0x216),'LICENSE_REMOVED':_0x396ce2(0x1e5)},_0x3bc718={'CREATING':_0x396ce2(0x197),'RESETTING':_0x396ce2(0x2be),'READY':_0x396ce2(0x1c6),'DROPPING':_0x396ce2(0x275),'WAITING':'waiting'},_0x4b6744={'CREATED':'created','STARTING':_0x396ce2(0x201),'STARTED':_0x396ce2(0x1fb),'STOPPING':_0x396ce2(0x22e),'STOPPED':_0x396ce2(0x2b2)},_0x2fd3aa={'CREATING':_0x396ce2(0x197),'READY':_0x396ce2(0x1c6),'HALTED':_0x396ce2(0x1dd),'STOPPED':_0x396ce2(0x2b2),'RESETTING':'resetting'},_0x35b09f=Object[_0x396ce2(0x2ad)]({'POKE':_0x396ce2(0x24d),'DRAIN':_0x396ce2(0x2bd),'TYPE_DROP':'bus:type_drop','PROC':'bus:proc'});return okdbEnums={'BUS_EVENTS':_0x35b09f,'CHANGE_ACTIONS':_0x14b7d3,'EVENTS':_0x3cc775,'INDEX_STATE':_0x3bc718,'OKDB_STATE':_0x4b6744,'VIEW_STATE':_0x2fd3aa},okdbEnums;}var okdbLoopMonitor,hasRequiredOkdbLoopMonitor;function requireOkdbLoopMonitor(){const _0x4bcbd1=_0x275d88;if(hasRequiredOkdbLoopMonitor)return okdbLoopMonitor;hasRequiredOkdbLoopMonitor=0x1;const {monitorEventLoopDelay:_0x149e5e,performance:_0x4ce206}=require$$0,_0x558c9e=process.env.OKDB_LOOP_LAG==='1'||process.env.OKDB_LOOP_LAG==='true',_0xe778a=Number(process.env.OKDB_LOOP_LAG_MS)||0x7d0,_0x2ee5db=process.env.OKDB_LOOP_LAG_ALL==='1',_0x1093dd=Number(process.env.OKDB_LOOP_LAG_MIN_MS)||0x64;class _0x3bf88c{constructor(){const _0x5a21c9=_0x3fcd;this[_0x5a21c9(0x1c4)]=_0x558c9e,this[_0x5a21c9(0x244)]=new Map(),this['_h']=null,this['_timer']=null,this[_0x5a21c9(0x1d2)]=![],this[_0x5a21c9(0x29c)]=(_0x440692,_0x38a57f)=>process[_0x5a21c9(0x1bd)][_0x5a21c9(0x231)](_0x440692+(_0x38a57f?'\x20'+JSON[_0x5a21c9(0x2ba)](_0x38a57f):'')+'\x0a');}[_0x4bcbd1(0x247)](){const _0x4de07e=_0x4bcbd1;return _0x4ce206[_0x4de07e(0x247)]();}[_0x4bcbd1(0x273)](_0x59f649){if(typeof _0x59f649==='function')this['_log']=_0x59f649;}[_0x4bcbd1(0x200)](_0x53fa29,_0x1103af,_0x2abfa1){const _0x41509b=_0x4bcbd1;if(!this[_0x41509b(0x1c4)])return;let _0x3f4f55=this[_0x41509b(0x244)][_0x41509b(0x23b)](_0x53fa29);!_0x3f4f55&&(_0x3f4f55={'ms':0x0,'count':0x0,'maxMs':0x0,'maxExtra':''},this[_0x41509b(0x244)][_0x41509b(0x1be)](_0x53fa29,_0x3f4f55)),_0x3f4f55['ms']+=_0x1103af,_0x3f4f55[_0x41509b(0x2b8)]+=0x1,_0x1103af>_0x3f4f55[_0x41509b(0x1bc)]&&(_0x3f4f55[_0x41509b(0x1bc)]=_0x1103af,_0x3f4f55[_0x41509b(0x1dc)]=_0x2abfa1||'');}[_0x4bcbd1(0x26a)](_0x1f510c){const _0x42897e=_0x4bcbd1;if(!this[_0x42897e(0x1c4)]||this[_0x42897e(0x1d2)])return;this[_0x42897e(0x1d2)]=!![];if(_0x1f510c)this[_0x42897e(0x29c)]=_0x1f510c;this['_h']=_0x149e5e({'resolution':0xa}),this['_h'][_0x42897e(0x1b6)](),this[_0x42897e(0x2a2)]=setInterval(()=>this['_report'](),_0xe778a);if(this[_0x42897e(0x2a2)]['unref'])this[_0x42897e(0x2a2)][_0x42897e(0x2b6)]();}[_0x4bcbd1(0x1fe)](_0x468879){const _0x50b488=_0x4bcbd1;if(!this[_0x50b488(0x240)])this['_windowCbs']=new Set();this['_windowCbs']['add'](_0x468879);if(!this['_started'])this[_0x50b488(0x1d8)]();}[_0x4bcbd1(0x1a0)](_0x1b79f8){const _0x5e6ac4=_0x4bcbd1;this[_0x5e6ac4(0x240)]?.[_0x5e6ac4(0x27e)](_0x1b79f8);}[_0x4bcbd1(0x1d8)](){const _0x4480eb=_0x4bcbd1;if(this['_admissionStarted'])return;this['_admissionStarted']=!![];!this['_h']&&(this['_h']=_0x149e5e({'resolution':0xa}),this['_h'][_0x4480eb(0x1b6)]());const _0x2302d2=_0xe778a;this['_admissionTimer']=setInterval(()=>{const _0x23031e=_0x4480eb,_0x54c704=this['_h'];if(!_0x54c704)return;const _0x4171b7=_0x54c704[_0x23031e(0x2a6)](0x63)/0xf4240,_0x3eb897=_0x54c704[_0x23031e(0x270)]/0xf4240,_0x3f34f0=_0x54c704[_0x23031e(0x191)]/0xf4240;_0x54c704[_0x23031e(0x1b1)]();if(this[_0x23031e(0x240)])for(const _0xaf5786 of this['_windowCbs']){try{_0xaf5786({'p99Ms':_0x4171b7,'maxMs':_0x3eb897,'meanMs':_0x3f34f0,'reportMs':_0x2302d2});}catch{}}},_0x2302d2);if(this['_admissionTimer'][_0x4480eb(0x2b6)])this['_admissionTimer'][_0x4480eb(0x2b6)]();}['_report'](){const _0x6685c9=_0x4bcbd1,_0x2c29d9=this['_h'],_0x39a60f=_0x2c29d9[_0x6685c9(0x270)]/0xf4240,_0x4d5bc2=_0x2c29d9[_0x6685c9(0x2a6)](0x63)/0xf4240,_0x2feb16=_0x2c29d9[_0x6685c9(0x191)]/0xf4240;_0x2c29d9[_0x6685c9(0x1b1)]();const _0xd759ef=[...this[_0x6685c9(0x244)][_0x6685c9(0x1aa)]()]['map'](([_0x235a2d,_0x4ad099])=>({'label':_0x235a2d,..._0x4ad099}))[_0x6685c9(0x1fa)]((_0x545d3d,_0x5de3ee)=>_0x5de3ee['ms']-_0x545d3d['ms'])[_0x6685c9(0x25d)](0x0,0x8);this[_0x6685c9(0x244)]['clear']();const _0x37dd3e=_0xd759ef[_0x6685c9(0x269)]((_0x41b9c1,_0x187c51)=>_0x41b9c1+_0x187c51['ms'],0x0),_0x3d0542=_0xd759ef[_0x6685c9(0x1a6)](_0x4bfdbe=>_0x4bfdbe[_0x6685c9(0x192)]+'='+_0x4bfdbe['ms'][_0x6685c9(0x26f)](0x0)+_0x6685c9(0x1c5)+_0x4bfdbe[_0x6685c9(0x2b8)]+(_0x4bfdbe[_0x6685c9(0x1bc)]>0x5?_0x6685c9(0x1af)+_0x4bfdbe[_0x6685c9(0x1bc)][_0x6685c9(0x26f)](0x0)+'ms'+(_0x4bfdbe[_0x6685c9(0x1dc)]?'\x20'+_0x4bfdbe[_0x6685c9(0x1dc)]:'')+')':''));(_0x2ee5db||_0x39a60f>=_0x1093dd)&&this[_0x6685c9(0x29c)](_0x6685c9(0x29a)+_0xe778a+_0x6685c9(0x250)+_0x39a60f['toFixed'](0x0)+_0x6685c9(0x292)+_0x4d5bc2['toFixed'](0x0)+_0x6685c9(0x222)+_0x2feb16[_0x6685c9(0x26f)](0x0)+_0x6685c9(0x1c9)+_0x37dd3e[_0x6685c9(0x26f)](0x0)+'ms'+(_0x3d0542[_0x6685c9(0x23e)]?'\x20│\x20'+_0x3d0542[_0x6685c9(0x271)]('\x20\x20'):''),{'feature':_0x6685c9(0x28f)});if(this[_0x6685c9(0x240)])for(const _0x43af05 of this[_0x6685c9(0x240)]){try{_0x43af05({'p99Ms':_0x4d5bc2,'maxMs':_0x39a60f,'meanMs':_0x2feb16,'reportMs':_0xe778a});}catch{}}}[_0x4bcbd1(0x1d6)](){const _0x2bd108=_0x4bcbd1;if(this[_0x2bd108(0x2a2)])clearInterval(this['_timer']);if(this['_h'])this['_h'][_0x2bd108(0x1e9)]();this['_timer']=null,this['_h']=null,this['_started']=![];}}const _0x4cfd09=new _0x3bf88c();if(_0x4cfd09[_0x4bcbd1(0x1c4)])_0x4cfd09[_0x4bcbd1(0x26a)]();return okdbLoopMonitor={'LOOP':_0x4cfd09},okdbLoopMonitor;}function _0x33bb(){const _0x2fc3d8=['loop-lag\x20','resolve','_log','queue\x20definition\x20SKIPPED:\x20','recycle','~views','detachConsole','env-removed\x20evict\x20FAILED\x20for\x20','_timer','_tiers','error','string','percentile','modulePath','main','_dropTier','close','rootPath','sandbox-','freeze','611ziiULa','random','exit','system:stopped','stopped','env','requestedAt','size','unref','add','count','ms\x20(+','stringify','3395zwTdIP','terminate','bus:drain','resetting','ref:violation','attach','logs','sandbox\x20host\x20stopped','_rootDb','item:update','1025112yzfIru','onEmit','putSync','ttl:clear','_lockHandle','system','mean','label','pending','env:opened','registerType','reject','creating','remove','_runBootstrapScanPhases','version','_terminateTier','type:registered','includes','transactionSync','win32','offWindow','license:invalid','log','dropSchema','object','envName','map','removeSync','view','node:perf_hooks','entries','getRange','FUNCTION_OOM','entry','user','(worst\x20','unhandledRejection','reset','cursorKey','fts:drop','state','dropFts','enable','inflight','hasOwnProperty','txn:rollback','txn:end','resetIndex','maxMs','stderr','set','tick','unique:violation','resume','_stopped','claimRoutedBootstrap','enabled','ms/','ready','run','ms\x20grace)\x20—\x20sandbox\x20terminated','ms\x20busy=','3880732ONaDoW','claimedBy','detail','license:added','_maybeIdle','3IGrUTF','queue.process\x20threw:\x20','schema:drop','_started','control','has','queue','stop','setTtl','_startAdmission','system:ready','clear','env-removed\x20hint:\x20force-evicting\x20','maxExtra','halted','clearTtl','setSchema','cancelled','11xfMfbZ','registerIndex','index:reset','ref:violation_resolved','license:removed','_drainHandler','core','send','disable','system:poke','system:clock_change','stdout','type','options','450BxWjdS','_closeSharedEnvs','cpuUsage','exports','FUNCTION_CANCELLED','postMessage','default','fts:registered','stats','8632qKpsCe','open','sort','started','cancel','timeoutMs','onWindow','worker\x20OKDB\x20open\x20failed:\x20','note','starting','external','rss','SYSTEM_PROC','_tierFor','defaultMemoryMb','env:removed','then','heapTotal','pid','Spawned\x20queue\x20worker\x20export\x20not\x20found\x20or\x20not\x20a\x20function:\x20','openEnv','sync:apply','requestId','runId','worker:\x20no\x20init\x20message\x20received','30HVOOmD','warn','maxConcurrency','ppid','key','license:activated','queue-worker','MB\x20heap\x20cap)','handler\x20module\x20failed\x20to\x20load:\x20','processor','Could\x20not\x20dynamically\x20require\x20\x22','index:registered','SYSTEM_DRAIN','platform','view:progress','function\x20exceeded\x20','openDB','ms\x20mean=','3625788cCJKqe','fts:reset','inFlightCount','viewName','rejectReady','claimAndRunWorkerBootstrap','graceMs','views','okdb.js','events','startsWith','stopping','function\x20sandbox\x20out\x20of\x20memory\x20(tier\x20','isHeld','write','item:remove','function','_envs','sandbox\x20terminated\x20for\x20a\x20sibling\x20job\x20—\x20retryable','result','idleTimer','fn-sandbox:','__esModule','~proc:bootstrap-index','get','round','watchdog','length','worker','_windowCbs','blocks','passive','memoryUsage','_buckets','env\x20has\x20no\x20queue\x20feature\x20attached','_onMessage','now','\x20evicted','values','588judiWh','bootstrap','tierList','bus:poke','164862tgVJNt','Spawned\x20queue\x20worker\x20module\x20must\x20export\x20a\x20function\x20or\x20default\x20function','ms\x20max=','disconnect','catch','FUNCTION_SANDBOX_EXIT','2JAGoED','scope','unique:violation_resolved','function\x20cancelled\x20—\x20did\x20not\x20unwind\x20within\x20grace;\x20sandbox\x20terminated','_failTier','ERR_WORKER_OUT_OF_MEMORY','FUNCTION_FAILED','~fn:requests','system:type_drop','slice','code','_bareOpen','stopAll','off','lastError','\x20(resident=','env-removed','fts','system:proc','clearThreadStats','onThreadStats','reduce','start','unhandledRejection:\x20','active','944038BpOhtZ','reportThreadStats','toFixed','max','join','item:create','setLogger','put','dropping','schema:set','keys','SYSTEM_POKE','processes','finally','listDesired','worker_threads','index:ready','delete','cost','idleMs','fatal','init','message','push','wedged','_viewState','system:drain','exportName','dropType','SandboxHost:\x20rootPath\x20required','name','running','_ensureTier','process','loop-lag','ttl:expired','inFlight','ms\x20p99=','queueType','heapUsed','_processorStops','split','index:progress','level','heavy'];_0x33bb=function(){return _0x2fc3d8;};return _0x33bb();}var okdbIntakeGate,hasRequiredOkdbIntakeGate;function requireOkdbIntakeGate(){if(hasRequiredOkdbIntakeGate)return okdbIntakeGate;hasRequiredOkdbIntakeGate=0x1;const _0x3337fe=0x2,_0x1eea73=0x2,_0x415017=0x2;function _0x59293d({gateMs:_0x281b90}){let _0x24ae0e=0x0,_0x8431b=0x0,_0x1873e5=0x0;return{'level':()=>_0x24ae0e,'blocks'(_0x50c3ce){const _0x4fd271=_0x3fcd;if(_0x50c3ce==='control')return![];if(_0x24ae0e>=0x2)return!![];if(_0x24ae0e>=0x1&&_0x50c3ce===_0x4fd271(0x299))return!![];return![];},'onWindow'(_0x10fa56){if(_0x10fa56>_0x281b90){_0x8431b++,_0x1873e5=0x0;if(_0x8431b>=_0x3337fe&&_0x24ae0e<_0x415017)return _0x24ae0e++,_0x8431b=0x0,{'changed':!![],'level':_0x24ae0e};}else{if(_0x10fa56<_0x281b90/0x2){_0x1873e5++,_0x8431b=0x0;if(_0x1873e5>=_0x1eea73&&_0x24ae0e>0x0)return _0x24ae0e--,_0x1873e5=0x0,{'changed':!![],'level':_0x24ae0e};}else _0x8431b=0x0,_0x1873e5=0x0;}return{'changed':![],'level':_0x24ae0e};}};}return okdbIntakeGate={'createIntakeGate':_0x59293d},okdbIntakeGate;}var okdbQueueLoadHandler,hasRequiredOkdbQueueLoadHandler;function requireOkdbQueueLoadHandler(){if(hasRequiredOkdbQueueLoadHandler)return okdbQueueLoadHandler;hasRequiredOkdbQueueLoadHandler=0x1;function _0x9b1cd9(_0x219665,_0x30ab2f){const _0x9372a9=_0x3fcd,_0x1f8644=commonjsRequire(_0x219665);if(_0x30ab2f&&_0x30ab2f!==_0x9372a9(0x1f5)){const _0xc9346=_0x1f8644?.[_0x30ab2f];if(typeof _0xc9346!=='function')throw new Error(_0x9372a9(0x20b)+_0x30ab2f);return _0xc9346;}if(typeof _0x1f8644===_0x9372a9(0x233))return _0x1f8644;if(typeof _0x1f8644?.[_0x9372a9(0x1f5)]===_0x9372a9(0x233))return _0x1f8644[_0x9372a9(0x1f5)];throw new Error(_0x9372a9(0x24f));}return okdbQueueLoadHandler={'loadHandler':_0x9b1cd9},okdbQueueLoadHandler;}var okdbFunctionsSandboxHost,hasRequiredOkdbFunctionsSandboxHost;function requireOkdbFunctionsSandboxHost(){const _0x2f3b32=_0x275d88;if(hasRequiredOkdbFunctionsSandboxHost)return okdbFunctionsSandboxHost;hasRequiredOkdbFunctionsSandboxHost=0x1;const _0x549994=require$$0$1,{Worker:_0x5aa049}=require$$1,_0x55000f=_0x549994[_0x2f3b32(0x271)](__dirname,'okdb-functions-sandbox-worker.js'),_0x374141=0x100,_0x54e465=0x3e8;function _0x14900d(_0x3c8ffe,_0x425476){const _0x3a5b30=_0x2f3b32,_0x7be452=new Error(_0x3c8ffe);return _0x7be452[_0x3a5b30(0x25e)]=_0x425476,_0x7be452;}class _0x34bbf2{constructor({rootPath:_0x426c15,memoryMb:_0x13c2f1,maxConcurrency:_0x1e7a57,idleMs:_0x45e585,graceMs:_0xc73f9b,onThreadStats:_0xf245ea,log:_0x2998c8}={}){const _0x130c48=_0x2f3b32;if(!_0x426c15)throw new Error(_0x130c48(0x28a));this[_0x130c48(0x2ab)]=_0x426c15,this[_0x130c48(0x206)]=Math[_0x130c48(0x270)](0x20,Math['floor'](_0x13c2f1??_0x374141)),this[_0x130c48(0x213)]=Math[_0x130c48(0x270)](0x1,Number(process.env.OKDB_FN_SANDBOX_CONCURRENCY)||_0x1e7a57||0x4),this['idleMs']=Math['max'](0x3e8,Number(process.env.OKDB_FN_SANDBOX_IDLE_MS)||_0x45e585||0x7530),this['graceMs']=Math['max'](0x64,Number(process.env.OKDB_FN_SANDBOX_GRACE_MS)||_0xc73f9b||0x5dc),this[_0x130c48(0x268)]=_0xf245ea??null,this[_0x130c48(0x1a2)]=_0x2998c8??null,this[_0x130c48(0x2a3)]=new Map(),this[_0x130c48(0x1c2)]=![];}[_0x2f3b32(0x225)](){const _0x200d0a=_0x2f3b32;let _0x4dc506=0x0;for(const _0x279ff0 of this[_0x200d0a(0x2a3)]['values']())_0x4dc506+=_0x279ff0[_0x200d0a(0x1b7)][_0x200d0a(0x2b5)];return _0x4dc506;}['_tierFor'](){const _0x4fa5c7=_0x2f3b32;return this[_0x4fa5c7(0x206)];}[_0x2f3b32(0x28d)](_0xdc0173){const _0x511c8d=_0x2f3b32;let _0x41c4f9=this[_0x511c8d(0x2a3)][_0x511c8d(0x23b)](_0xdc0173);if(_0x41c4f9)return _0x41c4f9;const _0xe18d5b=new _0x5aa049(_0x55000f,{'workerData':{'rootPath':this[_0x511c8d(0x2ab)]},'stdout':!![],'stderr':!![]});_0xe18d5b[_0x511c8d(0x1ec)]?.[_0x511c8d(0x1c1)](),_0xe18d5b['stderr']?.[_0x511c8d(0x1c1)](),_0xe18d5b[_0x511c8d(0x2b6)]?.();let _0x66cba4;const _0x46a4f1=new Promise((_0x5522aa,_0x4c8aae)=>{const _0xe64233=_0x511c8d,_0x1063e2=(_0x596b15,_0x424ded)=>{const _0x57e77b=_0x3fcd;_0x41c4f9['readySettled']=!![],_0xe18d5b['off'](_0x57e77b(0x283),_0x469b9c),_0x596b15(_0x424ded);},_0x469b9c=_0x18497d=>{const _0x5bdab4=_0x3fcd;if(_0x18497d?.[_0x5bdab4(0x1ed)]===_0x5bdab4(0x1c6))_0x1063e2(_0x5522aa);else{if(_0x18497d?.[_0x5bdab4(0x1ed)]===_0x5bdab4(0x281))_0x1063e2(_0x4c8aae,_0x14900d(_0x18497d[_0x5bdab4(0x2a4)]?.[_0x5bdab4(0x283)]??'sandbox\x20failed\x20to\x20boot',_0x5bdab4(0x253)));}};_0x66cba4=_0x3ed5ad=>_0x1063e2(_0x4c8aae,_0x3ed5ad),_0xe18d5b['on'](_0xe64233(0x283),_0x469b9c);});return _0x41c4f9={'worker':_0xe18d5b,'inflight':new Map(),'idleTimer':null,'readySettled':![],'rejectReady':_0x66cba4,'ready':_0x46a4f1},_0x41c4f9[_0x511c8d(0x1c6)][_0x511c8d(0x252)](()=>{}),this[_0x511c8d(0x2a3)][_0x511c8d(0x1be)](_0xdc0173,_0x41c4f9),_0xe18d5b['on'](_0x511c8d(0x283),_0x4889f2=>this[_0x511c8d(0x246)](_0xdc0173,_0x41c4f9,_0x4889f2)),_0xe18d5b['on']('error',_0x38eb05=>{const _0x381e9b=_0x511c8d,_0x410771=_0x38eb05?.[_0x381e9b(0x25e)]===_0x381e9b(0x259);this[_0x381e9b(0x258)](_0xdc0173,_0x41c4f9,_0x410771?_0x14900d(_0x381e9b(0x22f)+_0xdc0173+_0x381e9b(0x218),_0x381e9b(0x1ac)):_0x14900d('function\x20sandbox\x20error:\x20'+(_0x38eb05?.[_0x381e9b(0x283)]??_0x38eb05),_0x381e9b(0x253)));}),_0xe18d5b['on'](_0x511c8d(0x2b0),_0x4d974b=>{const _0x4d6fe9=_0x511c8d;this[_0x4d6fe9(0x258)](_0xdc0173,_0x41c4f9,_0x14900d('function\x20sandbox\x20exited\x20(code\x20'+_0x4d974b+')',_0x4d6fe9(0x253)));}),_0x41c4f9;}[_0x2f3b32(0x246)](_0x163362,_0x48d7bf,_0x5c42cb){const _0x9e561b=_0x2f3b32;if(!_0x5c42cb||typeof _0x5c42cb!==_0x9e561b(0x1a4))return;if(_0x5c42cb[_0x9e561b(0x1ed)]==='stats'){this[_0x9e561b(0x268)]?.(_0x9e561b(0x238)+_0x163362,{'heapUsed':_0x5c42cb[_0x9e561b(0x294)]??0x0});return;}const _0x5dfcd6=_0x5c42cb[_0x9e561b(0x20e)]!=null?_0x48d7bf[_0x9e561b(0x1b7)][_0x9e561b(0x23b)](_0x5c42cb[_0x9e561b(0x20e)]):null;if(!_0x5dfcd6)return;if(_0x5c42cb[_0x9e561b(0x1ed)]===_0x9e561b(0x1a2)){_0x5dfcd6[_0x9e561b(0x2c1)][_0x9e561b(0x284)](_0x5c42cb[_0x9e561b(0x1ad)]);return;}if(_0x5c42cb[_0x9e561b(0x1ed)]===_0x9e561b(0x236)||_0x5c42cb[_0x9e561b(0x1ed)]===_0x9e561b(0x2a4))_0x48d7bf[_0x9e561b(0x1b7)][_0x9e561b(0x27e)](_0x5c42cb['requestId']),clearTimeout(_0x5dfcd6[_0x9e561b(0x23d)]),_0x5dfcd6[_0x9e561b(0x29b)]({'message':_0x5c42cb,'logs':_0x5dfcd6[_0x9e561b(0x2c1)]}),this[_0x9e561b(0x1ce)](_0x163362,_0x48d7bf);else _0x5dfcd6['onEmit']&&_0x5dfcd6[_0x9e561b(0x18c)](_0x5c42cb);}async[_0x2f3b32(0x1c7)](_0x60b654,{onEmit:_0x116a66}={}){const _0x43fb1a=_0x2f3b32;if(this[_0x43fb1a(0x1c2)])throw _0x14900d(_0x43fb1a(0x2c2),'FUNCTION_SANDBOX_EXIT');const _0x234855=this[_0x43fb1a(0x205)](_0x60b654),_0x5f479c=this[_0x43fb1a(0x28d)](_0x234855);return _0x5f479c['idleTimer']&&(clearTimeout(_0x5f479c[_0x43fb1a(0x237)]),_0x5f479c[_0x43fb1a(0x237)]=null),await _0x5f479c[_0x43fb1a(0x1c6)],new Promise((_0x4e25ad,_0x5c2df7)=>{const _0x2dfc8f=_0x43fb1a,_0x2de8ce=Math[_0x2dfc8f(0x270)](0x1,_0x60b654['runtime']?.[_0x2dfc8f(0x1fd)]??_0x54e465),_0x453308={'resolve':_0x4e25ad,'reject':_0x5c2df7,'logs':[],'onEmit':_0x116a66??null,'cancelled':![],'watchdog':setTimeout(()=>{const _0x4d2376=_0x2dfc8f;this[_0x4d2376(0x19b)](_0x234855,_0x5f479c,_0x60b654['requestId'],_0x14900d(_0x4d2376(0x220)+_0x2de8ce+_0x4d2376(0x2b9)+this[_0x4d2376(0x229)]+_0x4d2376(0x1c8),_0x453308[_0x4d2376(0x1e0)]?'FUNCTION_CANCELLED':'FUNCTION_TIMEOUT'));},_0x2de8ce+this[_0x2dfc8f(0x229)])};if(_0x453308[_0x2dfc8f(0x23d)][_0x2dfc8f(0x2b6)])_0x453308['watchdog'][_0x2dfc8f(0x2b6)]();_0x5f479c['inflight'][_0x2dfc8f(0x1be)](_0x60b654[_0x2dfc8f(0x20e)],_0x453308),_0x5f479c['worker'][_0x2dfc8f(0x1f4)]({'type':_0x2dfc8f(0x1c7),'job':_0x60b654});});}[_0x2f3b32(0x1fc)](_0x4052b5){const _0x405b83=_0x2f3b32;for(const [_0xe69efe,_0x25cfe9]of this['_tiers']){const _0x4c5de2=_0x25cfe9[_0x405b83(0x1b7)][_0x405b83(0x23b)](_0x4052b5);if(!_0x4c5de2)continue;if(_0x4c5de2[_0x405b83(0x1e0)])return!![];_0x4c5de2['cancelled']=!![],_0x25cfe9[_0x405b83(0x23f)][_0x405b83(0x1f4)]({'type':'cancel','requestId':_0x4052b5}),clearTimeout(_0x4c5de2[_0x405b83(0x23d)]),_0x4c5de2[_0x405b83(0x23d)]=setTimeout(()=>{const _0x2f6fe8=_0x405b83;this[_0x2f6fe8(0x19b)](_0xe69efe,_0x25cfe9,_0x4052b5,_0x14900d(_0x2f6fe8(0x257),_0x2f6fe8(0x1f3)));},this[_0x405b83(0x229)]);if(_0x4c5de2['watchdog'][_0x405b83(0x2b6)])_0x4c5de2[_0x405b83(0x23d)][_0x405b83(0x2b6)]();return!![];}return![];}[_0x2f3b32(0x19b)](_0xe85e34,_0x49852e,_0x54bb10,_0x8ca10b){const _0x56be72=_0x2f3b32;for(const [_0x830f91,_0x44e8dd]of _0x49852e['inflight']){clearTimeout(_0x44e8dd['watchdog']),_0x44e8dd[_0x56be72(0x196)](_0x830f91===_0x54bb10?_0x8ca10b:_0x14900d(_0x56be72(0x235),_0x56be72(0x253)));}_0x49852e[_0x56be72(0x1b7)][_0x56be72(0x1da)](),this[_0x56be72(0x2a9)](_0xe85e34,_0x49852e);}[_0x2f3b32(0x258)](_0x20a137,_0x1062ef,_0x1e362e){const _0x5ac98f=_0x2f3b32;if(this['_tiers'][_0x5ac98f(0x23b)](_0x20a137)!==_0x1062ef)return;if(!_0x1062ef['readySettled'])_0x1062ef[_0x5ac98f(0x227)]?.(_0x1e362e);for(const [,_0x4fd045]of _0x1062ef[_0x5ac98f(0x1b7)]){clearTimeout(_0x4fd045[_0x5ac98f(0x23d)]),_0x4fd045[_0x5ac98f(0x196)](_0x1e362e);}_0x1062ef[_0x5ac98f(0x1b7)][_0x5ac98f(0x1da)](),this['_dropTier'](_0x20a137,_0x1062ef);}['_dropTier'](_0x41d4ab,_0xd491fa){const _0x28ce67=_0x2f3b32;if(this[_0x28ce67(0x2a3)]['get'](_0x41d4ab)===_0xd491fa)this['_tiers']['delete'](_0x41d4ab);if(_0xd491fa[_0x28ce67(0x237)])clearTimeout(_0xd491fa['idleTimer']);this[_0x28ce67(0x268)]?.('fn-sandbox:'+_0x41d4ab,null),_0xd491fa['worker'][_0x28ce67(0x2bc)]()[_0x28ce67(0x252)](()=>{});}[_0x2f3b32(0x1ce)](_0x593ef4,_0x16ca37){const _0x5a1d92=_0x2f3b32;if(_0x16ca37[_0x5a1d92(0x1b7)][_0x5a1d92(0x2b5)]>0x0||_0x16ca37[_0x5a1d92(0x237)])return;_0x16ca37['idleTimer']=setTimeout(()=>this[_0x5a1d92(0x2a9)](_0x593ef4,_0x16ca37),this[_0x5a1d92(0x280)]);if(_0x16ca37[_0x5a1d92(0x237)][_0x5a1d92(0x2b6)])_0x16ca37[_0x5a1d92(0x237)]['unref']();}[_0x2f3b32(0x29e)](){const _0x4bb180=_0x2f3b32;for(const [_0x26ede3,_0x453947]of[...this[_0x4bb180(0x2a3)]]){this[_0x4bb180(0x258)](_0x26ede3,_0x453947,_0x14900d('sandbox\x20recycled',_0x4bb180(0x253)));}}async[_0x2f3b32(0x1d6)](){const _0x5efd41=_0x2f3b32;this[_0x5efd41(0x1c2)]=!![],this[_0x5efd41(0x29e)]();}}return okdbFunctionsSandboxHost={'SandboxHost':_0x34bbf2,'SANDBOX_ENTRY':_0x55000f},okdbFunctionsSandboxHost;}var hasRequiredOkdbWorkerChild;function requireOkdbWorkerChild(){const _0x328e3b=_0x275d88;if(hasRequiredOkdbWorkerChild)return okdbWorkerChild$1;hasRequiredOkdbWorkerChild=0x1;const _0x16a176=require$$0$1;function _0x34a535(_0x34a0eb){const _0x23554d=_0x3fcd;try{if(typeof process[_0x23554d(0x1e8)]===_0x23554d(0x233))process[_0x23554d(0x1e8)](_0x34a0eb);}catch{}}let _0x3e9c98=![],_0x1f69bb=null;async function _0x1bd3b1(_0x288f2c,_0x4ae721){const _0x316c79=_0x3fcd;if(_0x3e9c98)return;_0x3e9c98=!![];try{await _0x1f69bb?.['stop']?.();}catch{}const _0x15853a=setTimeout(()=>process[_0x316c79(0x2b0)](_0x288f2c),0xbb8);if(typeof _0x15853a['unref']===_0x316c79(0x233))_0x15853a['unref']();try{await _0x4ae721?.[_0x316c79(0x2aa)]?.();}catch{}process['exit'](_0x288f2c);}function _0x453185(_0x425760,_0x43723c,_0x22f8b8=null){const _0x247b67=_0x3fcd,_0x361de3=require$$1$1;let _0x3d3007=process[_0x247b67(0x1f1)](),_0x3c97be=Date[_0x247b67(0x247)]();const _0x4f60ba=()=>{const _0x45fd38=_0x247b67;try{const _0x259c19=[];for(const [_0x3ce171,_0x49de41]of _0x43723c[_0x45fd38(0x234)]){if(_0x3ce171[_0x45fd38(0x22d)]('~'))continue;for(const _0x52a1fd of _0x49de41[_0x45fd38(0x21a)][_0x45fd38(0x24c)]())_0x259c19[_0x45fd38(0x284)]({..._0x52a1fd,'env':_0x3ce171});}return _0x259c19['length']>0x0?{'processors':_0x259c19}:null;}catch{return null;}},_0x4f43da=()=>{const _0xde47=_0x247b67;if(_0x3e9c98)return;const _0x128f15=Date[_0xde47(0x247)](),_0x51cb2d=process[_0xde47(0x1f1)](),_0x1c148f=(_0x128f15-_0x3c97be)*0x3e8,_0x23d73c=_0x51cb2d[_0xde47(0x1ae)]-_0x3d3007[_0xde47(0x1ae)]+(_0x51cb2d[_0xde47(0x190)]-_0x3d3007[_0xde47(0x190)]),_0x5035c3=_0x1c148f>0x0?Math['min'](0x64,Math[_0xde47(0x23c)](_0x23d73c/(_0x1c148f*(_0x361de3['cpus']()[_0xde47(0x23e)]||0x1))*0x64)):0x0;_0x3d3007=_0x51cb2d,_0x3c97be=_0x128f15;const _0x4d7b35=process[_0xde47(0x243)]();_0x425760({'type':_0xde47(0x1f7),'stats':{'rss':_0x4d7b35[_0xde47(0x203)],'heapUsed':_0x4d7b35[_0xde47(0x294)],'heapTotal':_0x4d7b35[_0xde47(0x209)],'external':_0x4d7b35[_0xde47(0x202)],'cpuPct':_0x5035c3,'cpuWindowMs':Math[_0xde47(0x23c)](_0x1c148f/0x3e8)||null,..._0x22f8b8?.()??{}},'processing':_0x4f60ba()});},_0x509020=Math['max'](0x3e8,Number(process.env.OKDB_STATS_INTERVAL_MS)||0x1388),_0x277efe=setInterval(_0x4f43da,_0x509020);if(typeof _0x277efe[_0x247b67(0x2b6)]===_0x247b67(0x233))_0x277efe[_0x247b67(0x2b6)]();}process['on'](_0x328e3b(0x1b0),_0x3a0915=>{const _0x258ca0=_0x328e3b;_0x34a535({'type':_0x258ca0(0x212),'msg':_0x258ca0(0x26b)+(_0x3a0915?.[_0x258ca0(0x283)]??_0x3a0915)});});async function _0x13d282(){const _0x55f329=_0x328e3b,_0x2fd1d5=await new Promise((_0x3644b0,_0xbdb00a)=>{const _0x500fcf=_0x3fcd,_0x2b3ddb=_0xf98c32=>{const _0x5ef6c6=_0x3fcd;_0xf98c32?.[_0x5ef6c6(0x1ed)]===_0x5ef6c6(0x282)&&(process[_0x5ef6c6(0x261)](_0x5ef6c6(0x283),_0x2b3ddb),_0x3644b0(_0xf98c32));};process['on'](_0x500fcf(0x283),_0x2b3ddb);const _0x1459c1=setTimeout(()=>{const _0x1705ea=_0x500fcf;process[_0x1705ea(0x261)](_0x1705ea(0x283),_0x2b3ddb),_0xbdb00a(new Error(_0x1705ea(0x210)));},0x2710);if(typeof _0x1459c1['unref']===_0x500fcf(0x233))_0x1459c1[_0x500fcf(0x2b6)]();}),{rootPath:_0xa5a48f,slot:_0x2d9485,supervisorKey:_0x5f96e2}=_0x2fd1d5,_0x5ecd13=commonjsRequire(_0x16a176[_0x55f329(0x271)](__dirname,'..',_0x55f329(0x22b))),{EVENTS:_0x2e5d86}=requireOkdbEnums(),_0x167555=new _0x5ecd13(_0xa5a48f,{'engines':![],'http':![],'asyncProcessors':!![],'compaction':_0x55f329(0x242),'envs':_0x55f329(0x1e7),'auth':{'open':!![]},'processing':_0x55f329(0x2a8)});{const _0x5abf06={'debug':0x0,'info':0x1,'warn':0x2,'error':0x3},_0x160a78=_0x5abf06[process.env.OKDB_WORKERS_LOG_LEVEL]??_0x5abf06[_0x55f329(0x212)];_0x167555[_0x55f329(0x1a2)][_0x55f329(0x2a0)]?.(),_0x167555['log'][_0x55f329(0x2c0)](_0x24a3a1=>{const _0x522a5e=_0x55f329;if((_0x5abf06[_0x24a3a1[_0x522a5e(0x298)]]??0x1)<_0x160a78)return;_0x34a535({'type':_0x522a5e(0x1a2),'entry':_0x24a3a1});});}try{await _0x167555[_0x55f329(0x1f9)]();}catch(_0x183785){_0x34a535({'type':_0x55f329(0x2a4),'error':_0x55f329(0x1ff)+_0x183785['message']}),process[_0x55f329(0x2b0)](0x1);return;}const _0x3a529e=Math[_0x55f329(0x270)](0x4,Number(process.env.OKDB_WORKERS_ENV_CACHE)||0x40),_0x5787bb=new Map(),_0x403685=new Set();function _0x2570e2(_0x3260bb){const _0x31f7b3=_0x55f329;try{for(const _0xe89462 of _0x3260bb[_0x31f7b3(0x21a)]?.['_registrations']?.[_0x31f7b3(0x249)]()??[]){if(_0xe89462[_0x31f7b3(0x18f)]?.[_0x31f7b3(0x230)]?.())return!![];}}catch{}return![];}function _0x197315(_0x12f9cb,_0x414506){const _0x2124bb=_0x55f329;if(_0x403685[_0x2124bb(0x1d4)](_0x12f9cb))return!![];if(_0x2570e2(_0x414506))return!![];for(const [,_0x45d4c7]of _0x411e51){if(_0x45d4c7?.[_0x2124bb(0x1a5)]===_0x12f9cb)return!![];}return![];}async function _0x302423(_0x4784b1,_0x5c2965){const _0xe49c65=_0x55f329;for(const _0x3120b9 of[..._0x167555['fts'][_0xe49c65(0x295)]?.[_0xe49c65(0x277)]?.()??[]]){if(!_0x3120b9[_0xe49c65(0x22d)](_0x4784b1+':'))continue;const _0x27c9d2=_0x167555[_0xe49c65(0x265)][_0xe49c65(0x295)][_0xe49c65(0x23b)](_0x3120b9);_0x167555[_0xe49c65(0x265)][_0xe49c65(0x295)][_0xe49c65(0x27e)](_0x3120b9);try{await _0x27c9d2?.();}catch{}}try{await _0x5c2965[_0xe49c65(0x21a)]?.[_0xe49c65(0x260)]?.();}catch{}}async function _0x11b83b(_0x450b99){const _0x26fdb8=_0x55f329,_0x3584f8=_0x5787bb['get'](_0x450b99);if(!_0x3584f8)return;_0x5787bb['delete'](_0x450b99),await _0x302423(_0x450b99,_0x3584f8);try{await _0x3584f8['timeMachine']?.[_0x26fdb8(0x1d6)]?.();}catch{}try{await _0x167555['fts'][_0x26fdb8(0x1f0)]?.(_0x450b99);}catch{}_0x167555[_0x26fdb8(0x234)][_0x26fdb8(0x27e)](_0x450b99);try{await _0x3584f8[_0x26fdb8(0x2aa)]();}catch{}}async function _0x3c9051(_0x202526){const _0x5aad65=_0x55f329;if(_0x5787bb[_0x5aad65(0x1d4)](_0x202526)){const _0xd2ed13=_0x5787bb[_0x5aad65(0x23b)](_0x202526);return _0x5787bb['delete'](_0x202526),_0x5787bb[_0x5aad65(0x1be)](_0x202526,_0xd2ed13),_0xd2ed13;}const _0x10b868=_0x167555[_0x5aad65(0x234)][_0x5aad65(0x23b)](_0x202526);if(_0x10b868&&!_0x10b868[_0x5aad65(0x25f)])return _0x10b868;if(_0x5787bb['size']>=_0x3a529e)for(const [_0x53f91d,_0x5e73d7]of _0x5787bb){if(!_0x197315(_0x53f91d,_0x5e73d7)){await _0x11b83b(_0x53f91d);break;}}const _0x4e88bd=await _0x167555[_0x5aad65(0x20c)](_0x202526);return _0x5787bb['set'](_0x202526,_0x4e88bd),_0x4e88bd;}_0x167555['events']['on'](_0x2e5d86[_0x55f329(0x21d)],()=>{const _0x4aadc3=_0x55f329;(async()=>{for(const [_0x30bfd3,_0x35d438]of[..._0x5787bb]){if(!_0x197315(_0x30bfd3,_0x35d438))await _0x11b83b(_0x30bfd3);}})()[_0x4aadc3(0x252)](()=>{});});const _0xc54753=setInterval(()=>{const _0x29e4e2=_0x55f329;if(_0x3e9c98)return;for(const [,_0x520fb6]of _0x167555['_envs']){try{_0x520fb6[_0x29e4e2(0x1e6)]?.();}catch{}}},0xc8);if(typeof _0xc54753['unref']===_0x55f329(0x233))_0xc54753['unref']();process['on'](_0x55f329(0x251),()=>_0x1bd3b1(0x0,_0x167555));if(process[_0x55f329(0x21e)]!==_0x55f329(0x19f)){const _0x40e029=setInterval(()=>{const _0xf10a34=_0x55f329;if(process[_0xf10a34(0x214)]===0x1)_0x1bd3b1(0x0,_0x167555);},0x7d0);if(typeof _0x40e029['unref']===_0x55f329(0x233))_0x40e029[_0x55f329(0x2b6)]();}process['on']('message',_0x18a5c6=>{const _0xc4b97b=_0x55f329;if(_0x18a5c6?.['type']===_0xc4b97b(0x1d6))_0x1bd3b1(0x0,_0x167555);});const {LOOP:_0x39b1b8}=requireOkdbLoopMonitor(),{createIntakeGate:_0x4422a4}=requireOkdbIntakeGate(),_0x224253=Number(process.env.OKDB_WORKERS_MAX_LEASES)||0x20,_0xdd52e9=Number(process.env.OKDB_WORKERS_LAG_GATE_MS)||0xc8,_0x4b384e=Number(process.env.OKDB_WORKERS_WEDGE_MS)||0x7530,_0x1c225e=_0x4422a4({'gateMs':_0xdd52e9});_0x39b1b8[_0x55f329(0x1fe)](({p99Ms:_0x5c7406,maxMs:_0x592db2})=>{const _0x330d83=_0x55f329;_0x592db2>_0x4b384e&&_0x34a535({'type':_0x330d83(0x285),'maxMs':_0x592db2});const {changed:_0x31110d,level:_0x4d4d4f}=_0x1c225e[_0x330d83(0x1fe)](_0x5c7406);if(_0x31110d)_0x34a535({'type':'intake','level':_0x4d4d4f,'p99Ms':_0x5c7406});});const {loadHandler:_0x10d862}=requireOkdbQueueLoadHandler(),_0x411e51=new Map();let _0x3898c9=![],_0x12e641={'defsSeen':-0x1,'lastError':null,'at':0x0};const _0x33cd9f=new Set(),_0x2ab6df=(_0x4abdca,_0x94832e)=>{const _0x226d08=_0x55f329,_0x585676=_0x4abdca+'::'+_0x94832e;if(_0x33cd9f[_0x226d08(0x1d4)](_0x585676))return;_0x33cd9f[_0x226d08(0x2b7)](_0x585676),_0x34a535({'type':'warn','msg':_0x226d08(0x29d)+_0x4abdca+'\x20—\x20'+_0x94832e});},_0x29990d={'name':'queue','cost':_0x55f329(0x1d3),'inFlight':()=>_0x411e51['size'],'detail':()=>({'consumers':[..._0x411e51['keys']()],'tick':_0x12e641}),async 'tick'(){const _0x368aee=_0x55f329;if(_0x3898c9||_0x3e9c98)return;_0x3898c9=!![];try{const _0x3eef53=_0x167555[_0x368aee(0x279)][_0x368aee(0x27b)]?.('queue-worker')??[];_0x12e641={'defsSeen':_0x3eef53['length'],'lastError':null,'at':Date[_0x368aee(0x247)]()};const _0x28cf6a=new Set();for(const {key:_0xdc3b05,value:_0x357cff}of _0x3eef53){if(!_0x357cff||_0x357cff[_0x368aee(0x26c)]===![])continue;_0x28cf6a[_0x368aee(0x2b7)](_0xdc3b05);const _0x4edfed=_0x411e51[_0x368aee(0x23b)](_0xdc3b05);if(_0x4edfed){if(_0x4edfed['version']===_0x357cff[_0x368aee(0x19a)])continue;_0x411e51[_0x368aee(0x27e)](_0xdc3b05);try{await _0x4edfed[_0x368aee(0x23f)]?.['stop']?.();}catch{}}const _0x3cc472=_0x357cff[_0x368aee(0x1a5)]??_0xdc3b05['split']('::')[0x0];let _0x47e9f7;try{_0x47e9f7=await _0x3c9051(_0x3cc472);}catch(_0xe13fda){_0x2ab6df(_0xdc3b05,'env\x20open\x20failed:\x20'+_0xe13fda?.[_0x368aee(0x283)]);continue;}if(!_0x47e9f7?.[_0x368aee(0x1d5)]){_0x2ab6df(_0xdc3b05,_0x368aee(0x245));continue;}let _0x4e1d98;try{_0x4e1d98=_0x10d862(_0x357cff[_0x368aee(0x2a7)],_0x357cff[_0x368aee(0x288)]);}catch(_0x5f1b72){_0x2ab6df(_0xdc3b05,_0x368aee(0x219)+_0x5f1b72?.[_0x368aee(0x283)]);continue;}let _0x575df7;try{_0x575df7=_0x47e9f7['queue'][_0x368aee(0x28e)](_0x357cff[_0x368aee(0x293)]??_0xdc3b05[_0x368aee(0x296)]('::')[0x1],_0x4e1d98,_0x357cff[_0x368aee(0x1ee)]??{});}catch(_0x3d9b4f){_0x2ab6df(_0xdc3b05,_0x368aee(0x1d0)+_0x3d9b4f?.[_0x368aee(0x283)]);continue;}_0x411e51['set'](_0xdc3b05,{'worker':_0x575df7,'version':_0x357cff['version'],'envName':_0x3cc472});}for(const [_0x58661f,_0x291bfd]of[..._0x411e51]){if(!_0x28cf6a['has'](_0x58661f)){_0x411e51[_0x368aee(0x27e)](_0x58661f),_0x34a535({'type':_0x368aee(0x212),'msg':'queue\x20consumer\x20stopped\x20(def\x20deregistered):\x20'+_0x58661f});try{await _0x291bfd['worker']?.[_0x368aee(0x1d6)]?.();}catch{}}}}catch(_0x40731b){_0x12e641[_0x368aee(0x262)]=_0x40731b?.[_0x368aee(0x283)]??String(_0x40731b);throw _0x40731b;}finally{_0x3898c9=![];}}};let _0x4afc6e;{const {SandboxHost:_0x41943f}=requireOkdbFunctionsSandboxHost(),_0x554414=_0x167555[_0x55f329(0x189)][_0x55f329(0x221)](_0x55f329(0x25b),{'dupSort':![]}),_0x2e3d7b=_0x167555[_0x55f329(0x189)][_0x55f329(0x221)]('~fn:responses',{'dupSort':![]}),_0x3efdfd=Number(process.env.OKDB_FN_STALE_MS)||0xea60,_0x94eec6=new _0x41943f({'rootPath':_0xa5a48f,'log':_0x167555[_0x55f329(0x1a2)],'onThreadStats':(_0x40010a,_0x1910c4)=>{const _0x116555=_0x55f329;if(_0x1910c4)_0x167555[_0x116555(0x279)]?.[_0x116555(0x26e)]?.(_0x40010a,_0x1910c4);else _0x167555[_0x116555(0x279)]?.[_0x116555(0x267)]?.(_0x40010a);}});_0x1f69bb=_0x94eec6;const _0x48053d=new Set(),_0x30df13=(_0x296918,_0x2a3f12)=>{const _0x8b82c1=_0x55f329,_0x3ba75d=_0x554414[_0x8b82c1(0x23b)](_0x296918);if(!_0x3ba75d||_0x3ba75d[_0x8b82c1(0x1b4)]===_0x8b82c1(0x1e0)){try{_0x554414[_0x8b82c1(0x1a7)](_0x296918);}catch{}return;}_0x2e3d7b[_0x8b82c1(0x18d)](_0x296918,_0x2a3f12);try{_0x554414[_0x8b82c1(0x1a7)](_0x296918);}catch{}},_0xd78ba0=(_0x286b50,_0x3902e7)=>{const _0x2eef95=_0x55f329;_0x48053d[_0x2eef95(0x2b7)](_0x286b50),_0x94eec6[_0x2eef95(0x1c7)]({..._0x3902e7,'requestId':_0x286b50})[_0x2eef95(0x208)](({message:_0x20d744,logs:_0x1b02eb})=>_0x30df13(_0x286b50,{'message':_0x20d744,'logs':_0x1b02eb}))[_0x2eef95(0x252)](_0x1e55c3=>{const _0x1cee6a=_0x2eef95;if(_0x1e55c3?.[_0x1cee6a(0x25e)]===_0x1cee6a(0x253)){try{const _0x112595=_0x554414['get'](_0x286b50);_0x112595&&_0x112595['state']===_0x1cee6a(0x28c)&&_0x112595[_0x1cee6a(0x1cb)]===process[_0x1cee6a(0x20a)]&&_0x554414[_0x1cee6a(0x18d)](_0x286b50,{..._0x112595,'state':_0x1cee6a(0x193),'requestedAt':Date[_0x1cee6a(0x247)]()});}catch{}return;}_0x30df13(_0x286b50,{'message':{'type':'error','requestId':_0x286b50,'runId':_0x3902e7[_0x1cee6a(0x20f)],'error':{'message':_0x1e55c3?.[_0x1cee6a(0x283)]??String(_0x1e55c3),'code':_0x1e55c3?.['code']??_0x1cee6a(0x25a)},'meta':{'runnerId':_0x1cee6a(0x2ac)+process[_0x1cee6a(0x20a)]}},'logs':[]});})[_0x2eef95(0x27a)](()=>_0x48053d['delete'](_0x286b50));};_0x4afc6e={'name':'fn','cost':_0x55f329(0x1d3),'inFlight':()=>_0x94eec6[_0x55f329(0x225)](),async 'tick'(){const _0x1c9875=_0x55f329;if(_0x3e9c98)return;for(const _0x2eec94 of[..._0x48053d]){const _0x18b740=_0x554414[_0x1c9875(0x23b)](_0x2eec94);if(!_0x18b740||_0x18b740[_0x1c9875(0x1b4)]===_0x1c9875(0x1e0))_0x94eec6[_0x1c9875(0x1fc)](_0x2eec94);}for(const {key:_0x430aa6,value:_0x1ec4bc}of _0x554414[_0x1c9875(0x1ab)]({})){if(_0x3e9c98)break;if(_0x94eec6[_0x1c9875(0x225)]()>=_0x94eec6[_0x1c9875(0x213)])break;if(!_0x1ec4bc||_0x1ec4bc['state']!==_0x1c9875(0x193))continue;if(_0x1ec4bc[_0x1c9875(0x2b4)]&&Date['now']()-_0x1ec4bc[_0x1c9875(0x2b4)]>_0x3efdfd){try{_0x554414['transactionSync'](()=>{const _0x488210=_0x1c9875,_0x1b20fe=_0x554414[_0x488210(0x23b)](_0x430aa6);if(_0x1b20fe?.[_0x488210(0x1b4)]==='pending'&&_0x1b20fe[_0x488210(0x2b4)]&&Date[_0x488210(0x247)]()-_0x1b20fe[_0x488210(0x2b4)]>_0x3efdfd)_0x554414[_0x488210(0x198)](_0x430aa6);});}catch{}continue;}let _0xbe859d=![];_0x554414[_0x1c9875(0x19e)](()=>{const _0x2b2b85=_0x1c9875,_0x435736=_0x554414[_0x2b2b85(0x23b)](_0x430aa6);_0x435736?.[_0x2b2b85(0x1b4)]==='pending'&&(_0x554414[_0x2b2b85(0x274)](_0x430aa6,{..._0x435736,'state':_0x2b2b85(0x28c),'claimedBy':process[_0x2b2b85(0x20a)],'claimedAt':Date['now']()}),_0xbe859d=!![]);});if(!_0xbe859d)continue;_0xd78ba0(_0x430aa6,_0x1ec4bc);}}};}let _0x3a39ca=0x0;const _0x73b1eb=_0x167555[_0x55f329(0x189)][_0x55f329(0x221)](_0x55f329(0x23a),{'dupSort':![]}),_0x223a2a={'name':'bootstrap','cost':'heavy','inFlight':()=>_0x3a39ca,async 'tick'(){const _0xfea844=_0x55f329;if(_0x3e9c98||_0x3a39ca>=0x1)return;const _0x585288=[];try{for(const {key:_0x1ab1de,value:_0x22a249}of _0x73b1eb[_0xfea844(0x1ab)]({})){if(typeof _0x1ab1de===_0xfea844(0x2a5)&&_0x22a249?.[_0xfea844(0x2b3)]&&!_0x22a249[_0xfea844(0x2b3)]['startsWith']('~'))_0x585288['push'](_0x22a249);}}catch{}for(const _0x40a84c of _0x585288){if(_0x3e9c98||_0x3a39ca>=0x1)return;let _0x16b9c9;try{_0x16b9c9=await _0x3c9051(_0x40a84c['env']);}catch{continue;}if(_0x40a84c['kind']===_0xfea844(0x1a8)&&_0x40a84c[_0xfea844(0x226)]){const _0x34ce60=_0x16b9c9['get']?.(_0xfea844(0x29f),_0x40a84c[_0xfea844(0x226)]);if(!_0x34ce60)continue;let _0x2bf69b=![];_0x403685['add'](_0x40a84c[_0xfea844(0x2b3)]);const _0x4803de=_0x16b9c9[_0xfea844(0x21a)][_0xfea844(0x1c3)]({'rowKey':'bootstrap:'+_0x40a84c['cursorKey'],'cursorKey':_0x40a84c[_0xfea844(0x1b2)]},async()=>{const _0x4c7126=_0xfea844;!_0x16b9c9[_0x4c7126(0x22a)][_0x4c7126(0x286)][_0x4c7126(0x1d4)](_0x40a84c[_0x4c7126(0x226)])&&_0x16b9c9[_0x4c7126(0x22a)]['_activateViewStorage'](_0x40a84c['viewName'],_0x34ce60),await _0x16b9c9['views'][_0x4c7126(0x199)](_0x40a84c[_0x4c7126(0x226)],_0x34ce60);},{'onClaimed':()=>{_0x2bf69b=!![],_0x3a39ca++;}})[_0xfea844(0x252)](()=>{})[_0xfea844(0x27a)](()=>{const _0x13d807=_0xfea844;if(_0x2bf69b)_0x3a39ca--;_0x403685[_0x13d807(0x27e)](_0x40a84c[_0x13d807(0x2b3)]);});if(_0x2bf69b)return;await _0x4803de;continue;}try{await _0x167555[_0xfea844(0x265)]['process']({'envs':[_0x40a84c['env']],'types':_0x40a84c[_0xfea844(0x1ed)]?[_0x40a84c['type']]:'*'});}catch{continue;}let _0x2333a5=[];try{_0x2333a5=_0x16b9c9[_0xfea844(0x21a)]['listWorkerBootstrapJobs']();}catch{}for(const _0xba152c of _0x2333a5){if(_0x3e9c98||_0x3a39ca>=0x1)return;let _0x4895f6=![];_0x403685['add'](_0x40a84c[_0xfea844(0x2b3)]);const _0x2fb4aa=_0x16b9c9[_0xfea844(0x21a)][_0xfea844(0x228)](_0xba152c,{'onClaimed':()=>{_0x4895f6=!![],_0x3a39ca++;}})['catch'](()=>{})[_0xfea844(0x27a)](()=>{const _0x771d48=_0xfea844;if(_0x4895f6)_0x3a39ca--;_0x403685['delete'](_0x40a84c[_0x771d48(0x2b3)]);});if(_0x4895f6)return;await _0x2fb4aa;}}}},_0x476855=Math[_0x55f329(0x270)](0x1,Number(process.env.OKDB_WORKERS_PROBE_PER_TICK)||0x2),_0x584e9b=Math[_0x55f329(0x270)](0x1,Number(process.env.OKDB_WORKERS_PROBE_GRACE_TICKS)||0x3);let _0x29031=Math['floor'](Math[_0x55f329(0x2af)]()*0x1000);const _0x50a762=new Set(),_0x3d7808=new Map(),_0x2ac78d=Math['max'](0x3e8,Number(process.env.OKDB_WORKERS_PROBE_COOLDOWN_MS)||0x7530),_0x17b345=new Map(),_0x4c458a={'name':_0x55f329(0x265),'cost':'light','inFlight':()=>{let _0x371735=0x0;for(const [,_0x4662c3]of _0x5787bb)if(_0x2570e2(_0x4662c3))_0x371735++;return _0x371735;},async 'tick'(){const _0x2b8dca=_0x55f329;if(_0x3e9c98)return;const _0x20a37c=_0x167555[_0x2b8dca(0x265)]['listFtsEnvs']();if(_0x20a37c['length']===0x0)return;const _0x590d09=new Map();for(const _0x152827 of _0x20a37c){if(!_0x590d09[_0x2b8dca(0x1d4)](_0x152827['env']))_0x590d09[_0x2b8dca(0x1be)](_0x152827['env'],[]);_0x590d09[_0x2b8dca(0x23b)](_0x152827['env'])['push'](_0x152827[_0x2b8dca(0x1ed)]);}const _0x2e3e5b=[..._0x590d09['keys']()],_0x213292=Date[_0x2b8dca(0x247)](),_0x19b3d0=[];for(const _0x59e433 of _0x50a762){_0x590d09[_0x2b8dca(0x1d4)](_0x59e433)&&!_0x19b3d0[_0x2b8dca(0x19d)](_0x59e433)&&(_0x17b345[_0x2b8dca(0x27e)](_0x59e433),_0x19b3d0[_0x2b8dca(0x284)](_0x59e433));}_0x50a762[_0x2b8dca(0x1da)]();for(let _0x3a27a3=0x0;_0x19b3d0['length']<_0x476855&&_0x3a27a3<_0x2e3e5b['length'];_0x3a27a3++){const _0x2ff9b0=_0x2e3e5b[(_0x29031+_0x3a27a3)%_0x2e3e5b[_0x2b8dca(0x23e)]];if(_0x19b3d0[_0x2b8dca(0x19d)](_0x2ff9b0))continue;if((_0x17b345[_0x2b8dca(0x23b)](_0x2ff9b0)??0x0)>_0x213292)continue;_0x19b3d0[_0x2b8dca(0x284)](_0x2ff9b0);}_0x29031=(_0x29031+_0x476855)%Math[_0x2b8dca(0x270)](0x1,_0x2e3e5b[_0x2b8dca(0x23e)]);for(const _0x251aef of _0x19b3d0){if(_0x3e9c98)return;try{await _0x3c9051(_0x251aef),await _0x167555['fts'][_0x2b8dca(0x28e)]({'envs':[_0x251aef],'types':_0x590d09[_0x2b8dca(0x23b)](_0x251aef)});}catch{}}for(const [_0x507d42,_0x4f14d9]of[..._0x5787bb]){if(_0x197315(_0x507d42,_0x4f14d9)){_0x3d7808[_0x2b8dca(0x27e)](_0x507d42);continue;}const _0x29f2cf=(_0x3d7808[_0x2b8dca(0x23b)](_0x507d42)??0x0)+0x1;_0x29f2cf>=_0x584e9b?(_0x3d7808['delete'](_0x507d42),_0x17b345['set'](_0x507d42,Date[_0x2b8dca(0x247)]()+_0x2ac78d),await _0x11b83b(_0x507d42)):_0x3d7808[_0x2b8dca(0x1be)](_0x507d42,_0x29f2cf);}}};_0x167555[_0x55f329(0x22c)]['on'](_0x2e5d86[_0x55f329(0x278)],_0x53ffd8=>{const _0x29d2c4=_0x55f329,_0x3f12de=_0x53ffd8?.[_0x29d2c4(0x2b3)];if(typeof _0x3f12de===_0x29d2c4(0x2a5)&&_0x3f12de&&!_0x3f12de[_0x29d2c4(0x22d)]('~'))_0x50a762[_0x29d2c4(0x2b7)](_0x3f12de);});const _0x4b9a98=Math[_0x55f329(0x270)](0x64,Number(process.env.OKDB_WORKERS_CLAIM_TICK_MS)||0x3e8),_0x4c3c8f=[_0x4afc6e,_0x29990d,_0x223a2a,_0x4c458a],_0x45c69d=[_0x29990d,_0x223a2a,_0x4c458a];let _0x13f7f2=0x0;const _0x41f70b=_0x147e50=>{const _0x32fdc9=_0x55f329;if(_0x3e9c98||_0x1c225e[_0x32fdc9(0x241)](_0x147e50[_0x32fdc9(0x27f)]))return;_0x147e50[_0x32fdc9(0x1bf)]()[_0x32fdc9(0x252)](()=>{});},_0x2a64d7=setInterval(()=>{const _0x1b76af=_0x55f329;_0x41f70b(_0x4afc6e);for(let _0x222613=0x0;_0x222613<_0x45c69d[_0x1b76af(0x23e)];_0x222613++){_0x41f70b(_0x45c69d[(_0x13f7f2+_0x222613)%_0x45c69d[_0x1b76af(0x23e)]]);}_0x13f7f2=(_0x13f7f2+0x1)%_0x45c69d[_0x1b76af(0x23e)];},_0x4b9a98);if(typeof _0x2a64d7['unref']===_0x55f329(0x233))_0x2a64d7[_0x55f329(0x2b6)]();_0x167555[_0x55f329(0x22c)]['on'](_0x2e5d86[_0x55f329(0x204)],_0x3c82ea=>{const _0x22e0e3=_0x55f329;if(_0x3c82ea?.[_0x22e0e3(0x255)]==='fn')_0x41f70b(_0x4afc6e);else{if(_0x3c82ea?.[_0x22e0e3(0x255)]===_0x22e0e3(0x24b))_0x41f70b(_0x223a2a);else{if(_0x3c82ea?.[_0x22e0e3(0x255)]===_0x22e0e3(0x217))_0x41f70b(_0x29990d);else{if(_0x3c82ea?.[_0x22e0e3(0x255)]===_0x22e0e3(0x264)&&typeof _0x3c82ea[_0x22e0e3(0x215)]===_0x22e0e3(0x2a5)){const _0x5d28f2=_0x3c82ea[_0x22e0e3(0x215)];_0x34a535({'type':'warn','msg':_0x22e0e3(0x1db)+_0x5d28f2+_0x22e0e3(0x263)+_0x5787bb['has'](_0x5d28f2)+')'}),(async()=>{const _0x5a3ce0=_0x22e0e3;for(const [_0x545092,_0x4029a7]of[..._0x411e51]){if(_0x4029a7?.[_0x5a3ce0(0x1a5)]!==_0x5d28f2)continue;_0x411e51[_0x5a3ce0(0x27e)](_0x545092);try{await _0x4029a7[_0x5a3ce0(0x23f)]?.[_0x5a3ce0(0x1d6)]?.();}catch{}}_0x403685[_0x5a3ce0(0x27e)](_0x5d28f2),_0x50a762[_0x5a3ce0(0x27e)](_0x5d28f2),_0x17b345[_0x5a3ce0(0x1be)](_0x5d28f2,Date[_0x5a3ce0(0x247)]()+0x1d4c0),await _0x11b83b(_0x5d28f2),_0x34a535({'type':_0x5a3ce0(0x212),'msg':'env-removed:\x20'+_0x5d28f2+_0x5a3ce0(0x248)});})()['catch'](_0x29553f=>{const _0x209cbe=_0x22e0e3;_0x34a535({'type':_0x209cbe(0x212),'msg':_0x209cbe(0x2a1)+_0x5d28f2+':\x20'+_0x29553f?.['message']});});}}}}});for(const _0x44c68d of _0x4c3c8f)_0x41f70b(_0x44c68d);_0x453185(_0x34a535,_0x167555,()=>({'claims':_0x4c3c8f[_0x55f329(0x1a6)](_0x1acfd1=>({'name':_0x1acfd1[_0x55f329(0x28b)],'inFlight':_0x1acfd1[_0x55f329(0x291)](),'gated':_0x1c225e[_0x55f329(0x241)](_0x1acfd1[_0x55f329(0x27f)]),..._0x1acfd1[_0x55f329(0x1cc)]?{'detail':_0x1acfd1[_0x55f329(0x1cc)]()}:{}})),'envsOpen':_0x167555[_0x55f329(0x234)]['size']})),_0x34a535({'type':_0x55f329(0x1c6),'pid':process[_0x55f329(0x20a)],'slot':_0x2d9485,'supervisorKey':_0x5f96e2,'maxLeases':_0x224253});}return _0x13d282()[_0x328e3b(0x252)](_0x3f43b6=>{const _0x197eb8=_0x328e3b;_0x34a535({'type':_0x197eb8(0x2a4),'error':_0x3f43b6[_0x197eb8(0x283)]}),process[_0x197eb8(0x2b0)](0x1);}),okdbWorkerChild$1;}var okdbWorkerChildExports=requireOkdbWorkerChild(),okdbWorkerChild=getDefaultExportFromCjs(okdbWorkerChildExports);module[_0x275d88(0x1f2)]=okdbWorkerChild;
|
|
1
|
+
'use strict';const _0x3dd697=_0xbb9b;(function(_0x462f68,_0x53d6c1){const _0x3ede54=_0xbb9b,_0x50ec4d=_0x462f68();while(!![]){try{const _0x321e45=parseInt(_0x3ede54(0x1e0))/0x1*(parseInt(_0x3ede54(0x1c4))/0x2)+-parseInt(_0x3ede54(0x1e4))/0x3*(-parseInt(_0x3ede54(0x1ca))/0x4)+-parseInt(_0x3ede54(0x163))/0x5+parseInt(_0x3ede54(0x1ac))/0x6+-parseInt(_0x3ede54(0x23b))/0x7+-parseInt(_0x3ede54(0x142))/0x8*(-parseInt(_0x3ede54(0x170))/0x9)+parseInt(_0x3ede54(0x14f))/0xa;if(_0x321e45===_0x53d6c1)break;else _0x50ec4d['push'](_0x50ec4d['shift']());}catch(_0x3ff2d7){_0x50ec4d['push'](_0x50ec4d['shift']());}}}(_0x1bfc,0xcdfbe));var require$$0$1=require(_0x3dd697(0x1c2)),require$$1$1=require('os'),require$$2=require(_0x3dd697(0x19b)),require$$0=require(_0x3dd697(0x1ad)),require$$1=require(_0x3dd697(0x238));function getDefaultExportFromCjs(_0x53c012){const _0x9bffce=_0x3dd697;return _0x53c012&&_0x53c012[_0x9bffce(0x195)]&&Object[_0x9bffce(0x22f)][_0x9bffce(0x14c)]['call'](_0x53c012,'default')?_0x53c012[_0x9bffce(0x208)]:_0x53c012;}var okdbWorkerChild$1={},okdbEnums,hasRequiredOkdbEnums;function requireOkdbEnums(){const _0x32bbe3=_0x3dd697;if(hasRequiredOkdbEnums)return okdbEnums;hasRequiredOkdbEnums=0x1;const _0x252d4b={'PUT':_0x32bbe3(0x244),'REMOVE':_0x32bbe3(0x159),'INDEX_DROP':'dropIndex','INDEX_REGISTER':'registerIndex','INDEX_RESET':_0x32bbe3(0x20c),'TYPE_REGISTER':_0x32bbe3(0x1b2),'TYPE_DROP':_0x32bbe3(0x1f7),'FTS_REGISTER':_0x32bbe3(0x1da),'FTS_DROP':'dropFts','FTS_RESET':_0x32bbe3(0x137),'SCHEMA_SET':_0x32bbe3(0x1c3),'SCHEMA_DROP':_0x32bbe3(0x1b7),'TTL_SET':_0x32bbe3(0x126),'TTL_CLEAR':'clearTtl'},_0x16024e={'SYSTEM_READY':_0x32bbe3(0x242),'SYSTEM_STOPPED':_0x32bbe3(0x230),'SYSTEM_CLOCK_CHANGE':_0x32bbe3(0x1ec),'SYSTEM_POKE':_0x32bbe3(0x156),'SYSTEM_DRAIN':_0x32bbe3(0x15f),'SYSTEM_TYPE_DROP':_0x32bbe3(0x167),'SYSTEM_PROC':_0x32bbe3(0x194),'SYSTEM_BUS_STATE_CHANGE':_0x32bbe3(0x145),'ITEM_CREATE':_0x32bbe3(0x16b),'ITEM_UPDATE':'item:update','ITEM_REMOVE':_0x32bbe3(0x1f1),'INDEX_RESET':_0x32bbe3(0x1b4),'INDEX_READY':_0x32bbe3(0x189),'INDEX_PROGRESS':_0x32bbe3(0x249),'VIEW_PROGRESS':_0x32bbe3(0x16f),'INDEX_DROP':_0x32bbe3(0x234),'INDEX_REGISTERED':'index:registered','FTS_REGISTERED':'fts:registered','FTS_DROP':'fts:drop','FTS_RESET':_0x32bbe3(0x22a),'SCHEMA_SET':_0x32bbe3(0x196),'SCHEMA_DROP':_0x32bbe3(0x127),'UNIQUE_VIOLATION':'unique:violation','UNIQUE_VIOLATION_RESOLVED':'unique:violation_resolved','REF_VIOLATION':_0x32bbe3(0x1d9),'REF_VIOLATION_RESOLVED':_0x32bbe3(0x130),'SYNC_APPLY':_0x32bbe3(0x131),'TXN_START':_0x32bbe3(0x18c),'TXN_END':_0x32bbe3(0x14d),'TXN_ROLLBACK':_0x32bbe3(0x222),'TYPE_REGISTERED':_0x32bbe3(0x1ee),'TYPE_DROP':_0x32bbe3(0x20f),'ENV_OPENED':_0x32bbe3(0x23e),'ENV_REMOVED':_0x32bbe3(0x1a2),'TTL_EXPIRED':_0x32bbe3(0x1c9),'TTL_SET':_0x32bbe3(0x13d),'TTL_CLEAR':'ttl:clear','LICENSE_INVALID':_0x32bbe3(0x239),'LICENSE_ADDED':'license:added','LICENSE_ACTIVATED':_0x32bbe3(0x1d5),'LICENSE_REMOVED':_0x32bbe3(0x178)},_0x3451cb={'CREATING':'creating','RESETTING':_0x32bbe3(0x1ed),'READY':_0x32bbe3(0x12a),'DROPPING':_0x32bbe3(0x1e3),'WAITING':_0x32bbe3(0x1e6)},_0x5c0750={'CREATED':'created','STARTING':'starting','STARTED':'started','STOPPING':'stopping','STOPPED':_0x32bbe3(0x125)},_0x3c759f={'CREATING':_0x32bbe3(0x210),'READY':_0x32bbe3(0x12a),'HALTED':_0x32bbe3(0x1a8),'STOPPED':_0x32bbe3(0x125),'RESETTING':_0x32bbe3(0x1ed)},_0x2f7226=Object[_0x32bbe3(0x1e8)]({'POKE':'bus:poke','DRAIN':_0x32bbe3(0x1b3),'TYPE_DROP':_0x32bbe3(0x1dc),'PROC':_0x32bbe3(0x205)});return okdbEnums={'BUS_EVENTS':_0x2f7226,'CHANGE_ACTIONS':_0x252d4b,'EVENTS':_0x16024e,'INDEX_STATE':_0x3451cb,'OKDB_STATE':_0x5c0750,'VIEW_STATE':_0x3c759f},okdbEnums;}var okdbLoopMonitor,hasRequiredOkdbLoopMonitor;function requireOkdbLoopMonitor(){const _0xb22bb6=_0x3dd697;if(hasRequiredOkdbLoopMonitor)return okdbLoopMonitor;hasRequiredOkdbLoopMonitor=0x1;const {monitorEventLoopDelay:_0x1a5403,performance:_0x3142d2}=require$$0,_0x3e5138=process.env.OKDB_LOOP_LAG==='1'||process.env.OKDB_LOOP_LAG===_0xb22bb6(0x147),_0x385181=Number(process.env.OKDB_LOOP_LAG_MS)||0x7d0,_0x13d37e=process.env.OKDB_LOOP_LAG_ALL==='1',_0xb9a001=Number(process.env.OKDB_LOOP_LAG_MIN_MS)||0x64;class _0x547e19{constructor(){const _0x351116=_0xb22bb6;this[_0x351116(0x1fc)]=_0x3e5138,this[_0x351116(0x21b)]=new Map(),this['_h']=null,this['_timer']=null,this['_started']=![],this[_0x351116(0x1eb)]=(_0x300518,_0x3ee628)=>process[_0x351116(0x15b)][_0x351116(0x245)](_0x300518+(_0x3ee628?'\x20'+JSON[_0x351116(0x1a7)](_0x3ee628):'')+'\x0a');}[_0xb22bb6(0x211)](){const _0x2b4668=_0xb22bb6;return _0x3142d2[_0x2b4668(0x211)]();}[_0xb22bb6(0x1ea)](_0x4c7b93){const _0x38a58d=_0xb22bb6;if(typeof _0x4c7b93==='function')this[_0x38a58d(0x1eb)]=_0x4c7b93;}[_0xb22bb6(0x17c)](_0x154012,_0x3cf070,_0x492a5a){const _0x11e7ce=_0xb22bb6;if(!this[_0x11e7ce(0x1fc)])return;let _0xacaaec=this[_0x11e7ce(0x21b)]['get'](_0x154012);!_0xacaaec&&(_0xacaaec={'ms':0x0,'count':0x0,'maxMs':0x0,'maxExtra':''},this[_0x11e7ce(0x21b)][_0x11e7ce(0x213)](_0x154012,_0xacaaec)),_0xacaaec['ms']+=_0x3cf070,_0xacaaec[_0x11e7ce(0x1cb)]+=0x1,_0x3cf070>_0xacaaec[_0x11e7ce(0x22d)]&&(_0xacaaec[_0x11e7ce(0x22d)]=_0x3cf070,_0xacaaec['maxExtra']=_0x492a5a||'');}[_0xb22bb6(0x166)](_0x3c01c3){const _0x45d9a6=_0xb22bb6;if(!this[_0x45d9a6(0x1fc)]||this[_0x45d9a6(0x22e)])return;this[_0x45d9a6(0x22e)]=!![];if(_0x3c01c3)this['_log']=_0x3c01c3;this['_h']=_0x1a5403({'resolution':0xa}),this['_h']['enable'](),this['_timer']=setInterval(()=>this[_0x45d9a6(0x123)](),_0x385181);if(this[_0x45d9a6(0x1fb)][_0x45d9a6(0x215)])this[_0x45d9a6(0x1fb)][_0x45d9a6(0x215)]();}['onWindow'](_0x316f3d){const _0x187528=_0xb22bb6;if(!this['_windowCbs'])this[_0x187528(0x1e7)]=new Set();this[_0x187528(0x1e7)][_0x187528(0x122)](_0x316f3d);if(!this['_started'])this['_startAdmission']();}['offWindow'](_0x26ef54){const _0x383af7=_0xb22bb6;this[_0x383af7(0x1e7)]?.['delete'](_0x26ef54);}[_0xb22bb6(0x23a)](){const _0x142f3f=_0xb22bb6;if(this['_admissionStarted'])return;this['_admissionStarted']=!![];!this['_h']&&(this['_h']=_0x1a5403({'resolution':0xa}),this['_h'][_0x142f3f(0x176)]());const _0x223642=_0x385181;this['_admissionTimer']=setInterval(()=>{const _0x287d43=_0x142f3f,_0xcf9b39=this['_h'];if(!_0xcf9b39)return;const _0xeca6d2=_0xcf9b39['percentile'](0x63)/0xf4240,_0x407abc=_0xcf9b39[_0x287d43(0x1bd)]/0xf4240,_0x416c99=_0xcf9b39[_0x287d43(0x197)]/0xf4240;_0xcf9b39[_0x287d43(0x17d)]();if(this[_0x287d43(0x1e7)])for(const _0x294b83 of this[_0x287d43(0x1e7)]){try{_0x294b83({'p99Ms':_0xeca6d2,'maxMs':_0x407abc,'meanMs':_0x416c99,'reportMs':_0x223642});}catch{}}},_0x223642);if(this[_0x142f3f(0x1f6)][_0x142f3f(0x215)])this[_0x142f3f(0x1f6)]['unref']();}[_0xb22bb6(0x123)](){const _0x50e609=_0xb22bb6,_0x3958ed=this['_h'],_0x2ea727=_0x3958ed['max']/0xf4240,_0x354f4b=_0x3958ed['percentile'](0x63)/0xf4240,_0x2bd4d4=_0x3958ed[_0x50e609(0x197)]/0xf4240;_0x3958ed[_0x50e609(0x17d)]();const _0x2be134=[...this[_0x50e609(0x21b)]['entries']()][_0x50e609(0x1a0)](([_0x2ca153,_0x28a1bc])=>({'label':_0x2ca153,..._0x28a1bc}))[_0x50e609(0x226)]((_0x51e82c,_0xf9e110)=>_0xf9e110['ms']-_0x51e82c['ms'])[_0x50e609(0x17e)](0x0,0x8);this[_0x50e609(0x21b)][_0x50e609(0x1b1)]();const _0x5664f7=_0x2be134[_0x50e609(0x1f3)]((_0x9aa93c,_0x378344)=>_0x9aa93c+_0x378344['ms'],0x0),_0x2126b1=_0x2be134[_0x50e609(0x1a0)](_0x4a76ed=>_0x4a76ed[_0x50e609(0x173)]+'='+_0x4a76ed['ms'][_0x50e609(0x1e5)](0x0)+_0x50e609(0x1a6)+_0x4a76ed[_0x50e609(0x1cb)]+(_0x4a76ed[_0x50e609(0x22d)]>0x5?_0x50e609(0x1f4)+_0x4a76ed['maxMs'][_0x50e609(0x1e5)](0x0)+'ms'+(_0x4a76ed[_0x50e609(0x227)]?'\x20'+_0x4a76ed[_0x50e609(0x227)]:'')+')':''));(_0x13d37e||_0x2ea727>=_0xb9a001)&&this['_log'](_0x50e609(0x146)+_0x385181+_0x50e609(0x12d)+_0x2ea727[_0x50e609(0x1e5)](0x0)+_0x50e609(0x1ff)+_0x354f4b[_0x50e609(0x1e5)](0x0)+_0x50e609(0x161)+_0x2bd4d4[_0x50e609(0x1e5)](0x0)+_0x50e609(0x1af)+_0x5664f7[_0x50e609(0x1e5)](0x0)+'ms'+(_0x2126b1[_0x50e609(0x231)]?_0x50e609(0x162)+_0x2126b1[_0x50e609(0x214)]('\x20\x20'):''),{'feature':'loop-lag'});if(this['_windowCbs'])for(const _0x99bf1f of this[_0x50e609(0x1e7)]){try{_0x99bf1f({'p99Ms':_0x354f4b,'maxMs':_0x2ea727,'meanMs':_0x2bd4d4,'reportMs':_0x385181});}catch{}}}[_0xb22bb6(0x1c8)](){const _0xc8d0ee=_0xb22bb6;if(this[_0xc8d0ee(0x1fb)])clearInterval(this['_timer']);if(this['_h'])this['_h'][_0xc8d0ee(0x201)]();this['_timer']=null,this['_h']=null,this[_0xc8d0ee(0x22e)]=![];}}const _0x5a836a=new _0x547e19();if(_0x5a836a[_0xb22bb6(0x1fc)])_0x5a836a['start']();return okdbLoopMonitor={'LOOP':_0x5a836a},okdbLoopMonitor;}function _0xbb9b(_0x2ac425,_0x5b4db6){_0x2ac425=_0x2ac425-0x121;const _0x1bfc67=_0x1bfc();let _0xbb9b3f=_0x1bfc67[_0x2ac425];return _0xbb9b3f;}var okdbIntakeGate,hasRequiredOkdbIntakeGate;function requireOkdbIntakeGate(){if(hasRequiredOkdbIntakeGate)return okdbIntakeGate;hasRequiredOkdbIntakeGate=0x1;const _0x5ef471=0x2,_0x10a603=0x2,_0x438e0f=0x2;function _0x54ee03({gateMs:_0x2d629e}){let _0x41f5f6=0x0,_0x35e4f9=0x0,_0x12f9f3=0x0;return{'level':()=>_0x41f5f6,'blocks'(_0x573fbd){const _0x4682ba=_0xbb9b;if(_0x573fbd===_0x4682ba(0x21a))return![];if(_0x41f5f6>=0x2)return!![];if(_0x41f5f6>=0x1&&_0x573fbd==='heavy')return!![];return![];},'onWindow'(_0x31065c){if(_0x31065c>_0x2d629e){_0x35e4f9++,_0x12f9f3=0x0;if(_0x35e4f9>=_0x5ef471&&_0x41f5f6<_0x438e0f)return _0x41f5f6++,_0x35e4f9=0x0,{'changed':!![],'level':_0x41f5f6};}else{if(_0x31065c<_0x2d629e/0x2){_0x12f9f3++,_0x35e4f9=0x0;if(_0x12f9f3>=_0x10a603&&_0x41f5f6>0x0)return _0x41f5f6--,_0x12f9f3=0x0,{'changed':!![],'level':_0x41f5f6};}else _0x35e4f9=0x0,_0x12f9f3=0x0;}return{'changed':![],'level':_0x41f5f6};}};}return okdbIntakeGate={'createIntakeGate':_0x54ee03},okdbIntakeGate;}var okdbQueueLoadHandler,hasRequiredOkdbQueueLoadHandler;function requireOkdbQueueLoadHandler(){if(hasRequiredOkdbQueueLoadHandler)return okdbQueueLoadHandler;hasRequiredOkdbQueueLoadHandler=0x1;function _0x397cd7(_0x3002a6,_0x1a3b07){const _0x38109e=_0xbb9b,_0xb8cd21=require(_0x3002a6);if(_0x1a3b07&&_0x1a3b07!==_0x38109e(0x208)){const _0x1003e2=_0xb8cd21?.[_0x1a3b07];if(typeof _0x1003e2!==_0x38109e(0x1f8))throw new Error('Spawned\x20queue\x20worker\x20export\x20not\x20found\x20or\x20not\x20a\x20function:\x20'+_0x1a3b07);return _0x1003e2;}if(typeof _0xb8cd21===_0x38109e(0x1f8))return _0xb8cd21;if(typeof _0xb8cd21?.[_0x38109e(0x208)]===_0x38109e(0x1f8))return _0xb8cd21[_0x38109e(0x208)];throw new Error(_0x38109e(0x192));}return okdbQueueLoadHandler={'loadHandler':_0x397cd7},okdbQueueLoadHandler;}function _0x1bfc(){const _0x4e92d1=['_report','postMessage','stopped','setTtl','schema:drop','cpuUsage','terminate','ready','transactionSync','resolve','ms\x20max=','type','_ensureTier','ref:violation_resolved','sync:apply','floor','disconnect','cpus','~fn:requests','env-removed:\x20','resetFts','watchdog','options','removeSync','rootPath','includes','ttl:set','attach','run','init','processor','106432DJapUz','code','startsWith','system:bus_state_change','loop-lag\x20','true','push','events','timeoutMs','heavy','hasOwnProperty','txn:end','putSync','9301550tlRJrV','sandbox-','_stopped','env-removed\x20hint:\x20force-evicting\x20','detachConsole','ERR_WORKER_OUT_OF_MEMORY','queue.process\x20threw:\x20','system:poke','main','bootstrap:','remove','memoryUsage','stderr','fts','worker\x20OKDB\x20open\x20failed:\x20','isHeld','system:drain','\x20(resident=','ms\x20mean=','\x20│\x20','7612875oWJAqb','cancel','env','start','system:type_drop','reportThreadStats','_bareOpen','has','item:create','worker','rejectReady','lastError','view:progress','153gSdTUv','pid','timeMachine','label','~fn:responses','version','enable','function\x20sandbox\x20error:\x20','license:removed','onEmit','inFlight','modulePath','note','reset','slice','function\x20exceeded\x20','function\x20sandbox\x20exited\x20(code\x20','active','size','maxConcurrency','FUNCTION_CANCELLED','result','getRange','object','name','index:ready','passive','openDB','txn:start','_tiers','stdout','keys','rss','heapTotal','Spawned\x20queue\x20worker\x20module\x20must\x20export\x20a\x20function\x20or\x20default\x20function','listFtsEnvs','system:proc','__esModule','schema:set','mean','processes','sandbox\x20terminated\x20for\x20a\x20sibling\x20job\x20—\x20retryable','unhandledRejection','./okdb','runId','claimRoutedBootstrap','message','SYSTEM_PROC','map','exit','env:removed','stopAll','level','_envs','ms/','stringify','halted','queue','ms\x20grace)\x20—\x20sandbox\x20terminated','_maybeIdle','380994RGiYOi','node:perf_hooks','inFlightCount','ms\x20busy=','_activateViewStorage','clear','registerType','bus:drain','index:reset','logs','random','dropSchema','onWindow','FUNCTION_SANDBOX_EXIT','~views','_drainHandler','queueType','max','~proc:bootstrap-index','state','scope','okdb-functions-sandbox-worker.js','path','setSchema','1108996FbtvJZ','process','fn-sandbox:','view','stop','ttl:expired','339652HgKQwe','count','warn','_tierFor','_onMessage','_rootDb','bootstrap','running','blocks','off','cancelled','license:activated','listWorkerBootstrapJobs','string','exports','ref:violation','registerFts','listDesired','bus:type_drop','resume','envName','requestId','1nsBnIe','tick','MB\x20heap\x20cap)','dropping','21UFPXGX','toFixed','waiting','_windowCbs','freeze','sandbox\x20failed\x20to\x20boot','setLogger','_log','system:clock_change','resetting','type:registered','log','views','item:remove','kind','reduce','(worst\x20','function\x20cancelled\x20—\x20did\x20not\x20unwind\x20within\x20grace;\x20sandbox\x20terminated','_admissionTimer','dropType','function','error','_registrations','_timer','enabled','_failTier','close','ms\x20p99=','entry','disable','onThreadStats','FUNCTION_OOM','_terminateTier','bus:proc','openEnv','key','default','_processorStops','inflight','_closeSharedEnvs','resetIndex','open','reject','type:drop','creating','now','cursorKey','set','join','unref','FUNCTION_TIMEOUT','send','worker:\x20no\x20init\x20message\x20received','readySettled','control','_buckets','pending','win32','defaultMemoryMb','stats','claimAndRunWorkerBootstrap','user','txn:rollback','unhandledRejection:\x20','catch','SYSTEM_DRAIN','sort','maxExtra','recycle','system','fts:reset','_dropTier','values','maxMs','_started','prototype','system:stopped','length','graceMs','exportName','index:drop','detail','light','env\x20has\x20no\x20queue\x20feature\x20attached','worker_threads','license:invalid','_startAdmission','16982vUHlvA','idleTimer','fatal','env:opened','wedged','requestedAt','get','system:ready','viewName','put','write','idleMs','delete','finally','index:progress','cost','add'];_0x1bfc=function(){return _0x4e92d1;};return _0x1bfc();}var okdbFunctionsSandboxHost,hasRequiredOkdbFunctionsSandboxHost;function requireOkdbFunctionsSandboxHost(){const _0x26788d=_0x3dd697;if(hasRequiredOkdbFunctionsSandboxHost)return okdbFunctionsSandboxHost;hasRequiredOkdbFunctionsSandboxHost=0x1;const _0x162137=require$$0$1,{Worker:_0x2ae9cc}=require$$1,_0x8912f2=_0x162137[_0x26788d(0x214)](__dirname,_0x26788d(0x1c1)),_0x5d993a=0x100,_0x3dd614=0x3e8;function _0x5dab13(_0x4d1155,_0x3acd23){const _0x1629b5=new Error(_0x4d1155);return _0x1629b5['code']=_0x3acd23,_0x1629b5;}class _0x206c54{constructor({rootPath:_0x3fc2c9,memoryMb:_0x16f51e,maxConcurrency:_0x181c02,idleMs:_0x22a51e,graceMs:_0x37036d,onThreadStats:_0x304fce,log:_0x2533b2}={}){const _0x4e6341=_0x26788d;if(!_0x3fc2c9)throw new Error('SandboxHost:\x20rootPath\x20required');this[_0x4e6341(0x13b)]=_0x3fc2c9,this[_0x4e6341(0x21e)]=Math[_0x4e6341(0x1bd)](0x20,Math[_0x4e6341(0x132)](_0x16f51e??_0x5d993a)),this[_0x4e6341(0x183)]=Math[_0x4e6341(0x1bd)](0x1,Number(process.env.OKDB_FN_SANDBOX_CONCURRENCY)||_0x181c02||0x4),this[_0x4e6341(0x246)]=Math[_0x4e6341(0x1bd)](0x3e8,Number(process.env.OKDB_FN_SANDBOX_IDLE_MS)||_0x22a51e||0x7530),this[_0x4e6341(0x232)]=Math['max'](0x64,Number(process.env.OKDB_FN_SANDBOX_GRACE_MS)||_0x37036d||0x5dc),this[_0x4e6341(0x202)]=_0x304fce??null,this['log']=_0x2533b2??null,this[_0x4e6341(0x18d)]=new Map(),this[_0x4e6341(0x151)]=![];}['inFlightCount'](){const _0x4c17e2=_0x26788d;let _0x4fb27f=0x0;for(const _0x51ad40 of this[_0x4c17e2(0x18d)][_0x4c17e2(0x22c)]())_0x4fb27f+=_0x51ad40[_0x4c17e2(0x20a)]['size'];return _0x4fb27f;}[_0x26788d(0x1cd)](){const _0x1a459f=_0x26788d;return this[_0x1a459f(0x21e)];}[_0x26788d(0x12f)](_0xea09a3){const _0x28853d=_0x26788d;let _0x50fda9=this[_0x28853d(0x18d)]['get'](_0xea09a3);if(_0x50fda9)return _0x50fda9;const _0x4eecd5=new _0x2ae9cc(_0x8912f2,{'workerData':{'rootPath':this['rootPath']},'stdout':!![],'stderr':!![]});_0x4eecd5[_0x28853d(0x18e)]?.['resume'](),_0x4eecd5['stderr']?.[_0x28853d(0x1dd)](),_0x4eecd5[_0x28853d(0x215)]?.();let _0x985a13;const _0x45013f=new Promise((_0x302516,_0x5c76e8)=>{const _0xbefc17=(_0x18fe60,_0x4f63d0)=>{const _0x1b7cf7=_0xbb9b;_0x50fda9['readySettled']=!![],_0x4eecd5[_0x1b7cf7(0x1d3)](_0x1b7cf7(0x19e),_0x496630),_0x18fe60(_0x4f63d0);},_0x496630=_0x10492b=>{const _0x1aa54c=_0xbb9b;if(_0x10492b?.['type']==='ready')_0xbefc17(_0x302516);else{if(_0x10492b?.[_0x1aa54c(0x12e)]===_0x1aa54c(0x23d))_0xbefc17(_0x5c76e8,_0x5dab13(_0x10492b['error']?.[_0x1aa54c(0x19e)]??_0x1aa54c(0x1e9),'FUNCTION_SANDBOX_EXIT'));}};_0x985a13=_0xeb9f74=>_0xbefc17(_0x5c76e8,_0xeb9f74),_0x4eecd5['on']('message',_0x496630);});return _0x50fda9={'worker':_0x4eecd5,'inflight':new Map(),'idleTimer':null,'readySettled':![],'rejectReady':_0x985a13,'ready':_0x45013f},_0x50fda9[_0x28853d(0x12a)][_0x28853d(0x224)](()=>{}),this[_0x28853d(0x18d)][_0x28853d(0x213)](_0xea09a3,_0x50fda9),_0x4eecd5['on'](_0x28853d(0x19e),_0x146a6b=>this[_0x28853d(0x1ce)](_0xea09a3,_0x50fda9,_0x146a6b)),_0x4eecd5['on'](_0x28853d(0x1f9),_0x78bb8b=>{const _0x36170f=_0x28853d,_0x3ec19a=_0x78bb8b?.[_0x36170f(0x143)]===_0x36170f(0x154);this['_failTier'](_0xea09a3,_0x50fda9,_0x3ec19a?_0x5dab13('function\x20sandbox\x20out\x20of\x20memory\x20(tier\x20'+_0xea09a3+_0x36170f(0x1e2),_0x36170f(0x203)):_0x5dab13(_0x36170f(0x177)+(_0x78bb8b?.[_0x36170f(0x19e)]??_0x78bb8b),'FUNCTION_SANDBOX_EXIT'));}),_0x4eecd5['on']('exit',_0x2d3d6f=>{const _0x561bde=_0x28853d;this[_0x561bde(0x1fd)](_0xea09a3,_0x50fda9,_0x5dab13(_0x561bde(0x180)+_0x2d3d6f+')',_0x561bde(0x1b9)));}),_0x50fda9;}[_0x26788d(0x1ce)](_0x3a4cf8,_0x6046b0,_0x4a6643){const _0x1ad0e3=_0x26788d;if(!_0x4a6643||typeof _0x4a6643!==_0x1ad0e3(0x187))return;if(_0x4a6643[_0x1ad0e3(0x12e)]===_0x1ad0e3(0x21f)){this[_0x1ad0e3(0x202)]?.('fn-sandbox:'+_0x3a4cf8,{'heapUsed':_0x4a6643['heapUsed']??0x0});return;}const _0x3a21a2=_0x4a6643[_0x1ad0e3(0x1df)]!=null?_0x6046b0[_0x1ad0e3(0x20a)][_0x1ad0e3(0x241)](_0x4a6643['requestId']):null;if(!_0x3a21a2)return;if(_0x4a6643[_0x1ad0e3(0x12e)]==='log'){_0x3a21a2[_0x1ad0e3(0x1b5)][_0x1ad0e3(0x148)](_0x4a6643[_0x1ad0e3(0x200)]);return;}if(_0x4a6643[_0x1ad0e3(0x12e)]===_0x1ad0e3(0x185)||_0x4a6643['type']==='error')_0x6046b0[_0x1ad0e3(0x20a)][_0x1ad0e3(0x247)](_0x4a6643[_0x1ad0e3(0x1df)]),clearTimeout(_0x3a21a2[_0x1ad0e3(0x138)]),_0x3a21a2[_0x1ad0e3(0x12c)]({'message':_0x4a6643,'logs':_0x3a21a2['logs']}),this[_0x1ad0e3(0x1ab)](_0x3a4cf8,_0x6046b0);else _0x3a21a2[_0x1ad0e3(0x179)]&&_0x3a21a2[_0x1ad0e3(0x179)](_0x4a6643);}async[_0x26788d(0x13f)](_0x5c0694,{onEmit:_0x51b473}={}){const _0x18073a=_0x26788d;if(this[_0x18073a(0x151)])throw _0x5dab13('sandbox\x20host\x20stopped','FUNCTION_SANDBOX_EXIT');const _0x265e6d=this[_0x18073a(0x1cd)](_0x5c0694),_0x34410a=this['_ensureTier'](_0x265e6d);return _0x34410a['idleTimer']&&(clearTimeout(_0x34410a[_0x18073a(0x23c)]),_0x34410a['idleTimer']=null),await _0x34410a[_0x18073a(0x12a)],new Promise((_0x555998,_0x286ccc)=>{const _0x5171d=_0x18073a,_0x20786d=Math['max'](0x1,_0x5c0694['runtime']?.[_0x5171d(0x14a)]??_0x3dd614),_0x4d6ed6={'resolve':_0x555998,'reject':_0x286ccc,'logs':[],'onEmit':_0x51b473??null,'cancelled':![],'watchdog':setTimeout(()=>{const _0x5b24ad=_0x5171d;this[_0x5b24ad(0x204)](_0x265e6d,_0x34410a,_0x5c0694[_0x5b24ad(0x1df)],_0x5dab13(_0x5b24ad(0x17f)+_0x20786d+'ms\x20(+'+this[_0x5b24ad(0x232)]+_0x5b24ad(0x1aa),_0x4d6ed6['cancelled']?_0x5b24ad(0x184):_0x5b24ad(0x216)));},_0x20786d+this['graceMs'])};if(_0x4d6ed6['watchdog'][_0x5171d(0x215)])_0x4d6ed6[_0x5171d(0x138)][_0x5171d(0x215)]();_0x34410a['inflight'][_0x5171d(0x213)](_0x5c0694['requestId'],_0x4d6ed6),_0x34410a['worker']['postMessage']({'type':_0x5171d(0x13f),'job':_0x5c0694});});}[_0x26788d(0x164)](_0x40383a){const _0x32408b=_0x26788d;for(const [_0x33f184,_0x17afc1]of this[_0x32408b(0x18d)]){const _0x1d958a=_0x17afc1[_0x32408b(0x20a)][_0x32408b(0x241)](_0x40383a);if(!_0x1d958a)continue;if(_0x1d958a[_0x32408b(0x1d4)])return!![];_0x1d958a[_0x32408b(0x1d4)]=!![],_0x17afc1['worker'][_0x32408b(0x124)]({'type':'cancel','requestId':_0x40383a}),clearTimeout(_0x1d958a[_0x32408b(0x138)]),_0x1d958a[_0x32408b(0x138)]=setTimeout(()=>{const _0x20c769=_0x32408b;this[_0x20c769(0x204)](_0x33f184,_0x17afc1,_0x40383a,_0x5dab13(_0x20c769(0x1f5),_0x20c769(0x184)));},this[_0x32408b(0x232)]);if(_0x1d958a[_0x32408b(0x138)][_0x32408b(0x215)])_0x1d958a['watchdog'][_0x32408b(0x215)]();return!![];}return![];}[_0x26788d(0x204)](_0x393477,_0x38d5a5,_0x1682dd,_0x361c6e){const _0x36de1f=_0x26788d;for(const [_0x13bf8d,_0x55428d]of _0x38d5a5[_0x36de1f(0x20a)]){clearTimeout(_0x55428d[_0x36de1f(0x138)]),_0x55428d[_0x36de1f(0x20e)](_0x13bf8d===_0x1682dd?_0x361c6e:_0x5dab13(_0x36de1f(0x199),'FUNCTION_SANDBOX_EXIT'));}_0x38d5a5['inflight'][_0x36de1f(0x1b1)](),this[_0x36de1f(0x22b)](_0x393477,_0x38d5a5);}['_failTier'](_0x3b642e,_0x33897f,_0x3d9066){const _0x28be88=_0x26788d;if(this[_0x28be88(0x18d)][_0x28be88(0x241)](_0x3b642e)!==_0x33897f)return;if(!_0x33897f[_0x28be88(0x219)])_0x33897f[_0x28be88(0x16d)]?.(_0x3d9066);for(const [,_0x15b964]of _0x33897f['inflight']){clearTimeout(_0x15b964[_0x28be88(0x138)]),_0x15b964[_0x28be88(0x20e)](_0x3d9066);}_0x33897f['inflight'][_0x28be88(0x1b1)](),this[_0x28be88(0x22b)](_0x3b642e,_0x33897f);}[_0x26788d(0x22b)](_0x1de627,_0x48b9b9){const _0x204b06=_0x26788d;if(this[_0x204b06(0x18d)][_0x204b06(0x241)](_0x1de627)===_0x48b9b9)this[_0x204b06(0x18d)][_0x204b06(0x247)](_0x1de627);if(_0x48b9b9[_0x204b06(0x23c)])clearTimeout(_0x48b9b9['idleTimer']);this['onThreadStats']?.(_0x204b06(0x1c6)+_0x1de627,null),_0x48b9b9[_0x204b06(0x16c)][_0x204b06(0x129)]()[_0x204b06(0x224)](()=>{});}['_maybeIdle'](_0xc42402,_0x5f3632){const _0x28393b=_0x26788d;if(_0x5f3632[_0x28393b(0x20a)]['size']>0x0||_0x5f3632['idleTimer'])return;_0x5f3632['idleTimer']=setTimeout(()=>this['_dropTier'](_0xc42402,_0x5f3632),this['idleMs']);if(_0x5f3632[_0x28393b(0x23c)]['unref'])_0x5f3632['idleTimer'][_0x28393b(0x215)]();}[_0x26788d(0x228)](){const _0x445313=_0x26788d;for(const [_0x9c6360,_0x4ab4c6]of[...this[_0x445313(0x18d)]]){this['_failTier'](_0x9c6360,_0x4ab4c6,_0x5dab13('sandbox\x20recycled',_0x445313(0x1b9)));}}async['stop'](){const _0x294a3d=_0x26788d;this[_0x294a3d(0x151)]=!![],this[_0x294a3d(0x228)]();}}return okdbFunctionsSandboxHost={'SandboxHost':_0x206c54,'SANDBOX_ENTRY':_0x8912f2},okdbFunctionsSandboxHost;}var hasRequiredOkdbWorkerChild;function requireOkdbWorkerChild(){const _0x13db72=_0x3dd697;if(hasRequiredOkdbWorkerChild)return okdbWorkerChild$1;hasRequiredOkdbWorkerChild=0x1;function _0x371951(_0x333aa6){const _0x45c173=_0xbb9b;try{if(typeof process[_0x45c173(0x217)]==='function')process[_0x45c173(0x217)](_0x333aa6);}catch{}}let _0x326095=![],_0x63a3bc=null;async function _0xab29fc(_0x1234fd,_0x4f9c9a){const _0x3efe96=_0xbb9b;if(_0x326095)return;_0x326095=!![];try{await _0x63a3bc?.[_0x3efe96(0x1c8)]?.();}catch{}const _0x5c47b8=setTimeout(()=>process['exit'](_0x1234fd),0xbb8);if(typeof _0x5c47b8[_0x3efe96(0x215)]===_0x3efe96(0x1f8))_0x5c47b8[_0x3efe96(0x215)]();try{await _0x4f9c9a?.['close']?.();}catch{}process[_0x3efe96(0x1a1)](_0x1234fd);}function _0x3f6f66(_0x15ca52,_0x31c564,_0x2bff8f=null){const _0x3c8c10=_0xbb9b,_0x2cc3a4=require$$1$1;let _0x7f0a45=process[_0x3c8c10(0x128)](),_0x516350=Date[_0x3c8c10(0x211)]();const _0x23de46=()=>{const _0x705359=_0x3c8c10;try{const _0x504eb4=[];for(const [_0x123792,_0x29218b]of _0x31c564['_envs']){if(_0x123792['startsWith']('~'))continue;for(const _0x209ffe of _0x29218b[_0x705359(0x141)]['tierList']())_0x504eb4[_0x705359(0x148)]({..._0x209ffe,'env':_0x123792});}return _0x504eb4[_0x705359(0x231)]>0x0?{'processors':_0x504eb4}:null;}catch{return null;}},_0x182258=()=>{const _0x1ff842=_0x3c8c10;if(_0x326095)return;const _0x27c1a7=Date[_0x1ff842(0x211)](),_0x12ffe4=process['cpuUsage'](),_0x89811f=(_0x27c1a7-_0x516350)*0x3e8,_0x13d0c6=_0x12ffe4[_0x1ff842(0x221)]-_0x7f0a45[_0x1ff842(0x221)]+(_0x12ffe4[_0x1ff842(0x229)]-_0x7f0a45[_0x1ff842(0x229)]),_0xf3f318=_0x89811f>0x0?Math['min'](0x64,Math['round'](_0x13d0c6/(_0x89811f*(_0x2cc3a4[_0x1ff842(0x134)]()[_0x1ff842(0x231)]||0x1))*0x64)):0x0;_0x7f0a45=_0x12ffe4,_0x516350=_0x27c1a7;const _0x521370=process[_0x1ff842(0x15a)]();_0x15ca52({'type':_0x1ff842(0x21f),'stats':{'rss':_0x521370[_0x1ff842(0x190)],'heapUsed':_0x521370['heapUsed'],'heapTotal':_0x521370[_0x1ff842(0x191)],'external':_0x521370['external'],'cpuPct':_0xf3f318,'cpuWindowMs':Math['round'](_0x89811f/0x3e8)||null,..._0x2bff8f?.()??{}},'processing':_0x23de46()});},_0x36e883=Math['max'](0x3e8,Number(process.env.OKDB_STATS_INTERVAL_MS)||0x1388),_0x4034e7=setInterval(_0x182258,_0x36e883);if(typeof _0x4034e7[_0x3c8c10(0x215)]===_0x3c8c10(0x1f8))_0x4034e7[_0x3c8c10(0x215)]();}process['on'](_0x13db72(0x19a),_0x1d066a=>{const _0x38a906=_0x13db72;_0x371951({'type':_0x38a906(0x1cc),'msg':_0x38a906(0x223)+(_0x1d066a?.[_0x38a906(0x19e)]??_0x1d066a)});});async function _0x22c997(){const _0x8b422a=_0x13db72,_0x45e73b=await new Promise((_0x17617d,_0x93d0ee)=>{const _0x3d2777=_0xbb9b,_0x59f97d=_0xf30f97=>{const _0x4002ff=_0xbb9b;_0xf30f97?.[_0x4002ff(0x12e)]===_0x4002ff(0x140)&&(process[_0x4002ff(0x1d3)](_0x4002ff(0x19e),_0x59f97d),_0x17617d(_0xf30f97));};process['on'](_0x3d2777(0x19e),_0x59f97d);const _0x5961a3=setTimeout(()=>{const _0x20f6ab=_0x3d2777;process[_0x20f6ab(0x1d3)]('message',_0x59f97d),_0x93d0ee(new Error(_0x20f6ab(0x218)));},0x2710);if(typeof _0x5961a3['unref']===_0x3d2777(0x1f8))_0x5961a3[_0x3d2777(0x215)]();}),{rootPath:_0x1858ae,slot:_0x38a43b,supervisorKey:_0xd3a9da}=_0x45e73b,_0x455a6f=require$$2,{EVENTS:_0x3708eb}=requireOkdbEnums(),_0x480f23=new _0x455a6f(_0x1858ae,{'engines':![],'http':![],'asyncProcessors':!![],'compaction':_0x8b422a(0x18a),'envs':'core','auth':{'open':!![]},'processing':_0x8b422a(0x157)});{const _0x464739={'debug':0x0,'info':0x1,'warn':0x2,'error':0x3},_0x57bad3=_0x464739[process.env.OKDB_WORKERS_LOG_LEVEL]??_0x464739[_0x8b422a(0x1cc)];_0x480f23['log'][_0x8b422a(0x153)]?.(),_0x480f23[_0x8b422a(0x1ef)][_0x8b422a(0x13e)](_0x2b4851=>{const _0x482d0f=_0x8b422a;if((_0x464739[_0x2b4851[_0x482d0f(0x1a4)]]??0x1)<_0x57bad3)return;_0x371951({'type':_0x482d0f(0x1ef),'entry':_0x2b4851});});}try{await _0x480f23[_0x8b422a(0x20d)]();}catch(_0x10fa97){_0x371951({'type':_0x8b422a(0x1f9),'error':_0x8b422a(0x15d)+_0x10fa97[_0x8b422a(0x19e)]}),process[_0x8b422a(0x1a1)](0x1);return;}const _0x441ff0=Math[_0x8b422a(0x1bd)](0x4,Number(process.env.OKDB_WORKERS_ENV_CACHE)||0x40),_0x3e8222=new Map(),_0x31047a=new Set();function _0x331b36(_0x239d64){const _0x24f95e=_0x8b422a;try{for(const _0x122831 of _0x239d64[_0x24f95e(0x141)]?.[_0x24f95e(0x1fa)]?.[_0x24f95e(0x22c)]()??[]){if(_0x122831['_lockHandle']?.[_0x24f95e(0x15e)]?.())return!![];}}catch{}return![];}function _0x27fab4(_0x4d089a,_0x233ecd){const _0x842340=_0x8b422a;if(_0x31047a[_0x842340(0x16a)](_0x4d089a))return!![];if(_0x331b36(_0x233ecd))return!![];for(const [,_0x5f3dbe]of _0xf6d3a7){if(_0x5f3dbe?.[_0x842340(0x1de)]===_0x4d089a)return!![];}return![];}async function _0x5683d8(_0xb1d74f,_0x43852e){const _0x3ae08c=_0x8b422a;for(const _0x50a34f of[..._0x480f23['fts']['_processorStops']?.[_0x3ae08c(0x18f)]?.()??[]]){if(!_0x50a34f[_0x3ae08c(0x144)](_0xb1d74f+':'))continue;const _0x34bdbf=_0x480f23[_0x3ae08c(0x15c)][_0x3ae08c(0x209)]['get'](_0x50a34f);_0x480f23[_0x3ae08c(0x15c)]['_processorStops'][_0x3ae08c(0x247)](_0x50a34f);try{await _0x34bdbf?.();}catch{}}try{await _0x43852e['processor']?.[_0x3ae08c(0x1a3)]?.();}catch{}}async function _0x1e51d0(_0x4daa84){const _0x22a4fe=_0x8b422a,_0x166939=_0x3e8222[_0x22a4fe(0x241)](_0x4daa84);if(!_0x166939)return;_0x3e8222['delete'](_0x4daa84),await _0x5683d8(_0x4daa84,_0x166939);try{await _0x166939[_0x22a4fe(0x172)]?.[_0x22a4fe(0x1c8)]?.();}catch{}try{await _0x480f23['fts'][_0x22a4fe(0x20b)]?.(_0x4daa84);}catch{}_0x480f23[_0x22a4fe(0x1a5)][_0x22a4fe(0x247)](_0x4daa84);try{await _0x166939[_0x22a4fe(0x1fe)]();}catch{}}async function _0x1ca187(_0x25af30){const _0x131a9f=_0x8b422a;if(_0x3e8222[_0x131a9f(0x16a)](_0x25af30)){const _0x1ff6d4=_0x3e8222[_0x131a9f(0x241)](_0x25af30);return _0x3e8222[_0x131a9f(0x247)](_0x25af30),_0x3e8222[_0x131a9f(0x213)](_0x25af30,_0x1ff6d4),_0x1ff6d4;}const _0x3993df=_0x480f23[_0x131a9f(0x1a5)]['get'](_0x25af30);if(_0x3993df&&!_0x3993df[_0x131a9f(0x169)])return _0x3993df;if(_0x3e8222['size']>=_0x441ff0)for(const [_0x54c9bd,_0x20fbd0]of _0x3e8222){if(!_0x27fab4(_0x54c9bd,_0x20fbd0)){await _0x1e51d0(_0x54c9bd);break;}}const _0x4983e8=await _0x480f23[_0x131a9f(0x206)](_0x25af30);return _0x3e8222['set'](_0x25af30,_0x4983e8),_0x4983e8;}_0x480f23[_0x8b422a(0x149)]['on'](_0x3708eb[_0x8b422a(0x225)],()=>{const _0x3e725e=_0x8b422a;(async()=>{for(const [_0x17bf26,_0x3ba9cd]of[..._0x3e8222]){if(!_0x27fab4(_0x17bf26,_0x3ba9cd))await _0x1e51d0(_0x17bf26);}})()[_0x3e725e(0x224)](()=>{});});const _0x57b270=setInterval(()=>{const _0x53286e=_0x8b422a;if(_0x326095)return;for(const [,_0x5c3e6a]of _0x480f23[_0x53286e(0x1a5)]){try{_0x5c3e6a[_0x53286e(0x1bb)]?.();}catch{}}},0xc8);if(typeof _0x57b270['unref']===_0x8b422a(0x1f8))_0x57b270[_0x8b422a(0x215)]();process['on'](_0x8b422a(0x133),()=>_0xab29fc(0x0,_0x480f23));if(process['platform']!==_0x8b422a(0x21d)){const _0x287d63=setInterval(()=>{if(process['ppid']===0x1)_0xab29fc(0x0,_0x480f23);},0x7d0);if(typeof _0x287d63[_0x8b422a(0x215)]==='function')_0x287d63[_0x8b422a(0x215)]();}process['on']('message',_0x1f49d5=>{const _0x5977af=_0x8b422a;if(_0x1f49d5?.[_0x5977af(0x12e)]===_0x5977af(0x1c8))_0xab29fc(0x0,_0x480f23);});const {LOOP:_0x59463e}=requireOkdbLoopMonitor(),{createIntakeGate:_0x27d662}=requireOkdbIntakeGate(),_0x17c621=Number(process.env.OKDB_WORKERS_MAX_LEASES)||0x20,_0x304ab4=Number(process.env.OKDB_WORKERS_LAG_GATE_MS)||0xc8,_0xd5278c=Number(process.env.OKDB_WORKERS_WEDGE_MS)||0x7530,_0x4e5700=_0x27d662({'gateMs':_0x304ab4});_0x59463e['onWindow'](({p99Ms:_0x2ea87d,maxMs:_0xac85bc})=>{const _0x56137c=_0x8b422a;_0xac85bc>_0xd5278c&&_0x371951({'type':_0x56137c(0x23f),'maxMs':_0xac85bc});const {changed:_0x5ceeb3,level:_0x42b753}=_0x4e5700[_0x56137c(0x1b8)](_0x2ea87d);if(_0x5ceeb3)_0x371951({'type':'intake','level':_0x42b753,'p99Ms':_0x2ea87d});});const {loadHandler:_0x3fcef8}=requireOkdbQueueLoadHandler(),_0xf6d3a7=new Map();let _0xbc6b12=![],_0x431bc2={'defsSeen':-0x1,'lastError':null,'at':0x0};const _0x1822ac=new Set(),_0x48f8c7=(_0x582db5,_0x51329e)=>{const _0x5e6b6e=_0x582db5+'::'+_0x51329e;if(_0x1822ac['has'](_0x5e6b6e))return;_0x1822ac['add'](_0x5e6b6e),_0x371951({'type':'warn','msg':'queue\x20definition\x20SKIPPED:\x20'+_0x582db5+'\x20—\x20'+_0x51329e});},_0x32bf68={'name':'queue','cost':_0x8b422a(0x21a),'inFlight':()=>_0xf6d3a7[_0x8b422a(0x182)],'detail':()=>({'consumers':[..._0xf6d3a7['keys']()],'tick':_0x431bc2}),async 'tick'(){const _0x2057be=_0x8b422a;if(_0xbc6b12||_0x326095)return;_0xbc6b12=!![];try{const _0x1fb703=_0x480f23[_0x2057be(0x198)][_0x2057be(0x1db)]?.('queue-worker')??[];_0x431bc2={'defsSeen':_0x1fb703[_0x2057be(0x231)],'lastError':null,'at':Date[_0x2057be(0x211)]()};const _0x35a7cb=new Set();for(const {key:_0x1bc34,value:_0x48137d}of _0x1fb703){if(!_0x48137d||_0x48137d[_0x2057be(0x181)]===![])continue;_0x35a7cb[_0x2057be(0x122)](_0x1bc34);const _0x3d0a88=_0xf6d3a7['get'](_0x1bc34);if(_0x3d0a88){if(_0x3d0a88[_0x2057be(0x175)]===_0x48137d[_0x2057be(0x175)])continue;_0xf6d3a7[_0x2057be(0x247)](_0x1bc34);try{await _0x3d0a88[_0x2057be(0x16c)]?.[_0x2057be(0x1c8)]?.();}catch{}}const _0x112678=_0x48137d[_0x2057be(0x1de)]??_0x1bc34['split']('::')[0x0];let _0x262554;try{_0x262554=await _0x1ca187(_0x112678);}catch(_0xcc4e2){_0x48f8c7(_0x1bc34,'env\x20open\x20failed:\x20'+_0xcc4e2?.[_0x2057be(0x19e)]);continue;}if(!_0x262554?.['queue']){_0x48f8c7(_0x1bc34,_0x2057be(0x237));continue;}let _0x1f2ffe;try{_0x1f2ffe=_0x3fcef8(_0x48137d[_0x2057be(0x17b)],_0x48137d[_0x2057be(0x233)]);}catch(_0x1ca625){_0x48f8c7(_0x1bc34,'handler\x20module\x20failed\x20to\x20load:\x20'+_0x1ca625?.['message']);continue;}let _0x42f293;try{_0x42f293=_0x262554[_0x2057be(0x1a9)]['process'](_0x48137d[_0x2057be(0x1bc)]??_0x1bc34['split']('::')[0x1],_0x1f2ffe,_0x48137d[_0x2057be(0x139)]??{});}catch(_0xeb59fb){_0x48f8c7(_0x1bc34,_0x2057be(0x155)+_0xeb59fb?.[_0x2057be(0x19e)]);continue;}_0xf6d3a7[_0x2057be(0x213)](_0x1bc34,{'worker':_0x42f293,'version':_0x48137d[_0x2057be(0x175)],'envName':_0x112678});}for(const [_0x132856,_0x18c52e]of[..._0xf6d3a7]){if(!_0x35a7cb[_0x2057be(0x16a)](_0x132856)){_0xf6d3a7['delete'](_0x132856),_0x371951({'type':'warn','msg':'queue\x20consumer\x20stopped\x20(def\x20deregistered):\x20'+_0x132856});try{await _0x18c52e[_0x2057be(0x16c)]?.[_0x2057be(0x1c8)]?.();}catch{}}}}catch(_0x32bab1){_0x431bc2[_0x2057be(0x16e)]=_0x32bab1?.[_0x2057be(0x19e)]??String(_0x32bab1);throw _0x32bab1;}finally{_0xbc6b12=![];}}};let _0x1f6c0a;{const {SandboxHost:_0x3ec52b}=requireOkdbFunctionsSandboxHost(),_0x170ae8=_0x480f23['_rootDb'][_0x8b422a(0x18b)](_0x8b422a(0x135),{'dupSort':![]}),_0x2234fe=_0x480f23['_rootDb'][_0x8b422a(0x18b)](_0x8b422a(0x174),{'dupSort':![]}),_0x3b9047=Number(process.env.OKDB_FN_STALE_MS)||0xea60,_0x2d1d3f=new _0x3ec52b({'rootPath':_0x1858ae,'log':_0x480f23[_0x8b422a(0x1ef)],'onThreadStats':(_0x43a1ba,_0x45bf73)=>{const _0x59e928=_0x8b422a;if(_0x45bf73)_0x480f23[_0x59e928(0x198)]?.[_0x59e928(0x168)]?.(_0x43a1ba,_0x45bf73);else _0x480f23['processes']?.['clearThreadStats']?.(_0x43a1ba);}});_0x63a3bc=_0x2d1d3f;const _0x314305=new Set(),_0x4bd58a=(_0x5bee96,_0x428ba4)=>{const _0x380ae6=_0x8b422a,_0x11ce06=_0x170ae8['get'](_0x5bee96);if(!_0x11ce06||_0x11ce06[_0x380ae6(0x1bf)]===_0x380ae6(0x1d4)){try{_0x170ae8[_0x380ae6(0x13a)](_0x5bee96);}catch{}return;}_0x2234fe[_0x380ae6(0x14e)](_0x5bee96,_0x428ba4);try{_0x170ae8[_0x380ae6(0x13a)](_0x5bee96);}catch{}},_0xd9060d=(_0x537d82,_0x32dcf3)=>{const _0x5b9067=_0x8b422a;_0x314305['add'](_0x537d82),_0x2d1d3f[_0x5b9067(0x13f)]({..._0x32dcf3,'requestId':_0x537d82})['then'](({message:_0xabfce5,logs:_0x57d8e7})=>_0x4bd58a(_0x537d82,{'message':_0xabfce5,'logs':_0x57d8e7}))['catch'](_0x43c68f=>{const _0x4682ab=_0x5b9067;if(_0x43c68f?.[_0x4682ab(0x143)]===_0x4682ab(0x1b9)){try{const _0x1f5498=_0x170ae8[_0x4682ab(0x241)](_0x537d82);_0x1f5498&&_0x1f5498[_0x4682ab(0x1bf)]===_0x4682ab(0x1d1)&&_0x1f5498['claimedBy']===process['pid']&&_0x170ae8[_0x4682ab(0x14e)](_0x537d82,{..._0x1f5498,'state':_0x4682ab(0x21c),'requestedAt':Date[_0x4682ab(0x211)]()});}catch{}return;}_0x4bd58a(_0x537d82,{'message':{'type':_0x4682ab(0x1f9),'requestId':_0x537d82,'runId':_0x32dcf3[_0x4682ab(0x19c)],'error':{'message':_0x43c68f?.['message']??String(_0x43c68f),'code':_0x43c68f?.[_0x4682ab(0x143)]??'FUNCTION_FAILED'},'meta':{'runnerId':_0x4682ab(0x150)+process[_0x4682ab(0x171)]}},'logs':[]});})[_0x5b9067(0x248)](()=>_0x314305['delete'](_0x537d82));};_0x1f6c0a={'name':'fn','cost':_0x8b422a(0x21a),'inFlight':()=>_0x2d1d3f[_0x8b422a(0x1ae)](),async 'tick'(){const _0x293b8a=_0x8b422a;if(_0x326095)return;for(const _0xc79043 of[..._0x314305]){const _0x20183f=_0x170ae8[_0x293b8a(0x241)](_0xc79043);if(!_0x20183f||_0x20183f[_0x293b8a(0x1bf)]==='cancelled')_0x2d1d3f[_0x293b8a(0x164)](_0xc79043);}for(const {key:_0x42ba8c,value:_0x9f8417}of _0x170ae8[_0x293b8a(0x186)]({})){if(_0x326095)break;if(_0x2d1d3f[_0x293b8a(0x1ae)]()>=_0x2d1d3f['maxConcurrency'])break;if(!_0x9f8417||_0x9f8417['state']!=='pending')continue;if(_0x9f8417['requestedAt']&&Date[_0x293b8a(0x211)]()-_0x9f8417['requestedAt']>_0x3b9047){try{_0x170ae8[_0x293b8a(0x12b)](()=>{const _0x5bd825=_0x293b8a,_0x426d13=_0x170ae8[_0x5bd825(0x241)](_0x42ba8c);if(_0x426d13?.[_0x5bd825(0x1bf)]===_0x5bd825(0x21c)&&_0x426d13['requestedAt']&&Date['now']()-_0x426d13[_0x5bd825(0x240)]>_0x3b9047)_0x170ae8[_0x5bd825(0x159)](_0x42ba8c);});}catch{}continue;}let _0x480d7a=![];_0x170ae8[_0x293b8a(0x12b)](()=>{const _0x3b944b=_0x293b8a,_0x442add=_0x170ae8['get'](_0x42ba8c);_0x442add?.['state']===_0x3b944b(0x21c)&&(_0x170ae8[_0x3b944b(0x244)](_0x42ba8c,{..._0x442add,'state':_0x3b944b(0x1d1),'claimedBy':process[_0x3b944b(0x171)],'claimedAt':Date[_0x3b944b(0x211)]()}),_0x480d7a=!![]);});if(!_0x480d7a)continue;_0xd9060d(_0x42ba8c,_0x9f8417);}}};}let _0x842468=0x0;const _0x29031a=_0x480f23[_0x8b422a(0x1cf)][_0x8b422a(0x18b)](_0x8b422a(0x1be),{'dupSort':![]}),_0x378ba9={'name':_0x8b422a(0x1d0),'cost':_0x8b422a(0x14b),'inFlight':()=>_0x842468,async 'tick'(){const _0x4cfcef=_0x8b422a;if(_0x326095||_0x842468>=0x1)return;const _0x1751f3=[];try{for(const {key:_0x33995d,value:_0xfeca0a}of _0x29031a['getRange']({})){if(typeof _0x33995d===_0x4cfcef(0x1d7)&&_0xfeca0a?.[_0x4cfcef(0x165)]&&!_0xfeca0a[_0x4cfcef(0x165)][_0x4cfcef(0x144)]('~'))_0x1751f3[_0x4cfcef(0x148)](_0xfeca0a);}}catch{}for(const _0x2ac3ae of _0x1751f3){if(_0x326095||_0x842468>=0x1)return;let _0x269bac;try{_0x269bac=await _0x1ca187(_0x2ac3ae[_0x4cfcef(0x165)]);}catch{continue;}if(_0x2ac3ae[_0x4cfcef(0x1f2)]===_0x4cfcef(0x1c7)&&_0x2ac3ae[_0x4cfcef(0x243)]){const _0x10463f=_0x269bac[_0x4cfcef(0x241)]?.(_0x4cfcef(0x1ba),_0x2ac3ae[_0x4cfcef(0x243)]);if(!_0x10463f)continue;let _0x3ab835=![];_0x31047a['add'](_0x2ac3ae[_0x4cfcef(0x165)]);const _0x3b495c=_0x269bac[_0x4cfcef(0x141)][_0x4cfcef(0x19d)]({'rowKey':_0x4cfcef(0x158)+_0x2ac3ae[_0x4cfcef(0x212)],'cursorKey':_0x2ac3ae[_0x4cfcef(0x212)]},async()=>{const _0xc9b0a=_0x4cfcef;!_0x269bac[_0xc9b0a(0x1f0)]['_viewState'][_0xc9b0a(0x16a)](_0x2ac3ae['viewName'])&&_0x269bac[_0xc9b0a(0x1f0)][_0xc9b0a(0x1b0)](_0x2ac3ae['viewName'],_0x10463f),await _0x269bac[_0xc9b0a(0x1f0)]['_runBootstrapScanPhases'](_0x2ac3ae[_0xc9b0a(0x243)],_0x10463f);},{'onClaimed':()=>{_0x3ab835=!![],_0x842468++;}})[_0x4cfcef(0x224)](()=>{})[_0x4cfcef(0x248)](()=>{const _0x1b2085=_0x4cfcef;if(_0x3ab835)_0x842468--;_0x31047a[_0x1b2085(0x247)](_0x2ac3ae[_0x1b2085(0x165)]);});if(_0x3ab835)return;await _0x3b495c;continue;}try{await _0x480f23['fts'][_0x4cfcef(0x1c5)]({'envs':[_0x2ac3ae[_0x4cfcef(0x165)]],'types':_0x2ac3ae[_0x4cfcef(0x12e)]?[_0x2ac3ae[_0x4cfcef(0x12e)]]:'*'});}catch{continue;}let _0x4cd685=[];try{_0x4cd685=_0x269bac['processor'][_0x4cfcef(0x1d6)]();}catch{}for(const _0x15e630 of _0x4cd685){if(_0x326095||_0x842468>=0x1)return;let _0x4e5d3e=![];_0x31047a[_0x4cfcef(0x122)](_0x2ac3ae[_0x4cfcef(0x165)]);const _0x2b14b3=_0x269bac[_0x4cfcef(0x141)][_0x4cfcef(0x220)](_0x15e630,{'onClaimed':()=>{_0x4e5d3e=!![],_0x842468++;}})[_0x4cfcef(0x224)](()=>{})['finally'](()=>{const _0x331926=_0x4cfcef;if(_0x4e5d3e)_0x842468--;_0x31047a[_0x331926(0x247)](_0x2ac3ae[_0x331926(0x165)]);});if(_0x4e5d3e)return;await _0x2b14b3;}}}},_0x2ca7fb=Math['max'](0x1,Number(process.env.OKDB_WORKERS_PROBE_PER_TICK)||0x2),_0x1f7b43=Math[_0x8b422a(0x1bd)](0x1,Number(process.env.OKDB_WORKERS_PROBE_GRACE_TICKS)||0x3);let _0xb0f855=Math[_0x8b422a(0x132)](Math[_0x8b422a(0x1b6)]()*0x1000);const _0x25a6e6=new Set(),_0xbec8dc=new Map(),_0x10a230=Math[_0x8b422a(0x1bd)](0x3e8,Number(process.env.OKDB_WORKERS_PROBE_COOLDOWN_MS)||0x7530),_0x351c2a=new Map(),_0x3b5370={'name':'fts','cost':_0x8b422a(0x236),'inFlight':()=>{let _0x5a7189=0x0;for(const [,_0x30ce24]of _0x3e8222)if(_0x331b36(_0x30ce24))_0x5a7189++;return _0x5a7189;},async 'tick'(){const _0x11a4d0=_0x8b422a;if(_0x326095)return;const _0x27b22b=_0x480f23[_0x11a4d0(0x15c)][_0x11a4d0(0x193)]();if(_0x27b22b[_0x11a4d0(0x231)]===0x0)return;const _0xe2c460=new Map();for(const _0x5cbb61 of _0x27b22b){if(!_0xe2c460[_0x11a4d0(0x16a)](_0x5cbb61['env']))_0xe2c460['set'](_0x5cbb61['env'],[]);_0xe2c460[_0x11a4d0(0x241)](_0x5cbb61[_0x11a4d0(0x165)])[_0x11a4d0(0x148)](_0x5cbb61[_0x11a4d0(0x12e)]);}const _0x92ec4c=[..._0xe2c460[_0x11a4d0(0x18f)]()],_0x5e5414=Date[_0x11a4d0(0x211)](),_0x3902c6=[];for(const _0xd621d0 of _0x25a6e6){_0xe2c460[_0x11a4d0(0x16a)](_0xd621d0)&&!_0x3902c6[_0x11a4d0(0x13c)](_0xd621d0)&&(_0x351c2a['delete'](_0xd621d0),_0x3902c6[_0x11a4d0(0x148)](_0xd621d0));}_0x25a6e6[_0x11a4d0(0x1b1)]();for(let _0xf14ca2=0x0;_0x3902c6[_0x11a4d0(0x231)]<_0x2ca7fb&&_0xf14ca2<_0x92ec4c[_0x11a4d0(0x231)];_0xf14ca2++){const _0x3c1e82=_0x92ec4c[(_0xb0f855+_0xf14ca2)%_0x92ec4c[_0x11a4d0(0x231)]];if(_0x3902c6['includes'](_0x3c1e82))continue;if((_0x351c2a[_0x11a4d0(0x241)](_0x3c1e82)??0x0)>_0x5e5414)continue;_0x3902c6[_0x11a4d0(0x148)](_0x3c1e82);}_0xb0f855=(_0xb0f855+_0x2ca7fb)%Math['max'](0x1,_0x92ec4c[_0x11a4d0(0x231)]);for(const _0x2fba8a of _0x3902c6){if(_0x326095)return;try{await _0x1ca187(_0x2fba8a),await _0x480f23[_0x11a4d0(0x15c)][_0x11a4d0(0x1c5)]({'envs':[_0x2fba8a],'types':_0xe2c460['get'](_0x2fba8a)});}catch{}}for(const [_0x21ee13,_0x57bf22]of[..._0x3e8222]){if(_0x27fab4(_0x21ee13,_0x57bf22)){_0xbec8dc[_0x11a4d0(0x247)](_0x21ee13);continue;}const _0x48f5f1=(_0xbec8dc[_0x11a4d0(0x241)](_0x21ee13)??0x0)+0x1;_0x48f5f1>=_0x1f7b43?(_0xbec8dc[_0x11a4d0(0x247)](_0x21ee13),_0x351c2a[_0x11a4d0(0x213)](_0x21ee13,Date['now']()+_0x10a230),await _0x1e51d0(_0x21ee13)):_0xbec8dc['set'](_0x21ee13,_0x48f5f1);}}};_0x480f23[_0x8b422a(0x149)]['on'](_0x3708eb['SYSTEM_POKE'],_0xc4d1e7=>{const _0x2ac09d=_0x8b422a,_0x3b611e=_0xc4d1e7?.[_0x2ac09d(0x165)];if(typeof _0x3b611e===_0x2ac09d(0x1d7)&&_0x3b611e&&!_0x3b611e['startsWith']('~'))_0x25a6e6['add'](_0x3b611e);});const _0x154ec9=Math[_0x8b422a(0x1bd)](0x64,Number(process.env.OKDB_WORKERS_CLAIM_TICK_MS)||0x3e8),_0xe26bc3=[_0x1f6c0a,_0x32bf68,_0x378ba9,_0x3b5370],_0x4c763a=[_0x32bf68,_0x378ba9,_0x3b5370];let _0x5bbb2a=0x0;const _0x5ba21e=_0x22b93a=>{const _0xee6ce3=_0x8b422a;if(_0x326095||_0x4e5700[_0xee6ce3(0x1d2)](_0x22b93a[_0xee6ce3(0x121)]))return;_0x22b93a[_0xee6ce3(0x1e1)]()['catch'](()=>{});},_0x4d4b6d=setInterval(()=>{const _0x95124f=_0x8b422a;_0x5ba21e(_0x1f6c0a);for(let _0x39eb1f=0x0;_0x39eb1f<_0x4c763a[_0x95124f(0x231)];_0x39eb1f++){_0x5ba21e(_0x4c763a[(_0x5bbb2a+_0x39eb1f)%_0x4c763a['length']]);}_0x5bbb2a=(_0x5bbb2a+0x1)%_0x4c763a[_0x95124f(0x231)];},_0x154ec9);if(typeof _0x4d4b6d[_0x8b422a(0x215)]==='function')_0x4d4b6d[_0x8b422a(0x215)]();_0x480f23[_0x8b422a(0x149)]['on'](_0x3708eb[_0x8b422a(0x19f)],_0x21249b=>{const _0x7530b=_0x8b422a;if(_0x21249b?.[_0x7530b(0x1c0)]==='fn')_0x5ba21e(_0x1f6c0a);else{if(_0x21249b?.[_0x7530b(0x1c0)]===_0x7530b(0x1d0))_0x5ba21e(_0x378ba9);else{if(_0x21249b?.[_0x7530b(0x1c0)]==='queue-worker')_0x5ba21e(_0x32bf68);else{if(_0x21249b?.['scope']==='env-removed'&&typeof _0x21249b[_0x7530b(0x207)]===_0x7530b(0x1d7)){const _0x2b3f4a=_0x21249b[_0x7530b(0x207)];_0x371951({'type':_0x7530b(0x1cc),'msg':_0x7530b(0x152)+_0x2b3f4a+_0x7530b(0x160)+_0x3e8222[_0x7530b(0x16a)](_0x2b3f4a)+')'}),(async()=>{const _0x2175c0=_0x7530b;for(const [_0x54d1a7,_0x2d94d7]of[..._0xf6d3a7]){if(_0x2d94d7?.['envName']!==_0x2b3f4a)continue;_0xf6d3a7[_0x2175c0(0x247)](_0x54d1a7);try{await _0x2d94d7['worker']?.['stop']?.();}catch{}}_0x31047a[_0x2175c0(0x247)](_0x2b3f4a),_0x25a6e6['delete'](_0x2b3f4a),_0x351c2a[_0x2175c0(0x213)](_0x2b3f4a,Date[_0x2175c0(0x211)]()+0x1d4c0),await _0x1e51d0(_0x2b3f4a),_0x371951({'type':_0x2175c0(0x1cc),'msg':_0x2175c0(0x136)+_0x2b3f4a+'\x20evicted'});})()[_0x7530b(0x224)](_0x245967=>{const _0x56d32f=_0x7530b;_0x371951({'type':_0x56d32f(0x1cc),'msg':'env-removed\x20evict\x20FAILED\x20for\x20'+_0x2b3f4a+':\x20'+_0x245967?.[_0x56d32f(0x19e)]});});}}}}});for(const _0x435d83 of _0xe26bc3)_0x5ba21e(_0x435d83);_0x3f6f66(_0x371951,_0x480f23,()=>({'claims':_0xe26bc3[_0x8b422a(0x1a0)](_0x3cff9f=>({'name':_0x3cff9f[_0x8b422a(0x188)],'inFlight':_0x3cff9f[_0x8b422a(0x17a)](),'gated':_0x4e5700[_0x8b422a(0x1d2)](_0x3cff9f[_0x8b422a(0x121)]),..._0x3cff9f[_0x8b422a(0x235)]?{'detail':_0x3cff9f[_0x8b422a(0x235)]()}:{}})),'envsOpen':_0x480f23[_0x8b422a(0x1a5)]['size']})),_0x371951({'type':_0x8b422a(0x12a),'pid':process['pid'],'slot':_0x38a43b,'supervisorKey':_0xd3a9da,'maxLeases':_0x17c621});}return _0x22c997()[_0x13db72(0x224)](_0x51e199=>{const _0x2c2fb5=_0x13db72;_0x371951({'type':'error','error':_0x51e199[_0x2c2fb5(0x19e)]}),process[_0x2c2fb5(0x1a1)](0x1);}),okdbWorkerChild$1;}var okdbWorkerChildExports=requireOkdbWorkerChild(),okdbWorkerChild=getDefaultExportFromCjs(okdbWorkerChildExports);module[_0x3dd697(0x1d8)]=okdbWorkerChild;
|