scordi-extension 1.19.21 → 1.19.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +11 -11
- package/dist/assets/{index-BgWib9Ir.js → index-DtKBE6PG.js} +1 -1
- package/dist/assets/{index.ts-CtNSw7FL.js → index.ts-Bk1NNWnw.js} +1 -1
- package/dist/assets/{main.tsx-Co8lUSvY.js → main.tsx-BVBPmfe6.js} +2 -2
- package/dist/assets/{main.tsx-loader-B8WX4z2t.js → main.tsx-loader-BuTI6mk0.js} +1 -1
- package/dist/assets/{types-DpElvRFi.js → types-DYDdb31p.js} +10 -10
- package/dist/blocks/PasteValueBlock.d.ts +4 -0
- package/dist/blocks/PasteValueBlock.d.ts.map +1 -1
- package/dist/blocks/index.d.ts +3 -0
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/manifest.json +6 -7
- package/dist/sdk/index.cjs +8 -8
- package/dist/sdk/index.js +586 -573
- package/dist/service-worker-loader.js +1 -1
- package/package.json +1 -1
package/dist/.vite/manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"../../../../../../../@crx/manifest": {
|
|
3
|
-
"file": "assets/crx-manifest.js-
|
|
3
|
+
"file": "assets/crx-manifest.js-DBMFNIKj.js",
|
|
4
4
|
"name": "crx-manifest.js",
|
|
5
5
|
"src": "../../../../../../../@crx/manifest",
|
|
6
6
|
"isEntry": true
|
|
@@ -20,40 +20,40 @@
|
|
|
20
20
|
"file": "assets/internal-messages-CYId_2VJ.js",
|
|
21
21
|
"name": "internal-messages"
|
|
22
22
|
},
|
|
23
|
-
"_main.tsx-loader-
|
|
24
|
-
"file": "assets/main.tsx-loader-
|
|
25
|
-
"src": "_main.tsx-loader-
|
|
23
|
+
"_main.tsx-loader-BuTI6mk0.js": {
|
|
24
|
+
"file": "assets/main.tsx-loader-BuTI6mk0.js",
|
|
25
|
+
"src": "_main.tsx-loader-BuTI6mk0.js"
|
|
26
26
|
},
|
|
27
|
-
"_types-
|
|
28
|
-
"file": "assets/types-
|
|
27
|
+
"_types-DYDdb31p.js": {
|
|
28
|
+
"file": "assets/types-DYDdb31p.js",
|
|
29
29
|
"name": "types",
|
|
30
30
|
"imports": [
|
|
31
31
|
"_index-DCE6egHv.js"
|
|
32
32
|
]
|
|
33
33
|
},
|
|
34
34
|
"src/background/index.ts": {
|
|
35
|
-
"file": "assets/index.ts-
|
|
35
|
+
"file": "assets/index.ts-Bk1NNWnw.js",
|
|
36
36
|
"name": "index.ts",
|
|
37
37
|
"src": "src/background/index.ts",
|
|
38
38
|
"isEntry": true,
|
|
39
39
|
"imports": [
|
|
40
40
|
"_internal-messages-CYId_2VJ.js",
|
|
41
|
-
"_types-
|
|
41
|
+
"_types-DYDdb31p.js",
|
|
42
42
|
"_index-DCE6egHv.js"
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
45
|
"src/blocks/index.ts": {
|
|
46
|
-
"file": "assets/index-
|
|
46
|
+
"file": "assets/index-DtKBE6PG.js",
|
|
47
47
|
"name": "index",
|
|
48
48
|
"src": "src/blocks/index.ts",
|
|
49
49
|
"isDynamicEntry": true,
|
|
50
50
|
"imports": [
|
|
51
|
-
"_types-
|
|
51
|
+
"_types-DYDdb31p.js",
|
|
52
52
|
"_index-DCE6egHv.js"
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
55
|
"src/content/main.tsx": {
|
|
56
|
-
"file": "assets/main.tsx-
|
|
56
|
+
"file": "assets/main.tsx-BVBPmfe6.js",
|
|
57
57
|
"name": "main.tsx",
|
|
58
58
|
"src": "src/content/main.tsx",
|
|
59
59
|
"isEntry": true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as t,h as l,d as s,f as r,i as c,j as o,k as i,m as n,p as d,q as B,r as v,t as k,w as h,x as u,y as m,z as S,A as w,B as p,D as E,E as x,F as A,G as F,H as V,I as f,J as C,K as D,L as G,M as y,N as g,O as T,P as N,Q as P,R as W,S as J,T as K,U as L,V as M,W as j,X as U,Y as q,_ as H,$,a0 as z,a1 as I,a2 as O,a3 as Q,a4 as R,a5 as X,a6 as Y,a7 as _}from"./types-
|
|
1
|
+
import{v as t,h as l,d as s,f as r,i as c,j as o,k as i,m as n,p as d,q as B,r as v,t as k,w as h,x as u,y as m,z as S,A as w,B as p,D as E,E as x,F as A,G as F,H as V,I as f,J as C,K as D,L as G,M as y,N as g,O as T,P as N,Q as P,R as W,S as J,T as K,U as L,V as M,W as j,X as U,Y as q,_ as H,$,a0 as z,a1 as I,a2 as O,a3 as Q,a4 as R,a5 as X,a6 as Y,a7 as _}from"./types-DYDdb31p.js";import{ao as sa,au as ra,a8 as ca,ad as oa,af as ia,ag as na,aw as da,ar as Ba,ap as va,aa as ka,am as ha,a9 as ua,ab as ma,ah as Sa,at as wa,ak as pa,as as Ea,av as xa,al as Aa,an as Fa,ae as Va,ac as fa,ax as Ca,aq as Da,ai as Ga,aj as ya}from"./types-DYDdb31p.js";import"./index-DCE6egHv.js";class ea{static async executeBlock(e){try{switch(e.name){case"get-text":{const a=Y(e);return await _(a)}case"attribute-value":{const a=R(e);return await X(a)}case"get-value-form":{const a=O(e);return await Q(a)}case"set-value-form":{const a=z(e);return await I(a)}case"set-contenteditable":{const a=H(e);return await $(a)}case"clear-value-form":{const a=U(e);return await q(a)}case"element-exists":{const a=M(e);return await j(a)}case"event-click":{const a=K(e);return await L(a)}case"keypress":{const a=W(e);return await J(a)}case"wait":{const a=N(e);return await P(a)}case"wait-for-condition":{const a=g(e);return await T(a)}case"navigate":{const a=G(e);return await y(a)}case"save-assets":{const a=C(e);return await D(a)}case"get-element-data":{const a=V(e);return await f(a)}case"scroll":{const a=A(e);return await F(a)}case"ai-parse-data":{const a=E(e);return await x(a)}case"fetch-api":{const a=w(e);return await p(a)}case"transform-data":{const a=m(e);return await S(a)}case"export-data":{const a=h(e);return await u(a)}case"network-catch":{const a=v(e);return await k(a)}case"mark-border":{const a=d(e);return await B(a)}case"apply-locale":{const a=i(e);return await n(a)}case"paste-value":{const a=c(e);return await o(a)}case"execute-javascript":{const a=s(e);return await r(a)}case"throw-error":{const a=t(e);return await l(a)}default:return{hasError:!0,message:`Unknown block type: ${e.name}`,data:null}}}catch(a){return{hasError:!0,message:a instanceof Error?a.message:"Unknown error in block execution",data:null}}}}export{sa as AiParseDataBlockSchema,ra as ApplyLocaleBlockSchema,ca as BaseBlockSchema,ea as BlockHandler,oa as ClearValueFormsBlockSchema,ia as ElementExistsBlockSchema,na as EventClickBlockSchema,da as ExecuteJavaScriptBlockSchema,Ba as ExportDataBlockSchema,va as FetchApiBlockSchema,ka as GetAttributeValueBlockSchema,ha as GetElementDataBlockSchema,ua as GetTextBlockSchema,ma as GetValueFormsBlockSchema,Sa as KeypressBlockSchema,wa as MarkBorderBlockSchema,pa as NavigateBlockSchema,Ea as NetworkCatchBlockSchema,xa as PasteValueBlockSchema,Aa as SaveAssetsBlockSchema,Fa as ScrollBlockSchema,Va as SetContentEditableBlockSchema,fa as SetValueFormsBlockSchema,Ca as ThrowErrorBlockSchema,Da as TransformDataBlockSchema,Ga as WaitBlockSchema,ya as WaitForConditionBlockSchema};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ab=Object.defineProperty;var ib=(r,e,t)=>e in r?ab(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var b=(r,e,t)=>ib(r,typeof e!="symbol"?e+"":e,t);import{i as ob,g as ub,h as cb,j as lb,k as db,l as hb,m as fb,n as pb}from"./internal-messages-CYId_2VJ.js";import{g as Ys,Z as M,a as An,o as Pr,s as Mn,b as Jd,n as Gd,e as ba,C as Uo,c as mb,l as gb,u as yb}from"./types-DpElvRFi.js";import"./index-DCE6egHv.js";class _b{constructor(e){b(this,"activeTabs",new Map);b(this,"closedTabs",new Set);b(this,"executingWorkflowTabs",new Map);b(this,"cdpService");b(this,"tabOrigins",new Map);b(this,"trackedChildTabs",new Map);this.cdpService=e,this.initializeTabClosedListener(),this.initializeTabUpdatedListener(),this.initializeTabCreatedListener()}initializeTabClosedListener(){chrome.tabs.onRemoved.addListener(async e=>{if(console.log("[TabManager] Tab closed:",e),this.activeTabs.has(e)){console.log("[TabManager] Tracked tab was closed:",e);try{await this.cdpService.stopNetworkTracking(e),console.log("[TabManager] Network tracking stopped for closed tab:",e)}catch(t){console.warn("[TabManager] Failed to stop network tracking:",t)}try{await this.cdpService.detachDebugger(e),console.log("[TabManager] Debugger detached for closed tab:",e)}catch(t){console.warn("[TabManager] Failed to detach debugger:",t)}this.cdpService.clearNetworkRequests(e),this.activeTabs.delete(e),this.closedTabs.add(e),this.executingWorkflowTabs.delete(e),this.trackedChildTabs.delete(e),setTimeout(()=>{this.closedTabs.delete(e)},6e4)}this.trackedChildTabs.has(e)&&this.trackedChildTabs.delete(e),await this.focusSiblingOrParent(e)})}initializeTabUpdatedListener(){chrome.tabs.onUpdated.addListener(async(e,t)=>{if(t.status==="complete"&&this.executingWorkflowTabs.has(e)&&!this.trackedChildTabs.has(e)){const n=this.executingWorkflowTabs.get(e);n&&(console.log("[TabManager] Page loaded in executing workflow tab, re-showing UI:",e),setTimeout(async()=>{await this.showExecutionStatus(e,n.message)},500))}if(t.status==="complete"&&this.trackedChildTabs.has(e)){const n=this.trackedChildTabs.get(e);if(n){console.log(`[TabManager] Tracked child tab loaded, showing execution status and confirmation UI. Child: ${e}, Parent: ${n}`);const s=this.executingWorkflowTabs.get(n),a=(s==null?void 0:s.message)||"워크플로우 실행 중";setTimeout(async()=>{await this.showExecutionStatus(e,a,!1),await this.showConfirmation(e,n,void 0,void 0,"top")},1e3)}}})}initializeTabCreatedListener(){chrome.tabs.onCreated.addListener(async e=>{if(!e.id)return;const t=await chrome.tabs.query({windowId:e.windowId});let n;for(const s of t)if(s.id&&s.id!==e.id&&this.executingWorkflowTabs.has(s.id)){n=s.id;break}if(n){console.log(`[TabManager] New tab created from executing workflow tab. Child: ${e.id}, Parent: ${n}`),this.trackedChildTabs.set(e.id,n),this.tabOrigins.set(e.id,n);try{await this.cdpService.attachDebugger(e.id),await this.cdpService.startNetworkTracking(e.id),this.activeTabs.set(e.id,{url:e.url||"",createdAt:Date.now()}),console.log("[TabManager] Debugger attached for new child tab:",e.id)}catch(s){console.warn("[TabManager] Failed to attach debugger to new child tab:",s)}}})}isTabClosed(e){return this.closedTabs.has(e)}async createTab(e,t=!1,n=2e3,s=!0,a){const i=await chrome.tabs.create({url:e,active:t});if(!i.id)throw new Error("Failed to create new tab");this.showExecutionStatus(i.id,"워크플로우 실행 중",!0).catch(o=>console.warn("[TabManager] Failed to show execution status on tab creation:",o));try{await this.cdpService.attachDebugger(i.id),console.log("[TabManager] Debugger attached for tab:",i.id)}catch(o){throw await chrome.tabs.remove(i.id),o}if(this.activeTabs.set(i.id,{url:e,createdAt:Date.now()}),a!==void 0&&a!==i.id&&this.tabOrigins.set(i.id,a),s)try{await this.cdpService.startNetworkTracking(i.id),console.log("[TabManager] Network tracking started for tab:",i.id)}catch(o){console.warn("[TabManager] Failed to start network tracking:",o)}return await this.waitForTabLoad(i.id),await new Promise(o=>setTimeout(o,n)),i}async closeTab(e){await this.closeTabWithoutFocus(e),await this.focusParentTab(e)}async closeTabWithoutFocus(e){try{await this.cdpService.stopNetworkTracking(e),console.log("[TabManager] Network tracking stopped before closing tab:",e)}catch(s){console.warn("[TabManager] Failed to stop network tracking:",s)}try{await this.cdpService.detachDebugger(e),console.log("[TabManager] Debugger detached before closing tab:",e)}catch(s){console.warn("[TabManager] Failed to detach debugger before closing tab:",s)}this.cdpService.clearNetworkRequests(e),await chrome.tabs.remove(e),this.activeTabs.delete(e);const t=new Set;let n=e;for(;n&&!t.has(n);){t.add(n);const s=this.tabOrigins.get(n);this.tabOrigins.delete(n),this.trackedChildTabs.delete(n),n=s}}async waitForTabLoad(e,t=1e5){return new Promise((n,s)=>{const a=setTimeout(()=>{chrome.tabs.onUpdated.removeListener(i),s(new Error("Tab load timeout"))},t),i=(o,u)=>{o===e&&u.status==="complete"&&(clearTimeout(a),chrome.tabs.onUpdated.removeListener(i),console.log("[8G TabManager] Tab loaded successfully:",e),n())};chrome.tabs.onUpdated.addListener(i)})}async showExecutionStatus(e,t,n=!0,s,a,i){if(this.isTabClosed(e)){console.log("[TabManager] Cannot show execution status - tab was closed:",e);return}const o=t||"워크플로우 실행 중";n&&this.executingWorkflowTabs.set(e,{message:o});const u={type:"SHOW_EXECUTION_STATUS",data:{message:o,statusType:s||"loading",icon:a||"default",position:i||"bottom-right"}};try{await chrome.tabs.sendMessage(e,u),n&&await this.showConfirmation(e,void 0,"데이터를 수집하고 있습니다. 잠시만 기다려 주세요.",void 0,"top","success","shield",!1),console.log("[TabManager] Execution status shown",{tabId:e,registerAsExecuting:n,statusType:s,icon:a,position:i})}catch(c){console.warn("[TabManager] Failed to show execution status:",c)}}async hideExecutionStatus(e){if(this.isTabClosed(e)){console.log("[TabManager] Cannot hide execution status - tab was closed:",e);return}this.executingWorkflowTabs.delete(e);const t={type:"HIDE_EXECUTION_STATUS"};try{await chrome.tabs.sendMessage(e,t),console.log("[TabManager] Execution status hidden")}catch(n){console.warn("[TabManager] Failed to hide execution status:",n)}}async showConfirmation(e,t,n,s,a,i,o,u){if(this.isTabClosed(e)){console.log("[TabManager] Cannot show confirmation - tab was closed:",e);return}const c={type:"SHOW_CONFIRMATION",data:{message:n||"로그인 완료 후 확인 버튼을 클릭해주세요.",buttonText:s,position:a||"top",variant:i||"default",icon:o||"alert",showClose:u!==void 0?u:!0,parentTabId:t}};try{await chrome.tabs.sendMessage(e,c),console.log("[TabManager] Confirmation UI shown on child tab:",{tabId:e,position:a,variant:i,icon:o,showClose:u})}catch(l){console.warn("[TabManager] Failed to show confirmation UI:",l)}}async executeBlock(e,t){return this.isTabClosed(t)?(console.log("[TabManager] Cannot execute block - tab was closed:",t),{hasError:!0,message:"Tab was closed by user",data:null}):this.executeBlockWithRetry(e,t,0)}async executeBlockWithRetry(e,t,n){return new Promise((a,i)=>{const o={isBlock:!0,type:"EXECUTE_BLOCK",data:e};chrome.tabs.sendMessage(t,o,async u=>{if(chrome.runtime.lastError){const c=chrome.runtime.lastError.message||"";if(console.log("[TabManager] Error sending message:",c),this.isTabClosed(t)){i(new Error("Tab was closed by user"));return}if((c.includes("Receiving end does not exist")||c.includes("message channel closed")||c.includes("back/forward cache"))&&n<3){console.log(`[TabManager] Page transition detected, waiting for reload and retrying (${n+1}/3)...`);try{await this.waitForTabLoad(t,1e4),await new Promise(h=>setTimeout(h,1e3));const d=await this.executeBlockWithRetry(e,t,n+1);a(d)}catch{i(new Error("Page load timeout after transition"))}}else i(new Error(c||"Communication error"))}else ob(u)?(console.log("[TabManager] Content script error:",u.message),i(new Error(u.message))):(console.log("[TabManager] Received response from content script"),a(u||{data:null}))})})}findRootParentTab(e){const t=new Set;let n=e;for(;n;){if(t.has(n)){console.warn(`[TabManager] Circular reference detected in tab origins: ${n}`);return}t.add(n);const s=this.tabOrigins.get(n);if(!s)return n===e?void 0:n;n=s}}findAnyExecutingTab(e){for(const t of this.executingWorkflowTabs.keys())if(t!==e&&!this.closedTabs.has(t))return t}findRecentlyCreatedSiblingTab(e){const t=this.tabOrigins.get(e);if(t){for(const[n,s]of this.tabOrigins.entries())if(s===t&&n!==e&&!this.closedTabs.has(n)&&this.activeTabs.has(n)&&!this.executingWorkflowTabs.has(n))return n}}async focusSiblingOrParent(e){const t=this.tabOrigins.get(e),n=this.findAnyExecutingTab(e),s=this.findRecentlyCreatedSiblingTab(e);this.tabOrigins.delete(e),this.trackedChildTabs.delete(e);try{const a=await chrome.tabs.query({active:!0});for(const i of a)if(i.id&&i.id!==e&&this.executingWorkflowTabs.has(i.id)){console.log(`[TabManager] Skipping focus change - already active executing tab ${i.id} exists`);return}}catch(a){console.warn("[TabManager] Failed to check active tabs:",a)}if(s&&!n){console.log(`[TabManager] Found recently created sibling tab ${s}, waiting for workflow to start...`),setTimeout(async()=>{try{const i=await chrome.tabs.get(s);if(i){if(i.active){console.log(`[TabManager] Skipping focus change after delay - recently created sibling tab ${s} is still active`);return}if(this.executingWorkflowTabs.has(s)){if(console.log(`[TabManager] Found executing sibling tab ${s} after delay, focusing it`),!i.active&&(await chrome.tabs.update(s,{active:!0}),typeof i.windowId=="number"))try{await chrome.windows.update(i.windowId,{focused:!0})}catch(o){console.warn("[TabManager] Failed to focus sibling tab window:",o)}return}}}catch(i){console.warn("[TabManager] Failed to check sibling tab after delay:",i)}try{const i=await chrome.tabs.query({active:!0});for(const o of i)if(o.id&&o.id!==e&&this.executingWorkflowTabs.has(o.id)){console.log(`[TabManager] Skipping focus change after delay - active tab ${o.id} is executing`);return}}catch(i){console.warn("[TabManager] Failed to check active tabs after delay:",i)}const a=this.findAnyExecutingTab(e);if(a)try{const i=await chrome.tabs.get(a);if(i&&!i.active){if(await chrome.tabs.update(a,{active:!0}),typeof i.windowId=="number")try{await chrome.windows.update(i.windowId,{focused:!0})}catch(o){console.warn("[TabManager] Failed to focus executing tab window:",o)}console.log(`[TabManager] Focused executing tab ${a} after delay`);return}}catch(i){console.warn("[TabManager] Failed to focus executing tab after delay:",i)}t&&await this.focusParentTabById(t,e)},1e3);return}if(n)try{const a=await chrome.tabs.get(n);if(!a){console.log(`[TabManager] Executing tab ${n} not found`),t&&await this.focusParentTabById(t,e);return}if(a.active){console.log(`[TabManager] Skipping focus change - executing tab ${n} is already active`);return}if(await chrome.tabs.update(n,{active:!0}),typeof a.windowId=="number")try{await chrome.windows.update(a.windowId,{focused:!0})}catch(i){console.warn("[TabManager] Failed to focus executing tab window:",i)}console.log(`[TabManager] Focused executing tab ${n} after closing tab ${e}`);return}catch(a){console.warn(`[TabManager] Failed to focus executing tab ${n} after closing tab ${e}:`,a),t&&await this.focusParentTabById(t,e);return}t&&await this.focusParentTabById(t,e)}async focusParentTab(e){const t=this.tabOrigins.get(e);if(!t){console.log(`[TabManager] No direct parent tab found for tab ${e}`);return}await this.focusParentTabById(t,e)}async focusParentTabById(e,t){try{const n=await chrome.tabs.get(e);if(!n){console.log(`[TabManager] Direct parent tab ${e} not found`);return}if(await chrome.tabs.update(e,{active:!0}),typeof n.windowId=="number")try{await chrome.windows.update(n.windowId,{focused:!0})}catch(s){console.warn("[TabManager] Failed to focus parent window:",s)}console.log(`[TabManager] Focused direct parent tab ${e} after closing child tab ${t}`)}catch(n){console.warn(`[TabManager] Failed to focus direct parent tab ${e} after closing child tab ${t}:`,n)}}getDirectParentTabId(e){return this.tabOrigins.get(e)}isExecutingWorkflow(e){return this.executingWorkflowTabs.has(e)}isTrackedChildTab(e){return this.trackedChildTabs.has(e)}getRootParentTabId(e){return this.findRootParentTab(e)}async reloadTab(e){if(this.isTabClosed(e)){console.log("[TabManager] Cannot reload tab - tab was closed:",e);return}try{await chrome.tabs.reload(e),console.log("[TabManager] Tab reloaded:",e)}catch(t){console.warn("[TabManager] Failed to reload tab:",t)}}findExecutingWorkflowTab(e){const t=new Set;let n=e;for(;n;){if(t.has(n))return;if(t.add(n),this.executingWorkflowTabs.has(n))return n;n=this.tabOrigins.get(n)}}getIntermediateTabs(e){const t=[],n=this.findRootParentTab(e);if(!n||n===e)return t;const s=new Set;let a=e;for(;a&&a!==n&&!s.has(a);){s.add(a);const i=this.tabOrigins.get(a);if(!i||i===n)break;this.executingWorkflowTabs.has(i)||t.push(i),a=i}return t}getNetworkRequests(e){return this.cdpService.getNetworkRequests(e)}async startNetworkTracking(e){await this.cdpService.startNetworkTracking(e)}async stopNetworkTracking(e){await this.cdpService.stopNetworkTracking(e)}}function va(r,e){return r.lc_error_code=e,r.message=`${r.message}
|
|
1
|
+
var ab=Object.defineProperty;var ib=(r,e,t)=>e in r?ab(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var b=(r,e,t)=>ib(r,typeof e!="symbol"?e+"":e,t);import{i as ob,g as ub,h as cb,j as lb,k as db,l as hb,m as fb,n as pb}from"./internal-messages-CYId_2VJ.js";import{g as Ys,Z as M,a as An,o as Pr,s as Mn,b as Jd,n as Gd,e as ba,C as Uo,c as mb,l as gb,u as yb}from"./types-DYDdb31p.js";import"./index-DCE6egHv.js";class _b{constructor(e){b(this,"activeTabs",new Map);b(this,"closedTabs",new Set);b(this,"executingWorkflowTabs",new Map);b(this,"cdpService");b(this,"tabOrigins",new Map);b(this,"trackedChildTabs",new Map);this.cdpService=e,this.initializeTabClosedListener(),this.initializeTabUpdatedListener(),this.initializeTabCreatedListener()}initializeTabClosedListener(){chrome.tabs.onRemoved.addListener(async e=>{if(console.log("[TabManager] Tab closed:",e),this.activeTabs.has(e)){console.log("[TabManager] Tracked tab was closed:",e);try{await this.cdpService.stopNetworkTracking(e),console.log("[TabManager] Network tracking stopped for closed tab:",e)}catch(t){console.warn("[TabManager] Failed to stop network tracking:",t)}try{await this.cdpService.detachDebugger(e),console.log("[TabManager] Debugger detached for closed tab:",e)}catch(t){console.warn("[TabManager] Failed to detach debugger:",t)}this.cdpService.clearNetworkRequests(e),this.activeTabs.delete(e),this.closedTabs.add(e),this.executingWorkflowTabs.delete(e),this.trackedChildTabs.delete(e),setTimeout(()=>{this.closedTabs.delete(e)},6e4)}this.trackedChildTabs.has(e)&&this.trackedChildTabs.delete(e),await this.focusSiblingOrParent(e)})}initializeTabUpdatedListener(){chrome.tabs.onUpdated.addListener(async(e,t)=>{if(t.status==="complete"&&this.executingWorkflowTabs.has(e)&&!this.trackedChildTabs.has(e)){const n=this.executingWorkflowTabs.get(e);n&&(console.log("[TabManager] Page loaded in executing workflow tab, re-showing UI:",e),setTimeout(async()=>{await this.showExecutionStatus(e,n.message)},500))}if(t.status==="complete"&&this.trackedChildTabs.has(e)){const n=this.trackedChildTabs.get(e);if(n){console.log(`[TabManager] Tracked child tab loaded, showing execution status and confirmation UI. Child: ${e}, Parent: ${n}`);const s=this.executingWorkflowTabs.get(n),a=(s==null?void 0:s.message)||"워크플로우 실행 중";setTimeout(async()=>{await this.showExecutionStatus(e,a,!1),await this.showConfirmation(e,n,void 0,void 0,"top")},1e3)}}})}initializeTabCreatedListener(){chrome.tabs.onCreated.addListener(async e=>{if(!e.id)return;const t=await chrome.tabs.query({windowId:e.windowId});let n;for(const s of t)if(s.id&&s.id!==e.id&&this.executingWorkflowTabs.has(s.id)){n=s.id;break}if(n){console.log(`[TabManager] New tab created from executing workflow tab. Child: ${e.id}, Parent: ${n}`),this.trackedChildTabs.set(e.id,n),this.tabOrigins.set(e.id,n);try{await this.cdpService.attachDebugger(e.id),await this.cdpService.startNetworkTracking(e.id),this.activeTabs.set(e.id,{url:e.url||"",createdAt:Date.now()}),console.log("[TabManager] Debugger attached for new child tab:",e.id)}catch(s){console.warn("[TabManager] Failed to attach debugger to new child tab:",s)}}})}isTabClosed(e){return this.closedTabs.has(e)}async createTab(e,t=!1,n=2e3,s=!0,a){const i=await chrome.tabs.create({url:e,active:t});if(!i.id)throw new Error("Failed to create new tab");this.showExecutionStatus(i.id,"워크플로우 실행 중",!0).catch(o=>console.warn("[TabManager] Failed to show execution status on tab creation:",o));try{await this.cdpService.attachDebugger(i.id),console.log("[TabManager] Debugger attached for tab:",i.id)}catch(o){throw await chrome.tabs.remove(i.id),o}if(this.activeTabs.set(i.id,{url:e,createdAt:Date.now()}),a!==void 0&&a!==i.id&&this.tabOrigins.set(i.id,a),s)try{await this.cdpService.startNetworkTracking(i.id),console.log("[TabManager] Network tracking started for tab:",i.id)}catch(o){console.warn("[TabManager] Failed to start network tracking:",o)}return await this.waitForTabLoad(i.id),await new Promise(o=>setTimeout(o,n)),i}async closeTab(e){await this.closeTabWithoutFocus(e),await this.focusParentTab(e)}async closeTabWithoutFocus(e){try{await this.cdpService.stopNetworkTracking(e),console.log("[TabManager] Network tracking stopped before closing tab:",e)}catch(s){console.warn("[TabManager] Failed to stop network tracking:",s)}try{await this.cdpService.detachDebugger(e),console.log("[TabManager] Debugger detached before closing tab:",e)}catch(s){console.warn("[TabManager] Failed to detach debugger before closing tab:",s)}this.cdpService.clearNetworkRequests(e),await chrome.tabs.remove(e),this.activeTabs.delete(e);const t=new Set;let n=e;for(;n&&!t.has(n);){t.add(n);const s=this.tabOrigins.get(n);this.tabOrigins.delete(n),this.trackedChildTabs.delete(n),n=s}}async waitForTabLoad(e,t=1e5){return new Promise((n,s)=>{const a=setTimeout(()=>{chrome.tabs.onUpdated.removeListener(i),s(new Error("Tab load timeout"))},t),i=(o,u)=>{o===e&&u.status==="complete"&&(clearTimeout(a),chrome.tabs.onUpdated.removeListener(i),console.log("[8G TabManager] Tab loaded successfully:",e),n())};chrome.tabs.onUpdated.addListener(i)})}async showExecutionStatus(e,t,n=!0,s,a,i){if(this.isTabClosed(e)){console.log("[TabManager] Cannot show execution status - tab was closed:",e);return}const o=t||"워크플로우 실행 중";n&&this.executingWorkflowTabs.set(e,{message:o});const u={type:"SHOW_EXECUTION_STATUS",data:{message:o,statusType:s||"loading",icon:a||"default",position:i||"bottom-right"}};try{await chrome.tabs.sendMessage(e,u),n&&await this.showConfirmation(e,void 0,"데이터를 수집하고 있습니다. 잠시만 기다려 주세요.",void 0,"top","success","shield",!1),console.log("[TabManager] Execution status shown",{tabId:e,registerAsExecuting:n,statusType:s,icon:a,position:i})}catch(c){console.warn("[TabManager] Failed to show execution status:",c)}}async hideExecutionStatus(e){if(this.isTabClosed(e)){console.log("[TabManager] Cannot hide execution status - tab was closed:",e);return}this.executingWorkflowTabs.delete(e);const t={type:"HIDE_EXECUTION_STATUS"};try{await chrome.tabs.sendMessage(e,t),console.log("[TabManager] Execution status hidden")}catch(n){console.warn("[TabManager] Failed to hide execution status:",n)}}async showConfirmation(e,t,n,s,a,i,o,u){if(this.isTabClosed(e)){console.log("[TabManager] Cannot show confirmation - tab was closed:",e);return}const c={type:"SHOW_CONFIRMATION",data:{message:n||"로그인 완료 후 확인 버튼을 클릭해주세요.",buttonText:s,position:a||"top",variant:i||"default",icon:o||"alert",showClose:u!==void 0?u:!0,parentTabId:t}};try{await chrome.tabs.sendMessage(e,c),console.log("[TabManager] Confirmation UI shown on child tab:",{tabId:e,position:a,variant:i,icon:o,showClose:u})}catch(l){console.warn("[TabManager] Failed to show confirmation UI:",l)}}async executeBlock(e,t){return this.isTabClosed(t)?(console.log("[TabManager] Cannot execute block - tab was closed:",t),{hasError:!0,message:"Tab was closed by user",data:null}):this.executeBlockWithRetry(e,t,0)}async executeBlockWithRetry(e,t,n){return new Promise((a,i)=>{const o={isBlock:!0,type:"EXECUTE_BLOCK",data:e};chrome.tabs.sendMessage(t,o,async u=>{if(chrome.runtime.lastError){const c=chrome.runtime.lastError.message||"";if(console.log("[TabManager] Error sending message:",c),this.isTabClosed(t)){i(new Error("Tab was closed by user"));return}if((c.includes("Receiving end does not exist")||c.includes("message channel closed")||c.includes("back/forward cache"))&&n<3){console.log(`[TabManager] Page transition detected, waiting for reload and retrying (${n+1}/3)...`);try{await this.waitForTabLoad(t,1e4),await new Promise(h=>setTimeout(h,1e3));const d=await this.executeBlockWithRetry(e,t,n+1);a(d)}catch{i(new Error("Page load timeout after transition"))}}else i(new Error(c||"Communication error"))}else ob(u)?(console.log("[TabManager] Content script error:",u.message),i(new Error(u.message))):(console.log("[TabManager] Received response from content script"),a(u||{data:null}))})})}findRootParentTab(e){const t=new Set;let n=e;for(;n;){if(t.has(n)){console.warn(`[TabManager] Circular reference detected in tab origins: ${n}`);return}t.add(n);const s=this.tabOrigins.get(n);if(!s)return n===e?void 0:n;n=s}}findAnyExecutingTab(e){for(const t of this.executingWorkflowTabs.keys())if(t!==e&&!this.closedTabs.has(t))return t}findRecentlyCreatedSiblingTab(e){const t=this.tabOrigins.get(e);if(t){for(const[n,s]of this.tabOrigins.entries())if(s===t&&n!==e&&!this.closedTabs.has(n)&&this.activeTabs.has(n)&&!this.executingWorkflowTabs.has(n))return n}}async focusSiblingOrParent(e){const t=this.tabOrigins.get(e),n=this.findAnyExecutingTab(e),s=this.findRecentlyCreatedSiblingTab(e);this.tabOrigins.delete(e),this.trackedChildTabs.delete(e);try{const a=await chrome.tabs.query({active:!0});for(const i of a)if(i.id&&i.id!==e&&this.executingWorkflowTabs.has(i.id)){console.log(`[TabManager] Skipping focus change - already active executing tab ${i.id} exists`);return}}catch(a){console.warn("[TabManager] Failed to check active tabs:",a)}if(s&&!n){console.log(`[TabManager] Found recently created sibling tab ${s}, waiting for workflow to start...`),setTimeout(async()=>{try{const i=await chrome.tabs.get(s);if(i){if(i.active){console.log(`[TabManager] Skipping focus change after delay - recently created sibling tab ${s} is still active`);return}if(this.executingWorkflowTabs.has(s)){if(console.log(`[TabManager] Found executing sibling tab ${s} after delay, focusing it`),!i.active&&(await chrome.tabs.update(s,{active:!0}),typeof i.windowId=="number"))try{await chrome.windows.update(i.windowId,{focused:!0})}catch(o){console.warn("[TabManager] Failed to focus sibling tab window:",o)}return}}}catch(i){console.warn("[TabManager] Failed to check sibling tab after delay:",i)}try{const i=await chrome.tabs.query({active:!0});for(const o of i)if(o.id&&o.id!==e&&this.executingWorkflowTabs.has(o.id)){console.log(`[TabManager] Skipping focus change after delay - active tab ${o.id} is executing`);return}}catch(i){console.warn("[TabManager] Failed to check active tabs after delay:",i)}const a=this.findAnyExecutingTab(e);if(a)try{const i=await chrome.tabs.get(a);if(i&&!i.active){if(await chrome.tabs.update(a,{active:!0}),typeof i.windowId=="number")try{await chrome.windows.update(i.windowId,{focused:!0})}catch(o){console.warn("[TabManager] Failed to focus executing tab window:",o)}console.log(`[TabManager] Focused executing tab ${a} after delay`);return}}catch(i){console.warn("[TabManager] Failed to focus executing tab after delay:",i)}t&&await this.focusParentTabById(t,e)},1e3);return}if(n)try{const a=await chrome.tabs.get(n);if(!a){console.log(`[TabManager] Executing tab ${n} not found`),t&&await this.focusParentTabById(t,e);return}if(a.active){console.log(`[TabManager] Skipping focus change - executing tab ${n} is already active`);return}if(await chrome.tabs.update(n,{active:!0}),typeof a.windowId=="number")try{await chrome.windows.update(a.windowId,{focused:!0})}catch(i){console.warn("[TabManager] Failed to focus executing tab window:",i)}console.log(`[TabManager] Focused executing tab ${n} after closing tab ${e}`);return}catch(a){console.warn(`[TabManager] Failed to focus executing tab ${n} after closing tab ${e}:`,a),t&&await this.focusParentTabById(t,e);return}t&&await this.focusParentTabById(t,e)}async focusParentTab(e){const t=this.tabOrigins.get(e);if(!t){console.log(`[TabManager] No direct parent tab found for tab ${e}`);return}await this.focusParentTabById(t,e)}async focusParentTabById(e,t){try{const n=await chrome.tabs.get(e);if(!n){console.log(`[TabManager] Direct parent tab ${e} not found`);return}if(await chrome.tabs.update(e,{active:!0}),typeof n.windowId=="number")try{await chrome.windows.update(n.windowId,{focused:!0})}catch(s){console.warn("[TabManager] Failed to focus parent window:",s)}console.log(`[TabManager] Focused direct parent tab ${e} after closing child tab ${t}`)}catch(n){console.warn(`[TabManager] Failed to focus direct parent tab ${e} after closing child tab ${t}:`,n)}}getDirectParentTabId(e){return this.tabOrigins.get(e)}isExecutingWorkflow(e){return this.executingWorkflowTabs.has(e)}isTrackedChildTab(e){return this.trackedChildTabs.has(e)}getRootParentTabId(e){return this.findRootParentTab(e)}async reloadTab(e){if(this.isTabClosed(e)){console.log("[TabManager] Cannot reload tab - tab was closed:",e);return}try{await chrome.tabs.reload(e),console.log("[TabManager] Tab reloaded:",e)}catch(t){console.warn("[TabManager] Failed to reload tab:",t)}}findExecutingWorkflowTab(e){const t=new Set;let n=e;for(;n;){if(t.has(n))return;if(t.add(n),this.executingWorkflowTabs.has(n))return n;n=this.tabOrigins.get(n)}}getIntermediateTabs(e){const t=[],n=this.findRootParentTab(e);if(!n||n===e)return t;const s=new Set;let a=e;for(;a&&a!==n&&!s.has(a);){s.add(a);const i=this.tabOrigins.get(a);if(!i||i===n)break;this.executingWorkflowTabs.has(i)||t.push(i),a=i}return t}getNetworkRequests(e){return this.cdpService.getNetworkRequests(e)}async startNetworkTracking(e){await this.cdpService.startNetworkTracking(e)}async stopNetworkTracking(e){await this.cdpService.stopNetworkTracking(e)}}function va(r,e){return r.lc_error_code=e,r.message=`${r.message}
|
|
2
2
|
|
|
3
3
|
Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/
|
|
4
4
|
`,r}function te(r,e,t,n,s){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}function O(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}let vm=function(){const{crypto:r}=globalThis;if(r!=null&&r.randomUUID)return vm=r.randomUUID.bind(r),r.randomUUID();const e=new Uint8Array(1),t=r?()=>r.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^t()&15>>+n/4).toString(16))};function kc(r){return typeof r=="object"&&r!==null&&("name"in r&&r.name==="AbortError"||"message"in r&&String(r.message).includes("FetchRequestCanceledException"))}const Cc=r=>{if(r instanceof Error)return r;if(typeof r=="object"&&r!==null){try{if(Object.prototype.toString.call(r)==="[object Error]"){const e=new Error(r.message,r.cause?{cause:r.cause}:{});return r.stack&&(e.stack=r.stack),r.cause&&!e.cause&&(e.cause=r.cause),r.name&&(e.name=r.name),e}}catch{}try{return new Error(JSON.stringify(r))}catch{}}return new Error(r)};class Y extends Error{}let mt=class Rc extends Y{constructor(e,t,n,s){super(`${Rc.makeMessage(e,t,n)}`),this.status=e,this.headers=s,this.requestID=s==null?void 0:s.get("x-request-id"),this.error=t;const a=t;this.code=a==null?void 0:a.code,this.param=a==null?void 0:a.param,this.type=a==null?void 0:a.type}static makeMessage(e,t,n){const s=t!=null&&t.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&s?`${e} ${s}`:e?`${e} status code (no body)`:s||"(no status code or body)"}static generate(e,t,n,s){if(!e||!s)return new eo({message:n,cause:Cc(t)});const a=t==null?void 0:t.error;return e===400?new Tm(e,a,n,s):e===401?new Sm(e,a,n,s):e===403?new Em(e,a,n,s):e===404?new xm(e,a,n,s):e===409?new Im(e,a,n,s):e===422?new Om(e,a,n,s):e===429?new Am(e,a,n,s):e>=500?new km(e,a,n,s):new Rc(e,a,n,s)}},St=class extends mt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},eo=class extends mt{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},to=class extends eo{constructor({message:e}={}){super({message:e??"Request timed out."})}},Tm=class extends mt{},Sm=class extends mt{},Em=class extends mt{},xm=class extends mt{},Im=class extends mt{},Om=class extends mt{},Am=class extends mt{},km=class extends mt{};class Cm extends Y{constructor(){super("Could not parse response content as the length limit was reached")}}class Rm extends Y{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}class ms extends Error{constructor(e){super(e)}}const wb=/^[a-z][a-z0-9+.-]*:/i,bb=r=>wb.test(r);let lt=r=>(lt=Array.isArray,lt(r)),Vd=lt;function $m(r){return typeof r!="object"?{}:r??{}}function vb(r){if(!r)return!0;for(const e in r)return!1;return!0}function Tb(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Do(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)}const Sb=(r,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Y(`${r} must be an integer`);if(e<0)throw new Y(`${r} must be a positive integer`);return e},Eb=r=>{try{return JSON.parse(r)}catch{return}},Qs=r=>new Promise(e=>setTimeout(e,r)),Tn="6.9.1",xb=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function Ib(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}const Ob=()=>{var t;const r=Ib();if(r==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Tn,"X-Stainless-OS":Zd(Deno.build.os),"X-Stainless-Arch":Kd(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:((t=Deno.version)==null?void 0:t.deno)??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Tn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(r==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Tn,"X-Stainless-OS":Zd(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Kd(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};const e=Ab();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Tn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Tn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Ab(){if(typeof navigator>"u"||!navigator)return null;const r=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:e,pattern:t}of r){const n=t.exec(navigator.userAgent);if(n){const s=n[1]||0,a=n[2]||0,i=n[3]||0;return{browser:e,version:`${s}.${a}.${i}`}}}return null}const Kd=r=>r==="x32"?"x32":r==="x86_64"||r==="x64"?"x64":r==="arm"?"arm":r==="aarch64"||r==="arm64"?"arm64":r?`other:${r}`:"unknown",Zd=r=>(r=r.toLowerCase(),r.includes("ios")?"iOS":r==="android"?"Android":r==="darwin"?"MacOS":r==="win32"?"Windows":r==="freebsd"?"FreeBSD":r==="openbsd"?"OpenBSD":r==="linux"?"Linux":r?`Other:${r}`:"Unknown");let Xd;const kb=()=>Xd??(Xd=Ob());function Cb(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Pm(...r){const e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...r)}function Nm(r){let e=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator]();return Pm({start(){},async pull(t){const{done:n,value:s}=await e.next();n?t.close():t.enqueue(s)},async cancel(){var t;await((t=e.return)==null?void 0:t.call(e))}})}function Mm(r){if(r[Symbol.asyncIterator])return r;const e=r.getReader();return{async next(){try{const t=await e.read();return t!=null&&t.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){const t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Rb(r){var n,s;if(r===null||typeof r!="object")return;if(r[Symbol.asyncIterator]){await((s=(n=r[Symbol.asyncIterator]()).return)==null?void 0:s.call(n));return}const e=r.getReader(),t=e.cancel();e.releaseLock(),await t}const $b=({headers:r,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)}),Lm="RFC3986",jm=r=>String(r),Yd={RFC1738:r=>String(r).replace(/%20/g,"+"),RFC3986:jm},Pb="RFC1738";let $c=(r,e)=>($c=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),$c(r,e));const rr=(()=>{const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})(),Bo=1024,Nb=(r,e,t,n,s)=>{if(r.length===0)return r;let a=r;if(typeof r=="symbol"?a=Symbol.prototype.toString.call(r):typeof r!="string"&&(a=String(r)),t==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(o){return"%26%23"+parseInt(o.slice(2),16)+"%3B"});let i="";for(let o=0;o<a.length;o+=Bo){const u=a.length>=Bo?a.slice(o,o+Bo):a,c=[];for(let l=0;l<u.length;++l){let d=u.charCodeAt(l);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||s===Pb&&(d===40||d===41)){c[c.length]=u.charAt(l);continue}if(d<128){c[c.length]=rr[d];continue}if(d<2048){c[c.length]=rr[192|d>>6]+rr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=rr[224|d>>12]+rr[128|d>>6&63]+rr[128|d&63];continue}l+=1,d=65536+((d&1023)<<10|u.charCodeAt(l)&1023),c[c.length]=rr[240|d>>18]+rr[128|d>>12&63]+rr[128|d>>6&63]+rr[128|d&63]}i+=c.join("")}return i};function Mb(r){return!r||typeof r!="object"?!1:!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))}function Qd(r,e){if(lt(r)){const t=[];for(let n=0;n<r.length;n+=1)t.push(e(r[n]));return t}return e(r)}const Fm={brackets(r){return String(r)+"[]"},comma:"comma",indices(r,e){return String(r)+"["+e+"]"},repeat(r){return String(r)}},Um=function(r,e){Array.prototype.push.apply(r,lt(e)?e:[e])};let eh;const qe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Nb,encodeValuesOnly:!1,format:Lm,formatter:jm,indices:!1,serializeDate(r){return(eh??(eh=Function.prototype.call.bind(Date.prototype.toISOString)))(r)},skipNulls:!1,strictNullHandling:!1};function Lb(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r=="symbol"||typeof r=="bigint"}const qo={};function Dm(r,e,t,n,s,a,i,o,u,c,l,d,h,f,p,g,m,w){let _=r,y=w,E=0,x=!1;for(;(y=y.get(qo))!==void 0&&!x;){const se=y.get(r);if(E+=1,typeof se<"u"){if(se===E)throw new RangeError("Cyclic object value");x=!0}typeof y.get(qo)>"u"&&(E=0)}if(typeof c=="function"?_=c(e,_):_ instanceof Date?_=h==null?void 0:h(_):t==="comma"&<(_)&&(_=Qd(_,function(se){return se instanceof Date?h==null?void 0:h(se):se})),_===null){if(a)return u&&!g?u(e,qe.encoder,m,"key",f):e;_=""}if(Lb(_)||Mb(_)){if(u){const se=g?e:u(e,qe.encoder,m,"key",f);return[(p==null?void 0:p(se))+"="+(p==null?void 0:p(u(_,qe.encoder,m,"value",f)))]}return[(p==null?void 0:p(e))+"="+(p==null?void 0:p(String(_)))]}const A=[];if(typeof _>"u")return A;let C;if(t==="comma"&<(_))g&&u&&(_=Qd(_,u)),C=[{value:_.length>0?_.join(",")||null:void 0}];else if(lt(c))C=c;else{const se=Object.keys(_);C=l?se.sort(l):se}const S=o?String(e).replace(/\./g,"%2E"):String(e),G=n&<(_)&&_.length===1?S+"[]":S;if(s&<(_)&&_.length===0)return G+"[]";for(let se=0;se<C.length;++se){const W=C[se],Oe=typeof W=="object"&&typeof W.value<"u"?W.value:_[W];if(i&&Oe===null)continue;const gt=d&&o?W.replace(/\./g,"%2E"):W,L=lt(_)?typeof t=="function"?t(G,gt):G:G+(d?"."+gt:"["+gt+"]");w.set(r,E);const P=new WeakMap;P.set(qo,w),Um(A,Dm(Oe,L,t,n,s,a,i,o,t==="comma"&&g&<(_)?null:u,c,l,d,h,f,p,g,m,P))}return A}function jb(r=qe){if(typeof r.allowEmptyArrays<"u"&&typeof r.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof r.encodeDotInKeys<"u"&&typeof r.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(r.encoder!==null&&typeof r.encoder<"u"&&typeof r.encoder!="function")throw new TypeError("Encoder has to be a function.");const e=r.charset||qe.charset;if(typeof r.charset<"u"&&r.charset!=="utf-8"&&r.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=Lm;if(typeof r.format<"u"){if(!$c(Yd,r.format))throw new TypeError("Unknown format option provided.");t=r.format}const n=Yd[t];let s=qe.filter;(typeof r.filter=="function"||lt(r.filter))&&(s=r.filter);let a;if(r.arrayFormat&&r.arrayFormat in Fm?a=r.arrayFormat:"indices"in r?a=r.indices?"indices":"repeat":a=qe.arrayFormat,"commaRoundTrip"in r&&typeof r.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const i=typeof r.allowDots>"u"?r.encodeDotInKeys?!0:qe.allowDots:!!r.allowDots;return{addQueryPrefix:typeof r.addQueryPrefix=="boolean"?r.addQueryPrefix:qe.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof r.allowEmptyArrays=="boolean"?!!r.allowEmptyArrays:qe.allowEmptyArrays,arrayFormat:a,charset:e,charsetSentinel:typeof r.charsetSentinel=="boolean"?r.charsetSentinel:qe.charsetSentinel,commaRoundTrip:!!r.commaRoundTrip,delimiter:typeof r.delimiter>"u"?qe.delimiter:r.delimiter,encode:typeof r.encode=="boolean"?r.encode:qe.encode,encodeDotInKeys:typeof r.encodeDotInKeys=="boolean"?r.encodeDotInKeys:qe.encodeDotInKeys,encoder:typeof r.encoder=="function"?r.encoder:qe.encoder,encodeValuesOnly:typeof r.encodeValuesOnly=="boolean"?r.encodeValuesOnly:qe.encodeValuesOnly,filter:s,format:t,formatter:n,serializeDate:typeof r.serializeDate=="function"?r.serializeDate:qe.serializeDate,skipNulls:typeof r.skipNulls=="boolean"?r.skipNulls:qe.skipNulls,sort:typeof r.sort=="function"?r.sort:null,strictNullHandling:typeof r.strictNullHandling=="boolean"?r.strictNullHandling:qe.strictNullHandling}}function Fb(r,e={}){let t=r;const n=jb(e);let s,a;typeof n.filter=="function"?(a=n.filter,t=a("",t)):lt(n.filter)&&(a=n.filter,s=a);const i=[];if(typeof t!="object"||t===null)return"";const o=Fm[n.arrayFormat],u=o==="comma"&&n.commaRoundTrip;s||(s=Object.keys(t)),n.sort&&s.sort(n.sort);const c=new WeakMap;for(let h=0;h<s.length;++h){const f=s[h];n.skipNulls&&t[f]===null||Um(i,Dm(t[f],f,o,u,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}const l=i.join(n.delimiter);let d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),l.length>0?d+l:""}function Ub(r){let e=0;for(const s of r)e+=s.length;const t=new Uint8Array(e);let n=0;for(const s of r)t.set(s,n),n+=s.length;return t}let th;function Ol(r){let e;return(th??(e=new globalThis.TextEncoder,th=e.encode.bind(e)))(r)}let rh;function nh(r){let e;return(rh??(e=new globalThis.TextDecoder,rh=e.decode.bind(e)))(r)}var yt,_t;let ro=class{constructor(){yt.set(this,void 0),_t.set(this,void 0),te(this,yt,new Uint8Array),te(this,_t,null)}decode(e){if(e==null)return[];const t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Ol(e):e;te(this,yt,Ub([O(this,yt,"f"),t]));const n=[];let s;for(;(s=Db(O(this,yt,"f"),O(this,_t,"f")))!=null;){if(s.carriage&&O(this,_t,"f")==null){te(this,_t,s.index);continue}if(O(this,_t,"f")!=null&&(s.index!==O(this,_t,"f")+1||s.carriage)){n.push(nh(O(this,yt,"f").subarray(0,O(this,_t,"f")-1))),te(this,yt,O(this,yt,"f").subarray(O(this,_t,"f"))),te(this,_t,null);continue}const a=O(this,_t,"f")!==null?s.preceding-1:s.preceding,i=nh(O(this,yt,"f").subarray(0,a));n.push(i),te(this,yt,O(this,yt,"f").subarray(s.index)),te(this,_t,null)}return n}flush(){return O(this,yt,"f").length?this.decode(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{j as h,c as x}from"./client-CU6jEEQX.js";import{i as v,a as y,b,c as S,d as k,e as C,f as I}from"./internal-messages-CYId_2VJ.js";import{r as w,a as T}from"./index-DCE6egHv.js";const L="modulepreload",_=function(r){return"/"+r},E={},g=function(e,n,o){let t=Promise.resolve();if(n&&n.length>0){let i=function(c){return Promise.all(c.map(l=>Promise.resolve(l).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),d=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));t=i(n.map(c=>{if(c=_(c),c in E)return;E[c]=!0;const l=c.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":L,l||(u.as="script"),u.crossOrigin="",u.href=c,d&&u.setAttribute("nonce",d),document.head.appendChild(u),l)return new Promise((p,m)=>{u.addEventListener("load",p),u.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(i){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=i,window.dispatchEvent(s),!s.defaultPrevented)throw i}return t.then(i=>{for(const s of i||[])s.status==="rejected"&&a(s.reason);return e().catch(a)})};class M{async sendToBackground(e){return new Promise((n,o)=>{chrome.runtime.sendMessage(e,t=>{chrome.runtime.lastError?o(new Error(chrome.runtime.lastError.message||"Communication error")):v(t)?o(new Error(t.message)):n(t)})})}async executeBlock(e){const{BlockHandler:n}=await g(async()=>{const{BlockHandler:t}=await import("./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DtKBE6PG.js","assets/types-DYDdb31p.js","assets/index-DCE6egHv.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as h,c as x}from"./client-CU6jEEQX.js";import{i as v,a as y,b,c as S,d as k,e as C,f as I}from"./internal-messages-CYId_2VJ.js";import{r as w,a as T}from"./index-DCE6egHv.js";const L="modulepreload",_=function(r){return"/"+r},E={},g=function(e,n,o){let t=Promise.resolve();if(n&&n.length>0){let i=function(c){return Promise.all(c.map(l=>Promise.resolve(l).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),d=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));t=i(n.map(c=>{if(c=_(c),c in E)return;E[c]=!0;const l=c.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":L,l||(u.as="script"),u.crossOrigin="",u.href=c,d&&u.setAttribute("nonce",d),document.head.appendChild(u),l)return new Promise((p,m)=>{u.addEventListener("load",p),u.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(i){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=i,window.dispatchEvent(s),!s.defaultPrevented)throw i}return t.then(i=>{for(const s of i||[])s.status==="rejected"&&a(s.reason);return e().catch(a)})};class M{async sendToBackground(e){return new Promise((n,o)=>{chrome.runtime.sendMessage(e,t=>{chrome.runtime.lastError?o(new Error(chrome.runtime.lastError.message||"Communication error")):v(t)?o(new Error(t.message)):n(t)})})}async executeBlock(e){const{BlockHandler:n}=await g(async()=>{const{BlockHandler:t}=await import("./index-DtKBE6PG.js");return{BlockHandler:t}},__vite__mapDeps([0,1,2])),{synchronizedLock:o}=await g(async()=>{const{synchronizedLock:t}=await import("./index-CYVwV_2L.js");return{synchronizedLock:t}},[]);await o.getLock();try{return await n.executeBlock(e)}finally{o.releaseLock()}}async handleRuntimeMessage(e){if(e!=null&&e.isBlock&&(e==null?void 0:e.type)==="EXECUTE_BLOCK")try{return await this.executeBlock(e.data)}catch(n){return{$isError:!0,message:n instanceof Error?n.message:"Unknown error",data:{}}}throw new Error("Invalid message type")}sendToWebpage(e){window.postMessage(e,"*")}createErrorResponse(e,n){return{type:"8G_COLLECT_RESPONSE",requestId:e,success:!1,result:{error:n instanceof Error?n.message:"Unknown error",timestamp:new Date().toISOString()}}}createSuccessResponse(e,n){return{type:"8G_COLLECT_RESPONSE",requestId:e,success:!0,result:n}}}class O{constructor(e){this.kernel=e}initializeMessageListener(){chrome.runtime.onMessage.addListener((e,n,o)=>{if(y(e))return this.kernel.handleRuntimeMessage(e).then(t=>o(t)).catch(t=>o(this.kernel.createErrorResponse("",t))),!0;if(b(e))return console.log("[InternalMessageHandler] Show execution status:",e.data),window.dispatchEvent(new CustomEvent("8g-show-execution-status",{detail:{message:e.data.message||"워크플로우 실행 중",statusType:e.data.statusType||"loading",icon:e.data.icon||"default"}})),o({success:!0}),!1;if(S(e))return console.log("[InternalMessageHandler] Hide execution status"),console.trace("[InternalMessageHandler] HIDE call stack:"),window.dispatchEvent(new CustomEvent("8g-hide-execution-status")),window.dispatchEvent(new CustomEvent("8g-hide-execution-status")),o({success:!0}),!1;if(k(e)){console.log("[InternalMessageHandler] Show confirmation:",e.data);const{message:t,buttonText:a,variant:i="default",icon:s="alert",showClose:d=!0,parentTabId:c}=e.data,l=a&&c?()=>{console.log("[InternalMessageHandler] User confirmed, closing tab and focusing parent:",c),chrome.runtime.sendMessage({type:"CLOSE_TAB_AND_FOCUS_PARENT",data:{parentTabId:c}}),window.dispatchEvent(new CustomEvent("8g-hide-execution-status"))}:void 0,f=()=>{console.log("[InternalMessageHandler] User closed confirmation UI"),window.dispatchEvent(new CustomEvent("8g-hide-execution-status"))};return window.dispatchEvent(new CustomEvent("8g-show-execution-status",{detail:{message:t,buttonText:a,variant:i,icon:s,showClose:d,onConfirm:l,onClose:f}})),o({success:!0}),!1}if(C(e)){console.log("[InternalMessageHandler] Close tab message received");const{parentTabId:t}=e.data;return chrome.runtime.sendMessage({type:"CLOSE_TAB_AND_FOCUS_PARENT",data:{parentTabId:t}}),o({success:!0}),!1}if(I(e))return console.log("[InternalMessageHandler] Trigger confirmation message received"),window.dispatchEvent(new CustomEvent("8g-trigger-confirmation")),o({success:!0}),!1;if(e.type==="CHECK_STATUS_DISMISSED"){const{notificationId:t,message:a}=e.payload||{};return window.dispatchEvent(new CustomEvent("8g-notification-dismissed",{detail:{notificationId:t,message:a}})),o({success:!0}),!1}if(e.type==="GET_ACCOUNT_INFO"){console.log("[InternalMessageHandler] Get account info message received");const t=this.extractAccountInfo();return o(t),!1}return!1})}extractAccountInfo(){const e=document.querySelector("[data-email]")||document.querySelector(".user-email")||document.querySelector('input[type="email"][disabled]'),n=document.querySelector("[data-name]")||document.querySelector(".user-name")||document.querySelector(".profile-name");return{email:(e==null?void 0:e.textContent)||(e==null?void 0:e.value)||null,name:(n==null?void 0:n.textContent)||null}}}class U{constructor(e){this.kernel=e}initializeMessageListener(){window.addEventListener("message",this.handleWindowMessage.bind(this))}async handleWindowMessage(e){if(e.source!==window)return;const n=e.data;switch(n.type){case"8G_EXTENSION_CHECK":this.handleExtensionCheck();break;case"8G_COLLECT_WORKFLOW":await this.handleCollectWorkflow(n);break}}handleExtensionCheck(){const e={type:"8G_EXTENSION_RESPONSE",installed:!0,version:"1.0.0"};this.kernel.sendToWebpage(e)}async handleCollectWorkflow(e){try{this.validateCollectWorkflowMessage(e);const n={type:"COLLECT_WORKFLOW_NEW_TAB",data:{targetUrl:e.targetUrl,workflow:e.workflow,closeTabAfterCollection:e.closeTabAfterCollection!==!1,activateTab:e.activateTab===!0}};try{const o=await this.kernel.sendToBackground(n),t=this.kernel.createSuccessResponse(e.requestId,o);this.kernel.sendToWebpage(t)}catch(o){const t=this.kernel.createErrorResponse(e.requestId,o);this.kernel.sendToWebpage(t)}}catch(n){const o=this.kernel.createErrorResponse(e.requestId,n);this.kernel.sendToWebpage(o)}}validateCollectWorkflowMessage(e){if(!e.targetUrl)throw new Error("Target URL is required");if(!e.workflow)throw new Error("Workflow is required");if(!e.workflow.start||!Array.isArray(e.workflow.steps))throw new Error("Workflow must have start and steps")}}function R(r){w.useEffect(()=>{if(!r)return;const e=["mousedown","mouseup","click","keydown","keyup"],n=t=>{t.isTrusted&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())};e.forEach(t=>{document.addEventListener(t,n,{capture:!0})});const o=document.querySelectorAll("iframe");return o.forEach(t=>{try{const a=t.contentDocument;a&&e.forEach(i=>{a.addEventListener(i,n,{capture:!0})})}catch{}}),()=>{e.forEach(t=>{document.removeEventListener(t,n,{capture:!0})}),o.forEach(t=>{try{const a=t.contentDocument;a&&e.forEach(i=>{a.removeEventListener(i,n,{capture:!0})})}catch{}})}},[r])}function H({visible:r}){const[e,n]=w.useState(!1);if(R(r),w.useEffect(()=>{if(r){const t="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><circle cx='12' cy='12' r='10' fill='none' stroke='%23a855f7' stroke-width='3'/><circle cx='12' cy='12' r='4' fill='%23a855f7'/></svg>";document.body.style.cursor=`url("${t}") 12 12, wait`}else document.body.style.cursor="";return()=>{document.body.style.cursor=""}},[r]),w.useEffect(()=>{n(r)},[r]),!r)return null;const o={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:2147483647,pointerEvents:"none",borderRadius:"16px",boxSizing:"border-box",boxShadow:e?"inset 0 0 0 2px rgba(168, 85, 247, 0.9), inset 0 0 0 8px rgba(168, 85, 247, 0.5), inset 0 0 0 16px rgba(168, 85, 247, 0.2)":"none",animation:e?"wave-flow 3s ease-in-out infinite":"none",opacity:e?1:0,transition:"opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1)"};return h.jsx("div",{style:o})}function A(){const[r,e]=w.useState(!1);return w.useEffect(()=>{const n=()=>{console.log("[8G ExecutionStatusUI] 🟢 SHOW event received"),e(!0)},o=()=>{console.log("[8G ExecutionStatusUI] 🔴 HIDE event received"),e(!1)};return window.addEventListener("8g-show-execution-status",n),window.addEventListener("8g-hide-execution-status",o),console.log("[8G ExecutionStatusUI] Event listeners registered"),()=>{window.removeEventListener("8g-show-execution-status",n),window.removeEventListener("8g-hide-execution-status",o)}},[]),w.useEffect(()=>{console.log("[8G ExecutionStatusUI] visible state changed to:",r)},[r]),h.jsx(H,{visible:r})}(()=>{if(window.is8gExtensionInjected)return;window.is8gExtensionInjected=!0,console.log("[8G Extension] Content script initialized on:",window.location.href),T();const r=new M,e=new O(r),n=new U(r);if(e.initializeMessageListener(),n.initializeMessageListener(),window.self===window.top){const t=()=>{const a=document.createElement("div");a.id="8g-extension-shadow-host",a.style.cssText="all: initial; position: fixed; top: 0; left: 0; width: 0; height: 0; z-index: 2147483647; pointer-events: none;",document.body.appendChild(a);const i=a.attachShadow({mode:"closed"}),s=document.createElement("div");s.id="8g-confirmation-ui-root",i.appendChild(s);const d=document.createElement("style");d.textContent=`
|
|
3
3
|
@keyframes wave-flow {
|
|
4
4
|
0% {
|
|
5
5
|
box-shadow:
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
(async () => {
|
|
6
6
|
const { onExecute } = await import(
|
|
7
7
|
/* @vite-ignore */
|
|
8
|
-
chrome.runtime.getURL("assets/main.tsx-
|
|
8
|
+
chrome.runtime.getURL("assets/main.tsx-BVBPmfe6.js")
|
|
9
9
|
);
|
|
10
10
|
onExecute?.({ perf: { injectTime, loadTime: performance.now() - injectTime } });
|
|
11
11
|
})().catch(console.error);
|