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">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>گسترش هوشمند تصاویر | آلفا AI</title>
|
| 7 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 8 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
| 10 |
+
<style>
|
| 11 |
+
:root {
|
| 12 |
+
--app-font: 'Vazirmatn', sans-serif; --app-bg: #F8F9FC; --panel-bg: #FFFFFF;
|
| 13 |
+
--panel-border: #EAEFF7; --input-bg: #F6F8FB; --input-border: #E1E7EF;
|
| 14 |
+
--text-primary: #1A202C; --text-secondary: #626F86; --text-tertiary: #8A94A6;
|
| 15 |
+
--accent-primary: #4A6CFA; --accent-primary-hover: #3553D6; --accent-primary-glow: rgba(74, 108, 250, 0.25);
|
| 16 |
+
--accent-secondary: #0FD4A8; --accent-secondary-hover: #0DA986; --accent-secondary-glow: rgba(15, 212, 168, 0.2);
|
| 17 |
+
--shadow-sm: 0 1px 2px 0 rgba(26, 32, 44, 0.03); --shadow-md: 0 4px 6px -1px rgba(26, 32, 44, 0.05), 0 2px 4px -2px rgba(26, 32, 44, 0.04);
|
| 18 |
+
--shadow-lg: 0 10px 15px -3px rgba(26, 32, 44, 0.06), 0 4px 6px -4px rgba(26, 32, 44, 0.05);
|
| 19 |
+
--shadow-xl: 0 20px 25px -5px rgba(26, 32, 44, 0.07), 0 8px 10px -6px rgba(26, 32, 44, 0.05);
|
| 20 |
+
--radius-card: 24px; --radius-btn: 14px; --radius-input: 12px;
|
| 21 |
+
--transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
|
| 22 |
+
|
| 23 |
+
--guide-bg: rgba(255, 255, 255, 0.98);
|
| 24 |
+
--guide-border: rgba(102, 126, 234, 0.2);
|
| 25 |
+
--guide-text-title: #2d3748;
|
| 26 |
+
--guide-text-body: #4a5568;
|
| 27 |
+
--guide-accent: #667eea;
|
| 28 |
+
--primary-gradient-guide: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 29 |
+
--success-gradient-guide: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
|
| 30 |
+
--radius-md-guide: 12px;
|
| 31 |
+
--radius-lg-guide: 20px;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
|
| 35 |
+
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
| 36 |
+
@keyframes rotate-loader-orbital { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
| 37 |
+
@keyframes orbit-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
| 38 |
+
@keyframes satellite-pulse-1 { from { transform: scale(0.7) translateX(-50%); opacity: 0.6; } to { transform: scale(1.1) translateX(-50%); opacity: 1; } }
|
| 39 |
+
@keyframes satellite-pulse-2 { from { transform: scale(0.7) translateY(-50%); opacity: 0.6; } to { transform: scale(1.1) translateY(-50%); opacity: 1; } }
|
| 40 |
+
@keyframes pulse { 0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; } 50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.25; } }
|
| 41 |
+
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-10px); } }
|
| 42 |
+
@keyframes slideInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
|
| 43 |
+
|
| 44 |
+
html { scroll-behavior: smooth; }
|
| 45 |
+
body {
|
| 46 |
+
font-family: var(--app-font); direction: rtl; background-color: var(--app-bg);
|
| 47 |
+
color: var(--text-primary); font-size: 16px; line-height: 1.8; margin: 0;
|
| 48 |
+
padding: 2.5rem 0; min-height: 100vh; display: flex; justify-content: center;
|
| 49 |
+
align-items: flex-start; overflow-x: hidden;
|
| 50 |
+
background-image: radial-gradient(var(--text-tertiary) 0.5px, transparent 0.5px);
|
| 51 |
+
background-size: 20px 20px; background-position: -10px -10px;
|
| 52 |
+
}
|
| 53 |
+
.app-container { max-width: 680px; width: 92%; margin: 0 auto; }
|
| 54 |
+
.app-header { padding: 0.5rem 0 2rem 0; text-align: center; margin-bottom: 1.5rem; animation: fadeIn 0.8s 0.2s ease-out backwards; }
|
| 55 |
+
.app-header h1 { font-size: 2.5em; font-weight: 900; margin: 0 0 0.8rem 0; background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -1px; }
|
| 56 |
+
.app-header p { font-size: 1.05em; color: var(--text-secondary); margin-top: 0; opacity: 0.9; font-weight: 400; line-height: 1.7; }
|
| 57 |
+
.main-content { position:relative; padding: 2.5rem; background-color: var(--panel-bg); border-radius: var(--radius-card); box-shadow: var(--shadow-xl); border: 1px solid var(--panel-border); animation: fadeIn 0.8s 0.4s ease-out backwards; }
|
| 58 |
+
.form-group { margin-bottom: 2.2rem; }
|
| 59 |
+
label { display: block; font-weight: 700; color: var(--text-primary); font-size: 1.1em; margin-bottom: 1rem; }
|
| 60 |
+
input[type="text"], input[type="number"] { width: 100%; padding: 1rem 1.2rem; border-radius: var(--radius-input); border: 1px solid var(--input-border); background-color: var(--input-bg); color: var(--text-primary); box-shadow: var(--shadow-sm) inset; font-family: var(--app-font); font-size: 1rem; box-sizing: border-box; transition: var(--transition-smooth); }
|
| 61 |
+
input[type="text"]:focus, input[type="number"]:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-primary-glow), var(--shadow-sm) inset; background-color: var(--panel-bg); }
|
| 62 |
+
|
| 63 |
+
.logo-container { display: inline-flex; align-items: center; justify-content: center; margin-bottom: 20px; position: relative; }
|
| 64 |
+
.logo-glow { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100px; height: 100px; background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%); filter: blur(30px); animation: pulse 4s infinite ease-in-out; }
|
| 65 |
+
|
| 66 |
+
.section-subtitle { font-size: 0.9em; color: var(--text-tertiary); font-weight: 400; margin-top: -12px; margin-bottom: 16px; }
|
| 67 |
+
|
| 68 |
+
.upload-area { border: 2px dashed var(--input-border); border-radius: var(--radius-input); padding: 2rem; text-align: center; cursor: pointer; transition: var(--transition-smooth); background-color: var(--input-bg); }
|
| 69 |
+
.upload-area:hover { border-color: var(--accent-primary); background-color: #fff; box-shadow: 0 0 15px var(--accent-primary-glow); }
|
| 70 |
+
.upload-icon svg { width: 48px; height: 48px; color: var(--accent-primary); margin-bottom: 1rem; stroke-width: 1.5; opacity: 0.8; }
|
| 71 |
+
.upload-area p { margin: 0; color: var(--text-secondary); font-weight: 500; }
|
| 72 |
+
.image-preview-container { position: relative; width: 100%; border: 1px solid var(--panel-border); border-radius: var(--radius-input); overflow: hidden; }
|
| 73 |
+
.image-preview { width: 100%; height: auto; display: block; }
|
| 74 |
+
.remove-image-btn { position: absolute; top: 12px; left: 12px; width: 32px; height: 32px; background: rgba(26, 32, 44, 0.7); backdrop-filter: blur(5px); color: white; border: none; border-radius: 50%; font-size: 22px; cursor: pointer; transition: var(--transition-smooth); display: flex; align-items: center; justify-content: center; z-index: 10; }
|
| 75 |
+
.remove-image-btn:hover { background: rgba(26, 32, 44, 0.9); transform: scale(1.1); }
|
| 76 |
+
|
| 77 |
+
.collapsible-header { cursor: pointer; user-select: none; margin-bottom: 1rem; display: flex; align-items: center; }
|
| 78 |
+
.collapsible-header .chevron-icon { margin-right: auto; transition: transform 0.3s ease; color: var(--text-tertiary); }
|
| 79 |
+
.collapsible-header.active .chevron-icon { transform: rotate(180deg); color: var(--accent-primary); }
|
| 80 |
+
.collapsible-content { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s ease-in-out; }
|
| 81 |
+
.collapsible-header.active + .collapsible-content { grid-template-rows: 1fr; }
|
| 82 |
+
.collapsible-content-inner { min-height: 0; overflow: hidden; }
|
| 83 |
+
.collapsible-header.active + .collapsible-content .collapsible-content-inner { padding-top: 4px; }
|
| 84 |
+
|
| 85 |
+
.direction-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
|
| 86 |
+
.direction-option { position: relative; border: 1px solid var(--input-border); background-color: var(--input-bg); border-radius: var(--radius-input); padding: 12px; cursor: pointer; transition: var(--transition-smooth); display: flex; align-items: center; user-select: none; }
|
| 87 |
+
.direction-option:hover { border-color: var(--accent-primary); background-color: white; }
|
| 88 |
+
.direction-option input { position: absolute; opacity: 0; }
|
| 89 |
+
.direction-option input:checked + .direction-label { color: var(--accent-primary); font-weight: 700; }
|
| 90 |
+
.direction-option input:checked ~ .direction-icon svg { color: var(--accent-primary); }
|
| 91 |
+
.direction-option .direction-label { font-size: 0.95rem; font-weight: 500; color: var(--text-secondary); margin-right: 10px; transition: var(--transition-smooth); }
|
| 92 |
+
.direction-option .direction-icon { width: 22px; height: 22px; color: var(--text-tertiary); }
|
| 93 |
+
.direction-option input:checked + .direction-label::before { content: '✔'; margin-left: 8px; color: var(--accent-secondary); }
|
| 94 |
+
|
| 95 |
+
.aspect-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
|
| 96 |
+
.aspect-btn {
|
| 97 |
+
padding: 8px; background-color: var(--input-bg); border: 1px solid var(--input-border);
|
| 98 |
+
border-radius: var(--radius-input); cursor: pointer; transition: var(--transition-smooth);
|
| 99 |
+
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
| 100 |
+
height: 70px; gap: 4px; font-family: var(--app-font);
|
| 101 |
+
}
|
| 102 |
+
.aspect-btn:hover { border-color: var(--accent-primary); background-color: white; }
|
| 103 |
+
.aspect-btn.active { background: var(--accent-primary); border-color: var(--accent-primary); box-shadow: 0 0 10px var(--accent-primary-glow); }
|
| 104 |
+
.aspect-btn svg { width: auto; height: 32px; transition: var(--transition-smooth); }
|
| 105 |
+
.aspect-btn svg .shape { fill: transparent; stroke: var(--text-tertiary); stroke-width: 1.5; vector-effect: non-scaling-stroke; transition: var(--transition-smooth); }
|
| 106 |
+
.aspect-btn svg .label-text { fill: var(--text-secondary); font-size: 7px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; transition: var(--transition-smooth); font-family: var(--app-font); }
|
| 107 |
+
.aspect-btn:hover svg .shape { stroke: var(--accent-primary); }
|
| 108 |
+
.aspect-btn:hover svg .label-text { fill: var(--accent-primary); }
|
| 109 |
+
.aspect-btn.active svg .shape { fill: var(--accent-primary); stroke: #fff; }
|
| 110 |
+
.aspect-btn.active svg .label-text { fill: #fff; }
|
| 111 |
+
.aspect-btn .custom-text { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); transition: var(--transition-smooth); }
|
| 112 |
+
.aspect-btn:hover .custom-text { color: var(--accent-primary); }
|
| 113 |
+
.aspect-btn.active .custom-text { color: white; }
|
| 114 |
+
.aspect-btn.active svg .custom-icon-shape { stroke: white; }
|
| 115 |
+
|
| 116 |
+
.custom-dimensions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.5s ease, opacity 0.3s ease, margin-top 0.5s ease; }
|
| 117 |
+
.custom-dimensions.visible { max-height: 100px; opacity: 1; }
|
| 118 |
+
.dimension-input-wrapper { display: flex; flex-direction: column; gap: 6px; }
|
| 119 |
+
.dimension-input-wrapper > label { margin-bottom: 0; font-size: 0.9em; font-weight: 600; color: var(--text-secondary); }
|
| 120 |
+
|
| 121 |
+
.generate-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 1.1rem 1.5rem; font-size: 1.25em; font-weight: 800; background: linear-gradient(95deg, var(--accent-secondary) 0%, var(--accent-primary) 100%); color: #fff; border: none; border-radius: var(--radius-btn); cursor: pointer; transition: all 0.3s ease; box-shadow: 0 6px 12px -3px var(--accent-primary-glow), 0 6px 12px -3px var(--accent-secondary-glow); position: relative; overflow: hidden; letter-spacing: 0.5px; }
|
| 122 |
+
.generate-btn:hover:not(:disabled) { transform: translateY(-5px) scale(1.02); box-shadow: 0 8px 20px -4px var(--accent-primary-glow), 0 8px 20px -4px var(--accent-secondary-glow); }
|
| 123 |
+
.generate-btn:disabled { background: var(--text-tertiary); cursor: not-allowed; box-shadow: none; color: var(--text-secondary); }
|
| 124 |
+
.generate-btn .spinner { width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; display: none;}
|
| 125 |
+
|
| 126 |
+
.download-btn {
|
| 127 |
+
display: flex; align-items: center; justify-content: center; gap: 10px;
|
| 128 |
+
width: 100%; padding: 0.9rem 1.5rem; font-size: 1.1em; font-weight: 700;
|
| 129 |
+
background: linear-gradient(95deg, var(--accent-primary) 0%, #5a8cff 100%);
|
| 130 |
+
color: #fff; border: none; border-radius: var(--radius-btn);
|
| 131 |
+
cursor: pointer; transition: var(--transition-smooth);
|
| 132 |
+
box-shadow: 0 4px 10px -2px var(--accent-primary-glow); margin-top: 1.5rem;
|
| 133 |
+
}
|
| 134 |
+
.download-btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 6px 15px -3px var(--accent-primary-glow); }
|
| 135 |
+
.download-btn svg { width: 22px; height: 22px; }
|
| 136 |
+
|
| 137 |
+
.output-section { margin-top: 3rem; display: flex; align-items: center; justify-content: center; flex-direction: column; min-height: 220px; position: relative; box-sizing: border-box; padding: 2rem; background-color: var(--input-bg); border-radius: var(--radius-card); border: 2px dashed var(--input-border); box-shadow: var(--shadow-sm) inset; transition: var(--transition-smooth); }
|
| 138 |
+
.output-section.has-content { background-color: var(--panel-bg); border: 1px solid var(--panel-border); box-shadow: var(--shadow-lg); padding: 1rem; min-height: auto; }
|
| 139 |
+
.status-message { font-weight: 500; color: var(--text-secondary); text-align: center; font-size: 1.1em; }
|
| 140 |
+
.status-message.error { color: #c53030; font-weight: 600; line-height: 1.9; }
|
| 141 |
+
.loading-animation-wrapper { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1.8rem; width: 100%; }
|
| 142 |
+
|
| 143 |
+
.orbital-loader { width: 110px; height: 110px; position: relative; animation: rotate-loader-orbital 10s linear infinite; }
|
| 144 |
+
.orbit { position: absolute; top: 50%; left: 50%; border: 2px dashed rgba(74, 108, 250, 0.35); border-radius: 50%; transform-origin: center center; }
|
| 145 |
+
.orbit:nth-child(1) { width: 65px; height: 65px; margin: -32.5px 0 0 -32.5px; animation: orbit-spin 3.8s linear infinite; }
|
| 146 |
+
.orbit:nth-child(2) { width: 95px; height: 95px; margin: -47.5px 0 0 -47.5px; animation: orbit-spin 4.8s linear infinite reverse; }
|
| 147 |
+
.orbit .satellite { position: absolute; width: 10px; height: 10px; border-radius: 50%; background-color: var(--accent-primary); box-shadow: 0 0 8px var(--accent-primary), 0 0 12px var(--accent-secondary); }
|
| 148 |
+
.orbit:nth-child(1) .satellite { top: 50%; left: -5px; background-color: var(--accent-secondary); animation: satellite-pulse-2 1.4s 0.2s ease-in-out infinite alternate; }
|
| 149 |
+
.orbit:nth-child(2) .satellite { bottom: -5px; right: 50%; animation: satellite-pulse-1 1.4s 0.4s ease-in-out infinite alternate;}
|
| 150 |
+
|
| 151 |
+
.loading-text { font-size: 1.2em; font-weight: 700; color: var(--text-primary); text-align: center; background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
|
| 152 |
+
.result-image { width: 100%; height: auto; border-radius: var(--radius-input); box-shadow: var(--shadow-md); transition: transform 0.2s ease-in-out; cursor: pointer; }
|
| 153 |
+
.result-image:hover { transform: scale(1.02); box-shadow: var(--shadow-lg); }
|
| 154 |
+
|
| 155 |
+
.fullscreen-modal {
|
| 156 |
+
display: none; position: fixed; z-index: 1000; top: 0; left: 0;
|
| 157 |
+
width: 100%; height: 100%; background-color: rgba(26, 32, 44, 0.9);
|
| 158 |
+
justify-content: center; align-items: center; animation: fadeIn 0.3s ease;
|
| 159 |
+
}
|
| 160 |
+
.fullscreen-image { max-width: 90%; max-height: 90%; object-fit: contain; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
|
| 161 |
+
.close-fullscreen { position: absolute; top: 20px; right: 35px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; transition: color 0.2s, transform 0.2s; }
|
| 162 |
+
.close-fullscreen:hover { color: var(--text-tertiary); transform: scale(1.1); }
|
| 163 |
+
|
| 164 |
+
@media (max-width: 600px) {
|
| 165 |
+
body { padding: 1.5rem 0; }
|
| 166 |
+
.main-content { padding: 1.5rem; }
|
| 167 |
+
.app-header h1 { font-size: 2em; }
|
| 168 |
+
.aspect-grid { grid-template-columns: repeat(2, 1fr); }
|
| 169 |
+
.direction-grid { grid-template-columns: 1fr; }
|
| 170 |
+
}
|
| 171 |
+
</style>
|
| 172 |
+
</head>
|
| 173 |
+
<body>
|
| 174 |
+
<div class="app-container">
|
| 175 |
+
<header class="app-header">
|
| 176 |
+
<div class="logo-container">
|
| 177 |
+
<div class="logo-glow"></div>
|
| 178 |
+
<svg width="70" height="70" viewBox="0 0 80 80">
|
| 179 |
+
<defs>
|
| 180 |
+
<linearGradient id="logoGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
| 181 |
+
<stop offset="0%" style="stop-color:var(--accent-primary);stop-opacity:1" />
|
| 182 |
+
<stop offset="100%" style="stop-color:var(--accent-secondary);stop-opacity:1" />
|
| 183 |
+
</linearGradient>
|
| 184 |
+
</defs>
|
| 185 |
+
<rect x="10" y="10" width="60" height="60" rx="12" fill="none" stroke="url(#logoGradient)" stroke-width="3" stroke-dasharray="5,5">
|
| 186 |
+
<animate attributeName="stroke-dashoffset" values="0;10" dur="2s" repeatCount="indefinite" />
|
| 187 |
+
</rect>
|
| 188 |
+
<rect x="20" y="20" width="40" height="40" rx="8" fill="url(#logoGradient)" opacity="0.3" />
|
| 189 |
+
<rect x="30" y="30" width="20" height="20" rx="4" fill="url(#logoGradient)" opacity="0.6" />
|
| 190 |
+
<circle cx="40" cy="40" r="3" fill="#fff" />
|
| 191 |
+
</svg>
|
| 192 |
+
</div>
|
| 193 |
+
<h1>گسترش هوشمند تصاویر</h1>
|
| 194 |
+
<p>با قدرت هوش مصنوعی آلفا، فراتر از کادر تصویر را ببینید.</p>
|
| 195 |
+
</header>
|
| 196 |
+
|
| 197 |
+
<main class="main-content">
|
| 198 |
+
<form id="main-form" onsubmit="return false;">
|
| 199 |
+
<div class="form-group">
|
| 200 |
+
<label for="image-file">🖼️ انتخاب تصویر</label>
|
| 201 |
+
<label class="upload-area" id="upload-area">
|
| 202 |
+
<div class="upload-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg></div>
|
| 203 |
+
<p>تصویر خود را اینجا بکشید یا برای انتخاب کلیک کنید</p>
|
| 204 |
+
</label>
|
| 205 |
+
<input type="file" id="image-file" accept="image/*" required style="display: none;">
|
| 206 |
+
<div id="image-preview-container" class="image-preview-container" style="display: none; margin-top: 1rem;">
|
| 207 |
+
<button id="remove-image-btn" class="remove-image-btn" title="حذف تصویر">×</button>
|
| 208 |
+
<img id="image-preview" src="#" alt="پیشنمایش تصویر" class="image-preview">
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
|
| 212 |
+
<div class="form-group">
|
| 213 |
+
<label for="prompt">🎨 توضیحات گسترش</label>
|
| 214 |
+
<input type="text" id="prompt" placeholder="اختیاری: توصیف آنچه میخواهید اضافه شود...">
|
| 215 |
+
</div>
|
| 216 |
+
|
| 217 |
+
<div class="form-group">
|
| 218 |
+
<div id="direction-header" class="collapsible-header">
|
| 219 |
+
<label style="margin-bottom: 0;">🧭 جهتهای گسترش</label>
|
| 220 |
+
<svg class="chevron-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>
|
| 221 |
+
</div>
|
| 222 |
+
<div class="collapsible-content">
|
| 223 |
+
<div class="collapsible-content-inner">
|
| 224 |
+
<div class="direction-grid">
|
| 225 |
+
<label class="direction-option"><input type="checkbox" name="direction" id="expand-top" checked><span class="direction-label">بالا</span><div class="direction-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 19V5M5 12l7-7 7 7"/></svg></div></label>
|
| 226 |
+
<label class="direction-option"><input type="checkbox" name="direction" id="expand-bottom" checked><span class="direction-label">پایین</span><div class="direction-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 5v14M19 12l-7 7-7-7"/></svg></div></label>
|
| 227 |
+
<label class="direction-option"><input type="checkbox" name="direction" id="expand-left"><span class="direction-label">چپ</span><div class="direction-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M19 12H5M12 5l-7 7 7 7"/></svg></div></label>
|
| 228 |
+
<label class="direction-option"><input type="checkbox" name="direction" id="expand-right"><span class="direction-label">راست</span><div class="direction-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 12h14M12 19l7-7-7-7"/></svg></div></label>
|
| 229 |
+
</div>
|
| 230 |
+
</div>
|
| 231 |
+
</div>
|
| 232 |
+
</div>
|
| 233 |
+
|
| 234 |
+
<div class="form-group">
|
| 235 |
+
<label>📐 ابعاد نهایی</label>
|
| 236 |
+
<p class="section-subtitle">تصویر شما به چه اندازهای تبدیل شود؟</p>
|
| 237 |
+
<div class="aspect-grid">
|
| 238 |
+
<button type="button" class="aspect-btn" data-ratio="16:9">
|
| 239 |
+
<svg viewBox="0 0 32 18">
|
| 240 |
+
<rect class="shape" x="1" y="1" width="30" height="16" rx="3"/>
|
| 241 |
+
<text class="label-text" x="16" y="9">16:9</text>
|
| 242 |
+
</svg>
|
| 243 |
+
</button>
|
| 244 |
+
<button type="button" class="aspect-btn" data-ratio="9:16">
|
| 245 |
+
<svg viewBox="0 0 18 32">
|
| 246 |
+
<rect class="shape" x="1" y="1" width="16" height="30" rx="3"/>
|
| 247 |
+
<text class="label-text" x="9" y="16">9:16</text>
|
| 248 |
+
</svg>
|
| 249 |
+
</button>
|
| 250 |
+
<button type="button" class="aspect-btn active" data-ratio="1:1">
|
| 251 |
+
<svg viewBox="0 0 24 24">
|
| 252 |
+
<rect class="shape" x="1" y="1" width="22" height="22" rx="3"/>
|
| 253 |
+
<text class="label-text" x="12" y="12.5">1:1</text>
|
| 254 |
+
</svg>
|
| 255 |
+
</button>
|
| 256 |
+
<button type="button" class="aspect-btn" data-ratio="custom">
|
| 257 |
+
<svg viewBox="0 0 24 24" height="24">
|
| 258 |
+
<g class="shape custom-icon-shape">
|
| 259 |
+
<line x1="4" y1="7" x2="20" y2="7"></line>
|
| 260 |
+
<line x1="4" y1="17" x2="20" y2="17"></line>
|
| 261 |
+
<circle cx="8" cy="7" r="2.5" fill="var(--input-bg)"></circle>
|
| 262 |
+
<circle cx="16" cy="17" r="2.5" fill="var(--input-bg)"></circle>
|
| 263 |
+
</g>
|
| 264 |
+
</svg>
|
| 265 |
+
<span class="custom-text">سفارشی</span>
|
| 266 |
+
</button>
|
| 267 |
+
</div>
|
| 268 |
+
<div id="custom-dimensions-container" class="custom-dimensions">
|
| 269 |
+
<div class="dimension-input-wrapper">
|
| 270 |
+
<label for="width">↔️ عرض (افقی)</label>
|
| 271 |
+
<input type="number" id="width" value="1024" placeholder="مثلاً: 1280">
|
| 272 |
+
</div>
|
| 273 |
+
<div class="dimension-input-wrapper">
|
| 274 |
+
<label for="height">↕️ ارتفاع (عمودی)</label>
|
| 275 |
+
<input type="number" id="height" value="1024" placeholder="مثلاً: 720">
|
| 276 |
+
</div>
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
|
| 280 |
+
<input type="number" id="outpaint-steps" value="50" style="display:none;">
|
| 281 |
+
<input type="number" id="guidance-scale" value="8" style="display:none;">
|
| 282 |
+
|
| 283 |
+
<button type="submit" id="submit-btn" class="generate-btn">
|
| 284 |
+
<span class="btn-text">✨ شروع گسترش تصویر</span>
|
| 285 |
+
<div class="spinner"></div>
|
| 286 |
+
</button>
|
| 287 |
+
</form>
|
| 288 |
+
|
| 289 |
+
<div id="output-section" class="output-section">
|
| 290 |
+
<div id="status-message" class="status-message">نتیجه در اینجا نمایش داده خواهد شد.</div>
|
| 291 |
+
<div id="loading-animation-wrapper" class="loading-animation-wrapper">
|
| 292 |
+
<div class="orbital-loader">
|
| 293 |
+
<div class="orbit"><div class="satellite"></div></div>
|
| 294 |
+
<div class="orbit"><div class="satellite"></div></div>
|
| 295 |
+
</div>
|
| 296 |
+
<p id="loading-text" class="loading-text">در حال پردازش هوشمند...</p>
|
| 297 |
+
</div>
|
| 298 |
+
<div id="result-container"></div>
|
| 299 |
+
</div>
|
| 300 |
+
</main>
|
| 301 |
+
</div>
|
| 302 |
+
|
| 303 |
+
<div id="fullscreen-modal" class="fullscreen-modal">
|
| 304 |
+
<span id="close-fullscreen" class="close-fullscreen">×</span>
|
| 305 |
+
<img id="fullscreen-image" class="fullscreen-image" src="#" alt="نمایش تمام صفحه">
|
| 306 |
+
</div>
|
| 307 |
+
|
| 308 |
+
<script>
|
| 309 |
+
const submitBtn = document.getElementById('submit-btn');
|
| 310 |
+
const btnText = submitBtn.querySelector('.btn-text');
|
| 311 |
+
const btnSpinner = submitBtn.querySelector('.spinner');
|
| 312 |
+
|
| 313 |
+
const outputSection = document.getElementById('output-section');
|
| 314 |
+
const statusMessage = document.getElementById('status-message');
|
| 315 |
+
const loadingAnimationWrapper = document.getElementById('loading-animation-wrapper');
|
| 316 |
+
const loadingText = document.getElementById('loading-text');
|
| 317 |
+
const resultContainer = document.getElementById('result-container');
|
| 318 |
+
|
| 319 |
+
const widthInput = document.getElementById('width');
|
| 320 |
+
const heightInput = document.getElementById('height');
|
| 321 |
+
const aspectButtons = document.querySelectorAll('.aspect-btn');
|
| 322 |
+
const customDimensionsContainer = document.getElementById('custom-dimensions-container');
|
| 323 |
+
|
| 324 |
+
const fileInput = document.getElementById('image-file');
|
| 325 |
+
const uploadArea = document.getElementById('upload-area');
|
| 326 |
+
const imagePreviewContainer = document.getElementById('image-preview-container');
|
| 327 |
+
const imagePreview = document.getElementById('image-preview');
|
| 328 |
+
const removeImageBtn = document.getElementById('remove-image-btn');
|
| 329 |
+
const directionHeader = document.getElementById('direction-header');
|
| 330 |
+
|
| 331 |
+
const fullscreenModal = document.getElementById('fullscreen-modal');
|
| 332 |
+
const fullscreenImage = document.getElementById('fullscreen-image');
|
| 333 |
+
const closeFullscreenBtn = document.getElementById('close-fullscreen');
|
| 334 |
+
|
| 335 |
+
let currentRunId = '';
|
| 336 |
+
let pollInterval = null;
|
| 337 |
+
let emptyActionCounter = 0;
|
| 338 |
+
let uploadedFile = null;
|
| 339 |
+
|
| 340 |
+
const GPU_QUOTA_ERROR_HTML = `
|
| 341 |
+
<div class="ip-reset-guide-container">
|
| 342 |
+
<div class="guide-header"><svg class="guide-header-icon" viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <defs><lineargradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color: #667eea; stop-opacity: 1;"></stop><stop offset="100%" style="stop-color: #764ba2; stop-opacity: 1;"></stop></lineargradient></defs> <circle cx="50" cy="50" r="45" fill="url(#grad1)" opacity="0.1"></circle><circle cx="50" cy="50" r="35" fill="none" stroke="url(#grad1)" stroke-width="2" opacity="0.3"></circle><path d="M35 50 L45 60 L65 40" stroke="url(#grad1)" stroke-width="4" fill="none" stroke-linecap="round" stroke-linejoin="round"></path><circle cx="65" cy="35" r="8" fill="#fee140"></circle><path d="M62 35 L68 35 M65 32 L65 38" stroke="white" stroke-width="2" stroke-linecap="round"></path> </svg>
|
| 343 |
+
<div>
|
| 344 |
+
<h2>یک قدم تا ساخت تصاویر جدید</h2>
|
| 345 |
+
<p>نیازمند تغییر نقطه دستیابی</p>
|
| 346 |
+
</div>
|
| 347 |
+
</div>
|
| 348 |
+
<div class="guide-content">
|
| 349 |
+
<div class="info-card">
|
| 350 |
+
<div class="info-card-header"><svg class="info-card-icon" viewbox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" fill="#667eea" opacity="0.2"></path><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" stroke="#667eea" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg> <span class="info-card-title">راه حل سریع</span></div>
|
| 351 |
+
<p>طبق ویدیو آموزشی پایین بین نقطه دستیابی جابجا شوید تلاش مجدد بزنید تا تصاویر مجدداً تولید بشه.</p>
|
| 352 |
+
</div>
|
| 353 |
+
<div class="summary-section">
|
| 354 |
+
<div class="summary-header"><svg class="summary-icon" viewbox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10" fill="#56ab2f" opacity="0.2"></circle><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z" stroke="#56ab2f" stroke-width="2"></path><path d="M9 12l2 2 4-4" stroke="#56ab2f" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg> <span class="summary-title">خلاصه راهنما</span></div>
|
| 355 |
+
<div class="summary-text">هربار که این صفحه را مشاهده کردید: از اینترنت سیمکارت استفاده کنید، VPN را خاموش کرده و طبق ویدیو آموزشی پایین نقطه دستیابی رو تغییر دهید. «تلاش مجدد» کلیک کنید. با این روش ساده میتوانید به صورت نامحدود تصویر بسازید! ☘️</div>
|
| 356 |
+
</div>
|
| 357 |
+
<div class="video-button-container"><button id="tutorialLinkBtn" class="elegant-video-button"> <svg class="elegant-video-button-icon" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M8 5v14l11-7z"></path></svg> <span>دیدن ویدیو آموزشی استفاده نامحدود</span> </button></div>
|
| 358 |
+
</div>
|
| 359 |
+
<div class="guide-actions">
|
| 360 |
+
<button class="action-button back-button"> <svg class="action-button-icon" viewbox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19 12H5M12 19l-7-7 7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg> <span>بازگشت</span> </button>
|
| 361 |
+
<button class="action-button retry-button"> <svg class="action-button-icon" viewbox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M23 4v6h-6M1 20v-6h6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg> <span>تلاش مجدد</span> </button>
|
| 362 |
+
</div>
|
| 363 |
+
</div>`;
|
| 364 |
+
|
| 365 |
+
uploadArea.addEventListener('click', () => fileInput.click());
|
| 366 |
+
fileInput.addEventListener('change', (e) => handleFileSelect(e.target.files[0]));
|
| 367 |
+
['dragenter','dragover','dragleave','drop'].forEach(e => uploadArea.addEventListener(e, p => { p.preventDefault(); p.stopPropagation(); }));
|
| 368 |
+
uploadArea.addEventListener('drop', e => handleFileSelect(e.dataTransfer.files[0]));
|
| 369 |
+
|
| 370 |
+
directionHeader.addEventListener('click', () => {
|
| 371 |
+
directionHeader.classList.toggle('active');
|
| 372 |
+
});
|
| 373 |
+
|
| 374 |
+
function handleFileSelect(file) {
|
| 375 |
+
if (file && file.type.startsWith('image/')) {
|
| 376 |
+
uploadedFile = file;
|
| 377 |
+
const reader = new FileReader();
|
| 378 |
+
reader.onload = function(event) {
|
| 379 |
+
imagePreview.src = event.target.result;
|
| 380 |
+
uploadArea.style.display = 'none';
|
| 381 |
+
imagePreviewContainer.style.display = 'block';
|
| 382 |
+
}
|
| 383 |
+
reader.readAsDataURL(file);
|
| 384 |
+
}
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
async function uploadFileToDocker(file, suffix) {
|
| 388 |
+
const formData = new FormData();
|
| 389 |
+
const ext = file.name.split('.').pop().toLowerCase();
|
| 390 |
+
formData.append('run_id', `${currentRunId}_${suffix}`);
|
| 391 |
+
formData.append('ext', ext);
|
| 392 |
+
formData.append('file', file);
|
| 393 |
+
|
| 394 |
+
const response = await fetch('/api/webhook/upload', { method: 'POST', body: formData });
|
| 395 |
+
if (!response.ok) throw new Error("خطا در آپلود فایل.");
|
| 396 |
+
return ext;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
function safeBase64Encode(str) {
|
| 400 |
+
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
|
| 401 |
+
return String.fromCharCode('0x' + p1);
|
| 402 |
+
}));
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
removeImageBtn.addEventListener('click', (e) => {
|
| 406 |
+
e.preventDefault();
|
| 407 |
+
fileInput.value = '';
|
| 408 |
+
uploadedFile = null;
|
| 409 |
+
imagePreview.src = '#';
|
| 410 |
+
uploadArea.style.display = 'block';
|
| 411 |
+
imagePreviewContainer.style.display = 'none';
|
| 412 |
+
});
|
| 413 |
+
|
| 414 |
+
aspectButtons.forEach(button => {
|
| 415 |
+
button.addEventListener('click', () => {
|
| 416 |
+
aspectButtons.forEach(btn => btn.classList.remove('active'));
|
| 417 |
+
button.classList.add('active');
|
| 418 |
+
const ratio = button.dataset.ratio;
|
| 419 |
+
if (ratio === 'custom') {
|
| 420 |
+
customDimensionsContainer.classList.add('visible');
|
| 421 |
+
} else {
|
| 422 |
+
customDimensionsContainer.classList.remove('visible');
|
| 423 |
+
switch (ratio) {
|
| 424 |
+
case '16:9': widthInput.value = 1280; heightInput.value = 720; break;
|
| 425 |
+
case '9:16': widthInput.value = 720; heightInput.value = 1280; break;
|
| 426 |
+
case '1:1': widthInput.value = 1024; heightInput.value = 1024; break;
|
| 427 |
+
}
|
| 428 |
+
}
|
| 429 |
+
});
|
| 430 |
+
});
|
| 431 |
+
|
| 432 |
+
const showUIState = (state, message = '') => {
|
| 433 |
+
submitBtn.disabled = (state === 'loading');
|
| 434 |
+
btnSpinner.style.display = (state === 'loading') ? 'inline-block' : 'none';
|
| 435 |
+
btnText.textContent = (state === 'loading') ? 'در حال پردازش...' : '✨ شروع گسترش تصویر';
|
| 436 |
+
|
| 437 |
+
outputSection.innerHTML = '';
|
| 438 |
+
outputSection.style.padding = '';
|
| 439 |
+
outputSection.style.border = '';
|
| 440 |
+
outputSection.style.background = '';
|
| 441 |
+
|
| 442 |
+
const baseElements = [statusMessage, loadingAnimationWrapper, resultContainer];
|
| 443 |
+
baseElements.forEach(el => outputSection.appendChild(el));
|
| 444 |
+
|
| 445 |
+
statusMessage.style.display = 'none';
|
| 446 |
+
statusMessage.classList.remove('error');
|
| 447 |
+
loadingAnimationWrapper.style.display = 'none';
|
| 448 |
+
resultContainer.innerHTML = '';
|
| 449 |
+
outputSection.classList.remove('has-content');
|
| 450 |
+
|
| 451 |
+
if (state === 'initial') {
|
| 452 |
+
statusMessage.textContent = 'نتیجه در اینجا نمایش داده خواهد شد.';
|
| 453 |
+
statusMessage.style.display = 'block';
|
| 454 |
+
} else if (state === 'loading') {
|
| 455 |
+
loadingText.textContent = message || 'در حال پردازش هوشمند...';
|
| 456 |
+
loadingAnimationWrapper.style.display = 'flex';
|
| 457 |
+
} else if (state === 'result') {
|
| 458 |
+
outputSection.classList.add('has-content');
|
| 459 |
+
} else if (state === 'error') {
|
| 460 |
+
statusMessage.innerHTML = `<b>خطا:</b> ${message}`;
|
| 461 |
+
statusMessage.classList.add('error');
|
| 462 |
+
statusMessage.style.display = 'block';
|
| 463 |
+
}
|
| 464 |
+
};
|
| 465 |
+
|
| 466 |
+
const handleErrorState = (error) => {
|
| 467 |
+
setUIState('error');
|
| 468 |
+
statusMessage.style.display = 'block';
|
| 469 |
+
statusMessage.classList.add('error');
|
| 470 |
+
|
| 471 |
+
const errorMessage = String(error.message || error).toLowerCase();
|
| 472 |
+
|
| 473 |
+
if (errorMessage.includes("gpu") || errorMessage.includes("quota") || errorMessage.includes("exceeded") || errorMessage.includes("limit") || errorMessage.includes("capacity")) {
|
| 474 |
+
outputSection.style.padding = '0';
|
| 475 |
+
outputSection.style.border = 'none';
|
| 476 |
+
outputSection.style.background = 'transparent';
|
| 477 |
+
statusMessage.innerHTML = GPU_QUOTA_ERROR_HTML;
|
| 478 |
+
|
| 479 |
+
statusMessage.querySelector('.back-button').addEventListener('click', () => showUIState('initial'));
|
| 480 |
+
statusMessage.querySelector('.retry-button').addEventListener('click', () => submitBtn.click());
|
| 481 |
+
statusMessage.querySelector('#tutorialLinkBtn').addEventListener('click', () => {
|
| 482 |
+
const tutorialUrl = '#/nav/online/news/getSingle/1149635/eyJpdiI6IjhHVGhPQWJwb3E0cjRXbnFWTW5BaUE9PSIsInZhbHVlIjoiS1V0dTdvT21wbXAwSXZaK1RCTG1pVXZqdlFJa1hXV1RKa2FLem9zU3pXMjd5MmlVOGc2YWY0NVdNR3h3Smp1aSIsIm1hYyI6IjY1NTA5ZDYzMjAzMTJhMGQyMWQ4NjA4ZDgyNGZjZDVlY2MyNjdiMjA2NWYzOWRjY2M4ZmVjYWRlMWNlMWQ3ODEiLCJ0YWciOiIifQ==/21135210';
|
| 483 |
+
parent.postMessage({ type: 'NAVIGATE_TO_URL', url: tutorialUrl }, '*');
|
| 484 |
+
});
|
| 485 |
+
} else {
|
| 486 |
+
statusMessage.innerHTML = `<div style="padding: 1rem;"><b>خطای ارتباط!</b><br>مشکلی در برقراری ارتباط با سرور پیش آمده است. لطفاً دوباره تلاش کنید.</div>`;
|
| 487 |
+
}
|
| 488 |
+
};
|
| 489 |
+
|
| 490 |
+
function setUIState(state) {
|
| 491 |
+
submitBtn.disabled = state === 'loading';
|
| 492 |
+
if (state === 'loading') {
|
| 493 |
+
btnText.style.display = 'none';
|
| 494 |
+
btnSpinner.style.display = 'inline-block';
|
| 495 |
+
outputSection.classList.remove('has-content');
|
| 496 |
+
statusMessage.style.display = 'none';
|
| 497 |
+
resultContainer.innerHTML = '';
|
| 498 |
+
loadingAnimationWrapper.style.display = 'flex';
|
| 499 |
+
} else {
|
| 500 |
+
btnText.style.display = 'inline-block';
|
| 501 |
+
btnSpinner.style.display = 'none';
|
| 502 |
+
btnText.textContent = "✨ شروع گسترش تصویر";
|
| 503 |
+
if (state !== 'idle') {
|
| 504 |
+
loadingAnimationWrapper.style.display = 'none';
|
| 505 |
+
outputSection.classList.add('has-content');
|
| 506 |
+
}
|
| 507 |
+
}
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
function startPolling(runId) {
|
| 511 |
+
if (pollInterval) clearInterval(pollInterval);
|
| 512 |
+
emptyActionCounter = 0;
|
| 513 |
+
|
| 514 |
+
pollInterval = setInterval(async () => {
|
| 515 |
+
try {
|
| 516 |
+
// بررسی مستقیم خروجی تصویر
|
| 517 |
+
try {
|
| 518 |
+
const imgCheck = await fetch(`/static/images/${runId}.png`, { method: 'HEAD' });
|
| 519 |
+
if (imgCheck.ok) {
|
| 520 |
+
clearInterval(pollInterval);
|
| 521 |
+
setUIState('success');
|
| 522 |
+
|
| 523 |
+
const img = document.createElement('img');
|
| 524 |
+
img.src = `/static/images/${runId}.png`;
|
| 525 |
+
img.className = 'result-image';
|
| 526 |
+
img.addEventListener('click', () => {
|
| 527 |
+
fullscreenImage.src = img.src;
|
| 528 |
+
fullscreenModal.style.display = 'flex';
|
| 529 |
+
});
|
| 530 |
+
resultContainer.appendChild(img);
|
| 531 |
+
|
| 532 |
+
const downloadBtn = document.createElement('button');
|
| 533 |
+
downloadBtn.className = 'download-btn';
|
| 534 |
+
downloadBtn.innerHTML = `
|
| 535 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
| 536 |
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
| 537 |
+
<polyline points="7 10 12 15 17 10"></polyline>
|
| 538 |
+
<line x1="12" y1="15" x2="12" y2="3"></line>
|
| 539 |
+
</svg>
|
| 540 |
+
<span>دانلود تصویر</span>
|
| 541 |
+
`;
|
| 542 |
+
downloadBtn.onclick = () => {
|
| 543 |
+
window.parent.postMessage({
|
| 544 |
+
type: 'DOWNLOAD_REQUEST',
|
| 545 |
+
url: window.location.origin + `/static/images/${runId}.png`
|
| 546 |
+
}, '*');
|
| 547 |
+
};
|
| 548 |
+
resultContainer.appendChild(downloadBtn);
|
| 549 |
+
return;
|
| 550 |
+
}
|
| 551 |
+
} catch(e) {}
|
| 552 |
+
|
| 553 |
+
const activeRes = await fetch('/api/actions/active');
|
| 554 |
+
const activeData = await activeRes.json();
|
| 555 |
+
const hasActiveActions = activeData.status === 'success' && activeData.actions.length > 0;
|
| 556 |
+
|
| 557 |
+
const statusRes = await fetch(`/api/status/${runId}`);
|
| 558 |
+
const statusData = await statusRes.json();
|
| 559 |
+
|
| 560 |
+
if (statusData.status === 'ready') {
|
| 561 |
+
const urlLower = statusData.url.toLowerCase();
|
| 562 |
+
if (urlLower.endsWith('.png') || urlLower.endsWith('.jpg') || urlLower.endsWith('.jpeg')) {
|
| 563 |
+
|
| 564 |
+
if (hasActiveActions) {
|
| 565 |
+
emptyActionCounter = 0;
|
| 566 |
+
loadingText.textContent = "تلاش رانر قبلی به مشکل خورد. در صف تلاش با رانر موازی جدید...";
|
| 567 |
+
return;
|
| 568 |
+
} else {
|
| 569 |
+
emptyActionCounter++;
|
| 570 |
+
if (emptyActionCounter < 4) {
|
| 571 |
+
loadingText.textContent = "در حال بازنشانی و تخصیص رانر (لطفا صبور باشید)...";
|
| 572 |
+
return;
|
| 573 |
+
}
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
clearInterval(pollInterval);
|
| 577 |
+
handleErrorState(new Error("GPU quota exceeded"));
|
| 578 |
+
}
|
| 579 |
+
} else {
|
| 580 |
+
if (hasActiveActions) {
|
| 581 |
+
emptyActionCounter = 0;
|
| 582 |
+
loadingText.textContent = "هوش مصنوعی در حال بازسازی و گسترش بخشهای فراتر از کادر تصویر شما...";
|
| 583 |
+
} else {
|
| 584 |
+
loadingText.textContent = "در انتظار تخصیص رانر آزاد...";
|
| 585 |
+
}
|
| 586 |
+
}
|
| 587 |
+
} catch (e) {
|
| 588 |
+
console.error("Error polling:", e);
|
| 589 |
+
}
|
| 590 |
+
}, 4000);
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
submitBtn.addEventListener('click', async () => {
|
| 594 |
+
if (!uploadedFile) {
|
| 595 |
+
alert("لطفاً ابتدا یک تصویر آپلود کنید.");
|
| 596 |
+
return;
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
setUIState('loading');
|
| 600 |
+
currentRunId = 'outpaint' + Math.random().toString(36).substring(2, 14);
|
| 601 |
+
|
| 602 |
+
try {
|
| 603 |
+
loadingText.textContent = "در حال آپلود و فشردهسازی تصویر مرجع...";
|
| 604 |
+
const imgExt = await uploadFileToDocker(uploadedFile, 'outpaint_img');
|
| 605 |
+
|
| 606 |
+
loadingText.textContent = "در حال رزرو موقعیت در صف ...";
|
| 607 |
+
|
| 608 |
+
const promptVal = document.getElementById('prompt').value.trim();
|
| 609 |
+
const b64Prompt = safeBase64Encode(promptVal);
|
| 610 |
+
|
| 611 |
+
const width = parseInt(widthInput.value);
|
| 612 |
+
const height = parseInt(heightInput.value);
|
| 613 |
+
const steps = parseInt(document.getElementById('outpaint-steps').value);
|
| 614 |
+
const scale = parseInt(document.getElementById('guidance-scale').value);
|
| 615 |
+
const left = document.getElementById('expand-left').checked;
|
| 616 |
+
const right = document.getElementById('expand-right').checked;
|
| 617 |
+
const top = document.getElementById('expand-top').checked;
|
| 618 |
+
const bottom = document.getElementById('expand-bottom').checked;
|
| 619 |
+
|
| 620 |
+
const outpaintPayload = `OUTPAINTCONFIG_userRunId_${currentRunId}_imgExt_${imgExt}_width_${width}_height_${height}_steps_${steps}_scale_${scale}_left_${left}_right_${right}_top_${top}_bottom_${bottom}_prompt_${b64Prompt}`;
|
| 621 |
+
|
| 622 |
+
const response = await fetch('/api/generate', {
|
| 623 |
+
method: 'POST',
|
| 624 |
+
headers: { 'Content-Type': 'application/json' },
|
| 625 |
+
body: JSON.stringify({
|
| 626 |
+
prompt: outpaintPayload,
|
| 627 |
+
width: 1024,
|
| 628 |
+
height: 1024,
|
| 629 |
+
action_name: 'gostaresh-tasvir'
|
| 630 |
+
})
|
| 631 |
+
});
|
| 632 |
+
|
| 633 |
+
const data = await response.json();
|
| 634 |
+
|
| 635 |
+
if (data.status === 'success') {
|
| 636 |
+
startPolling(data.run_id);
|
| 637 |
+
} else {
|
| 638 |
+
throw new Error(data.message || 'خطا در صفبندی درخواست.');
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
} catch (error) {
|
| 642 |
+
console.error("An error occurred:", error);
|
| 643 |
+
handleErrorState(error);
|
| 644 |
+
}
|
| 645 |
+
});
|
| 646 |
+
|
| 647 |
+
const closeModal = () => { fullscreenModal.style.display = 'none'; };
|
| 648 |
+
closeFullscreenBtn.addEventListener('click', closeModal);
|
| 649 |
+
fullscreenModal.addEventListener('click', (e) => { if (e.target === fullscreenModal) { closeModal(); } });
|
| 650 |
+
|
| 651 |
+
showUIState('initial');
|
| 652 |
+
</script>
|
| 653 |
+
</body>
|
| 654 |
+
</html>
|