import{d as v,R as Z,l as Oe,e as St,c as D,k as A,u as ce,f as _e,j as J,m as Ne,p as z,o as Je,P as B,s as Qe,q as Ce,r as w,n as e,b as G,i as Xe,h as Mt,C as Q,w as et,g as We,t as $t,a as At}from"./assets/storage-kVIrj-Ow.js";/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tt=v("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const he=v("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $e=v("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fe=v("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rt=v("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dt=v("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ae=v("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const st=v("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zt=v("CircleGauge",[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const q=v("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Re=v("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const It=v("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nt=v("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tt=v("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Et=v("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lt=v("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pe=v("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const De=v("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pt=v("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ft=v("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const at=v("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ot=v("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const it=v("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ze=v("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _t=v("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wt=v("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ot=v("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rt=v("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ge=v("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bt=v("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ut=v("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ht=v("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ct=v("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lt=v("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const X=v("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const te=v("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qt=v("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const se=v("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dt=v("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gt=v("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vt=v("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kt=v("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E=v("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Be=t=>{let a;const s=new Set,n=(d,m)=>{const g=typeof d=="function"?d(a):d;if(!Object.is(g,a)){const o=a;a=m??(typeof g!="object"||g===null)?g:Object.assign({},a,g),s.forEach(p=>p(a,o))}},i=()=>a,h={setState:n,getState:i,getInitialState:()=>l,subscribe:d=>(s.add(d),()=>s.delete(d))},l=a=t(n,i,h);return h},Zt=(t=>t?Be(t):Be),Yt=t=>t;function Jt(t,a=Yt){const s=Z.useSyncExternalStore(t.subscribe,Z.useCallback(()=>a(t.getState()),[t,a]),Z.useCallback(()=>a(t.getInitialState()),[t,a]));return Z.useDebugValue(s),s}const Ue=t=>{const a=Zt(t),s=n=>Jt(a,n);return Object.assign(s,a),s},Qt=(t=>t?Ue(t):Ue),Xt=async()=>{if(!navigator.onLine)return"offline";const t=new AbortController,a=window.setTimeout(()=>t.abort(),1600);try{return await fetch("https://www.gstatic.com/generate_204",{method:"GET",mode:"no-cors",cache:"no-store",signal:t.signal}),"online"}catch{return"limited"}finally{window.clearTimeout(a)}},es=()=>{var i;const t=navigator,a=t.deviceMemory??4,s=t.hardwareConcurrency??4;return((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches)||a<=2||s<=2?"low":a>=8&&s>=8?"high":"medium"},ts=(t,a,s)=>s==="reduced"?!0:s==="full"?!1:a&&t==="low",ss={launchpad:"لانچ‌پد",ai:"راهک",bookmarks:"بوکمارک‌ها",readpad:"اتاق مطالعه",notes:"یادداشت‌ها",reminders:"یادآورها",projects:"پروژه‌های تب",feed:"فیدخوان",apps:"اتصال اپ‌ها",shop:"دستیار خرید",mission:"Mission Control",settings:"تنظیمات",offline:"Offline Toolkit"},x=Qt((t,a)=>({booted:!1,settings:St,connection:"online",windows:[],commandOpen:!1,controlCenterOpen:!1,notificationCenterOpen:!1,pendingAiPrompt:null,pendingReminderDate:null,sites:{top:[],recent:[],bookmarks:[],bookmarkFolders:[],internal:Oe},shortcuts:[],savedLinks:[],notes:[],reminders:[],projects:[],currentTabs:[],async init(){const s=await Ce.get(),n=es(),i={...s,ai:{...s.ai,assistantName:!s.ai.assistantName||s.ai.assistantName==="!R"?"راهک":s.ai.assistantName},launchpad:{...s.launchpad,hiddenUrls:s.launchpad.hiddenUrls??[]},performance:{...s.performance,detectedTier:n}};await Ce.set(i);const[r,c,h,l,d,m]=await Promise.all([A.getAll("links"),A.getAll("shortcuts"),A.getAll("notes"),A.getAll("reminders"),A.getAll("projects"),Xt()]);t({settings:i,savedLinks:r.map(g=>({...g,category:g.category||"عمومی",tags:g.tags??[]})).sort((g,o)=>o.createdAt-g.createdAt),shortcuts:c.sort((g,o)=>o.createdAt-g.createdAt),notes:h.sort((g,o)=>o.updatedAt-g.updatedAt),reminders:l.sort((g,o)=>g.dueAt-o.dueAt),projects:d.sort((g,o)=>o.updatedAt-g.updatedAt),connection:m,booted:!0}),await a().refreshBrowserData()},async refreshBrowserData(){const[s,n,i,r,c]=await Promise.all([D.topSites(),D.recentHistory(),D.bookmarks(),D.bookmarkFolders(),D.currentTabs()]);t({sites:{top:s,recent:n,bookmarks:i,bookmarkFolders:r,internal:Oe},currentTabs:c})},async setSettings(s){await Ce.set(s),t({settings:s})},async patchSettings(s){const n={...a().settings,...s};await a().setSettings(n)},openWindow(s){t({windows:[{id:s,title:ss[s],z:20}],commandOpen:!1})},closeWindow(s){t({windows:a().windows.filter(n=>n.id!==s)})},focusWindow(s){const n=Math.max(10,...a().windows.map(i=>i.z));t({windows:a().windows.map(i=>i.id===s?{...i,z:n+1}:i)})},toggleCommand(s){t({commandOpen:s??!a().commandOpen})},toggleControlCenter(){t({controlCenterOpen:!a().controlCenterOpen,notificationCenterOpen:!1})},toggleNotificationCenter(){t({notificationCenterOpen:!a().notificationCenterOpen,controlCenterOpen:!1})},commandResults(s){const n=s.trim(),i=n.toLowerCase(),r=a(),c=[],h=(o,p,u)=>c.push({id:`tool-${o}`,title:p,subtitle:u,icon:te,kind:"tool",action:()=>r.openWindow(o)});if(!n)return h("launchpad","باز کردن لانچ‌پد","دسترسی سریع به سایت‌ها و میانبرها"),h("ai",`پرسش از ${r.settings.ai.assistantName}`,"ارسال مستقیم سوال به دستیار"),h("offline","Offline Toolkit","ابزارهای شبکه داخلی و حالت قطعی اینترنت"),h("feed","فیدخوان","خبرها و منابع منتخب"),c;if(Ne(n)||i.startsWith("open ")){const o=i.startsWith("open ")?n.slice(5).trim():n;c.push({id:"open-url",title:`باز کردن ${o}`,subtitle:Je(o),icon:Pt,kind:"site",action:()=>z(o)})}i.startsWith("note ")&&c.push({id:"quick-note",title:"افزودن یادداشت سریع",subtitle:n.slice(5),icon:B,kind:"command",action:()=>r.addNote(n.slice(5))}),i.startsWith("/dark")&&c.push({id:"dark",title:"تغییر به تم تیره",icon:rt,kind:"command",action:()=>r.patchSettings({theme:"dark"})}),i.startsWith("/light")&&c.push({id:"light",title:"تغییر به تم روشن",icon:dt,kind:"command",action:()=>r.patchSettings({theme:"light"})}),i.startsWith("/calc")&&c.push({id:"calc",title:"محاسبه سریع",subtitle:"ورود به حالت ماشین حساب در خط فرمان",icon:Rt,kind:"command",action:()=>{}});const l=/[?؟]$/.test(n)||/^(چی|چطور|چگونه|چرا|کِی|کی|کجا|what|how|why|when|where|راهنمایی|کمک)/i.test(n);[...r.sites.top,...r.sites.recent,...r.sites.bookmarks,...r.sites.internal,...r.shortcuts.map(o=>({...o,source:"manual"})),...r.savedLinks.map(o=>({...o,source:"saved"}))].filter(o=>`${o.title} ${o.domain} ${o.url}`.toLowerCase().includes(i)).slice(0,8).forEach(o=>c.push({id:`site-${o.id}`,title:o.title,subtitle:o.domain,kind:"site",action:()=>z(o.url)})),r.sites.recent.map(o=>({site:o,query:ns(o.url)})).filter(o=>!!o.query).filter(o=>o.query.toLowerCase().includes(i)||i.includes(o.query.toLowerCase())).slice(0,3).forEach(({site:o,query:p})=>c.push({id:`history-search-${o.id}`,title:`جستجوی قبلی: ${p}`,subtitle:o.domain,icon:X,kind:"history-search",priority:70,action:()=>z(o.url)}));const g={id:"ask-ai",title:`پرسش از ${r.settings.ai.assistantName}`,subtitle:n,icon:l?Wt:fe,kind:"ai",priority:Ne(n)||i.startsWith("open ")?20:95,action:()=>r.askAssistant(n)};return c.push({id:"web-search",title:`جستجوی وب: ${n}`,subtitle:"باز کردن نتیجه در موتور جستجو",icon:X,kind:"search",priority:Ne(n)||i.startsWith("open ")?40:55,action:()=>z(`${Qe[r.settings.searchEngine]}${encodeURIComponent(n)}`)}),c.push(g),c.sort((o,p)=>(p.priority??50)-(o.priority??50)).slice(0,12)},askAssistant(s){t({pendingAiPrompt:s}),a().openWindow("ai")},clearPendingAiPrompt(){t({pendingAiPrompt:null})},setPendingReminderDate(s){t({pendingReminderDate:s})},async saveLink(s){const n={id:ce("link"),title:s.title,url:s.url,domain:J(s.url),favicon:s.favicon||_e(s.url),tags:[],category:"عمومی",archived:!1,createdAt:Date.now()};await A.put("links",n),t({savedLinks:[n,...a().savedLinks]})},async addShortcut(s){const n={id:ce("shortcut"),title:s.title||s.domain,url:s.url,domain:J(s.url),favicon:s.favicon||_e(s.url),createdAt:Date.now()};await A.put("shortcuts",n),t({shortcuts:[n,...a().shortcuts]})},async updateShortcut(s){await A.put("shortcuts",s),t({shortcuts:a().shortcuts.map(n=>n.id===s.id?s:n)})},async deleteShortcut(s){await A.delete("shortcuts",s),t({shortcuts:a().shortcuts.filter(n=>n.id!==s)})},async updateLaunchpadAlias(s,n){const i=a().settings;await a().setSettings({...i,launchpad:{...i.launchpad,aliases:{...i.launchpad.aliases,[s]:n}}})},async updateSavedLink(s){await A.put("links",s),t({savedLinks:a().savedLinks.map(n=>n.id===s.id?s:n)})},async deleteSavedLink(s){await A.delete("links",s),t({savedLinks:a().savedLinks.filter(n=>n.id!==s)})},async addNote(s){const n=s.split(`
`)[0].slice(0,48)||"یادداشت جدید",i={id:ce("note"),title:n,body:s,createdAt:Date.now(),updatedAt:Date.now()};await A.put("notes",i),t({notes:[i,...a().notes]})},async updateNote(s){const n={...s,updatedAt:Date.now()};await A.put("notes",n),t({notes:a().notes.map(i=>i.id===s.id?n:i)})},async deleteNote(s){await A.delete("notes",s),t({notes:a().notes.filter(n=>n.id!==s)})},async addReminder(s,n){var r;const i={id:ce("reminder"),title:s,dueAt:n,done:!1,createdAt:Date.now()};await A.put("reminders",i),t({reminders:[...a().reminders,i].sort((c,h)=>c.dueAt-h.dueAt)}),(r=chrome==null?void 0:chrome.runtime)!=null&&r.sendMessage&&chrome.runtime.sendMessage({type:"SCHEDULE_REMINDER",reminder:i})},async updateReminder(s){var n;await A.put("reminders",s),t({reminders:a().reminders.map(i=>i.id===s.id?s:i).sort((i,r)=>i.dueAt-r.dueAt)}),(n=chrome==null?void 0:chrome.runtime)!=null&&n.sendMessage&&!s.done&&chrome.runtime.sendMessage({type:"SCHEDULE_REMINDER",reminder:s})},async deleteReminder(s){var n;await A.delete("reminders",s),t({reminders:a().reminders.filter(i=>i.id!==s)}),(n=chrome==null?void 0:chrome.runtime)!=null&&n.sendMessage&&chrome.runtime.sendMessage({type:"CLEAR_REMINDER",id:s})},async toggleReminder(s){const n=a().reminders.find(r=>r.id===s);if(!n)return;const i={...n,done:!n.done};await A.put("reminders",i),t({reminders:a().reminders.map(r=>r.id===s?i:r)})},async saveCurrentProject(s){const n=await D.saveCurrentTabsAsProject(s);await A.put("projects",n),t({projects:[n,...a().projects]})},async restoreProject(s){await D.restoreProject(s)},async closeTab(s){await D.closeTab(s),await a().refreshBrowserData()},async focusTab(s){await D.focusTab(s)},async removeBookmark(s){await D.removeBookmark(s),await a().refreshBrowserData()}})),ns=t=>{try{const a=new URL(t),s=a.hostname.replace(/^www\./,"");if(s.includes("google.")||s==="bing.com"||s==="duckduckgo.com"||s==="search.brave.com")return a.searchParams.get("q")||a.searchParams.get("query")||a.searchParams.get("text")||""}catch{return""}return""},as=(t,a)=>{const s=t.slice(0,10).map(i=>`- ${i.title}: ${i.url}`).join(`
`),n=a.slice(0,12).map(i=>`- ${i.title}: ${i.url}`).join(`
`);return["تو دستیار شخصی مرورگر آزادراه هستی. نام تو راهک است.","فقط وقتی از داده‌های محلی استفاده کن که کاربر اجازه داده باشد.","تب‌های باز:",s||"موردی نیست.","بازدیدهای اخیر:",n||"موردی نیست."].join(`
`)},ut=async({provider:t,apiKey:a,model:s,messages:n,webAccessEnabled:i=!1})=>{var r;if(!a)return"برای فعال شدن راهک، کلید API را در تنظیمات وارد کن. تا آن زمان می‌توانم با فرمان‌های محلی، جستجو، یادداشت و پروژه‌ها کمک کنم.";if(t==="openai"){const c=((r=n.find(o=>o.role==="system"))==null?void 0:r.content)??"",h=n.filter(o=>o.role!=="system").map(o=>`${o.role==="user"?"کاربر":"دستیار"}: ${o.content}`).join(`

`),l={model:s||"gpt-5",instructions:c,input:h,max_output_tokens:1200,...i?{tools:[{type:"web_search"}],tool_choice:"auto"}:{}},d=await fetch("https://api.openai.com/v1/responses",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(l)});if(!d.ok){const o=await d.text();if(i&&/web_search|tool/i.test(o))return ut({provider:t,apiKey:a,model:s,messages:n,webAccessEnabled:!1});throw new Error(o||"OpenAI request failed")}const m=await d.json();return is(m)||"مدل پاسخی متنی برنگرداند. لطفا دوباره با جزئیات بیشتر امتحان کن."}return"این Provider در UI آماده شده، اما اتصال مستقیم آن در نسخه فعلی فقط برای OpenAI فعال است. Providerهای دیگر در گام بعدی وصل می‌شوند."};function is(t){if(typeof(t==null?void 0:t.output_text)=="string"&&t.output_text.trim())return t.output_text.trim();const a=[],s=n=>{if(n&&typeof n!="string"){if(Array.isArray(n)){n.forEach(s);return}typeof n=="object"&&(typeof n.text=="string"&&a.push(n.text),typeof n.content=="string"&&a.push(n.content),n.type==="output_text"&&typeof n.text=="string"&&a.push(n.text),n.content&&s(n.content),n.output&&s(n.output))}};return s(t==null?void 0:t.output),a.filter(Boolean).join(`
`).trim()}async function os(t){var r;const a=`https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(t)}&count=1&language=fa&format=json`,s=await fetch(a);if(!s.ok)return null;const n=await s.json(),i=(r=n==null?void 0:n.results)==null?void 0:r[0];return i?{name:String(i.name??t),latitude:Number(i.latitude),longitude:Number(i.longitude)}:null}async function rs(t){var r,c,h;const a=t.units==="imperial"?"fahrenheit":"celsius",s=`https://api.open-meteo.com/v1/forecast?latitude=${t.latitude}&longitude=${t.longitude}&current=temperature_2m,wind_speed_10m,weather_code&daily=weather_code,temperature_2m_max,temperature_2m_min&forecast_days=7&temperature_unit=${a}&timezone=auto`,n=await fetch(s);if(!n.ok)throw new Error(`Weather API failed: ${n.status}`);const i=await n.json();return{city:t.city,temperature:Number(((r=i==null?void 0:i.current)==null?void 0:r.temperature_2m)??0),windSpeed:Number(((c=i==null?void 0:i.current)==null?void 0:c.wind_speed_10m)??0),weatherCode:Number(((h=i==null?void 0:i.current)==null?void 0:h.weather_code)??0),daily:Array.from({length:7},(l,d)=>{var m,g,o,p,u,j,k,f;return{date:String(((g=(m=i==null?void 0:i.daily)==null?void 0:m.time)==null?void 0:g[d])??""),max:Number(((p=(o=i==null?void 0:i.daily)==null?void 0:o.temperature_2m_max)==null?void 0:p[d])??0),min:Number(((j=(u=i==null?void 0:i.daily)==null?void 0:u.temperature_2m_min)==null?void 0:j[d])??0),code:Number(((f=(k=i==null?void 0:i.daily)==null?void 0:k.weather_code)==null?void 0:f[d])??0)}}),updatedAt:Date.now()}}async function cs(){const a=await fetch("https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=20&page=1&sparkline=false");if(!a.ok)throw new Error(`Crypto API failed: ${a.status}`);return(await a.json()).map(n=>({id:String(n.id),symbol:String(n.symbol??"").toUpperCase(),name:String(n.name??""),price:Number(n.current_price??0),change24h:Number(n.price_change_percentage_24h??0)}))}async function mt(t,a){const s=`https://api.coingecko.com/api/v3/coins/${encodeURIComponent(t)}/market_chart?vs_currency=usd&days=${a}`,n=await fetch(s);if(!n.ok)throw new Error(`Crypto chart API failed: ${n.status}`);const i=await n.json();return((i==null?void 0:i.prices)??[]).map(([c,h])=>({time:new Date(c).toISOString(),value:Number(h)}))}async function ls(t){const a=async r=>{try{const c=await fetch(r,{headers:{Authorization:`Bearer ${t.trim()}`}});if(!c.ok)return{ok:!1,status:c.status,message:`HTTP ${c.status}`};const h=await c.json(),l=Array.isArray(h)?h.length:0;return{ok:!0,status:c.status,message:`OK (${l} rows)`}}catch(c){return{ok:!1,status:0,message:c instanceof Error?c.message:"Network error"}}},[s,n,i]=await Promise.all([a("https://studio.persianapi.com/web-service/gold"),a("https://studio.persianapi.com/web-service/list/crypto/crypto"),a("https://studio.persianapi.com/web-service/currency/free")]);return{gold:s,crypto:n,currency:i}}const ht="azadrah-site-intent-memory-v1",ds=[["\\u062f\\u06cc\\u062c\\u06cc\\u0627\\u062a\\u0648","digiato.com"],["\\u062f\\u06cc\\u062c\\u06cc\\s+\\u0627\\u062a\\u0648","digiato.com"],["\\u0631\\u0627\\u0648\\u06cc\\u06a9\\u0633\\u062a","ravicast.com"],["\\u0631\\u0627\\u0648\\u06cc\\s+\\u06a9\\u0633\\u062a","ravicast.com"],["\\u0627\\u0648\\u067e\\u0646\\s+\\u0627\\u06cc\\s+\\u0622\\u06cc","openai.com"],["\\u0627\\u0648\\u067e\\u0646\\u200c\\u0627\\u06cc\\u200c\\u0622\\u06cc","openai.com"],["\\u06af\\u0648\\u06af\\u0644","google.com"],["\\u0641\\u06cc\\u0633\\u0628\\u0648\\u06a9","facebook.com"],["\\u0641\\u06cc\\u0633\\s+\\u0628\\u0648\\u06a9","facebook.com"],["\\u06cc\\u0648\\u062a\\u06cc\\u0648\\u0628","youtube.com"],["\\u0627\\u06cc\\u0646\\u0633\\u062a\\u0627\\u06af\\u0631\\u0627\\u0645","instagram.com"],["\\u0644\\u06cc\\u0646\\u06a9\\u062f\\u06cc\\u0646","linkedin.com"],["\\u0648\\u0627\\u062a\\u0633\\u0627\\u067e","web.whatsapp.com"],["\\u0648\\u0627\\u062a\\u0633\\s+\\u0627\\u067e","web.whatsapp.com"],["\\u062a\\u0644\\u06af\\u0631\\u0627\\u0645","web.telegram.org"],["\\u0686\\u062a\\s+\\u062c\\u06cc\\s+\\u067e\\u06cc\\s+\\u062a\\u06cc","chatgpt.com"]],pt=[{title:"OpenAI",domain:"openai.com",url:"https://openai.com",aliases:["openai","open ai","opening eye","open eye"],pages:[{title:"API usage",url:"https://platform.openai.com/usage",aliases:["api usage","usage"]},{title:"API docs",url:"https://platform.openai.com/docs",aliases:["api docs","documentation","docs"]},{title:"Pricing",url:"https://openai.com/api/pricing/",aliases:["pricing","price"]},{title:"Models",url:"https://platform.openai.com/docs/models",aliases:["models","model"]},{title:"Dashboard",url:"https://platform.openai.com/",aliases:["dashboard","platform"]}]},{title:"ChatGPT",domain:"chatgpt.com",url:"https://chatgpt.com",aliases:["chatgpt","chat gpt"]},{title:"Digiato",domain:"digiato.com",url:"https://digiato.com",aliases:["digiato"]},{title:"Ravicast",domain:"ravicast.com",url:"https://ravicast.com",aliases:["ravicast"]},{title:"Google",domain:"google.com",url:"https://google.com",aliases:["google"]},{title:"Gmail",domain:"mail.google.com",url:"https://mail.google.com",aliases:["gmail"]},{title:"Google Docs",domain:"docs.google.com",url:"https://docs.google.com",aliases:["google docs","docs"]},{title:"Google Drive",domain:"drive.google.com",url:"https://drive.google.com",aliases:["drive","google drive"]},{title:"Google Maps",domain:"maps.google.com",url:"https://maps.google.com",aliases:["maps","google maps"]},{title:"Google Meet",domain:"meet.google.com",url:"https://meet.google.com",aliases:["meet","google meet"]},{title:"YouTube",domain:"youtube.com",url:"https://youtube.com",aliases:["youtube","you tube"]},{title:"Facebook",domain:"facebook.com",url:"https://facebook.com",aliases:["facebook","face book"]},{title:"Instagram",domain:"instagram.com",url:"https://instagram.com",aliases:["instagram"]},{title:"X",domain:"x.com",url:"https://x.com",aliases:["x","twitter"]},{title:"LinkedIn",domain:"linkedin.com",url:"https://linkedin.com",aliases:["linkedin","linked in"]},{title:"Telegram",domain:"web.telegram.org",url:"https://web.telegram.org",aliases:["telegram"]},{title:"WhatsApp",domain:"web.whatsapp.com",url:"https://web.whatsapp.com",aliases:["whatsapp"]},{title:"Gemini",domain:"gemini.google.com",url:"https://gemini.google.com",aliases:["gemini"]},{title:"Claude",domain:"claude.ai",url:"https://claude.ai",aliases:["claude"]},{title:"GitHub",domain:"github.com",url:"https://github.com",aliases:["github"]},{title:"Stack Overflow",domain:"stackoverflow.com",url:"https://stackoverflow.com",aliases:["stackoverflow","stack overflow"]},{title:"MDN",domain:"developer.mozilla.org",url:"https://developer.mozilla.org",aliases:["mdn","mozilla docs"]},{title:"Aparat",domain:"aparat.com",url:"https://aparat.com",aliases:["aparat"]},{title:"Filimo",domain:"filimo.com",url:"https://filimo.com",aliases:["filimo"]},{title:"Namava",domain:"namava.ir",url:"https://namava.ir",aliases:["namava"]},{title:"Filmnet",domain:"filmnet.ir",url:"https://filmnet.ir",aliases:["filmnet"]},{title:"Zoomit",domain:"zoomit.ir",url:"https://zoomit.ir",aliases:["zoomit"]},{title:"Torob",domain:"torob.com",url:"https://torob.com",aliases:["torob"]},{title:"Digikala",domain:"digikala.com",url:"https://digikala.com",aliases:["digikala"]},{title:"Technolife",domain:"technolife.ir",url:"https://technolife.ir",aliases:["technolife"]},{title:"Basalam",domain:"basalam.com",url:"https://basalam.com",aliases:["basalam"]},{title:"Banimode",domain:"banimode.com",url:"https://banimode.com",aliases:["banimode"]},{title:"Snapp",domain:"snapp.ir",url:"https://snapp.ir",aliases:["snapp"]},{title:"Snappfood",domain:"snappfood.ir",url:"https://snappfood.ir",aliases:["snappfood"]},{title:"Bale",domain:"web.bale.ai",url:"https://web.bale.ai",aliases:["bale"]},{title:"Rubika",domain:"rubika.ir",url:"https://rubika.ir",aliases:["rubika"]},{title:"iGap",domain:"web.igap.net",url:"https://web.igap.net",aliases:["igap"]}];function He(t,a={}){const s=V(t),n=ys(s);if(n)return n;const i=[...ms(a),...pt],r=fs(s,i),c=xs(s,r),l=(r?hs(r,i):null)??gt(s,i);if(!l)return js(s);const d=c?ps(c,l.pages??[]):null;return d?{url:d.url,title:`${l.title} - ${d.title}`,domain:J(d.url),confidence:Math.max(.78,d.score),source:l.source,pageQuery:c}:c&&l.domain&&c.length>2?{url:`https://www.google.com/search?q=${encodeURIComponent(`site:${l.domain} ${c}`)}`,title:`Search ${c} in ${l.title}`,domain:"google.com",confidence:Math.min(.72,l.score),source:"search",pageQuery:c}:{url:l.url,title:l.title,domain:l.domain,confidence:l.score,source:l.source}}function V(t){let a=t.trim().replace(/\u064a/g,"ی").replace(/\u0643/g,"ک").replace(/\bdot\b/gi,".").replace(/\bpoint\b/gi,".").replace(/\bslash\b/gi,"/").replace(/\s+\u062f\u0627\u062a\s+/gi,".").replace(/\s+\u0646\u0642\u0637\u0647\s+/gi,".").replace(/\s+\u0627\u0633\u0644\u0634\s+/gi,"/").replace(/\s+\u06a9\u0627\u0645\b/gi," com").replace(/\s+com\b/gi,".com").replace(/\.com\.com\b/gi,".com").replace(/\s+\.\s+/g,".").replace(/\s+\/\s+/g,"/");for(const[s,n]of ds)a=a.replace(new RegExp(s,"gi"),n);for(const s of pt)for(const n of s.aliases)a=a.replace(new RegExp(bs(n),"gi"),s.domain.replace(/^www\./,""));return a.replace(/\s+/g," ").trim()}function us(t,a){if(typeof localStorage>"u")return;const s=V(t).toLowerCase(),n=ft().filter(i=>i.input!==s&&i.url!==a.url).slice(0,80);n.unshift({input:s,url:a.url,title:a.title,domain:a.domain,hits:1,updatedAt:Date.now()}),localStorage.setItem(ht,JSON.stringify(n))}function ms(t){const a=[...t.tabs??[],...t.localSites??[],...t.bookmarks??[],...t.recent??[]],s=new Set;return a.filter(n=>n.url&&n.domain).filter(n=>{const i=n.url.toLowerCase();return s.has(i)?!1:(s.add(i),!0)}).slice(0,300).map(n=>({title:n.title||n.domain,domain:n.domain,url:n.url,aliases:[n.title,n.domain,n.domain.replace(/\.(com|ir|org|net|ai)$/i,"")].filter(Boolean),source:"local",score:0}))}function hs(t,a){const s=le(t),n=a.find(r=>le(r.domain)===s);if(n)return{...n,source:n.source??"dataset",score:.98};const i=a.find(r=>le(r.domain).includes(s)||s.includes(le(r.domain)));return i?{...i,source:i.source??"dataset",score:.88}:null}function gt(t,a){var n;const s=a.map(i=>({...i,source:i.source??"dataset",score:gs(t,i)})).sort((i,r)=>r.score-i.score);return((n=s[0])==null?void 0:n.score)>=.42?s[0]:null}function ps(t,a){var n;const s=a.map(i=>({...i,score:Math.max(ee(t,i.title),...i.aliases.map(r=>ee(t,r)))})).sort((i,r)=>r.score-i.score);return((n=s[0])==null?void 0:n.score)>=.45?s[0]:null}function gs(t,a){const s=[a.title,a.domain,...a.aliases],n=Math.max(...s.map(r=>ee(t,r))),i=a.domain.split(".")[0];return Math.max(n,ee(t,i))}function ee(t,a){const s=qe(t),n=qe(a);if(!s||!n)return 0;if(s.includes(n)||n.includes(s))return Math.min(1,Math.max(s.length,n.length)/Math.max(1,Math.min(s.length,n.length))>4?.62:.92);const i=new Set(s.split(" ").filter(Boolean)),r=n.split(" ").filter(Boolean),h=r.filter(m=>i.has(m)).length/Math.max(1,r.length),d=1-ws(s.replace(/\s/g,""),n.replace(/\s/g,""))/Math.max(s.length,n.length,1);return Math.max(h,d*.9)}function fs(t,a){var n;const s=(n=t.toLowerCase().match(/([a-z0-9-]+(?:\.[a-z0-9-]+)+)/i))==null?void 0:n[1];if(s){const i=gt(s,a);return i&&i.score>.55?i.domain:s}return""}function xs(t,a){let s=t.replace(a," ").replace(/https?:\/\/\S+/gi," ").replace(/\b(open|go|site|website|page|on|in|at|read|summarize|summary)\b/gi," ").replace(/(باز کن|بازکردن|برو|بخوان|خوانش|خلاصه|تلخیص|صفحه|سایت|وب‌سایت|وب سایت|آدرس|در|روی|را)/g," ").replace(/[^\p{L}\p{N}\s.-]/gu," ").replace(/\s+/g," ").trim();return s===V(a)?"":s}function js(t){const a=t.toLowerCase().match(/([a-z0-9-]+(?:\.[a-z0-9-]+)+)(?:\/\S*)?/i);if(!(a!=null&&a[0]))return null;const s=Je(a[0]);return{url:s,title:J(s),domain:J(s),confidence:.68,source:"direct"}}function ys(t){const s=ft().map(n=>({...n,score:ee(t,n.input)+Math.min(.12,n.hits*.02)})).sort((n,i)=>i.score-n.score)[0];return!s||s.score<.74?null:{url:s.url,title:s.title,domain:s.domain,confidence:s.score,source:"memory"}}function ft(){if(typeof localStorage>"u")return[];try{const t=localStorage.getItem(ht);return t?JSON.parse(t):[]}catch{return[]}}function qe(t){return V(t).toLowerCase().replace(/^https?:\/\//,"").replace(/^www\./,"").replace(/[^\p{L}\p{N}.]+/gu," ").replace(/\.(com|ir|org|net|ai|io|dev)\b/g," ").replace(/\s+/g," ").trim()}function le(t){return t.toLowerCase().replace(/^https?:\/\//,"").replace(/^www\./,"").replace(/\/.*$/,"")}function ws(t,a){const s=Array.from({length:t.length+1},()=>Array(a.length+1).fill(0));for(let n=0;n<=t.length;n+=1)s[n][0]=n;for(let n=0;n<=a.length;n+=1)s[0][n]=n;for(let n=1;n<=t.length;n+=1)for(let i=1;i<=a.length;i+=1)s[n][i]=Math.min(s[n-1][i]+1,s[n][i-1]+1,s[n-1][i-1]+(t[n-1]===a[i-1]?0:1));return s[t.length][a.length]}function bs(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const ks=/(باز کن|بازکردن|open)\s+(.+)/i,vs=/(.+?)\s+(را|رو)?\s*باز کن/i,Ns=/(به\s+)?(آدرس|url|یوآرال)\s+(.+?)\s*(برو|go)?$/i,Ge=/(خلاصه|summary|تلخیص)/i,Cs=/(مقایسه|compare)/i,Ss=/^(ترجمه|translate)\s+(.+)/i,Ms=/(https?:\/\/[^\s]+|(?:[a-z0-9-]+\.)+[a-z]{2,}(?:\/[^\s]*)?)/i;async function $s(t,a){const s=t.trim();if(!s)return{handled:!0,reply:"لطفا سوال یا دستور را وارد کن."};const n=s.match(ks),i=s.match(vs),r=s.match(Ns),h=(n==null?void 0:n[2])||(i==null?void 0:i[1])||(r==null?void 0:r[3])||""||(Rs(s)?s:"");if(h){const o=zs(h);if(!o)return{handled:!0,reply:"No clear site or address was detected."};const p=He(o,a),u=(p==null?void 0:p.url)||Is(o,a.tabs,a.bookmarks,a.recent,a.localSites??[])||Ts(o);if(!u)return{handled:!0,reply:"I could not detect a valid address. Try: open digiato.com."};await D.openUrl(u,!1),p&&us(o,p);const j=(p==null?void 0:p.title)||o,k=p!=null&&p.pageQuery?`
Detected page: ${p.pageQuery}`:"";return{handled:!0,reply:`Done. [${Se(j)}](${u}) opened in a new tab.${k}`}}const l=s.match(Ss);if(l!=null&&l[2]){const o=l[2].trim(),p=await Ps(o);return p?{handled:!0,reply:`ترجمه:
${p}`}:{handled:!0,reply:"فعلا سرویس ترجمه در دسترس نبود. بعدا دوباره تلاش کن."}}const d=s.match(Ms),m=Ge.test(s)||Ds(s),g=!d&&m?He(s,a):null;if((d||g)&&m){const o=(g==null?void 0:g.url)||As(d[1]),p=await D.pageContentFromUrl(o);return{handled:!1,extraSystem:"کاربر یک لینک مستقیم داده است. اگر متن صفحه در context هست از همان استفاده کن؛ اگر کافی نیست و ابزار وب فعال است، خودت صفحه/وب را بررسی کن. برای درخواست‌های عمومی هم مثل یک دستیار کامل پاسخ بده.",extraUser:p?`لینک داده‌شده توسط کاربر:
عنوان: ${p.title}
URL: ${p.url}
هدینگ‌ها: ${p.headings.join(" | ")||"-"}
متن:
${p.text.slice(0,12e3)}`:`لینک داده‌شده توسط کاربر: ${o}
اگر به متن صفحه نیاز داری، از ابزار وب/دانش عمومی خود برای بررسی و خلاصه‌سازی استفاده کن.`}}if(Ge.test(s)||/محتوای تب|تحلیل تب|translate page|summarize page/i.test(s)){const o=await D.activeTabContent();return o?{handled:!1,extraSystem:"اگر محتوای صفحه داده شد، دقیق و ساختاریافته تحلیل کن. در صورت درخواست ترجمه، خروجی را فارسی روان بده.",extraUser:`محتوای تب فعال:
عنوان: ${o.title}
URL: ${o.url}
هدینگ‌ها: ${o.headings.join(" | ")||"-"}
تعداد ویدیو: ${o.videos}
محتوا:
${o.text.slice(0,12e3)}`}:{handled:!0,reply:"برای دسترسی به محتوای تب فعال، صفحه را یک‌بار باز/رفرش کن و دوباره تلاش کن."}}if(Cs.test(s)&&/تب|tab/i.test(s)){const o=a.tabs.slice(0,3);if(o.length<2)return{handled:!0,reply:"برای مقایسه، حداقل دو تب باز داشته باش."};const p=[];for(const u of o){if(!u.tabId)continue;const j=await D.tabContent(u.tabId);j&&p.push(`- ${j.title}
${j.text.slice(0,2800)}`)}return p.length?{handled:!1,extraSystem:"بین چند تب مقایسه دقیق انجام بده و خروجی را به‌صورت جدول متنی کوتاه با جمع‌بندی نهایی ارائه کن.",extraUser:`مقایسه این تب‌ها:
${p.join(`

`)}`}:{handled:!0,reply:`فعلا به متن داخل این تب‌ها دسترسی نگرفتم، اما مقایسه اولیه بر اساس عنوان/دامنه:
${o.map((j,k)=>`${k+1}) ${j.title} - ${j.domain}`).join(`
`)}

برای مقایسه محتوایی دقیق، هر دو تب را یک‌بار فعال کن و سپس دوباره دستور مقایسه بده.`}}if(/هیستوری|تاریخچه|history|بوکمارک|bookmark|دیروز|هفته گذشته/i.test(s)){const o=Es(s),u=(await D.historySearch(o||s,120)).filter(S=>S.source==="recent"),j=s.includes("دیروز")?Ls(u):u,f=(o?j.filter(S=>S.domain.includes(o)):j).sort((S,M)=>(M.lastVisitTime??0)-(S.lastVisitTime??0)).slice(0,s.includes("آخرین")?1:8);return f.length?{handled:!0,reply:`نتایج مرتبط پیدا شد. روی لینک‌ها بزن تا باز شوند:
${f.map(S=>`- [${Se(S.title||S.domain)}](${S.url})`).join(`
`)}`}:{handled:!0,reply:"در سوابق اخیر مورد مرتبطی پیدا نشد."}}if(/درباره\s+سایت|اطلاعات\s+سایت|سایت\s+.*\s+چیست/i.test(s)){const p=[...a.tabs,...a.recent,...a.bookmarks].filter(j=>s.includes(j.domain)||s.toLowerCase().includes(j.title.toLowerCase())).slice(0,6);return p.length?{handled:!0,reply:`این موارد را درباره سایت/سایت‌های مرتبط در داده‌های مرورگر پیدا کردم:
${p.map(j=>`- [${Se(j.title||j.domain)}](${j.url})`).join(`
`)}`}:{handled:!0,reply:"سایت موردنظر را در تب‌ها/سوابق پیدا نکردم. نام دقیق دامنه را بفرست."}}return{handled:!1}}function As(t){return/^https?:\/\//i.test(t)?t:`https://${t}`}function Rs(t){return/(open|go to|visit|launch|باز کن|بازکردن|برو|صفحه\s+.+\s+(در|روی)\s+سایت|page\s+.+\s+on\s+.+\.(com|ir|org|net|ai))/i.test(t)}function Ds(t){const a=t.toLowerCase();return/(read|summarize|summary|page|link|url)/i.test(t)||a.includes("خلاصه")||a.includes("تلخیص")||a.includes("صفحه")||a.includes("لینک")||a.includes("بخوان")||a.includes("خوانش")}function zs(t){return t.replace(/^سایت\s+/i,"").replace(/^آدرس\s+/i,"").replace(/^یوآرال\s+/i,"").replace(/\s+site$/i,"").replace(/^site\s+/i,"").replace(/^وب‌?سایت\s+/i,"").replace(/\s+/g," ").replace(/[؟?!.]+$/g,"").trim()}function Is(t,...a){const s=xt(t).toLowerCase();if(s.match(/^([a-z0-9-]+\.)+[a-z]{2,}$/i))return`https://${s}`;const i=new Map([["راویکست","https://ravicast.com"],["ravicast","https://ravicast.com"],["فیسبوک","https://facebook.com"],["facebook","https://facebook.com"],["google","https://google.com"],["گوگل","https://google.com"],["chatgpt","https://chatgpt.com"],["claude","https://claude.ai"],["gemini","https://gemini.google.com"]]);if(i.has(s))return i.get(s)||"";const r=a.flat(),c=r.find(d=>d.domain.toLowerCase()===s);if(c)return c.url;const h=r.find(d=>d.domain.toLowerCase().includes(s));if(h)return h.url;const l=r.find(d=>d.title.toLowerCase().includes(s));return l?l.url:""}function Se(t){return t.replace(/[\[\]\(\)]/g,"").slice(0,80)}function Ts(t){const a=xt(t).toLowerCase().replace(/\s+site$/i,"").replace(/[^\p{L}\p{N}.-]/gu,"").trim();return a?/^https?:\/\//.test(a)?a:a.includes(".")?`https://${a}`:/^[a-z0-9-]{2,}$/.test(a)?`https://${a}.com`:"":""}function xt(t){const a={گوگل:"google",فیسبوک:"facebook",فیس‌بوک:"facebook",راویکست:"ravicast",یوتیوب:"youtube",اینستاگرام:"instagram",لینکدین:"linkedin",واتساپ:"whatsapp",واتس‌اپ:"whatsapp",تلگرام:"telegram"};let s=t.trim();return Object.entries(a).forEach(([n,i])=>{s=s.replace(new RegExp(n,"gi"),i)}),s.replace(/\s+دات\s+/gi,".").replace(/\s+dot\s+/gi,".").replace(/\s+نقطه\s+/gi,".").replace(/\s+کام\b/gi,"com").replace(/\s+com\b/gi,".com").replace(/\.com\.com\b/gi,".com").replace(/\s+/g," ").trim()}function Es(t){const a=t.toLowerCase().match(/([a-z0-9-]+\.[a-z]{2,})/);return a!=null&&a[1]?a[1]:t.includes("راویکست")?"ravicast.com":""}function Ls(t){const a=new Date,s=new Date(a.getFullYear(),a.getMonth(),a.getDate()-1).getTime(),n=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime();return t.filter(i=>{const r=i.lastVisitTime??0;return r>=s&&r<n})}async function Ps(t){var a;try{const n=/[\u0600-\u06FF]/.test(t)?"fa|en":"en|fa",i=await fetch(`https://api.mymemory.translated.net/get?q=${encodeURIComponent(t)}&langpair=${n}`);if(!i.ok)return"";const r=await i.json();return String(((a=r==null?void 0:r.responseData)==null?void 0:a.translatedText)??"").trim()}catch{return""}}const Fs={launchpad:it,ai:fe,bookmarks:$e,readpad:ct,notes:ge,reminders:ze,projects:pe,feed:lt,apps:Ht,shop:qt,mission:zt,settings:te,offline:q},Os={openai:["gpt-5","gpt-5-mini","gpt-5-nano","gpt-4.1"],gemini:["gemini-2.5-pro","gemini-2.5-flash","gemini-2.0-flash"],claude:["claude-sonnet-4-0","claude-3-5-sonnet-latest","claude-3-5-haiku-latest"],grok:["grok-3","grok-3-mini"]};function _s(){var d;const t=x(m=>m.init),a=x(m=>m.booted),s=x(m=>m.settings),[n,i]=w.useState(new Date),[r,c]=w.useState(!1);w.useEffect(()=>{t();const m=window.setInterval(()=>i(new Date),3e4);return()=>window.clearInterval(m)},[t]);const h=ts(s.performance.detectedTier,s.performance.autoReduceEffects,s.motion),l=s.theme==="dark"||s.theme==="auto"&&((d=window.matchMedia)==null?void 0:d.call(window,"(prefers-color-scheme: dark)").matches);return a?e.jsxs("main",{className:G("azadrah",l&&"theme-dark",h&&"reduce-effects",!s.glass&&"solid-surfaces",`wallpaper-${s.wallpaper}`),style:Ws(s.wallpaper),children:[e.jsx(Bs,{now:n}),e.jsx(Us,{now:n}),s.widgets.sidebarEnabled&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"widget-reveal",onMouseEnter:()=>c(!0),onClick:()=>c(m=>!m),title:"نمایش ویجت‌ها",children:r?e.jsx(Tt,{size:18}):e.jsx(Et,{size:18})}),e.jsx(Hs,{open:r,onMouseLeave:()=>c(!1)})]}),e.jsx(Qs,{}),e.jsx(sn,{}),e.jsx(Dn,{}),e.jsx(zn,{}),e.jsx(Js,{}),e.jsx(Tn,{})]}):e.jsxs("main",{className:"boot-screen",children:[e.jsx(se,{}),e.jsx("strong",{children:"آزادراه"}),e.jsx("span",{children:"در حال آماده‌سازی فضای کاری شما..."})]})}function Ws(t){const a=et.find(s=>s.id===t);return a!=null&&a.image?{"--wallpaper-image":`url(${a.image})`}:void 0}function Bs({now:t}){const a=x(l=>l.settings),s=x(l=>l.connection),n=x(l=>l.toggleCommand),i=x(l=>l.toggleControlCenter),r=x(l=>l.toggleNotificationCenter),c=x(l=>l.openWindow),h=s==="online"?Kt:s==="limited"?De:Vt;return e.jsxs("header",{className:"menu-bar",children:[e.jsxs("div",{className:"menu-left",children:[e.jsx("button",{className:"brand-button",onClick:()=>c("launchpad"),title:"آزادراه",children:"آزادراه"}),e.jsx("button",{className:"menu-chip",onClick:()=>c("mission"),children:bt(a.workspace)})]}),e.jsxs("div",{className:"menu-right",children:[e.jsx("button",{className:"icon-button",onClick:()=>n(!0),title:"خط فرمان",children:e.jsx(Re,{size:17})}),e.jsx("button",{className:"icon-button",onClick:i,title:"کنترل سنتر",children:e.jsx(Bt,{size:17})}),e.jsx("button",{className:"icon-button",onClick:r,title:"اعلان‌ها",children:e.jsx(tt,{size:17})}),e.jsxs("button",{className:"status-pill",onClick:()=>c("offline"),children:[e.jsx(h,{size:15}),kt(s)]}),e.jsx("span",{className:"clock-text",children:Xe(t)})]})]})}function Us({now:t}){const a=x(r=>r.toggleCommand),s=x(r=>r.openWindow),n=x(r=>r.askAssistant),i=x(r=>r.settings);return e.jsxs("section",{className:"desktop-hero",children:[e.jsx("p",{className:"date-line",children:Mt(t)}),e.jsx("h1",{children:Xe(t)}),e.jsxs("button",{className:"spotlight-trigger",onClick:()=>a(!0),children:[e.jsx(X,{size:20}),e.jsxs("span",{children:["برای جستجو، فرمان یا پرسش از ",i.ai.assistantName]}),e.jsx("kbd",{children:"Ctrl K"})]}),e.jsxs("div",{className:"hero-actions",children:[e.jsxs("button",{onClick:()=>s("launchpad"),children:[e.jsx(it,{size:18}),"لانچ‌پد"]}),e.jsxs("button",{onClick:()=>s("ai"),children:[e.jsx(fe,{size:18}),i.ai.assistantName]}),e.jsxs("button",{onClick:()=>n("__voice__"),children:[e.jsx(ot,{size:18}),"فرمان صوتی"]}),e.jsxs("button",{onClick:()=>s("offline"),children:[e.jsx(q,{size:18}),"ابزار آفلاین"]})]})]})}function Hs({open:t,onMouseLeave:a}){var h;const s=x(l=>l.settings),n=x(l=>l.notes),i=x(l=>l.reminders),r=x(l=>l.openWindow),c=i.find(l=>!l.done);return e.jsxs("aside",{className:G("widget-rail",t&&"open"),onMouseLeave:a,children:[s.widgets.clock&&e.jsx(Ks,{}),s.widgets.calendar&&e.jsx(Ys,{}),s.widgets.reminders&&e.jsxs("button",{className:"widget",onClick:()=>r("reminders"),children:[e.jsx("span",{children:"یادآور بعدی"}),e.jsx("strong",{children:(c==null?void 0:c.title)||"یادآور فعالی ندارید"}),c&&e.jsx("small",{children:new Intl.DateTimeFormat("fa-IR-u-ca-persian",{dateStyle:"medium",timeStyle:"short"}).format(c.dueAt)})]}),s.widgets.notes&&e.jsxs("button",{className:"widget",onClick:()=>r("notes"),children:[e.jsx("span",{children:"آخرین یادداشت"}),e.jsx("strong",{children:((h=n[0])==null?void 0:h.title)||"یادداشتی ثبت نشده"}),n[0]&&e.jsx("small",{children:n[0].body.slice(0,70)})]}),s.widgets.weather&&s.premium.features.advancedWidgets&&e.jsx(qs,{}),s.widgets.currency&&s.premium.features.advancedWidgets&&e.jsx(Gs,{})]})}function qs(){const t=x(m=>m.settings),a=x(m=>m.setSettings),[s,n]=w.useState(null),[i,r]=w.useState(""),[c,h]=w.useState(""),[l,d]=w.useState(!1);return w.useEffect(()=>{localStorage.getItem("azadrah-weather-geo-asked")||!navigator.geolocation||(localStorage.setItem("azadrah-weather-geo-asked","1"),navigator.geolocation.getCurrentPosition(g=>{a({...t,weather:{...t.weather,city:"موقعیت فعلی",latitude:g.coords.latitude,longitude:g.coords.longitude}})}))},[]),w.useEffect(()=>{const m="azadrah-weather-cache",g=localStorage.getItem(m);if(g)try{n(JSON.parse(g))}catch{}const o=async()=>{try{const u=await rs(t.weather);n(u),localStorage.setItem(m,JSON.stringify(u)),Hn(u.weatherCode)&&(localStorage.setItem("azadrah-weather-alert",JSON.stringify({title:"هشدار آب‌وهوا",body:`احتمال بارندگی در ${u.city}`,timestamp:Date.now()})),"Notification"in window&&Notification.permission==="granted"&&new Notification("آزادراه | هشدار آب‌وهوا",{body:`احتمال بارندگی در ${u.city}`})),r("")}catch(u){r(u instanceof Error?u.message:"خطا در دریافت آب‌وهوا")}};o();const p=window.setInterval(o,t.weather.refreshMinutes*6e4);return()=>window.clearInterval(p)},[t.weather]),e.jsxs("section",{className:"widget weather-widget",children:[e.jsxs("div",{className:"weather-head",children:[e.jsx("span",{children:"آب‌وهوا"}),e.jsx("button",{className:"icon-button",title:"دریافت از موقعیت فعلی",onClick:()=>{navigator.geolocation&&navigator.geolocation.getCurrentPosition(m=>{a({...t,weather:{...t.weather,city:"موقعیت فعلی",latitude:m.coords.latitude,longitude:m.coords.longitude}})})},children:e.jsx(nt,{size:14})}),e.jsx("button",{className:"icon-button",title:"افزودن شهر",onClick:()=>d(m=>!m),children:e.jsx(B,{size:14})})]}),e.jsx("strong",{children:s?`${Ze(s.weatherCode)} ${s.city} | ${new Intl.NumberFormat("fa-IR").format(s.temperature)}°`:"در حال بارگذاری..."}),e.jsx("small",{children:i||(s?`${Un(s.weatherCode)} | باد: ${new Intl.NumberFormat("fa-IR").format(s.windSpeed)} km/h`:"آخرین داده کش‌شده نمایش داده می‌شود.")}),s&&e.jsx("div",{className:"weather-weekly",children:s.daily.slice(0,7).map(m=>e.jsxs("div",{className:"weather-day",children:[e.jsx("span",{children:new Intl.DateTimeFormat("fa-IR",{weekday:"short"}).format(new Date(m.date))}),e.jsx("strong",{children:Ze(m.code)}),e.jsxs("small",{children:[new Intl.NumberFormat("fa-IR").format(m.max)," / ",new Intl.NumberFormat("fa-IR").format(m.min)]})]},m.date))}),l&&e.jsxs("form",{className:"inline-form weather-city-form",onSubmit:async m=>{if(m.preventDefault(),!c.trim())return;const g=await os(c.trim());if(!g){r("شهر یافت نشد.");return}a({...t,weather:{...t.weather,city:g.name,latitude:g.latitude,longitude:g.longitude}}),h(""),d(!1)},children:[e.jsx("input",{value:c,onChange:m=>h(m.target.value),placeholder:"نام شهر"}),e.jsx("button",{type:"submit",children:e.jsx(Q,{size:13})})]})]})}function Gs(){const t=x(g=>g.settings),[a,s]=w.useState([]),[n,i]=w.useState(""),[r,c]=w.useState(""),[h,l]=w.useState(""),[d,m]=w.useState([]);return w.useEffect(()=>{const g="azadrah-crypto-cache",o=localStorage.getItem(g);if(o)try{s(JSON.parse(o))}catch{}const p=async()=>{try{const j=await cs();s(j),localStorage.setItem(g,JSON.stringify(j)),i("")}catch(j){i(j instanceof Error?j.message:"خطا در دریافت داده رمزارز")}};p();const u=window.setInterval(p,t.currency.refreshMinutes*6e4);return()=>window.clearInterval(u)},[t.currency.refreshMinutes]),e.jsxs("section",{className:"widget currency-widget",children:[e.jsxs("div",{className:"weather-head",children:[e.jsx("span",{children:"رمزارزهای برتر (رایگان)"}),e.jsx("small",{children:"CoinGecko"})]}),e.jsx("div",{className:"list-view",children:a.map(g=>e.jsxs("article",{onClick:async()=>{c(g.symbol),l(g.id);try{const o=await mt(g.id,7);m(o)}catch{m([])}},children:[e.jsx(se,{}),e.jsxs("div",{className:"list-main",children:[e.jsx("strong",{children:g.name}),e.jsxs("span",{children:["$",new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(g.price)," | ",g.change24h.toFixed(2),"%"]})]})]},g.id))}),r&&e.jsx(Vs,{title:r,series:d,symbol:h||r}),e.jsx("small",{children:n||"ویجت طلا و ارز فیات موقتاً به فاز بعدی منتقل شد تا با منبع پایدار داخلی برگردد."})]})}function Vs({title:t,symbol:a,series:s}){const[n,i]=w.useState("day"),[r,c]=w.useState(!1),[h,l]=w.useState([]);return w.useEffect(()=>{let d=!1;return(async()=>{c(!0);try{let g=s;g=await mt(a,n==="day"?1:n==="week"?7:30);const o=g.map(k=>k.value).filter(k=>Number.isFinite(k)&&k>0);if(!o.length){d||l([]);return}const p=Math.min(...o),u=Math.max(...o),j=o.slice(-24).map(k=>u===p?50:Math.round((k-p)/(u-p)*84+10));d||l(j)}catch{d||l([])}finally{d||c(!1)}})(),()=>{d=!0}},[t,n,a,s]),e.jsxs("div",{className:"mini-chart",children:[e.jsxs("div",{className:"mini-chart-head",children:[e.jsxs("strong",{children:["نمودار ",t]}),e.jsxs("select",{value:n,onChange:d=>i(d.target.value),children:[e.jsx("option",{value:"day",children:"روز"}),e.jsx("option",{value:"week",children:"هفته"}),e.jsx("option",{value:"month",children:"ماه"})]})]}),e.jsx("div",{className:"bars",children:(r?Array.from({length:12},()=>20):h).map((d,m)=>e.jsx("i",{style:{height:`${d}%`}},m))}),!r&&!h.length&&e.jsx("small",{children:"برای این منبع، نمودار واقعی در دسترس نیست."})]})}function Ks(){const t=x(g=>g.settings),a=x(g=>g.setSettings),[s,n]=w.useState(0),[i,r]=w.useState(!1),c=t.clocks.cities.length?t.clocks.cities:[{id:"tehran",label:"تهران",timeZone:"Asia/Tehran"}],h=c[Math.min(s,c.length-1)],l=new Date(new Date().toLocaleString("en-US",{timeZone:h.timeZone})),d=[{id:"dubai",label:"دبی",timeZone:"Asia/Dubai"},{id:"istanbul",label:"استانبول",timeZone:"Europe/Istanbul"},{id:"london",label:"لندن",timeZone:"Europe/London"},{id:"new-york",label:"نیویورک",timeZone:"America/New_York"},{id:"tokyo",label:"توکیو",timeZone:"Asia/Tokyo"}].filter(g=>!c.some(o=>o.timeZone===g.timeZone)),m=g=>{const o=d.find(p=>p.id===g);o&&(a({...t,clocks:{cities:[...c,o]}}),n(c.length),r(!1))};return e.jsxs("section",{className:"widget clock-widget",children:[e.jsx(Zs,{date:l}),e.jsxs("div",{className:"clock-city-row",children:[e.jsx("button",{onClick:()=>n(g=>(g-1+c.length)%c.length),title:"شهر قبلی",children:e.jsx(st,{size:15})}),e.jsx("strong",{children:h.label}),e.jsx("button",{onClick:()=>n(g=>(g+1)%c.length),title:"شهر بعدی",children:e.jsx(Ae,{size:15})}),e.jsx("button",{onClick:()=>r(g=>!g),title:"افزودن شهر",children:e.jsx(B,{size:15})})]}),i&&e.jsxs("select",{className:"clock-city-select",defaultValue:"",onChange:g=>m(g.target.value),children:[e.jsx("option",{value:"",disabled:!0,children:"انتخاب شهر"}),d.map(g=>e.jsx("option",{value:g.id,children:g.label},g.id))]})]})}function Zs({date:t}){const a=t.getSeconds(),s=t.getMinutes(),i=t.getHours()%12*30+s*.5,r=s*6,c=a*6;return e.jsxs("div",{className:"analog-clock","aria-hidden":"true",children:[e.jsx("i",{className:"mark m12"}),e.jsx("i",{className:"mark m3"}),e.jsx("i",{className:"mark m6"}),e.jsx("i",{className:"mark m9"}),e.jsx("b",{className:"hand hour",style:{transform:`rotate(${i}deg)`}}),e.jsx("b",{className:"hand minute",style:{transform:`rotate(${r}deg)`}}),e.jsx("b",{className:"hand second",style:{transform:`rotate(${c}deg)`}}),e.jsx("em",{})]})}function Ys(){var F;const[t,a]=w.useState("jalali"),[s,n]=w.useState(0),i=x(N=>N.openWindow),r=x(N=>N.setPendingReminderDate),c=x(N=>N.reminders),h=x(N=>N.addReminder),[l,d]=w.useState(""),[m,g]=w.useState(null),[o,p]=w.useState(""),[u,j]=w.useState("09:00"),k=new Date;k.setMonth(k.getMonth()+s);const f=t==="jalali"?Ln(k):Pn(k),y=Fn((F=f[0])==null?void 0:F.timestamp),S=t==="jalali"?new Intl.DateTimeFormat("fa-IR-u-ca-persian",{month:"long",year:"numeric"}).format(k):new Intl.DateTimeFormat("fa-IR-u-ca-gregory",{month:"long",year:"numeric"}).format(k),M=new Intl.DateTimeFormat("fa-IR-u-ca-islamic",{weekday:"long",day:"numeric",month:"long",year:"numeric"}).format(new Date),L=m?c.filter(N=>wt(N.dueAt,m.timestamp)):[];return e.jsxs("section",{className:"widget calendar-widget",children:[e.jsxs("div",{className:"calendar-head",children:[e.jsx("button",{onClick:()=>n(N=>N-1),title:"ماه قبل",children:e.jsx(st,{size:15})}),e.jsx("button",{className:"calendar-title",onClick:()=>i("reminders"),children:S}),e.jsx("button",{onClick:()=>n(N=>N+1),title:"ماه بعد",children:e.jsx(Ae,{size:15})})]}),e.jsx("button",{className:"calendar-mode",onClick:()=>a(t==="jalali"?"gregorian":"jalali"),children:t==="jalali"?"نمایش میلادی":"نمایش جلالی"}),e.jsxs("small",{className:"calendar-occasion",children:["قمری امروز: ",M]}),e.jsxs("div",{className:"calendar-grid",children:[["ش","ی","د","س","چ","پ","ج"].map(N=>e.jsx("span",{className:"weekday",children:N},N)),Array.from({length:y},(N,_)=>e.jsx("span",{className:"calendar-blank","aria-hidden":"true"},`blank-${_}`)),f.map((N,_)=>e.jsx("button",{className:G(N.today&&"today",N.holiday&&"holiday"),title:N.occasion||"بدون مناسبت ثبت‌شده",onMouseEnter:()=>d(N.occasion||""),onClick:()=>{d(N.occasion||""),g(N),j("09:00"),r(N.timestamp)},children:N.label},`${N.label}-${_}`))]}),e.jsx("small",{className:"calendar-occasion",children:l||On(f)||"برای این روز مناسبتی ثبت نشده است."}),m&&e.jsxs("div",{className:"calendar-day-popup",children:[e.jsxs("header",{children:[e.jsxs("strong",{children:["رویدادهای روز ",m.label]}),e.jsx("button",{className:"icon-button",onClick:()=>g(null),children:e.jsx(E,{size:14})})]}),e.jsx("small",{children:m.occasion||"مناسبت ثبت نشده"}),e.jsx("div",{className:"list-view",children:L.length?L.map(N=>e.jsxs("article",{children:[e.jsx(ze,{}),e.jsxs("div",{className:"list-main",children:[e.jsx("strong",{children:N.title}),e.jsx("span",{children:new Intl.DateTimeFormat("fa-IR-u-ca-persian",{timeStyle:"short"}).format(N.dueAt)})]})]},N.id)):e.jsx("p",{className:"empty-state",children:"یادآوری برای این روز ثبت نشده است."})}),e.jsxs("form",{className:"inline-form calendar-reminder-form",onSubmit:async N=>{if(N.preventDefault(),!o.trim()||!m)return;const[_=9,U=0]=u.split(":").map(Number),K=new Date(m.timestamp);K.setHours(Number.isFinite(_)?_:9,Number.isFinite(U)?U:0,0,0),await h(o.trim(),K.getTime()),p(""),i("reminders")},children:[e.jsx("input",{value:o,onChange:N=>p(N.target.value),placeholder:"افزودن یادآور برای این روز"}),e.jsx("input",{type:"time",value:u,onChange:N=>j(N.target.value),"aria-label":"ساعت یادآور"}),e.jsx("button",{type:"submit",children:e.jsx(B,{size:14})})]})]})]})}function Js(){const t=x(r=>r.settings),a=x(r=>r.openWindow),s=x(r=>r.toggleCommand),n=x(r=>r.windows),i=new Set(n.map(r=>r.id));return e.jsxs("nav",{className:"dock",children:[e.jsx("button",{className:"dock-item",onClick:()=>s(!0),title:"خط فرمان",children:e.jsx(Re,{})}),t.dock.map(r=>{const c=Fs[r];return e.jsxs("button",{className:"dock-item",onClick:()=>a(r),title:qn(r),children:[e.jsx(c,{}),i.has(r)&&e.jsx("span",{className:"active-dot"})]},r)})]})}function Qs(){const t=x(l=>l.windows),a=x(l=>l.closeWindow),s=x(l=>l.focusWindow),[n,i]=w.useState({}),r=l=>n[l]??{x:Math.max(16,Math.round(window.innerWidth*.18)),y:72,w:Math.min(980,Math.max(560,Math.round(window.innerWidth*.62))),h:Math.min(720,Math.max(420,Math.round(window.innerHeight*.68)))},c=(l,d)=>{const m=r(l),g=d.clientX-m.x,o=d.clientY-m.y,p=j=>{const k=window.innerWidth-320,f=window.innerHeight-140,y=Math.min(k,Math.max(8,j.clientX-g)),S=Math.min(f,Math.max(44,j.clientY-o));i(M=>({...M,[l]:{...r(l),x:y,y:S}}))},u=()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",p),window.addEventListener("mouseup",u)},h=(l,d)=>{d.stopPropagation();const m=r(l),g=d.clientX,o=d.clientY,p=j=>{const k=j.clientX-g,f=j.clientY-o,y=window.innerWidth-m.x-12,S=window.innerHeight-m.y-96,M=Math.min(y,Math.max(420,m.w+k)),L=Math.min(S,Math.max(280,m.h+f));i(F=>({...F,[l]:{...r(l),w:M,h:L}}))},u=()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",p),window.addEventListener("mouseup",u)};return e.jsx("div",{className:"window-layer",children:t.map(l=>(()=>{const d=r(l.id);return e.jsxs("section",{className:G("app-window",["launchpad","readpad","bookmarks","projects"].includes(l.id)&&"large-window",["readpad","projects"].includes(l.id)&&"wide-window"),style:{zIndex:l.z,left:d.x,top:d.y,width:d.w,height:d.h,right:"auto",maxHeight:"none",transform:"none"},onMouseDown:()=>s(l.id),children:[e.jsxs("header",{className:"window-titlebar",onMouseDown:m=>{m.target.closest(".traffic")||c(l.id,m)},children:[e.jsx("div",{className:"traffic",children:e.jsx("button",{className:"red",onClick:()=>a(l.id),"aria-label":"بستن پنجره"})}),e.jsx("strong",{children:l.title})]}),e.jsx("div",{className:"window-body",children:Xs(l.id)}),e.jsx("button",{className:"window-resize-handle",onMouseDown:m=>h(l.id,m),title:"Resize"})]},l.id)})())})}function Xs(t){return t==="launchpad"?e.jsx(en,{}):t==="bookmarks"?e.jsx(jn,{}):t==="readpad"?e.jsx(wn,{}):t==="notes"?e.jsx(bn,{}):t==="reminders"?e.jsx(vn,{}):t==="projects"?e.jsx(Nn,{}):t==="feed"?e.jsx($n,{}):t==="apps"?e.jsx(An,{}):t==="shop"?e.jsx(Rn,{}):t==="mission"?e.jsx(Cn,{}):t==="settings"?e.jsx(Sn,{}):t==="offline"?e.jsx(Mn,{}):e.jsx(nn,{})}function en(){x(n=>n.settings);const[t,a]=w.useState("smart"),s=[["smart","هوشمند",se],["featured","برترین‌ها",ct],["top","پربازدید",De],["recent","اخیر",at],["bookmarks","بوکمارک‌ها",$e],["saved","ذخیره‌شده",he],["internal","شبکه داخلی",nt]];return e.jsxs("div",{className:"panel-stack",children:[e.jsx("div",{className:"segmented",children:s.map(([n,i,r])=>e.jsxs("button",{className:t===n?"active":"",onClick:()=>a(n),children:[e.jsx(r,{size:15}),i]},n))}),e.jsx(tn,{mode:t})]})}function tn({mode:t}){const a=x(y=>y.sites),s=x(y=>y.shortcuts),n=x(y=>y.settings),i=x(y=>y.setSettings),r=x(y=>y.addShortcut),c=x(y=>y.updateShortcut),h=x(y=>y.deleteShortcut),l=x(y=>y.updateLaunchpadAlias),[d,m]=w.useState(""),[g,o]=w.useState(null),[p,u]=w.useState(""),j=w.useMemo(()=>{const y=new Set(n.launchpad.hiddenUrls??[]),S=M=>M.filter(L=>!y.has(L.url));return S(t==="smart"?[...s.slice(0,10).map(M=>({...M,source:"manual"})),...a.top.slice(0,10),...a.recent.slice(0,8),...a.internal.slice(0,6)]:t==="saved"?s.map(M=>({...M,source:"manual"})):t==="featured"?We.flatMap(M=>M.sites):a[t])},[t,s,a,n.launchpad.hiddenUrls]),k=async y=>{if(o(null),u(""),y.source==="manual"){await h(y.id);return}await i({...n,launchpad:{...n.launchpad,hiddenUrls:Array.from(new Set([...n.launchpad.hiddenUrls??[],y.url]))}})};return e.jsxs("div",{className:"panel-stack",children:[e.jsxs("form",{className:"inline-form",onSubmit:y=>{y.preventDefault(),d.trim()&&(r($t(d)),m(""))},children:[e.jsx("input",{value:d,onChange:y=>m(y.target.value),placeholder:"افزودن لینک جدید..."}),e.jsx("button",{type:"submit",children:e.jsx(B,{size:17})})]}),t==="featured"?e.jsx("div",{className:"featured-groups",children:We.map(y=>{const S=y.sites.filter(M=>!new Set(n.launchpad.hiddenUrls??[]).has(M.url));return S.length?e.jsxs("section",{className:"featured-group",children:[e.jsx("h3",{children:y.title}),e.jsx("div",{className:"site-grid",style:{gridTemplateColumns:"repeat(auto-fill, minmax(118px, 1fr))"},children:S.map(M=>f(M))})]},y.title):null})}):e.jsxs("div",{className:"site-grid",style:{gridTemplateColumns:`repeat(auto-fill, minmax(${Math.max(108,900/n.launchpad.columns)}px, 1fr))`},children:[j.map(y=>f(y)),!j.length&&e.jsx("p",{className:"empty-state",children:"آیتمی برای نمایش وجود ندارد."})]})]});function f(y){return e.jsxs("article",{className:"site-card launch-card",children:[e.jsxs("button",{className:"site-open",onClick:()=>{z(y.url,!0,!0)},children:[e.jsx(H,{src:y.favicon,domain:y.domain,compact:!0}),e.jsx("strong",{children:n.launchpad.aliases[y.url]||me(y)}),e.jsx("span",{children:y.domain})]}),e.jsx("button",{className:"mini-edit",onClick:()=>{o(y.id),u(n.launchpad.aliases[y.url]||me(y))},title:"ویرایش نام",children:e.jsx(te,{size:13})}),e.jsx("button",{className:"mini-delete",onClick:()=>k(y),"aria-label":"حذف از لانچ‌پد",children:e.jsx(E,{size:13})}),g===y.id&&e.jsxs("form",{className:"alias-editor",onSubmit:S=>{if(S.preventDefault(),y.source==="manual"){const M=s.find(L=>L.id===y.id);M&&c({...M,title:p||M.title})}else l(y.url,p||me(y));o(null)},children:[e.jsx("input",{value:p,onChange:S=>u(S.target.value)}),e.jsx("button",{type:"submit","aria-label":"ذخیره نام",children:e.jsx(Q,{size:13})}),e.jsx("button",{type:"button",className:"cancel","aria-label":"لغو ویرایش",onClick:()=>{o(null),u("")},children:e.jsx(E,{size:13})})]})]},`${y.source}-${y.id}`)}}function sn(){const t=x(c=>c.commandOpen),a=x(c=>c.toggleCommand),s=x(c=>c.commandResults),[n,i]=w.useState(""),r=s(n);return w.useEffect(()=>{const c=h=>{(h.ctrlKey||h.metaKey)&&h.key.toLowerCase()==="k"&&(h.preventDefault(),a(!0)),h.key==="Escape"&&a(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),t?e.jsx("div",{className:"command-backdrop",onMouseDown:()=>a(!1),children:e.jsxs("section",{className:"command-palette",onMouseDown:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"command-input",children:[e.jsx(Re,{size:20}),e.jsx("input",{autoFocus:!0,value:n,onChange:c=>i(c.target.value),placeholder:"وب‌گردی، فرمان، یا پرسش از راهک...",onKeyDown:async c=>{if(c.key!=="Enter")return;c.preventDefault();const h=r[0];h&&(await h.action(),a(!1),i(""))}})]}),e.jsx("div",{className:"command-results",children:r.map(c=>{const h=c.icon||X;return e.jsxs("button",{onClick:async()=>{await c.action(),a(!1),i("")},children:[e.jsx(h,{size:18}),e.jsxs("span",{children:[e.jsx("strong",{children:c.title}),c.subtitle&&e.jsx("small",{children:c.subtitle})]})]},c.id)})})]})}):null}function nn(){const t=x(b=>b.settings),a=x(b=>b.currentTabs),s=x(b=>b.sites.bookmarks),n=x(b=>b.sites.recent),i=x(b=>b.shortcuts),r=x(b=>b.savedLinks),c=x(b=>b.pendingAiPrompt),h=x(b=>b.clearPendingAiPrompt),[l,d]=w.useState(""),[m,g]=w.useState([]),[o,p]=w.useState(!1),[u,j]=w.useState(!1),[k,f]=w.useState("commands"),[y,S]=w.useState([]),[M,L]=w.useState([]),[F,N]=w.useState(!1),[_,U]=w.useState(!1),[K,xe]=w.useState(!1),[Te,vt]=w.useState(""),je=w.useRef({text:"",at:0}),ye=w.useRef(""),we="azadrah-ai-chat-v1";w.useEffect(()=>{try{const b=localStorage.getItem(we);if(b){const C=JSON.parse(b);if(C.length){g(C.slice(-80));return}}}catch{}g([{role:"assistant",content:`سلام، من ${t.ai.assistantName} هستم. می‌توانم درباره تب‌های باز، سابقه اخیر، و کارهای آنلاین شما کمک کنم.`}])},[t.ai.assistantName]),w.useEffect(()=>{m.length&&localStorage.setItem(we,JSON.stringify(m.slice(-120)))},[m]);const be=async(b=l)=>{if(!b.trim())return;const C=de(b);if(!C.trim())return;const $=C.trim();if(ye.current===$)return;ye.current=$;const I={role:"user",content:on(C,y,M)};g(R=>[...R,I]),d(""),j(!1),xe(!1),p(!0);try{const R=[];for(const T of y.slice(0,6)){const ke=`عنوان: ${T.title}
URL: ${T.url}`;if(!T.tabId){R.push(ke);continue}const ve=await D.tabContent(T.tabId)||await D.pageContentFromUrl(T.url);if(!ve){R.push(ke);continue}R.push(`${ke}
هدینگ‌ها: ${ve.headings.join(" | ")||"-"}
متن:
${ve.text.slice(0,4500)}`)}const P=y.length>0,O=P?{handled:!1,extraSystem:"",extraUser:""}:await $s(C,{assistantName:t.ai.assistantName,tabs:a,bookmarks:s,recent:n,localSites:[...i.map(T=>({...T,source:"manual"})),...r.map(T=>({...T,source:"saved"}))]});if(O.handled){Ee(O.reply);return}const ae=t.ai.apiKeys[t.ai.provider]||"",ie=t.ai.localContextEnabled?as(a,n):"پاسخ‌ها کوتاه، دقیق و کاربردی باشند.",oe="اگر کاربر درخواست مقایسه کرد، خروجی اصلی را در قالب جدول Markdown بده. اگر پاسخ شامل کد است، کد را داخل code fence استاندارد Markdown قرار بده.",Nt=P?"کاربر تب‌هایی را به گفتگو attach کرده است. برای پاسخ، همان تب‌های attach شده را منبع اصلی بدان. اگر متن صفحه در context نبود، از عنوان و URL برای پاسخ محدود و شفاف استفاده کن و حدس بی‌پایه نزن.":"",Ct=[ie,oe,O.extraSystem||"",Nt].filter(Boolean).join(`

`),Le=R.length>0?`تب‌های attach شده توسط کاربر:
${R.join(`

---

`)}`:"",Pe=M.length>0?`فایل‌های attach شده توسط کاربر:
${M.map(T=>`نام فایل: ${T.name}
نوع: ${T.type||"-"}
محتوا:
${T.content.slice(0,12e3)}`).join(`

---

`)}`:"",re=[];O.extraUser&&re.push({role:"user",content:O.extraUser}),Le&&re.push({role:"user",content:Le}),Pe&&re.push({role:"user",content:Pe});const Fe=await ut({provider:t.ai.provider,apiKey:ae,model:t.ai.model,messages:[{role:"system",content:Ct},...m,...re,I],webAccessEnabled:t.ai.webAccessEnabled});Ee(Fe),(t.ai.autoSpeak||t.ai.voiceModeEnabled)&&ln(Fe),S([]),L([])}catch(R){const P=R instanceof Error?R.message:"پاسخی دریافت نشد.";g(O=>[...O,{role:"assistant",content:`خطا در ارتباط با مدل: ${P.slice(0,700)}`}])}finally{p(!1),ye.current=""}},Ee=b=>{g(C=>{const $=C[C.length-1];return($==null?void 0:$.role)==="assistant"&&$.content.trim()===b.trim()?C:[...C,{role:"assistant",content:b}]})};w.useEffect(()=>{if(c){if(c==="__voice__"){ne(),h();return}be(c),h()}},[c]);const ne=(b="fa-IR")=>{const C=window.SpeechRecognition||window.webkitSpeechRecognition;if(!C){g(I=>[...I,{role:"assistant",content:"مرورگر شما از تشخیص گفتار پشتیبانی نمی‌کند."}]);return}const $=new C;$.lang=b,$.interimResults=!1,$.continuous=!1,$.onstart=()=>U(!0),$.onend=()=>U(!1),$.onerror=()=>{U(!1),xe(!1)},$.onresult=I=>{var ae,ie,oe;const R=String(((oe=(ie=(ae=I.results)==null?void 0:ae[0])==null?void 0:ie[0])==null?void 0:oe.transcript)??"").trim(),P=b==="fa-IR"?dn(R):un(R);if(!P)return;const O=Date.now();je.current.text===P&&O-je.current.at<2500||(je.current={text:P,at:O},d(P),vt(P),xe(!0),be(P))},$.start()};return e.jsxs("div",{className:"ai-app",children:[e.jsxs("div",{className:"assistant-card",children:[e.jsx(fe,{}),e.jsxs("div",{children:[e.jsx("strong",{children:t.ai.assistantName}),e.jsx("span",{children:"دستیار شخصی مرورگر شما"})]}),e.jsx("button",{className:"icon-button",title:"پاک‌کردن سابقه گفتگو",onClick:()=>{localStorage.removeItem(we),g([{role:"assistant",content:`گفتگو پاک شد. من ${t.ai.assistantName} هستم و آماده‌ام ادامه بدهیم.`}])},children:e.jsx(E,{size:16})})]}),e.jsx("button",{className:"history-toggle",type:"button",onClick:()=>N(b=>!b),children:F?"پنهان کردن گفتگوهای قبلی":"نمایش گفتگوهای قبلی"}),F&&e.jsxs("div",{className:"chat-log",children:[m.map((b,C)=>e.jsx("div",{className:`chat-message ${b.role}`,children:e.jsx(Me,{content:b.content})},C)),o&&e.jsx("div",{className:"chat-message assistant",children:e.jsx("em",{children:"در حال فکر کردن..."})})]}),!F&&Te&&e.jsxs("div",{className:"chat-message user voice-transcript",children:[e.jsx("small",{children:"فرمان صوتی تشخیص داده‌شده"}),e.jsx(Me,{content:Te})]}),!F&&(()=>{const b=m.filter(R=>R.role==="assistant"),C=b[b.length-1];if(!C)return null;const $=m.lastIndexOf(C),I=[...m.slice(0,$)].reverse().find(R=>R.role==="user");return e.jsxs("div",{className:"latest-answer-stack",children:[I&&e.jsxs("div",{className:"latest-request-preview",children:[e.jsx("small",{children:"در پاسخ به"}),e.jsx("strong",{children:rn(I.content)})]}),e.jsx("div",{className:"chat-message assistant latest-answer",children:e.jsx(Me,{content:C.content})})]})})(),!F&&(K||o)&&e.jsxs("div",{className:"assistant-working",role:"status","aria-live":"polite",children:[e.jsx("span",{}),e.jsx("strong",{children:K?"در حال تشخیص و اجرای فرمان...":"در حال فکر کردن..."})]}),e.jsxs("form",{className:"ai-composer",onSubmit:b=>{b.preventDefault(),be()},children:[u&&e.jsx(an,{mode:k,tabs:a,attachedTabs:y,onMode:f,onCommand:b=>{d(C=>`${de(C)}${de(C).trim()?" ":""}${b}`),j(!1)},onClose:()=>j(!1),onAttachTab:b=>{S(C=>C.some($=>$.id===b.id)?C:[...C,b]),d(C=>de(C)),j(!0),f("tabs")}}),y.length>0&&e.jsx("div",{className:"attached-tabs",children:y.map((b,C)=>e.jsxs("button",{type:"button",title:"حذف تب از گفتگو",onClick:()=>S($=>$.filter(I=>I.id!==b.id)),children:["تب ",new Intl.NumberFormat("fa-IR").format(C+1),": ",b.domain,e.jsx(E,{size:13})]},b.id))}),M.length>0&&e.jsx("div",{className:"attached-tabs",children:M.map(b=>e.jsxs("button",{type:"button",title:"حذف فایل از گفتگو",onClick:()=>L(C=>C.filter($=>$.id!==b.id)),children:[e.jsx(Lt,{size:13}),b.name,e.jsx(E,{size:13})]},b.id))}),e.jsx("input",{value:l,onChange:b=>{const C=b.target.value;d(C);const $=/(^|\s)\/[^\s]*$/.test(C);j($),$&&f("commands")},onKeyDown:b=>{b.key==="Escape"&&j(!1)},placeholder:"پیام بنویس یا / را برای افزودن تب و فرمان‌ها تایپ کن"}),e.jsx("input",{id:"rahak-file-input",hidden:!0,type:"file",multiple:!0,onChange:async b=>{const C=Array.from(b.target.files??[]),$=await Promise.all(C.map(cn));L(I=>[...I,...$.filter(Boolean)].slice(0,6)),b.currentTarget.value=""}}),e.jsx("button",{type:"button",title:"افزودن فایل",onClick:()=>{var b;return(b=document.getElementById("rahak-file-input"))==null?void 0:b.click()},children:e.jsx(Ut,{size:17})}),e.jsxs("div",{className:"voice-picker",children:[e.jsx("button",{type:"button",title:"فرمان صوتی فارسی",onClick:()=>ne("fa-IR"),className:_?"listening":"",children:e.jsx(ot,{size:17})}),e.jsxs("div",{className:"voice-menu",children:[e.jsx("button",{type:"button",onClick:()=>ne("fa-IR"),children:"فارسی"}),e.jsx("button",{type:"button",onClick:()=>ne("en-US"),children:"English"})]})]}),e.jsx("button",{disabled:o,type:"submit",children:e.jsx(se,{size:17})})]})]})}function an({mode:t,tabs:a,attachedTabs:s,onMode:n,onCommand:i,onClose:r,onAttachTab:c}){const h=[{title:"انتخاب تب‌های باز",subtitle:"افزودن تب به گفتگو",action:()=>n("tabs")},{title:"خلاصه تب",subtitle:"برای تب attach شده",action:()=>i("خلاصه تب‌های attach شده را بده.")},{title:"مقایسه تب‌ها",subtitle:"برای چند تب attach شده",action:()=>i("تب‌های attach شده را با هم مقایسه کن.")},{title:"ترجمه تب",subtitle:"ترجمه محتوای تب attach شده",action:()=>i("تب‌های attach شده را به فارسی ترجمه کن.")},{title:"منبع مقاله",subtitle:"استفاده از تب‌ها برای نوشتن",action:()=>i("از تب‌های attach شده به عنوان منبع برای نوشتن مقاله استفاده کن.")}];return e.jsxs("section",{className:"slash-menu floating-slash-menu",children:[e.jsxs("div",{className:"slash-menu-head",children:[e.jsx("strong",{children:t==="tabs"?"انتخاب تب‌ها":"فرمان‌های راهک"}),e.jsx("button",{type:"button",className:"icon-button",onClick:r,title:"بستن",children:e.jsx(E,{size:14})})]}),t==="commands"?e.jsx(e.Fragment,{children:h.map(l=>e.jsxs("button",{type:"button",onClick:l.action,children:[e.jsx("strong",{children:l.title}),e.jsx("small",{children:l.subtitle})]},l.title))}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>n("commands"),children:[e.jsx("strong",{children:"بازگشت به فرمان‌ها"}),e.jsx("small",{children:"انتخاب نوع کار"})]}),a.map(l=>{const d=s.some(m=>m.id===l.id);return e.jsxs("button",{type:"button",onClick:()=>c(l),disabled:d,children:[e.jsx("strong",{children:d?`✓ ${l.title}`:`+ ${l.title}`}),e.jsx("small",{children:l.domain})]},l.id)})]})]})}function de(t){return t.replace(/(^|\s)\/[^\s]*$/u,"$1").trim()}function on(t,a,s){if(!a.length&&!s.length)return t;const n=a.map((r,c)=>`(تب ${c+1}: ${r.domain})`).join(" "),i=s.map((r,c)=>`(فایل ${c+1}: ${r.name})`).join(" ");return`${[n,i].filter(Boolean).join(" ")}
${t}`}function rn(t){const a=t.replace(/\s+/g," ").trim();return a.length>130?`${a.slice(0,127)}...`:a}async function cn(t){if(!(t.type.startsWith("text/")||/\.(md|txt|csv|json|xml|html|css|js|ts|tsx|jsx|py|php|java|c|cpp|cs|go|rs|sql)$/i.test(t.name)))return{id:`${t.name}-${t.lastModified}-${t.size}`,name:t.name,type:t.type||"unknown",content:"این نوع فایل فعلا به صورت متنی قابل خواندن نیست. فقط نام، نوع و اندازه فایل در اختیار مدل قرار می‌گیرد."};const s=await t.text();return{id:`${t.name}-${t.lastModified}-${t.size}`,name:t.name,type:t.type||"text/plain",content:s.slice(0,18e4)}}function ln(t){if(!("speechSynthesis"in window))return;const a=t.replace(/```[\s\S]*?```/g," قطعه کد. ").replace(/\|/g," ");window.speechSynthesis.cancel();const s=new SpeechSynthesisUtterance(a.slice(0,1400));s.lang="fa-IR",window.speechSynthesis.speak(s)}function dn(t){const a={گوگل:"google",فیسبوک:"facebook",فیس‌بوک:"facebook",راویکست:"ravicast",یوتیوب:"youtube",اینستاگرام:"instagram",لینکدین:"linkedin",تلگرام:"telegram",واتساپ:"whatsapp",واتس‌اپ:"whatsapp"};let s=t;return Object.entries(a).forEach(([n,i])=>{s=s.replace(new RegExp(n,"gi"),i)}),V(s).replace(/\s+دات\s+/gi,".").replace(/\s+dot\s+/gi,".").replace(/\s+نقطه\s+/gi,".").replace(/\s+کام\b/gi,"com").replace(/\s+com\b/gi,".com").replace(/\.com\.com\b/gi,".com").trim()}function un(t){return V(t).replace(/\bdot\b/gi,".").replace(/\bpoint\b/gi,".").replace(/\bslash\b/gi,"/").replace(/\s+\.\s+/g,".").replace(/\s+\/\s+/g,"/").replace(/\bfacebook\s*\.?\s*com\b/gi,"facebook.com").replace(/\bgoogle\s*\.?\s*com\b/gi,"google.com").replace(/\bravicast\s*\.?\s*com\b/gi,"ravicast.com").trim()}function Me({content:t}){const a=fn(t);return e.jsx(e.Fragment,{children:a.map((s,n)=>s.type==="code"?e.jsx(hn,{code:s.text,lang:s.lang},n):e.jsx(mn,{text:s.text},n))})}function mn({text:t}){const a=xn(t);return a?e.jsx(pn,{headers:a.headers,rows:a.rows}):e.jsx(e.Fragment,{children:gn(t)})}function hn({code:t,lang:a}){return e.jsxs("div",{className:"code-block",dir:"ltr",children:[e.jsxs("header",{children:[e.jsx("span",{children:a||"code"}),e.jsx("button",{type:"button",onClick:()=>{var s;return(s=navigator.clipboard)==null?void 0:s.writeText(t)},title:"کپی کد",children:e.jsx(It,{size:14})})]}),e.jsx("pre",{children:e.jsx("code",{children:t})})]})}function pn({headers:t,rows:a}){return e.jsx("div",{className:"markdown-table-wrap",children:e.jsxs("table",{className:"markdown-table",children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map((s,n)=>e.jsx("th",{children:s},n))})}),e.jsx("tbody",{children:a.map((s,n)=>e.jsx("tr",{children:t.map((i,r)=>e.jsx("td",{children:s[r]||""},r))},n))})]})})}function gn(t){const a=[],s=/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s]+)/g;let n=0,i=s.exec(t);for(;i;){i.index>n&&a.push({type:"text",text:t.slice(n,i.index)});const r=i[2]||i[3];a.push({type:"link",text:i[1]||r,href:r}),n=i.index+i[0].length,i=s.exec(t)}return n<t.length&&a.push({type:"text",text:t.slice(n)}),a.map((r,c)=>r.type==="link"&&r.href?e.jsx("a",{href:r.href,target:"_blank",rel:"noreferrer",onClick:h=>{h.preventDefault(),z(r.href)},children:r.text},`${r.href}-${c}`):e.jsx("span",{children:r.text},`text-${c}`))}function fn(t){const a=[],s=/```(\w+)?\n([\s\S]*?)```/g;let n=0,i=s.exec(t);for(;i;)i.index>n&&a.push({type:"text",text:t.slice(n,i.index)}),a.push({type:"code",lang:i[1],text:i[2].trim()}),n=i.index+i[0].length,i=s.exec(t);return n<t.length&&a.push({type:"text",text:t.slice(n)}),a.length?a:[{type:"text",text:t}]}function xn(t){const a=t.trim().split(`
`).filter(n=>n.includes("|"));if(a.length<2||!/^\s*\|?\s*:?-{3,}:?\s*\|/.test(a[1]))return null;const s=n=>n.replace(/^\||\|$/g,"").split("|").map(i=>i.trim());return{headers:s(a[0]),rows:a.slice(2).map(s)}}function H({src:t,domain:a,compact:s=!1}){const[n,i]=w.useState(0),r=[t,`https://icons.duckduckgo.com/ip3/${a}.ico`,`https://www.google.com/s2/favicons?domain=${encodeURIComponent(a)}&sz=64`].filter(Boolean),c=r[n];return c?e.jsx("img",{className:s?"compact-favicon":"",src:c,alt:"",onError:()=>{n<r.length-1&&i(n+1)}}):e.jsx("span",{className:G("favicon-fallback",s&&"compact"),children:a.slice(0,1).toUpperCase()})}function me(t){const a=(t.title||"").trim();return!a||a===t.url||a===t.domain||a.startsWith("http")?t.domain:a.replace(/\s*[-|]\s*.+$/,"").slice(0,42)}function jn(){const t=x(d=>d.sites.bookmarkFolders),a=x(d=>d.removeBookmark),[s,n]=w.useState(null),[i,r]=w.useState("grid"),c=yn(t),h=c.find(d=>d.id===s)||c[0],l={gridTemplateColumns:`repeat(auto-fill, minmax(${i==="grid"?150:320}px, 1fr))`};return e.jsxs("div",{className:"bookmarks-app",children:[e.jsx("aside",{className:"bookmark-folders",children:c.map(d=>e.jsxs("button",{className:(h==null?void 0:h.id)===d.id?"active":"",onClick:()=>n(d.id),children:[e.jsx($e,{size:17}),e.jsx("span",{children:d.title}),e.jsx("small",{children:d.children.length})]},d.id))}),e.jsxs("section",{className:"bookmark-content",children:[e.jsxs("div",{className:"toolbar-row",children:[e.jsx("strong",{children:(h==null?void 0:h.title)||"بدون پوشه"}),e.jsxs("span",{children:[(h==null?void 0:h.children.length)||0," لینک"]}),e.jsx("button",{className:"icon-button",onClick:()=>r(i==="grid"?"list":"grid"),children:i==="grid"?e.jsx(_t,{size:17}):e.jsx(Ft,{size:17})})]}),e.jsxs("div",{className:i==="grid"?"bookmark-grid":"list-view",style:l,children:[h==null?void 0:h.children.map(d=>e.jsxs("article",{className:G("bookmark-card",i==="grid"&&"compact-bookmark"),children:[i==="list"&&e.jsx(H,{src:d.favicon,domain:d.domain,compact:!0}),e.jsxs("button",{className:"list-main",onClick:()=>z(d.url),children:[e.jsx("strong",{children:me(d)}),e.jsx("span",{children:d.domain})]}),e.jsx("button",{className:"icon-button danger-button",onClick:()=>a(d.id),title:" &",children:e.jsx(E,{size:16})})]},d.id)),!(h!=null&&h.children.length)&&e.jsx("p",{className:"empty-state",children:"این پوشه هنوز لینکی ندارد."})]})]})]})}function yn(t){const a=[],s=n=>{n.forEach(i=>{i.children.length&&a.push(i),s(i.folders)})};return s(t),a}function wn(){const t=x(u=>u.savedLinks),a=x(u=>u.settings),s=x(u=>u.setSettings),n=x(u=>u.updateSavedLink),i=x(u=>u.deleteSavedLink),r=a.studyRoom.view,[c,h]=w.useState("همه"),[l,d]=w.useState(""),[m,g]=w.useState({}),o=["همه",...Array.from(new Set(t.map(u=>u.category||"عمومی")))],p=t.filter(u=>{const j=c==="همه"||(u.category||"عمومی")===c,k=`${u.title} ${u.domain} ${u.tags.join(" ")}`.toLowerCase();return j&&k.includes(l.toLowerCase())});return e.jsxs("div",{className:"study-room-layout",children:[e.jsxs("aside",{className:"study-sidebar",children:[e.jsx("strong",{children:"&"}),o.map(u=>e.jsxs("button",{className:c===u?"active":"",onClick:()=>h(u),children:[e.jsx(he,{size:16}),u]},u))]}),e.jsxs("section",{className:"panel-stack study-room",children:[e.jsxs("div",{className:"toolbar-row study-toolbar",children:[e.jsx("input",{value:l,onChange:u=>d(u.target.value),placeholder:"جستجو در اتاق مطالعه"}),e.jsxs("select",{value:r,onChange:u=>s({...a,studyRoom:{...a.studyRoom,view:u.target.value}}),children:[e.jsx("option",{value:"grid",children:"گرید"}),e.jsx("option",{value:"list",children:"لیست"}),e.jsx("option",{value:"columns",children:"دو ستونه"})]})]}),e.jsxs("div",{className:r==="grid"?"study-grid":r==="columns"?"study-columns":"list-view",children:[p.map(u=>e.jsxs("article",{className:"study-card",children:[a.studyRoom.showThumbnail&&e.jsx("div",{className:"study-thumb",children:u.thumbnail?e.jsx("img",{src:u.thumbnail,alt:""}):e.jsx(H,{src:u.favicon,domain:u.domain})}),e.jsxs("button",{className:"list-main",onClick:()=>z(u.url),children:[e.jsx("strong",{children:u.title}),e.jsx("span",{children:u.domain}),a.studyRoom.showDate&&e.jsx("small",{children:new Intl.DateTimeFormat("fa-IR",{dateStyle:"medium"}).format(u.publishedAt||u.createdAt)}),a.studyRoom.showExcerpt&&e.jsx("small",{children:u.excerpt||"چکیده‌ای برای این صفحه موجود نیست."})]}),e.jsxs("div",{className:"tag-row clean-tags",children:[e.jsx(Gt,{size:14}),e.jsx("div",{className:"tag-chips",children:u.tags.map(j=>e.jsxs("button",{onClick:()=>n({...u,tags:u.tags.filter(k=>k!==j)}),title:"  ",children:[j,e.jsx(E,{size:11})]},j))}),e.jsx("input",{value:m[u.id]||"",onChange:j=>g({...m,[u.id]:j.target.value}),onKeyDown:j=>{if(j.key!=="Enter")return;j.preventDefault();const k=(m[u.id]||"").trim();k&&(n({...u,tags:Array.from(new Set([...u.tags,k]))}),g({...m,[u.id]:""}))},placeholder:"  + Enter"})]}),e.jsx("select",{value:u.category||"عمومی",onChange:j=>n({...u,category:j.target.value||"عمومی"}),children:["عمومی","تحقیق","برنامه‌نویسی","کار","شخصی","بدون‌دسته"].map(j=>e.jsx("option",{value:j,children:j},j))}),e.jsx("button",{className:"icon-button danger-button",onClick:()=>i(u.id),title:"",children:e.jsx(E,{size:16})})]},u.id)),!p.length&&e.jsx("p",{className:"empty-state",children:"نتیجه‌ای برای فیلتر فعلی پیدا نشد."})]})]})]})}function bn(){const t=x(r=>r.notes),a=x(r=>r.addNote),s=x(r=>r.deleteNote),[n,i]=w.useState("");return e.jsxs("div",{className:"panel-stack",children:[e.jsx("textarea",{value:n,onChange:r=>i(r.target.value),placeholder:"یادداشت خود را بنویسید..."}),e.jsx("button",{className:"primary-action",onClick:()=>{n.trim()&&(a(n),i(""))},children:"ذخیره یادداشت"}),e.jsx("div",{className:"list-view",children:t.map(r=>e.jsxs("article",{children:[e.jsx(ge,{}),e.jsxs("div",{className:"list-main",children:[e.jsx("strong",{children:r.title}),e.jsx("span",{children:r.body})]}),e.jsx("button",{className:"icon-button",onClick:()=>s(r.id),children:e.jsx(E,{size:16})})]},r.id))})]})}const kn=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"];function Ve({value:t,onChange:a}){const s=n=>a({...t,...n});return e.jsxs("div",{className:"jalali-date-fields",children:[e.jsxs("label",{className:"date-field year-field",children:[e.jsx("span",{children:"سال"}),e.jsx("input",{type:"number",inputMode:"numeric",min:1300,max:1500,value:t.year,onChange:n=>s({year:Number(n.target.value)||t.year}),"aria-label":"سال شمسی"})]}),e.jsxs("label",{className:"date-field month-field",children:[e.jsx("span",{children:"ماه"}),e.jsx("select",{value:t.month,onChange:n=>s({month:Y(Number(n.target.value)||t.month,1,12)}),"aria-label":"ماه شمسی",children:kn.map((n,i)=>e.jsx("option",{value:i+1,children:n},n))})]}),e.jsxs("label",{className:"date-field day-field",children:[e.jsx("span",{children:"روز"}),e.jsx("input",{type:"number",inputMode:"numeric",min:1,max:31,value:t.day,onChange:n=>s({day:Y(Number(n.target.value)||t.day,1,31)}),"aria-label":"روز شمسی"})]}),e.jsxs("label",{className:"date-field time-field",children:[e.jsx("span",{children:"ساعت"}),e.jsx("input",{type:"time",value:t.time,onChange:n=>s({time:n.target.value}),"aria-label":"ساعت"})]})]})}function vn(){const t=x(f=>f.reminders),a=x(f=>f.pendingReminderDate),s=x(f=>f.setPendingReminderDate),n=x(f=>f.addReminder),i=x(f=>f.updateReminder),r=x(f=>f.deleteReminder),c=x(f=>f.toggleReminder),[h,l]=w.useState(""),[d,m]=w.useState(()=>ue(Date.now()+36e5)),[g,o]=w.useState(null),[p,u]=w.useState(""),[j,k]=w.useState(null);return w.useEffect(()=>{a&&(m(ue(a)),l(f=>f||"یادآور جدید"),s(null))},[a,s]),e.jsxs("div",{className:"panel-stack",children:[e.jsxs("form",{className:"inline-form reminder-create-form",onSubmit:f=>{f.preventDefault(),h.trim()&&(n(h,Ke(d)),l(""),m(ue(Date.now()+36e5)))},children:[e.jsx("input",{value:h,onChange:f=>l(f.target.value),placeholder:"عنوان یادآور"}),e.jsx(Ve,{value:d,onChange:m}),e.jsx("button",{type:"submit",children:e.jsx(B,{size:17})})]}),e.jsx("div",{className:"list-view",children:t.map(f=>e.jsxs("article",{className:f.done?"done":"",children:[e.jsx("button",{className:"icon-button",onClick:()=>c(f.id),children:e.jsx(Q,{size:16})}),g===f.id?e.jsxs("form",{className:"reminder-edit",onSubmit:y=>{y.preventDefault(),i({...f,title:p||f.title,dueAt:j?Ke(j):f.dueAt}),o(null),k(null)},children:[e.jsx("input",{value:p,onChange:y=>u(y.target.value)}),j&&e.jsx(Ve,{value:j,onChange:k}),e.jsx("button",{type:"submit",children:e.jsx(Q,{size:15})})]}):e.jsxs("div",{className:"list-main",children:[e.jsx("strong",{children:f.title}),e.jsx("span",{children:new Intl.DateTimeFormat("fa-IR-u-ca-persian",{dateStyle:"medium",timeStyle:"short"}).format(f.dueAt)})]}),e.jsxs("div",{className:"item-actions",children:[e.jsx("button",{className:"icon-button",onClick:()=>{o(f.id),u(f.title),k(ue(f.dueAt))},children:e.jsx(te,{size:16})}),e.jsx("button",{className:"icon-button danger-button",onClick:()=>r(f.id),children:e.jsx(E,{size:16})})]})]},f.id))})]})}function Nn(){const t=x(p=>p.currentTabs),a=x(p=>p.refreshBrowserData),s=x(p=>p.closeTab),n=x(p=>p.focusTab),i=x(p=>p.projects),r=x(p=>p.saveCurrentProject),c=x(p=>p.restoreProject),[h,l]=w.useState(""),[d,m]=w.useState("domain"),g=w.useMemo(()=>{const p=new Map;return t.forEach(j=>p.set(j.domain,[...p.get(j.domain)??[],j])),[...p.entries()].map(([j,k])=>({domain:j,memory:k.reduce((f,y)=>f+(y.memoryBytes??0),0),items:k})).sort((j,k)=>d==="memory"?k.memory-j.memory:j.domain.localeCompare(k.domain))},[d,t]),o=Math.max(1,...g.flatMap(p=>p.items.map(u=>u.memoryBytes??0)));return e.jsxs("div",{className:"panel-stack",children:[e.jsxs("div",{className:"toolbar-row tabs-toolbar",children:[e.jsx("strong",{children:"مدیریت تب‌ها"}),e.jsxs("select",{value:d,onChange:p=>m(p.target.value),children:[e.jsx("option",{value:"domain",children:"مرتب‌سازی بر اساس دامنه"}),e.jsx("option",{value:"memory",children:"مرتب‌سازی بر اساس مصرف RAM"})]}),e.jsx("button",{className:"icon-button",onClick:()=>a(),title:"به‌روزرسانی",children:e.jsx(at,{size:17})})]}),e.jsxs("form",{className:"inline-form",onSubmit:p=>{p.preventDefault(),r(h||"پروژه جدید"),l("")},children:[e.jsx("input",{value:h,onChange:p=>l(p.target.value),placeholder:"نام پروژه تب‌ها"}),e.jsx("button",{type:"submit",children:e.jsx(B,{size:17})})]}),e.jsx("div",{className:"tab-groups",children:g.map(p=>e.jsxs("details",{className:"tab-group",children:[e.jsxs("summary",{children:[e.jsx(Ae,{size:16,className:"summary-arrow"}),e.jsx(H,{domain:p.domain,compact:!0}),e.jsx("strong",{children:p.domain}),e.jsxs("span",{children:[p.items.length," "]}),e.jsx("small",{children:p.memory?Ye(p.memory):"RAM نامشخص"})]}),e.jsx("div",{className:"tab-list",children:p.items.map(u=>{const j=Math.min(1,(u.memoryBytes??0)/o);return e.jsxs("article",{className:"tab-card",style:{"--memory-ratio":j},children:[e.jsx(H,{src:u.favicon,domain:u.domain,compact:!0}),e.jsxs("button",{className:"list-main",onClick:()=>u.tabId&&n(u.tabId),children:[e.jsx("strong",{children:u.title}),e.jsx("span",{children:u.domain})]}),e.jsx("small",{children:u.memoryBytes?Ye(u.memoryBytes):"RAM نامشخص"}),u.tabId&&e.jsx("button",{className:"icon-button danger-button",onClick:()=>s(u.tabId),children:e.jsx(E,{size:16})})]},u.id)})})]},p.domain))}),e.jsxs("div",{className:"list-view saved-sessions",children:[e.jsx("strong",{children:"پروژه‌های ذخیره‌شده"}),i.map(p=>e.jsxs("article",{className:"saved-project-card",children:[e.jsxs("div",{className:"saved-project-head",children:[e.jsx(pe,{}),e.jsxs("div",{className:"list-main",children:[e.jsx("strong",{children:p.title}),e.jsxs("span",{children:[new Intl.NumberFormat("fa-IR").format(p.tabs.length)," تب · ",jt(p)]})]}),e.jsx("button",{className:"notice-action",onClick:()=>c(p),children:"باز کردن همه"})]}),e.jsxs("div",{className:"saved-project-tabs",children:[p.tabs.slice(0,8).map(u=>e.jsxs("button",{onClick:()=>z(u.url),title:u.url,children:[e.jsx(H,{src:u.favicon,domain:u.domain,compact:!0}),e.jsx("span",{children:u.title||u.domain})]},u.id)),p.tabs.length>8&&e.jsxs("small",{children:[new Intl.NumberFormat("fa-IR").format(p.tabs.length-8)," تب دیگر"]})]})]},p.id))]})]})}function Cn(){const t=x(n=>n.settings),a=x(n=>n.patchSettings),s=["work","study","writing","media","ai"];return e.jsx("div",{className:"mission-grid",children:s.map(n=>e.jsxs("button",{className:t.workspace===n?"active":"",onClick:()=>a({workspace:n}),children:[e.jsx(Ot,{}),e.jsx("strong",{children:bt(n)}),e.jsx("span",{children:"برای تمرکز در این حالت وارد شوید"})]},n))})}function Sn(){const t=x(o=>o.settings),a=x(o=>o.setSettings),s=o=>a({...t,...o}),n=o=>s({ai:{...t.ai,...o}}),i=o=>s({widgets:{...t.widgets,...o}}),r=o=>s({premium:{...t.premium,features:{...t.premium.features,...o}}}),[c,h]=w.useState(""),[l,d]=w.useState(!1),m=Os[t.ai.provider]??[],g=l||!m.includes(t.ai.model)?"__custom__":t.ai.model;return e.jsxs("div",{className:"settings-page",children:[e.jsxs("section",{className:"settings-section settings-card",children:[e.jsxs("header",{className:"settings-section-head",children:[e.jsx("strong",{children:"ظاهر و تجربه"}),e.jsx("small",{children:"پوسته، حرکت، پس‌زمینه و جستجو"})]}),e.jsxs("label",{children:["پوسته",e.jsxs("select",{value:t.theme,onChange:o=>s({theme:o.target.value}),children:[e.jsx("option",{value:"auto",children:"خودکار"}),e.jsx("option",{value:"light",children:"روشن"}),e.jsx("option",{value:"dark",children:"تیره"})]})]}),e.jsxs("label",{children:["جلوه‌های حرکتی",e.jsxs("select",{value:t.motion,onChange:o=>s({motion:o.target.value}),children:[e.jsx("option",{value:"auto",children:"هوشمند"}),e.jsx("option",{value:"full",children:"کامل"}),e.jsx("option",{value:"reduced",children:"حداقلی"})]})]}),e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.glass,onChange:o=>s({glass:o.target.checked})}),"افکت شیشه‌ای"]}),e.jsxs("label",{children:["موتور جستجو",e.jsx("select",{value:t.searchEngine,onChange:o=>s({searchEngine:o.target.value}),children:Object.keys(Qe).map(o=>e.jsx("option",{value:o,children:o},o))})]}),e.jsxs("label",{children:["تصویر پس‌زمینه",e.jsx("select",{value:t.wallpaper,onChange:o=>s({wallpaper:o.target.value}),children:et.map(o=>e.jsx("option",{value:o.id,children:o.label},o.id))})]})]}),e.jsxs("section",{className:"settings-section settings-card",children:[e.jsxs("header",{className:"settings-section-head",children:[e.jsx("strong",{children:"هوش مصنوعی و راهک"}),e.jsx("small",{children:"مدل، کلید API، context محلی و صدا"})]}),e.jsxs("label",{children:["نام دستیار",e.jsx("input",{value:t.ai.assistantName,onChange:o=>n({assistantName:o.target.value})})]}),e.jsxs("label",{children:["ارائه‌دهنده مدل",e.jsxs("select",{value:t.ai.provider,onChange:o=>n({provider:o.target.value}),children:[e.jsx("option",{value:"openai",children:"OpenAI"}),e.jsx("option",{value:"gemini",children:"Gemini"}),e.jsx("option",{value:"claude",children:"Claude"}),e.jsx("option",{value:"grok",children:"Grok"})]})]}),e.jsxs("label",{children:["مدل AI",e.jsxs("select",{value:g,onChange:o=>{if(o.target.value==="__custom__"){d(!0);return}d(!1),n({model:o.target.value})},children:[m.map(o=>e.jsx("option",{value:o,children:o},o)),e.jsx("option",{value:"__custom__",children:"سفارشی"})]})]}),g==="__custom__"&&e.jsxs("label",{children:["مدل سفارشی",e.jsx("input",{value:t.ai.model,onChange:o=>n({model:o.target.value.trim()})})]}),e.jsxs("label",{children:["مدل پیشنهادی تست",e.jsx("button",{type:"button",className:"primary-action",onClick:()=>n({model:"gpt-5"}),children:"تغییر به gpt-5"})]}),e.jsxs("label",{children:["API Key",e.jsx("input",{type:"password",value:t.ai.apiKeys[t.ai.provider]||"",onChange:o=>n({apiKeys:{...t.ai.apiKeys,[t.ai.provider]:o.target.value}})})]}),e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.ai.localContextEnabled,onChange:o=>n({localContextEnabled:o.target.checked})}),"استفاده از زمینه محلی (تب‌ها و تاریخچه اخیر)"]}),e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.ai.webAccessEnabled,onChange:o=>n({webAccessEnabled:o.target.checked})}),"دسترسی وب برای پاسخ به لینک‌ها و سوالات عمومی"]}),e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.ai.voiceModeEnabled,onChange:o=>n({voiceModeEnabled:o.target.checked})}),"حالت صوتی کامل دستیار"]}),e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.ai.autoSpeak,onChange:o=>n({autoSpeak:o.target.checked})}),"خواندن صوتی پاسخ‌ها"]})]}),e.jsxs("section",{className:"settings-section settings-card",children:[e.jsxs("header",{className:"settings-section-head",children:[e.jsx("strong",{children:"ویجت‌های سایدبار"}),e.jsx("small",{children:"روشن و خاموش کردن ابزارهای کنار صفحه"})]}),[["sidebarEnabled","فعال‌سازی سایدبار"],["clock","ساعت"],["calendar","تقویم"],["notes","یادداشت"],["reminders","یادآور"],["weather","آب‌وهوا (پریمیوم)"],["currency","نرخ ارز (پریمیوم)"]].map(([o,p])=>e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.widgets[o],onChange:u=>i({[o]:u.target.checked})}),p]},o))]}),e.jsxs("section",{className:"settings-section settings-card",children:[e.jsxs("header",{className:"settings-section-head",children:[e.jsx("strong",{children:"قابلیت‌های پیشرفته"}),e.jsx("small",{children:"ابزارهای تکمیلی آزادراه را روشن یا خاموش کنید"})]}),[["feedReader","فیدخوان"],["advancedWidgets","ویجت‌های پیشرفته"],["appConnections","اتصال اپلیکیشن‌ها"],["shoppingAssistant","دستیار خرید"]].map(([o,p])=>e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.premium.features[o],onChange:u=>r({[o]:u.target.checked})}),p]},o)),e.jsxs("label",{className:"switch-line disabled-setting",children:[e.jsx("input",{type:"checkbox",disabled:!0}),"یادگیری جمعی فرمان صوتی (در حال طراحی)"]}),e.jsxs("label",{className:"switch-line disabled-setting",children:[e.jsx("input",{type:"checkbox",disabled:!0}),"خروجی اکسل برای مقایسه‌ها (در مرحله بعد)"]})]}),e.jsxs("section",{className:"settings-section settings-card",children:[e.jsxs("header",{className:"settings-section-head",children:[e.jsx("strong",{children:"پیکربندی داده زنده"}),e.jsx("small",{children:"بازار، آب‌وهوا و فاصله بروزرسانی"})]}),e.jsxs("label",{children:["منبع بازار",e.jsxs("select",{value:t.market.provider,onChange:o=>s({market:{...t.market,provider:o.target.value}}),children:[e.jsx("option",{value:"auto",children:"خودکار"}),e.jsx("option",{value:"persianapi",children:"PersianAPI"}),e.jsx("option",{value:"global",children:"Global APIs"})]})]}),e.jsxs("label",{children:["توکن PersianAPI (Bearer)",e.jsx("input",{type:"password",value:t.market.persianApiToken,onChange:o=>s({market:{...t.market,persianApiToken:o.target.value}}),placeholder:"مثال: eyJhbGciOi..."})]}),e.jsx("button",{className:"primary-action",onClick:async()=>{if(!t.market.persianApiToken.trim()){h("توکن خالی است. ابتدا Bearer Token را وارد کنید.");return}h("در حال تست اتصال PersianAPI...");const o=await ls(t.market.persianApiToken);h(`Gold: ${o.gold.message} | Crypto: ${o.crypto.message} | Currency: ${o.currency.message}`)},children:"تست اتصال PersianAPI"}),c&&e.jsx("p",{className:"settings-note",children:c}),e.jsxs("label",{children:["شهر آب‌وهوا",e.jsx("input",{value:t.weather.city,onChange:o=>s({weather:{...t.weather,city:o.target.value}})})]}),e.jsxs("label",{children:["بروزرسانی آب‌وهوا (دقیقه)",e.jsx("input",{type:"number",min:5,max:180,value:t.weather.refreshMinutes,onChange:o=>s({weather:{...t.weather,refreshMinutes:Number(o.target.value)||30}})})]}),e.jsxs("label",{children:["بروزرسانی ارز (دقیقه)",e.jsx("input",{type:"number",min:5,max:180,value:t.currency.refreshMinutes,onChange:o=>s({currency:{...t.currency,refreshMinutes:Number(o.target.value)||30}})})]})]}),e.jsxs("section",{className:"settings-section settings-card",children:[e.jsxs("header",{className:"settings-section-head",children:[e.jsx("strong",{children:"اتاق مطالعه"}),e.jsx("small",{children:"نمایش، تصویر شاخص، تاریخ و چکیده"})]}),e.jsxs("label",{children:["نمایش آیتم‌ها",e.jsxs("select",{value:t.studyRoom.view,onChange:o=>s({studyRoom:{...t.studyRoom,view:o.target.value}}),children:[e.jsx("option",{value:"grid",children:"گرید"}),e.jsx("option",{value:"list",children:"لیست"}),e.jsx("option",{value:"columns",children:"دو ستونه"})]})]}),[["showThumbnail","نمایش تصویر شاخص"],["showDate","نمایش تاریخ"],["showExcerpt","نمایش چکیده"]].map(([o,p])=>e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.studyRoom[o],onChange:u=>s({studyRoom:{...t.studyRoom,[o]:u.target.checked}})}),p]},o))]}),e.jsxs("section",{className:"settings-section settings-card",children:[e.jsxs("header",{className:"settings-section-head",children:[e.jsx("strong",{children:"لانچ‌پد"}),e.jsx("small",{children:"چیدمان میانبرها و سایت‌های پرتکرار"})]}),e.jsxs("label",{children:["تعداد ستون‌ها",e.jsx("input",{type:"number",min:3,max:10,value:t.launchpad.columns,onChange:o=>s({launchpad:{...t.launchpad,columns:Number(o.target.value)||6}})})]})]}),e.jsxs("p",{className:"settings-note settings-footnote",children:["سطح عملکرد تشخیص‌داده‌شده: ",t.performance.detectedTier]})]})}function Mn(){const t=x(s=>s.connection),a=x(s=>s.sites.internal);return e.jsxs("div",{className:"panel-stack",children:[e.jsxs("div",{className:"offline-banner",children:[e.jsx(q,{}),e.jsxs("div",{children:[e.jsxs("strong",{children:["وضعیت شبکه: ",kt(t)]}),e.jsx("span",{children:"در زمان محدودیت اینترنت، از سرویس‌های شبکه داخلی و ابزارهای اضطراری استفاده کنید."})]})]}),e.jsx("div",{className:"site-grid compact",children:a.map(s=>e.jsxs("button",{className:"site-card",onClick:()=>z(s.url),children:[e.jsx("img",{src:s.favicon||`https://www.google.com/s2/favicons?domain=${s.domain}&sz=64`,alt:""}),e.jsx("strong",{children:s.title}),e.jsx("span",{children:s.domain})]},s.id))})]})}function $n(){const t=x(c=>c.settings),[a,s]=w.useState([]),[n,i]=w.useState(!1),r=t.premium.features.feedReader&&t.feed.enabled;return w.useEffect(()=>{if(!r)return;const c=async()=>{i(!0);try{const l=t.feed.sources.filter(m=>m.enabled),d=await Promise.all(l.map(async m=>{const g=`https://api.rss2json.com/v1/api.json?rss_url=${encodeURIComponent(m.url)}`,o=await fetch(g);return o.ok?((await o.json()).items??[]).slice(0,4).map(u=>({title:u.title,link:u.link,source:m.title})):[]}));s(d.flat().slice(0,24))}finally{i(!1)}};c();const h=window.setInterval(c,t.feed.refreshMinutes*6e4);return()=>window.clearInterval(h)},[r,t.feed]),r?e.jsxs("div",{className:"panel-stack",children:[e.jsx("strong",{children:"فیدخوان"}),n&&e.jsx("small",{children:"در حال به‌روزرسانی خبرها..."}),e.jsx("div",{className:"list-view",children:a.map((c,h)=>e.jsxs("article",{children:[e.jsx(lt,{}),e.jsxs("button",{className:"list-main",onClick:()=>z(c.link),children:[e.jsx("strong",{children:c.title}),e.jsx("span",{children:c.source})]})]},`${c.link}-${h}`))})]}):e.jsx(Ie,{title:"فیدخوان هوشمند",description:"برای فعال‌سازی، پلن پریمیوم و گزینه فیدخوان را در تنظیمات روشن کنید."})}function An(){const t=x(i=>i.settings),a=x(i=>i.setSettings);if(!t.premium.features.appConnections)return e.jsx(Ie,{title:"اتصال اپلیکیشن‌ها",description:"این بخش در پلن رایگان غیرفعال است و در پریمیوم فعال می‌شود."});const n=i=>a({...t,integrations:{...t.integrations,...i}});return e.jsxs("div",{className:"panel-stack",children:[e.jsx("strong",{children:"اتصال پیام‌رسان‌ها"}),e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.integrations.telegram,onChange:i=>n({telegram:i.target.checked})}),"Telegram Web"]}),e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.integrations.whatsapp,onChange:i=>n({whatsapp:i.target.checked})}),"WhatsApp Web"]}),e.jsxs("label",{className:"switch-line",children:[e.jsx("input",{type:"checkbox",checked:t.integrations.bale,onChange:i=>n({bale:i.target.checked})}),"Bale Web"]}),e.jsxs("div",{className:"toolbar-row",children:[t.integrations.telegram&&e.jsx("button",{onClick:()=>z("https://web.telegram.org"),children:"باز کردن تلگرام"}),t.integrations.whatsapp&&e.jsx("button",{onClick:()=>z("https://web.whatsapp.com"),children:"باز کردن واتس‌اپ"}),t.integrations.bale&&e.jsx("button",{onClick:()=>z("https://web.bale.ai"),children:"باز کردن بله"})]})]})}function Rn(){const t=x(i=>i.settings),[a,s]=w.useState("");return t.premium.features.shoppingAssistant?e.jsxs("div",{className:"panel-stack",children:[e.jsx("strong",{children:"دستیار خرید"}),e.jsx("p",{className:"settings-note",children:"نیازمندی خود را بنویسید تا جستجوی وب با الگوی خرید اجرا شود."}),e.jsxs("form",{className:"inline-form",onSubmit:i=>{i.preventDefault(),a.trim()&&z(`https://torob.com/search/?query=${encodeURIComponent(a)}`)},children:[e.jsx("input",{value:a,onChange:i=>s(i.target.value),placeholder:"مثال: لپ‌تاپ سبک برای برنامه‌نویسی"}),e.jsx("button",{type:"submit",children:e.jsx(X,{size:16})})]})]}):e.jsx(Ie,{title:"دستیار خرید",description:"نسخه پایه این ویژگی در فاز ۲ به‌صورت پریمیوم ارائه می‌شود."})}function Ie({title:t,description:a}){return e.jsxs("div",{className:"panel-stack",children:[e.jsx("strong",{children:t}),e.jsx("p",{className:"settings-note",children:a})]})}function Dn(){const t=x(i=>i.controlCenterOpen),a=x(i=>i.settings),s=x(i=>i.patchSettings),n=x(i=>i.openWindow);return t?e.jsxs("aside",{className:"side-panel control-center",children:[e.jsx("h2",{children:"کنترل سنتر"}),e.jsxs("button",{onClick:()=>s({theme:a.theme==="dark"?"light":"dark"}),children:[a.theme==="dark"?e.jsx(dt,{}):e.jsx(rt,{}),"تغییر تم"]}),e.jsxs("button",{onClick:()=>s({motion:a.motion==="reduced"?"auto":"reduced"}),children:[e.jsx(De,{}),"کاهش افکت‌ها"]}),e.jsxs("button",{onClick:()=>n("offline"),children:[e.jsx(q,{}),"Offline Toolkit"]}),e.jsxs("button",{onClick:()=>n("settings"),children:[e.jsx(te,{}),"تنظیمات"]})]}):null}function zn(){const t=x(f=>f.notificationCenterOpen),a=x(f=>f.reminders),s=x(f=>f.toggleReminder),n=x(f=>f.projects),i=x(f=>f.savedLinks),r=x(f=>f.notes),c=x(f=>f.openWindow),[h,l]=w.useState(null),[d,m]=w.useState(Date.now());if(w.useEffect(()=>{if(!t)return;const f=()=>{const S=localStorage.getItem("azadrah-weather-alert");if(!S)return l(null);try{l(JSON.parse(S))}catch{l(null)}};f();const y=window.setInterval(f,1e4);return()=>window.clearInterval(y)},[t]),w.useEffect(()=>{if(!t)return;m(Date.now());const f=window.setInterval(()=>m(Date.now()),3e4);return()=>window.clearInterval(f)},[t]),!t)return null;const g=a.filter(f=>!f.done&&wt(f.dueAt,d)).sort((f,y)=>f.dueAt-y.dueAt).slice(0,5),o=n.slice(0,3),p=n.filter(f=>!o.some(y=>y.id===f.id)).sort((f,y)=>y.tabs.length-f.tabs.length||y.updatedAt-f.updatedAt).slice(0,2),u=i.filter(f=>!f.archived).slice(0,2),j=r.slice(0,2),k=g.length||o.length||p.length||u.length||j.length||h;return e.jsxs("aside",{className:"side-panel notification-center",children:[e.jsxs("header",{className:"notification-head",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"اعلان‌ها"}),e.jsx("span",{children:k?"رویدادهای مهم امروز و فضای کاری":"فعلاً اعلان فعالی ندارید"})]}),e.jsx(tt,{size:18})]}),!k&&e.jsxs("section",{className:"notification-empty",children:[e.jsx(se,{}),e.jsx("strong",{children:"همه‌چیز آرام است"}),e.jsx("span",{children:"وقتی یادآور امروز، پروژه تازه یا هشدار ابزارها فعال شود، همین‌جا می‌بینید."})]}),g.length>0&&e.jsxs("section",{className:"notification-section",children:[e.jsxs("header",{children:[e.jsx(Dt,{size:16}),e.jsx("strong",{children:"یادآورهای امروز"})]}),g.map(f=>e.jsxs("article",{className:"notification-card reminder-notice",children:[e.jsx("div",{className:"notice-icon",children:e.jsx(ze,{size:16})}),e.jsxs("div",{className:"notice-main",children:[e.jsx("strong",{children:f.title}),e.jsx("span",{children:new Intl.DateTimeFormat("fa-IR-u-ca-persian",{dateStyle:"medium",timeStyle:"short"}).format(f.dueAt)}),e.jsx("b",{children:In(f.dueAt,d)})]}),e.jsx("button",{className:"icon-button",onClick:()=>s(f.id),title:"انجام شد",children:e.jsx(Q,{size:15})})]},f.id))]}),(o.length>0||p.length>0)&&e.jsxs("section",{className:"notification-section",children:[e.jsxs("header",{children:[e.jsx(pe,{size:16}),e.jsx("strong",{children:"پروژه‌ها"})]}),[...o.map(f=>({project:f,label:"اخیر"})),...p.map(f=>({project:f,label:"Featured"}))].map(({project:f,label:y})=>e.jsxs("article",{className:"notification-card project-notice",children:[e.jsx("div",{className:"notice-icon",children:e.jsx(pe,{size:16})}),e.jsxs("div",{className:"notice-main",children:[e.jsx("strong",{children:f.title}),e.jsxs("span",{children:[y," · ",new Intl.NumberFormat("fa-IR").format(f.tabs.length)," تب · ",jt(f)]})]}),e.jsx("button",{className:"notice-action",onClick:()=>c("projects"),children:"مشاهده"})]},`${y}-${f.id}`))]}),u.length>0&&e.jsxs("section",{className:"notification-section",children:[e.jsxs("header",{children:[e.jsx(he,{size:16}),e.jsx("strong",{children:"اتاق مطالعه"})]}),u.map(f=>e.jsxs("article",{className:"notification-card",children:[e.jsx("div",{className:"notice-icon",children:e.jsx(he,{size:16})}),e.jsxs("div",{className:"notice-main",children:[e.jsx("strong",{children:f.title}),e.jsx("span",{children:f.category||f.domain})]}),e.jsx("button",{className:"notice-action",onClick:()=>c("readpad"),children:"باز کردن"})]},f.id))]}),j.length>0&&e.jsxs("section",{className:"notification-section",children:[e.jsxs("header",{children:[e.jsx(ge,{size:16}),e.jsx("strong",{children:"یادداشت‌های تازه"})]}),j.map(f=>e.jsxs("article",{className:"notification-card",children:[e.jsx("div",{className:"notice-icon",children:e.jsx(ge,{size:16})}),e.jsxs("div",{className:"notice-main",children:[e.jsx("strong",{children:f.title}),e.jsx("span",{children:f.body.slice(0,72)})]}),e.jsx("button",{className:"notice-action",onClick:()=>c("notes"),children:"مشاهده"})]},f.id))]}),h&&e.jsxs("section",{className:"notification-section",children:[e.jsxs("header",{children:[e.jsx(q,{size:16}),e.jsx("strong",{children:"هشدار ابزارها"})]}),e.jsxs("article",{className:"notification-card",children:[e.jsx("div",{className:"notice-icon",children:e.jsx(q,{size:16})}),e.jsxs("div",{className:"notice-main",children:[e.jsx("strong",{children:h.title}),e.jsx("span",{children:h.body})]})]})]})]})}function In(t,a=Date.now()){const s=t-a,n=Math.abs(s),i=Math.floor(n/6e4),r=Math.floor(i/60),c=Math.floor(r/24),h=new Intl.NumberFormat("fa-IR");return s<=0?i<1?"همین حالا":r<1?`${h.format(i)} دقیقه از موعد گذشته`:`${h.format(r)} ساعت از موعد گذشته`:i<1?"کمتر از یک دقیقه مانده":r<1?`${h.format(i)} دقیقه مانده`:c<1?`${h.format(r)} ساعت و ${h.format(i%60)} دقیقه مانده`:`${h.format(c)} روز مانده`}function jt(t){const a=Array.from(new Set(t.tabs.map(s=>s.domain).filter(Boolean))).slice(0,3);return a.length?a.join("، "):"بدون دامنه"}function Tn(){const t=x(n=>n.reminders),[a,s]=w.useState(new Set);return w.useEffect(()=>{const n=window.setInterval(()=>{const i=Date.now(),r=t.find(c=>!c.done&&c.dueAt<=i&&!a.has(c.id));r&&(s(c=>new Set(c).add(r.id)),En(),"Notification"in window&&Notification.permission==="granted"?new Notification("یادآور آزادراه",{body:r.title}):"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission())},1e3);return()=>window.clearInterval(n)},[t,a]),null}function En(){const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const a=new t,s=a.createGain();s.gain.setValueAtTime(1e-4,a.currentTime),s.gain.exponentialRampToValueAtTime(.18,a.currentTime+.03),s.gain.exponentialRampToValueAtTime(1e-4,a.currentTime+.8),s.connect(a.destination),[0,.22,.44].forEach(n=>{const i=a.createOscillator();i.type="sine",i.frequency.setValueAtTime(740,a.currentTime+n),i.connect(s),i.start(a.currentTime+n),i.stop(a.currentTime+n+.16)})}function Ln(t){const a=new Intl.DateTimeFormat("fa-IR-u-ca-persian",{day:"numeric",month:"numeric",year:"numeric"}),s=l=>Object.fromEntries(a.formatToParts(l).map(d=>[d.type,d.value])),n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0,0),i=s(n),r=s(new Date(Date.now())),c=[],h=new Set;for(let l=-35;l<=45;l+=1){const d=new Date(n);d.setDate(n.getDate()+l),d.setHours(12,0,0,0);const m=s(d);m.month!==i.month||m.year!==i.year||h.has(m.day)||(h.add(m.day),c.push({label:m.day,today:m.day===r.day&&m.month===r.month&&m.year===r.year,timestamp:new Date(d.getFullYear(),d.getMonth(),d.getDate(),12,0,0,0).getTime(),occasion:_n(m.month,m.day),holiday:Wn(m.month,m.day)}))}return c.sort((l,d)=>Number(W(l.label))-Number(W(d.label)))}function Pn(t){const a=t.getFullYear(),s=t.getMonth(),n=new Date(a,s+1,0).getDate(),i=new Date;return Array.from({length:n},(r,c)=>{const h=c+1;return{label:new Intl.NumberFormat("fa-IR").format(h),today:i.getFullYear()===a&&i.getMonth()===s&&i.getDate()===h,timestamp:new Date(a,s,h,12,0,0,0).getTime(),occasion:Bn(s+1,h),holiday:!1}})}function Fn(t){return t?(new Date(t).getDay()+1)%7:0}function ue(t){const a=new Date(t),s=yt(a);return{year:s.year,month:s.month,day:s.day,time:`${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`}}function Ke(t){const[a=9,s=0]=t.time.split(":").map(Number),n=Y(t.year,1300,1500),i=Y(t.month,1,12),r=Y(t.day,1,31),c=new Date(n+621,i-1,r,12,0,0,0);for(let l=-370;l<=370;l+=1){const d=new Date(c);d.setDate(c.getDate()+l),d.setHours(12,0,0,0);const m=yt(d);if(m.year===n&&m.month===i&&m.day===r)return d.setHours(Number.isFinite(a)?a:9,Number.isFinite(s)?s:0,0,0),d.getTime()}const h=new Date;return h.setHours(Number.isFinite(a)?a:9,Number.isFinite(s)?s:0,0,0),h.getTime()}function yt(t){const a=new Intl.DateTimeFormat("fa-IR-u-ca-persian",{day:"numeric",month:"numeric",year:"numeric"}),s=Object.fromEntries(a.formatToParts(t).map(n=>[n.type,W(n.value)]));return{year:Number(s.year),month:Number(s.month),day:Number(s.day)}}function Y(t,a,s){return Math.min(s,Math.max(a,t))}function On(t){var a;return((a=t.find(s=>s.today))==null?void 0:a.occasion)||""}function _n(t,a){const s=`${W(t)}/${W(a)}`,n={"1/1":"نوروز","1/2":"عید نوروز","1/3":"عید نوروز","1/4":"عید نوروز","1/12":"روز جمهوری اسلامی ایران","1/13":"سیزده‌به‌در","2/10":"روز ملی خلیج فارس","2/25":"روز فردوسی","3/14":"رحلت امام خمینی","3/15":"قیام ۱۵ خرداد","5/17":"روز خبرنگار","6/31":"آغاز هفته دفاع مقدس","8/13":"روز دانش‌آموز","8/24":"روز کتاب و کتابخوانی","9/16":"روز دانشجو","10/13":"روز جهانی مقاومت","11/22":"پیروزی انقلاب اسلامی","12/5":"روز درختکاری","12/29":"روز ملی شدن صنعت نفت"};return n[s]?n[s]:{"1/1":"نوروز","1/12":"روز جمهوری اسلامی ایران","1/13":"سیزده‌به‌در","2/10":"روز ملی خلیج فارس","3/14":"رحلت امام خمینی","3/15":"قیام ۱۵ خرداد","6/31":"آغاز هفته دفاع مقدس","8/13":"روز دانش‌آموز","9/16":"روز دانشجو","11/22":"پیروزی انقلاب اسلامی","12/29":"روز ملی شدن صنعت نفت"}[s]||""}function Wn(t,a){const s=`${W(t)}/${W(a)}`;return new Set(["1/1","1/2","1/3","1/4","1/12","1/13","3/14","3/15","11/22","12/29"]).has(s)}function Bn(t,a){const s={"1/1":"سال نو میلادی","2/4":"روز جهانی سرطان","2/11":"روز جهانی زنان و دختران در علم","3/8":"روز جهانی زن","3/22":"روز جهانی آب","4/7":"روز جهانی سلامت","4/22":"روز جهانی زمین","5/1":"روز جهانی کارگر","5/3":"روز جهانی آزادی مطبوعات","5/15":"روز جهانی خانواده","6/5":"روز جهانی محیط زیست","7/18":"روز جهانی نلسون ماندلا","8/12":"روز جهانی جوانان","9/8":"روز جهانی سوادآموزی","9/10":"روز جهانی پیشگیری از خودکشی","9/21":"روز جهانی صلح","10/1":"روز جهانی سالمندان","10/10":"روز جهانی سلامت روان","10/16":"روز جهانی غذا","10/24":"روز ملل متحد","11/14":"روز جهانی دیابت","12/1":"روز جهانی ایدز","12/3":"روز جهانی افراد دارای معلولیت","12/10":"روز جهانی حقوق بشر","12/25":"کریسمس"},n=`${t}/${a}`;return s[n]?s[n]:{"1/1":"سال نو میلادی","3/8":"روز جهانی زن","5/1":"روز جهانی کارگر","12/25":"کریسمس"}[`${t}/${a}`]||""}function wt(t,a){const s=new Date(t),n=new Date(a);return s.getFullYear()===n.getFullYear()&&s.getMonth()===n.getMonth()&&s.getDate()===n.getDate()}function Ze(t){return[0].includes(t)?"☀️":[1,2,3].includes(t)?"⛅":[45,48].includes(t)?"🌫️":[51,53,55,56,57,61,63,65,80,81,82].includes(t)?"🌧️":[66,67,71,73,75,77,85,86].includes(t)?"❄️":[95,96,99].includes(t)?"⛈️":"🌤️"}function Un(t){return[0].includes(t)?"صاف":[1,2,3].includes(t)?"کمی ابری":[45,48].includes(t)?"مه‌آلود":[51,53,55,56,57,61,63,65,80,81,82].includes(t)?"بارانی":[66,67,71,73,75,77,85,86].includes(t)?"برفی":[95,96,99].includes(t)?"طوفانی":"پایدار"}function Hn(t){return[51,53,55,56,57,61,63,65,80,81,82].includes(t)}function W(t){const a="۰۱۲۳۴۵۶۷۸۹",s="٠١٢٣٤٥٦٧٨٩";return t.replace(/[۰-۹٠-٩]/g,n=>{const i=a.indexOf(n);if(i>=0)return String(i);const r=s.indexOf(n);return r>=0?String(r):n})}function Ye(t){if(!t)return"نامشخص";const a=t/1024/1024;return`${new Intl.NumberFormat("fa-IR",{maximumFractionDigits:0}).format(a)} MB`}function bt(t){return{work:"کاری",study:"مطالعه",writing:"نوشتن",media:"رسانه",ai:"همراه هوشمند"}[t]}function kt(t){return t==="online"?"آنلاین":t==="limited"?"محدود":"آفلاین"}function qn(t){return{launchpad:"لانچ‌پد",ai:"راهک",bookmarks:"بوکمارک‌ها",readpad:"اتاق مطالعه",notes:"یادداشت‌ها",reminders:"یادآورها",projects:"پروژه‌های تب",feed:"فیدخوان",apps:"اتصال اپ‌ها",shop:"دستیار خرید",mission:"Mission Control",settings:"تنظیمات",offline:"Offline Toolkit"}[t]}At.createRoot(document.getElementById("root")).render(e.jsx(Z.StrictMode,{children:e.jsx(_s,{})}));
