@sl-material/sl-import 1.1.0-beta4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sl-import.es.js CHANGED
@@ -1513,8 +1513,6 @@ function getImportDialogStyles() {
1513
1513
  align-items: center;
1514
1514
  justify-content: center;
1515
1515
  position: relative;
1516
- opacity: 0;
1517
- transition: opacity 0.3s ease;
1518
1516
  }
1519
1517
 
1520
1518
  .loading-spinner::before {
@@ -1526,10 +1524,6 @@ function getImportDialogStyles() {
1526
1524
  position: absolute;
1527
1525
  }
1528
1526
 
1529
- .loading-spinner.active {
1530
- opacity: 1;
1531
- }
1532
-
1533
1527
  @keyframes spin {
1534
1528
  0% { transform: rotate(0deg); }
1535
1529
  100% { transform: rotate(360deg); }
@@ -1583,15 +1577,22 @@ function getImportDialogStyles() {
1583
1577
  .import-dialog-vanilla-loading-spinner {
1584
1578
  width: 32px;
1585
1579
  height: 32px;
1586
- border: 3px solid var(--sl-border-color);
1587
- border-top: 3px solid var(--sl-color-primary);
1588
1580
  border-radius: 50%;
1589
- animation: import-dialog-vanilla-spin 1s linear infinite;
1581
+ background: conic-gradient(from 0deg at 50% 50%, rgba(24, 144, 255, 0.1) 0%, #1890ff 75%, rgba(24, 144, 255, 0) 100%);
1582
+ animation: spin 1s linear infinite;
1583
+ display: flex;
1584
+ align-items: center;
1585
+ justify-content: center;
1586
+ position: relative;
1590
1587
  }
1591
1588
 
1592
- @keyframes import-dialog-vanilla-spin {
1593
- 0% { transform: rotate(0deg); }
1594
- 100% { transform: rotate(360deg); }
1589
+ .import-dialog-vanilla-loading-spinner::before {
1590
+ content: '';
1591
+ width: 24px;
1592
+ height: 24px;
1593
+ border-radius: 50%;
1594
+ background-color: var(--sl-overlay-color-lighter);
1595
+ position: absolute;
1595
1596
  }
1596
1597
 
1597
1598
  `;
@@ -2920,7 +2921,7 @@ class ImportDialogRenderer {
2920
2921
  const isAllUploading = this.context.uploadFileList.some(
2921
2922
  (f) => f.status === "uploading"
2922
2923
  );
2923
- const reachedLimit = this.context.multiple && this.context.uploadFileList.length >= this.context.maxFiles;
2924
+ const reachedLimit = this.context.multiple && this.context.maxFiles != null && this.context.uploadFileList.length >= this.context.maxFiles;
2924
2925
  return `
2925
2926
  <div class="import-dialog-vanilla-section">
2926
2927
  <div class="import-dialog-vanilla-section-title">${this.uploadSectionIndex}.${config.uploadTitle}</div>
@@ -2973,7 +2974,7 @@ class ImportDialogRenderer {
2973
2974
  return `
2974
2975
  <div class="import-dialog-vanilla-file-item ${statusClass} ${widthClass}" data-file-id="${fileItem.id}">
2975
2976
  <div class="import-dialog-vanilla-file-loading-icon">
2976
- <div class="loading-spinner active"></div>
2977
+ <div class="loading-spinner"></div>
2977
2978
  </div>
2978
2979
  <div class="import-dialog-vanilla-file-remove-btn" data-file-index="${index}" title="删除">
2979
2980
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -3387,16 +3388,6 @@ class ImportDialogUploader {
3387
3388
  };
3388
3389
  return size * units[unit];
3389
3390
  }
3390
- /**
3391
- * 格式化文件大小显示
3392
- * @param bytes 字节数
3393
- * @param unit 目标单位
3394
- * @returns 格式化后的大小字符串
3395
- */
3396
- formatFileSize(bytes, unit = "MB") {
3397
- const size = bytes / this.convertToBytes(1, unit);
3398
- return `${size.toFixed(2)}${unit}`;
3399
- }
3400
3391
  /**
3401
3392
  * 检查文件格式是否符合要求
3402
3393
  * @param file 文件
@@ -3432,7 +3423,7 @@ class ImportDialogUploader {
3432
3423
  (_b = (_a = this.callbacks).onMessage) == null ? void 0 : _b.call(_a, t("pleaseSelectFile"), "warning");
3433
3424
  return false;
3434
3425
  }
3435
- if (this.config.multiple) {
3426
+ if (this.config.multiple && this.config.maxFiles != null) {
3436
3427
  const totalFiles = this.uploadFileList.length + fileArray.length;
3437
3428
  if (totalFiles > this.config.maxFiles) {
3438
3429
  (_d = (_c = this.callbacks).onMessage) == null ? void 0 : _d.call(
@@ -3454,23 +3445,25 @@ class ImportDialogUploader {
3454
3445
  return false;
3455
3446
  }
3456
3447
  }
3457
- const maxFileSizeUnit = this.config.maxFileSizeUnit || "MB";
3458
- const maxFileSizeBytes = this.convertToBytes(
3459
- this.config.maxFileSize,
3460
- maxFileSizeUnit
3461
- );
3462
- for (const file of fileArray) {
3463
- if (file.size > maxFileSizeBytes) {
3464
- (_h = (_g = this.callbacks).onMessage) == null ? void 0 : _h.call(
3465
- _g,
3466
- t("fileSizeExceeded", {
3467
- name: file.name,
3468
- size: this.config.maxFileSize,
3469
- unit: maxFileSizeUnit
3470
- }),
3471
- "warning"
3472
- );
3473
- return false;
3448
+ if (this.config.maxFileSize != null) {
3449
+ const maxFileSizeUnit = this.config.maxFileSizeUnit || "MB";
3450
+ const maxFileSizeBytes = this.convertToBytes(
3451
+ this.config.maxFileSize,
3452
+ maxFileSizeUnit
3453
+ );
3454
+ for (const file of fileArray) {
3455
+ if (file.size > maxFileSizeBytes) {
3456
+ (_h = (_g = this.callbacks).onMessage) == null ? void 0 : _h.call(
3457
+ _g,
3458
+ t("fileSizeExceeded", {
3459
+ name: file.name,
3460
+ size: this.config.maxFileSize,
3461
+ unit: maxFileSizeUnit
3462
+ }),
3463
+ "warning"
3464
+ );
3465
+ return false;
3466
+ }
3474
3467
  }
3475
3468
  }
3476
3469
  for (const file of fileArray) {
@@ -3899,8 +3892,6 @@ const _ImportDialog = class _ImportDialog2 {
3899
3892
  this.uploader = new ImportDialogUploader(
3900
3893
  {
3901
3894
  multiple: false,
3902
- maxFiles: 10,
3903
- maxFileSize: 100,
3904
3895
  maxFileSizeUnit: "MB"
3905
3896
  },
3906
3897
  {
@@ -3964,7 +3955,7 @@ const _ImportDialog = class _ImportDialog2 {
3964
3955
  formData: this.formData,
3965
3956
  uploadFileList: this.uploader.uploadFileList,
3966
3957
  multiple: ((_a = this.modalOptions.uploadConfig) == null ? void 0 : _a.multiple) != null ? this.modalOptions.uploadConfig.multiple : false,
3967
- maxFiles: ((_b = this.modalOptions.uploadConfig) == null ? void 0 : _b.maxFiles) != null ? this.modalOptions.uploadConfig.maxFiles : 10,
3958
+ maxFiles: (_b = this.modalOptions.uploadConfig) == null ? void 0 : _b.maxFiles,
3968
3959
  confirmLoading: this.confirmLoading,
3969
3960
  isUploading: this.uploader.isUploading,
3970
3961
  uploadProgress: this.uploader.uploadProgress,
@@ -4394,8 +4385,8 @@ const _ImportDialog = class _ImportDialog2 {
4394
4385
  const uploadConfig = options == null ? void 0 : options.uploadConfig;
4395
4386
  this.uploader.updateConfig({
4396
4387
  multiple: (uploadConfig == null ? void 0 : uploadConfig.multiple) != null ? uploadConfig.multiple : false,
4397
- maxFiles: (uploadConfig == null ? void 0 : uploadConfig.maxFiles) != null ? uploadConfig.maxFiles : 10,
4398
- maxFileSize: (uploadConfig == null ? void 0 : uploadConfig.maxFileSize) != null ? uploadConfig.maxFileSize : 100,
4388
+ maxFiles: uploadConfig == null ? void 0 : uploadConfig.maxFiles,
4389
+ maxFileSize: uploadConfig == null ? void 0 : uploadConfig.maxFileSize,
4399
4390
  maxFileSizeUnit: (uploadConfig == null ? void 0 : uploadConfig.maxFileSizeUnit) != null ? uploadConfig.maxFileSizeUnit : "MB",
4400
4391
  acceptTypes: this.currentConfig.acceptTypes,
4401
4392
  uploadConfig
@@ -1333,8 +1333,6 @@
1333
1333
  align-items: center;
1334
1334
  justify-content: center;
1335
1335
  position: relative;
1336
- opacity: 0;
1337
- transition: opacity 0.3s ease;
1338
1336
  }
1339
1337
 
1340
1338
  .loading-spinner::before {
@@ -1346,10 +1344,6 @@
1346
1344
  position: absolute;
1347
1345
  }
1348
1346
 
1349
- .loading-spinner.active {
1350
- opacity: 1;
1351
- }
1352
-
1353
1347
  @keyframes spin {
1354
1348
  0% { transform: rotate(0deg); }
1355
1349
  100% { transform: rotate(360deg); }
@@ -1403,15 +1397,22 @@
1403
1397
  .import-dialog-vanilla-loading-spinner {
1404
1398
  width: 32px;
1405
1399
  height: 32px;
1406
- border: 3px solid var(--sl-border-color);
1407
- border-top: 3px solid var(--sl-color-primary);
1408
1400
  border-radius: 50%;
1409
- animation: import-dialog-vanilla-spin 1s linear infinite;
1401
+ background: conic-gradient(from 0deg at 50% 50%, rgba(24, 144, 255, 0.1) 0%, #1890ff 75%, rgba(24, 144, 255, 0) 100%);
1402
+ animation: spin 1s linear infinite;
1403
+ display: flex;
1404
+ align-items: center;
1405
+ justify-content: center;
1406
+ position: relative;
1410
1407
  }
1411
1408
 
1412
- @keyframes import-dialog-vanilla-spin {
1413
- 0% { transform: rotate(0deg); }
1414
- 100% { transform: rotate(360deg); }
1409
+ .import-dialog-vanilla-loading-spinner::before {
1410
+ content: '';
1411
+ width: 24px;
1412
+ height: 24px;
1413
+ border-radius: 50%;
1414
+ background-color: var(--sl-overlay-color-lighter);
1415
+ position: absolute;
1415
1416
  }
1416
1417
 
1417
1418
  `}var Pe=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],fe={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(o){return typeof console<"u"&&console.warn(o)},getWeek:function(o){var t=new Date(o.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var e=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-e.getTime())/864e5-3+(e.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},ve={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(o){var t=o%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},$=function(o,t){return t===void 0&&(t=2),("000"+o).slice(t*-1)},ne=function(o){return o===!0?1:0};function $e(o,t){var e;return function(){var a=this,r=arguments;clearTimeout(e),e=setTimeout(function(){return o.apply(a,r)},t)}}var Ue=function(o){return o instanceof Array?o:[o]};function X(o,t,e){if(e===!0)return o.classList.add(t);o.classList.remove(t)}function U(o,t,e){var a=window.document.createElement(o);return t=t||"",e=e||"",a.className=t,e!==void 0&&(a.textContent=e),a}function Ce(o){for(;o.firstChild;)o.removeChild(o.firstChild)}function et(o,t){if(t(o))return o;if(o.parentNode)return et(o.parentNode,t)}function ke(o,t){var e=U("div","numInputWrapper"),a=U("input","numInput "+o),r=U("span","arrowUp"),c=U("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?a.type="number":(a.type="text",a.pattern="\\d*"),t!==void 0)for(var h in t)a.setAttribute(h,t[h]);return e.appendChild(a),e.appendChild(r),e.appendChild(c),e}function ee(o){try{if(typeof o.composedPath=="function"){var t=o.composedPath();return t[0]}return o.target}catch{return o.target}}var Re=function(){},De=function(o,t,e){return e.months[t?"shorthand":"longhand"][o]},kt={D:Re,F:function(o,t,e){o.setMonth(e.months.longhand.indexOf(t))},G:function(o,t){o.setHours((o.getHours()>=12?12:0)+parseFloat(t))},H:function(o,t){o.setHours(parseFloat(t))},J:function(o,t){o.setDate(parseFloat(t))},K:function(o,t,e){o.setHours(o.getHours()%12+12*ne(new RegExp(e.amPM[1],"i").test(t)))},M:function(o,t,e){o.setMonth(e.months.shorthand.indexOf(t))},S:function(o,t){o.setSeconds(parseFloat(t))},U:function(o,t){return new Date(parseFloat(t)*1e3)},W:function(o,t,e){var a=parseInt(t),r=new Date(o.getFullYear(),0,2+(a-1)*7,0,0,0,0);return r.setDate(r.getDate()-r.getDay()+e.firstDayOfWeek),r},Y:function(o,t){o.setFullYear(parseFloat(t))},Z:function(o,t){return new Date(t)},d:function(o,t){o.setDate(parseFloat(t))},h:function(o,t){o.setHours((o.getHours()>=12?12:0)+parseFloat(t))},i:function(o,t){o.setMinutes(parseFloat(t))},j:function(o,t){o.setDate(parseFloat(t))},l:Re,m:function(o,t){o.setMonth(parseFloat(t)-1)},n:function(o,t){o.setMonth(parseFloat(t)-1)},s:function(o,t){o.setSeconds(parseFloat(t))},u:function(o,t){return new Date(parseFloat(t))},w:Re,y:function(o,t){o.setFullYear(2e3+parseFloat(t))}},pe={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},be={Z:function(o){return o.toISOString()},D:function(o,t,e){return t.weekdays.shorthand[be.w(o,t,e)]},F:function(o,t,e){return De(be.n(o,t,e)-1,!1,t)},G:function(o,t,e){return $(be.h(o,t,e))},H:function(o){return $(o.getHours())},J:function(o,t){return t.ordinal!==void 0?o.getDate()+t.ordinal(o.getDate()):o.getDate()},K:function(o,t){return t.amPM[ne(o.getHours()>11)]},M:function(o,t){return De(o.getMonth(),!0,t)},S:function(o){return $(o.getSeconds())},U:function(o){return o.getTime()/1e3},W:function(o,t,e){return e.getWeek(o)},Y:function(o){return $(o.getFullYear(),4)},d:function(o){return $(o.getDate())},h:function(o){return o.getHours()%12?o.getHours()%12:12},i:function(o){return $(o.getMinutes())},j:function(o){return o.getDate()},l:function(o,t){return t.weekdays.longhand[o.getDay()]},m:function(o){return $(o.getMonth()+1)},n:function(o){return o.getMonth()+1},s:function(o){return o.getSeconds()},u:function(o){return o.getTime()},w:function(o){return o.getDay()},y:function(o){return String(o.getFullYear()).substring(2)}},tt=function(o){var t=o.config,e=t===void 0?fe:t,a=o.l10n,r=a===void 0?ve:a,c=o.isMobile,h=c===void 0?!1:c;return function(m,b,M){var y=M||r;return e.formatDate!==void 0&&!h?e.formatDate(m,b,y):b.split("").map(function(D,C,I){return be[D]&&I[C-1]!=="\\"?be[D](m,y,e):D!=="\\"?D:""}).join("")}},ze=function(o){var t=o.config,e=t===void 0?fe:t,a=o.l10n,r=a===void 0?ve:a;return function(c,h,m,b){if(!(c!==0&&!c)){var M=b||r,y,D=c;if(c instanceof Date)y=new Date(c.getTime());else if(typeof c!="string"&&c.toFixed!==void 0)y=new Date(c);else if(typeof c=="string"){var C=h||(e||fe).dateFormat,I=String(c).trim();if(I==="today")y=new Date,m=!0;else if(e&&e.parseDate)y=e.parseDate(c,C);else if(/Z$/.test(I)||/GMT$/.test(I))y=new Date(c);else{for(var s=void 0,p=[],g=0,u=0,l="";g<C.length;g++){var R=C[g],T=R==="\\",F=C[g-1]==="\\"||T;if(pe[R]&&!F){l+=pe[R];var P=new RegExp(l).exec(c);P&&(s=!0)&&p[R!=="Y"?"push":"unshift"]({fn:kt[R],val:P[++u]})}else T||(l+=".")}y=!e||!e.noCalendar?new Date(new Date().getFullYear(),0,1,0,0,0,0):new Date(new Date().setHours(0,0,0,0)),p.forEach(function(Y){var _=Y.fn,K=Y.val;return y=_(y,K,M)||y}),y=s?y:void 0}}if(!(y instanceof Date&&!isNaN(y.getTime()))){e.errorHandler(new Error("Invalid date provided: "+D));return}return m===!0&&y.setHours(0,0,0,0),y}}};function te(o,t,e){return e===void 0&&(e=!0),e!==!1?new Date(o.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):o.getTime()-t.getTime()}var Dt=function(o,t,e){return o>Math.min(t,e)&&o<Math.max(t,e)},Ne=function(o,t,e){return o*3600+t*60+e},Tt=function(o){var t=Math.floor(o/3600),e=(o-t*3600)/60;return[t,e,o-t*3600-e*60]},Mt={DAY:864e5};function je(o){var t=o.defaultHour,e=o.defaultMinute,a=o.defaultSeconds;if(o.minDate!==void 0){var r=o.minDate.getHours(),c=o.minDate.getMinutes(),h=o.minDate.getSeconds();t<r&&(t=r),t===r&&e<c&&(e=c),t===r&&e===c&&a<h&&(a=o.minDate.getSeconds())}if(o.maxDate!==void 0){var m=o.maxDate.getHours(),b=o.maxDate.getMinutes();t=Math.min(t,m),t===m&&(e=Math.min(b,e)),t===m&&e===b&&(a=o.maxDate.getSeconds())}return{hours:t,minutes:e,seconds:a}}typeof Object.assign!="function"&&(Object.assign=function(o){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];if(!o)throw TypeError("Cannot convert undefined or null to object");for(var a=function(m){m&&Object.keys(m).forEach(function(b){return o[b]=m[b]})},r=0,c=t;r<c.length;r++){var h=c[r];a(h)}return o});var V=function(){return V=Object.assign||function(o){for(var t,e=1,a=arguments.length;e<a;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r])}return o},V.apply(this,arguments)},at=function(){for(var o=0,t=0,e=arguments.length;t<e;t++)o+=arguments[t].length;for(var a=Array(o),r=0,t=0;t<e;t++)for(var c=arguments[t],h=0,m=c.length;h<m;h++,r++)a[r]=c[h];return a},St=300;function Et(o,t){var e={config:V(V({},fe),B.defaultConfig),l10n:ve};e.parseDate=ze({config:e.config,l10n:e.l10n}),e._handlers=[],e.pluginElements=[],e.loadedPlugins=[],e._bind=p,e._setHoursFromDate=C,e._positionCalendar=Ie,e.changeMonth=Ke,e.changeYear=Se,e.clear=_t,e.close=Zt,e.onMouseOver=Fe,e._createElement=U,e.createDay=P,e.destroy=Xt,e.isEnabled=ue,e.jumpToDate=l,e.updateValue=oe,e.open=ea,e.redraw=ft,e.set=ia,e.setDate=oa,e.toggle=da;function a(){e.utils={getDaysInMonth:function(n,i){return n===void 0&&(n=e.currentMonth),i===void 0&&(i=e.currentYear),n===1&&(i%4===0&&i%100!==0||i%400===0)?29:e.l10n.daysInMonth[n]}}}function r(){e.element=e.input=o,e.isOpen=!1,ta(),ut(),la(),ra(),a(),e.isMobile||F(),u(),(e.selectedDates.length||e.config.noCalendar)&&(e.config.enableTime&&C(e.config.noCalendar?e.latestSelectedDateObj:void 0),oe(!1)),m();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!e.isMobile&&n&&Ie(),j("onReady")}function c(){var n;return((n=e.calendarContainer)===null||n===void 0?void 0:n.getRootNode()).activeElement||document.activeElement}function h(n){return n.bind(e)}function m(){var n=e.config;n.weekNumbers===!1&&n.showMonths===1||n.noCalendar!==!0&&window.requestAnimationFrame(function(){if(e.calendarContainer!==void 0&&(e.calendarContainer.style.visibility="hidden",e.calendarContainer.style.display="block"),e.daysContainer!==void 0){var i=(e.days.offsetWidth+1)*n.showMonths;e.daysContainer.style.width=i+"px",e.calendarContainer.style.width=i+(e.weekWrapper!==void 0?e.weekWrapper.offsetWidth:0)+"px",e.calendarContainer.style.removeProperty("visibility"),e.calendarContainer.style.removeProperty("display")}})}function b(n){if(e.selectedDates.length===0){var i=e.config.minDate===void 0||te(new Date,e.config.minDate)>=0?new Date:new Date(e.config.minDate.getTime()),d=je(e.config);i.setHours(d.hours,d.minutes,d.seconds,i.getMilliseconds()),e.selectedDates=[i],e.latestSelectedDateObj=i}n!==void 0&&n.type!=="blur"&&ua(n);var f=e._input.value;D(),oe(),e._input.value!==f&&e._debouncedChange()}function M(n,i){return n%12+12*ne(i===e.l10n.amPM[1])}function y(n){switch(n%24){case 0:case 12:return 12;default:return n%12}}function D(){if(!(e.hourElement===void 0||e.minuteElement===void 0)){var n=(parseInt(e.hourElement.value.slice(-2),10)||0)%24,i=(parseInt(e.minuteElement.value,10)||0)%60,d=e.secondElement!==void 0?(parseInt(e.secondElement.value,10)||0)%60:0;e.amPM!==void 0&&(n=M(n,e.amPM.textContent));var f=e.config.minTime!==void 0||e.config.minDate&&e.minDateHasTime&&e.latestSelectedDateObj&&te(e.latestSelectedDateObj,e.config.minDate,!0)===0,v=e.config.maxTime!==void 0||e.config.maxDate&&e.maxDateHasTime&&e.latestSelectedDateObj&&te(e.latestSelectedDateObj,e.config.maxDate,!0)===0;if(e.config.maxTime!==void 0&&e.config.minTime!==void 0&&e.config.minTime>e.config.maxTime){var x=Ne(e.config.minTime.getHours(),e.config.minTime.getMinutes(),e.config.minTime.getSeconds()),A=Ne(e.config.maxTime.getHours(),e.config.maxTime.getMinutes(),e.config.maxTime.getSeconds()),k=Ne(n,i,d);if(k>A&&k<x){var O=Tt(x);n=O[0],i=O[1],d=O[2]}}else{if(v){var w=e.config.maxTime!==void 0?e.config.maxTime:e.config.maxDate;n=Math.min(n,w.getHours()),n===w.getHours()&&(i=Math.min(i,w.getMinutes())),i===w.getMinutes()&&(d=Math.min(d,w.getSeconds()))}if(f){var E=e.config.minTime!==void 0?e.config.minTime:e.config.minDate;n=Math.max(n,E.getHours()),n===E.getHours()&&i<E.getMinutes()&&(i=E.getMinutes()),i===E.getMinutes()&&(d=Math.max(d,E.getSeconds()))}}I(n,i,d)}}function C(n){var i=n||e.latestSelectedDateObj;i&&i instanceof Date&&I(i.getHours(),i.getMinutes(),i.getSeconds())}function I(n,i,d){e.latestSelectedDateObj!==void 0&&e.latestSelectedDateObj.setHours(n%24,i,d||0,0),!(!e.hourElement||!e.minuteElement||e.isMobile)&&(e.hourElement.value=$(e.config.time_24hr?n:(12+n)%12+12*ne(n%12===0)),e.minuteElement.value=$(i),e.amPM!==void 0&&(e.amPM.textContent=e.l10n.amPM[ne(n>=12)]),e.secondElement!==void 0&&(e.secondElement.value=$(d)))}function s(n){var i=ee(n),d=parseInt(i.value)+(n.delta||0);(d/1e3>1||n.key==="Enter"&&!/[^\d]/.test(d.toString()))&&Se(d)}function p(n,i,d,f){if(i instanceof Array)return i.forEach(function(v){return p(n,v,d,f)});if(n instanceof Array)return n.forEach(function(v){return p(v,i,d,f)});n.addEventListener(i,d,f),e._handlers.push({remove:function(){return n.removeEventListener(i,d,f)}})}function g(){j("onChange")}function u(){if(e.config.wrap&&["open","close","toggle","clear"].forEach(function(d){Array.prototype.forEach.call(e.element.querySelectorAll("[data-"+d+"]"),function(f){return p(f,"click",e[d])})}),e.isMobile){sa();return}var n=$e($t,50);if(e._debouncedChange=$e(g,St),e.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&p(e.daysContainer,"mouseover",function(d){e.config.mode==="range"&&Fe(ee(d))}),p(e._input,"keydown",dt),e.calendarContainer!==void 0&&p(e.calendarContainer,"keydown",dt),!e.config.inline&&!e.config.static&&p(window,"resize",n),window.ontouchstart!==void 0?p(window.document,"touchstart",We):p(window.document,"mousedown",We),p(window.document,"focus",We,{capture:!0}),e.config.clickOpens===!0&&(p(e._input,"focus",e.open),p(e._input,"click",e.open)),e.daysContainer!==void 0&&(p(e.monthNav,"click",pa),p(e.monthNav,["keyup","increment"],s),p(e.daysContainer,"click",mt)),e.timeContainer!==void 0&&e.minuteElement!==void 0&&e.hourElement!==void 0){var i=function(d){return ee(d).select()};p(e.timeContainer,["increment"],b),p(e.timeContainer,"blur",b,{capture:!0}),p(e.timeContainer,"click",R),p([e.hourElement,e.minuteElement],["focus","click"],i),e.secondElement!==void 0&&p(e.secondElement,"focus",function(){return e.secondElement&&e.secondElement.select()}),e.amPM!==void 0&&p(e.amPM,"click",function(d){b(d)})}e.config.allowInput&&p(e._input,"blur",Qt)}function l(n,i){var d=n!==void 0?e.parseDate(n):e.latestSelectedDateObj||(e.config.minDate&&e.config.minDate>e.now?e.config.minDate:e.config.maxDate&&e.config.maxDate<e.now?e.config.maxDate:e.now),f=e.currentYear,v=e.currentMonth;try{d!==void 0&&(e.currentYear=d.getFullYear(),e.currentMonth=d.getMonth())}catch(x){x.message="Invalid date supplied: "+d,e.config.errorHandler(x)}i&&e.currentYear!==f&&(j("onYearChange"),Z()),i&&(e.currentYear!==f||e.currentMonth!==v)&&j("onMonthChange"),e.redraw()}function R(n){var i=ee(n);~i.className.indexOf("arrow")&&T(n,i.classList.contains("arrowUp")?1:-1)}function T(n,i,d){var f=n&&ee(n),v=d||f&&f.parentNode&&f.parentNode.firstChild,x=Ge("increment");x.delta=i,v&&v.dispatchEvent(x)}function F(){var n=window.document.createDocumentFragment();if(e.calendarContainer=U("div","flatpickr-calendar"),e.calendarContainer.tabIndex=-1,!e.config.noCalendar){if(n.appendChild(ge()),e.innerContainer=U("div","flatpickr-innerContainer"),e.config.weekNumbers){var i=Vt(),d=i.weekWrapper,f=i.weekNumbers;e.innerContainer.appendChild(d),e.weekNumbers=f,e.weekWrapper=d}e.rContainer=U("div","flatpickr-rContainer"),e.rContainer.appendChild(J()),e.daysContainer||(e.daysContainer=U("div","flatpickr-days"),e.daysContainer.tabIndex=-1),Q(),e.rContainer.appendChild(e.daysContainer),e.innerContainer.appendChild(e.rContainer),n.appendChild(e.innerContainer)}e.config.enableTime&&n.appendChild(W()),X(e.calendarContainer,"rangeMode",e.config.mode==="range"),X(e.calendarContainer,"animate",e.config.animate===!0),X(e.calendarContainer,"multiMonth",e.config.showMonths>1),e.calendarContainer.appendChild(n);var v=e.config.appendTo!==void 0&&e.config.appendTo.nodeType!==void 0;if((e.config.inline||e.config.static)&&(e.calendarContainer.classList.add(e.config.inline?"inline":"static"),e.config.inline&&(!v&&e.element.parentNode?e.element.parentNode.insertBefore(e.calendarContainer,e._input.nextSibling):e.config.appendTo!==void 0&&e.config.appendTo.appendChild(e.calendarContainer)),e.config.static)){var x=U("div","flatpickr-wrapper");e.element.parentNode&&e.element.parentNode.insertBefore(x,e.element),x.appendChild(e.element),e.altInput&&x.appendChild(e.altInput),x.appendChild(e.calendarContainer)}!e.config.static&&!e.config.inline&&(e.config.appendTo!==void 0?e.config.appendTo:window.document.body).appendChild(e.calendarContainer)}function P(n,i,d,f){var v=ue(i,!0),x=U("span",n,i.getDate().toString());return x.dateObj=i,x.$i=f,x.setAttribute("aria-label",e.formatDate(i,e.config.ariaDateFormat)),n.indexOf("hidden")===-1&&te(i,e.now)===0&&(e.todayDateElem=x,x.classList.add("today"),x.setAttribute("aria-current","date")),v?(x.tabIndex=-1,Ve(i)&&(x.classList.add("selected"),e.selectedDateElem=x,e.config.mode==="range"&&(X(x,"startRange",e.selectedDates[0]&&te(i,e.selectedDates[0],!0)===0),X(x,"endRange",e.selectedDates[1]&&te(i,e.selectedDates[1],!0)===0),n==="nextMonthDay"&&x.classList.add("inRange")))):x.classList.add("flatpickr-disabled"),e.config.mode==="range"&&ca(i)&&!Ve(i)&&x.classList.add("inRange"),e.weekNumbers&&e.config.showMonths===1&&n!=="prevMonthDay"&&f%7===6&&e.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+e.config.getWeek(i)+"</span>"),j("onDayCreate",x),x}function Y(n){n.focus(),e.config.mode==="range"&&Fe(n)}function _(n){for(var i=n>0?0:e.config.showMonths-1,d=n>0?e.config.showMonths:-1,f=i;f!=d;f+=n)for(var v=e.daysContainer.children[f],x=n>0?0:v.children.length-1,A=n>0?v.children.length:-1,k=x;k!=A;k+=n){var O=v.children[k];if(O.className.indexOf("hidden")===-1&&ue(O.dateObj))return O}}function K(n,i){for(var d=n.className.indexOf("Month")===-1?n.dateObj.getMonth():e.currentMonth,f=i>0?e.config.showMonths:-1,v=i>0?1:-1,x=d-e.currentMonth;x!=f;x+=v)for(var A=e.daysContainer.children[x],k=d-e.currentMonth===x?n.$i+i:i<0?A.children.length-1:0,O=A.children.length,w=k;w>=0&&w<O&&w!=(i>0?O:-1);w+=v){var E=A.children[w];if(E.className.indexOf("hidden")===-1&&ue(E.dateObj)&&Math.abs(n.$i-w)>=Math.abs(i))return Y(E)}e.changeMonth(v),N(_(v),0)}function N(n,i){var d=c(),f=Ee(d||document.body),v=n!==void 0?n:f?d:e.selectedDateElem!==void 0&&Ee(e.selectedDateElem)?e.selectedDateElem:e.todayDateElem!==void 0&&Ee(e.todayDateElem)?e.todayDateElem:_(i>0?1:-1);v===void 0?e._input.focus():f?K(v,i):Y(v)}function se(n,i){for(var d=(new Date(n,i,1).getDay()-e.l10n.firstDayOfWeek+7)%7,f=e.utils.getDaysInMonth((i-1+12)%12,n),v=e.utils.getDaysInMonth(i,n),x=window.document.createDocumentFragment(),A=e.config.showMonths>1,k=A?"prevMonthDay hidden":"prevMonthDay",O=A?"nextMonthDay hidden":"nextMonthDay",w=f+1-d,E=0;w<=f;w++,E++)x.appendChild(P("flatpickr-day "+k,new Date(n,i-1,w),w,E));for(w=1;w<=v;w++,E++)x.appendChild(P("flatpickr-day",new Date(n,i,w),w,E));for(var z=v+1;z<=42-d&&(e.config.showMonths===1||E%7!==0);z++,E++)x.appendChild(P("flatpickr-day "+O,new Date(n,i+1,z%v),z,E));var ie=U("div","dayContainer");return ie.appendChild(x),ie}function Q(){if(e.daysContainer!==void 0){Ce(e.daysContainer),e.weekNumbers&&Ce(e.weekNumbers);for(var n=document.createDocumentFragment(),i=0;i<e.config.showMonths;i++){var d=new Date(e.currentYear,e.currentMonth,1);d.setMonth(e.currentMonth+i),n.appendChild(se(d.getFullYear(),d.getMonth()))}e.daysContainer.appendChild(n),e.days=e.daysContainer.firstChild,e.config.mode==="range"&&e.selectedDates.length===1&&Fe()}}function Z(){if(!(e.config.showMonths>1||e.config.monthSelectorType!=="dropdown")){var n=function(f){return e.config.minDate!==void 0&&e.currentYear===e.config.minDate.getFullYear()&&f<e.config.minDate.getMonth()?!1:!(e.config.maxDate!==void 0&&e.currentYear===e.config.maxDate.getFullYear()&&f>e.config.maxDate.getMonth())};e.monthsDropdownContainer.tabIndex=-1,e.monthsDropdownContainer.innerHTML="";for(var i=0;i<12;i++)if(n(i)){var d=U("option","flatpickr-monthDropdown-month");d.value=new Date(e.currentYear,i).getMonth().toString(),d.textContent=De(i,e.config.shorthandCurrentMonth,e.l10n),d.tabIndex=-1,e.currentMonth===i&&(d.selected=!0),e.monthsDropdownContainer.appendChild(d)}}}function de(){var n=U("div","flatpickr-month"),i=window.document.createDocumentFragment(),d;e.config.showMonths>1||e.config.monthSelectorType==="static"?d=U("span","cur-month"):(e.monthsDropdownContainer=U("select","flatpickr-monthDropdown-months"),e.monthsDropdownContainer.setAttribute("aria-label",e.l10n.monthAriaLabel),p(e.monthsDropdownContainer,"change",function(A){var k=ee(A),O=parseInt(k.value,10);e.changeMonth(O-e.currentMonth),j("onMonthChange")}),Z(),d=e.monthsDropdownContainer);var f=ke("cur-year",{tabindex:"-1"}),v=f.getElementsByTagName("input")[0];v.setAttribute("aria-label",e.l10n.yearAriaLabel),e.config.minDate&&v.setAttribute("min",e.config.minDate.getFullYear().toString()),e.config.maxDate&&(v.setAttribute("max",e.config.maxDate.getFullYear().toString()),v.disabled=!!e.config.minDate&&e.config.minDate.getFullYear()===e.config.maxDate.getFullYear());var x=U("div","flatpickr-current-month");return x.appendChild(d),x.appendChild(f),i.appendChild(x),n.appendChild(i),{container:n,yearElement:v,monthElement:d}}function Me(){Ce(e.monthNav),e.monthNav.appendChild(e.prevMonthNav),e.config.showMonths&&(e.yearElements=[],e.monthElements=[]);for(var n=e.config.showMonths;n--;){var i=de();e.yearElements.push(i.yearElement),e.monthElements.push(i.monthElement),e.monthNav.appendChild(i.container)}e.monthNav.appendChild(e.nextMonthNav)}function ge(){return e.monthNav=U("div","flatpickr-months"),e.yearElements=[],e.monthElements=[],e.prevMonthNav=U("span","flatpickr-prev-month"),e.prevMonthNav.innerHTML=e.config.prevArrow,e.nextMonthNav=U("span","flatpickr-next-month"),e.nextMonthNav.innerHTML=e.config.nextArrow,Me(),Object.defineProperty(e,"_hidePrevMonthArrow",{get:function(){return e.__hidePrevMonthArrow},set:function(n){e.__hidePrevMonthArrow!==n&&(X(e.prevMonthNav,"flatpickr-disabled",n),e.__hidePrevMonthArrow=n)}}),Object.defineProperty(e,"_hideNextMonthArrow",{get:function(){return e.__hideNextMonthArrow},set:function(n){e.__hideNextMonthArrow!==n&&(X(e.nextMonthNav,"flatpickr-disabled",n),e.__hideNextMonthArrow=n)}}),e.currentYearElement=e.yearElements[0],Le(),e.monthNav}function W(){e.calendarContainer.classList.add("hasTime"),e.config.noCalendar&&e.calendarContainer.classList.add("noCalendar");var n=je(e.config);e.timeContainer=U("div","flatpickr-time"),e.timeContainer.tabIndex=-1;var i=U("span","flatpickr-time-separator",":"),d=ke("flatpickr-hour",{"aria-label":e.l10n.hourAriaLabel});e.hourElement=d.getElementsByTagName("input")[0];var f=ke("flatpickr-minute",{"aria-label":e.l10n.minuteAriaLabel});if(e.minuteElement=f.getElementsByTagName("input")[0],e.hourElement.tabIndex=e.minuteElement.tabIndex=-1,e.hourElement.value=$(e.latestSelectedDateObj?e.latestSelectedDateObj.getHours():e.config.time_24hr?n.hours:y(n.hours)),e.minuteElement.value=$(e.latestSelectedDateObj?e.latestSelectedDateObj.getMinutes():n.minutes),e.hourElement.setAttribute("step",e.config.hourIncrement.toString()),e.minuteElement.setAttribute("step",e.config.minuteIncrement.toString()),e.hourElement.setAttribute("min",e.config.time_24hr?"0":"1"),e.hourElement.setAttribute("max",e.config.time_24hr?"23":"12"),e.hourElement.setAttribute("maxlength","2"),e.minuteElement.setAttribute("min","0"),e.minuteElement.setAttribute("max","59"),e.minuteElement.setAttribute("maxlength","2"),e.timeContainer.appendChild(d),e.timeContainer.appendChild(i),e.timeContainer.appendChild(f),e.config.time_24hr&&e.timeContainer.classList.add("time24hr"),e.config.enableSeconds){e.timeContainer.classList.add("hasSeconds");var v=ke("flatpickr-second");e.secondElement=v.getElementsByTagName("input")[0],e.secondElement.value=$(e.latestSelectedDateObj?e.latestSelectedDateObj.getSeconds():n.seconds),e.secondElement.setAttribute("step",e.minuteElement.getAttribute("step")),e.secondElement.setAttribute("min","0"),e.secondElement.setAttribute("max","59"),e.secondElement.setAttribute("maxlength","2"),e.timeContainer.appendChild(U("span","flatpickr-time-separator",":")),e.timeContainer.appendChild(v)}return e.config.time_24hr||(e.amPM=U("span","flatpickr-am-pm",e.l10n.amPM[ne((e.latestSelectedDateObj?e.hourElement.value:e.config.defaultHour)>11)]),e.amPM.title=e.l10n.toggleTitle,e.amPM.tabIndex=-1,e.timeContainer.appendChild(e.amPM)),e.timeContainer}function J(){e.weekdayContainer?Ce(e.weekdayContainer):e.weekdayContainer=U("div","flatpickr-weekdays");for(var n=e.config.showMonths;n--;){var i=U("div","flatpickr-weekdaycontainer");e.weekdayContainer.appendChild(i)}return xe(),e.weekdayContainer}function xe(){if(e.weekdayContainer){var n=e.l10n.firstDayOfWeek,i=at(e.l10n.weekdays.shorthand);n>0&&n<i.length&&(i=at(i.splice(n,i.length),i.splice(0,n)));for(var d=e.config.showMonths;d--;)e.weekdayContainer.children[d].innerHTML=`
@@ -1524,7 +1525,7 @@
1524
1525
  <span class="import-dialog-vanilla-setting-label required">${L("selectDate")}</span>
1525
1526
  <div class="import-dialog-vanilla-date-range-container" data-field="dateRange"></div>
1526
1527
  </div>
1527
- `}renderUploadSection(){const t=this.context.currentConfig,e=this.context.uploadFileList.length>0,a=this.context.uploadFileList.some(c=>c.status==="uploading"),r=this.context.multiple&&this.context.uploadFileList.length>=this.context.maxFiles;return`
1528
+ `}renderUploadSection(){const t=this.context.currentConfig,e=this.context.uploadFileList.length>0,a=this.context.uploadFileList.some(c=>c.status==="uploading"),r=this.context.multiple&&this.context.maxFiles!=null&&this.context.uploadFileList.length>=this.context.maxFiles;return`
1528
1529
  <div class="import-dialog-vanilla-section">
1529
1530
  <div class="import-dialog-vanilla-section-title">${this.uploadSectionIndex}.${t.uploadTitle}</div>
1530
1531
  <div class="import-dialog-vanilla-upload-wrapper">
@@ -1552,7 +1553,7 @@
1552
1553
  `}renderFileItem(t,e){var D;const a=`status-${t.status}`,r=this.formatFileSize(t.size),c=t.status==="uploading",h=t.status==="error",m=((D=t.name.split(".").pop())==null?void 0:D.toUpperCase())||"FILE",b=this.context.multiple?"":"width-100",M=h?"#FF1212":"#FFD741";let y="";return h?y=`<span class="import-dialog-vanilla-file-error-text">${L("uploadFailed")}</span>`:c?y=`<span>${L("uploading")}...</span><span>·</span><span>${r}</span>`:y=`<span>${m}</span><span>·</span><span>${r}</span>`,c?`
1553
1554
  <div class="import-dialog-vanilla-file-item ${a} ${b}" data-file-id="${t.id}">
1554
1555
  <div class="import-dialog-vanilla-file-loading-icon">
1555
- <div class="loading-spinner active"></div>
1556
+ <div class="loading-spinner"></div>
1556
1557
  </div>
1557
1558
  <div class="import-dialog-vanilla-file-remove-btn" data-file-index="${e}" title="删除">
1558
1559
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -1623,7 +1624,7 @@
1623
1624
  <div class="import-dialog-vanilla-loading-spinner"></div>
1624
1625
  </div>
1625
1626
  `:""}
1626
- `}}var ot={exports:{}};(function(o){(function(){var t=function(e){if(!(this instanceof t))return new t(e);if(this.version=1,this.support=typeof File<"u"&&typeof Blob<"u"&&typeof FileList<"u"&&(!!Blob.prototype.webkitSlice||!!Blob.prototype.mozSlice||!!Blob.prototype.slice||!1),!this.support)return!1;var a=this;a.files=[],a.defaults={chunkSize:1048576,forceChunkSize:!1,simultaneousUploads:3,fileParameterName:"file",chunkNumberParameterName:"resumableChunkNumber",chunkSizeParameterName:"resumableChunkSize",currentChunkSizeParameterName:"resumableCurrentChunkSize",totalSizeParameterName:"resumableTotalSize",typeParameterName:"resumableType",identifierParameterName:"resumableIdentifier",fileNameParameterName:"resumableFilename",relativePathParameterName:"resumableRelativePath",totalChunksParameterName:"resumableTotalChunks",throttleProgressCallbacks:.5,query:{},headers:{},preprocess:null,method:"multipart",uploadMethod:"POST",testMethod:"GET",prioritizeFirstAndLastChunk:!1,target:"/",testTarget:null,parameterNamespace:"",testChunks:!0,generateUniqueIdentifier:null,getTarget:null,maxChunkRetries:100,chunkRetryInterval:void 0,permanentErrors:[400,404,415,500,501],maxFiles:void 0,withCredentials:!1,xhrTimeout:0,clearInput:!0,chunkFormat:"blob",setChunkTypeFromFile:!1,maxFilesErrorCallback:function(s,p){var g=a.getOpt("maxFiles");alert("Please upload no more than "+g+" file"+(g===1?"":"s")+" at a time.")},minFileSize:1,minFileSizeErrorCallback:function(s,p){alert(s.fileName||s.name+" is too small, please upload files larger than "+r.formatSize(a.getOpt("minFileSize"))+".")},maxFileSize:void 0,maxFileSizeErrorCallback:function(s,p){alert(s.fileName||s.name+" is too large, please upload files less than "+r.formatSize(a.getOpt("maxFileSize"))+".")},fileType:[],fileTypeErrorCallback:function(s,p){alert(s.fileName||s.name+" has type not allowed, please upload files of type "+a.getOpt("fileType")+".")}},a.opts=e||{},a.getOpt=function(s){var p=this;if(s instanceof Array){var g={};return r.each(s,function(u){g[u]=p.getOpt(u)}),g}if(p instanceof I){if(typeof p.opts[s]<"u")return p.opts[s];p=p.fileObj}if(p instanceof C){if(typeof p.opts[s]<"u")return p.opts[s];p=p.resumableObj}if(p instanceof t)return typeof p.opts[s]<"u"?p.opts[s]:p.defaults[s]},a.events=[],a.on=function(s,p){a.events.push(s.toLowerCase(),p)},a.fire=function(){for(var s=[],p=0;p<arguments.length;p++)s.push(arguments[p]);for(var g=s[0].toLowerCase(),p=0;p<=a.events.length;p+=2)a.events[p]==g&&a.events[p+1].apply(a,s.slice(1)),a.events[p]=="catchall"&&a.events[p+1].apply(null,s);g=="fileerror"&&a.fire("error",s[2],s[1]),g=="fileprogress"&&a.fire("progress")};var r={stopEvent:function(s){s.stopPropagation(),s.preventDefault()},each:function(s,p){if(typeof s.length<"u"){for(var g=0;g<s.length;g++)if(p(s[g])===!1)return}else for(g in s)if(p(g,s[g])===!1)return},generateUniqueIdentifier:function(s,p){var g=a.getOpt("generateUniqueIdentifier");if(typeof g=="function")return g(s,p);var u=s.webkitRelativePath||s.fileName||s.name,l=s.size;return l+"-"+u.replace(/[^0-9a-zA-Z_-]/img,"")},contains:function(s,p){var g=!1;return r.each(s,function(u){return u==p?(g=!0,!1):!0}),g},formatSize:function(s){return s<1024?s+" bytes":s<1024*1024?(s/1024).toFixed(0)+" KB":s<1024*1024*1024?(s/1024/1024).toFixed(1)+" MB":(s/1024/1024/1024).toFixed(1)+" GB"},getTarget:function(s,p){var g=a.getOpt("target");if(s==="test"&&a.getOpt("testTarget")&&(g=a.getOpt("testTarget")==="/"?a.getOpt("target"):a.getOpt("testTarget")),typeof g=="function")return g(p);var u=g.indexOf("?")<0?"?":"&",l=p.join("&");return g+u+l}},c=function(s){r.stopEvent(s),s.dataTransfer&&s.dataTransfer.items?y(s.dataTransfer.items,s):s.dataTransfer&&s.dataTransfer.files&&y(s.dataTransfer.files,s)},h=function(s){s.preventDefault()};function m(s,p,g,u){var l;if(s.isFile)return s.file(function(R){R.relativePath=p+R.name,g.push(R),u()});if(s.isDirectory?l=s:s instanceof File&&g.push(s),typeof s.webkitGetAsEntry=="function"&&(l=s.webkitGetAsEntry()),l&&l.isDirectory)return M(l,p+l.name+"/",g,u);typeof s.getAsFile=="function"&&(s=s.getAsFile(),s instanceof File&&(s.relativePath=p+s.name,g.push(s))),u()}function b(s,p){if(!s||s.length===0)return p();s[0](function(){b(s.slice(1),p)})}function M(s,p,g,u){var l=s.createReader();l.readEntries(function(R){if(!R.length)return u();b(R.map(function(T){return m.bind(null,T,p,g)}),u)})}function y(s,p){if(s.length){a.fire("beforeAdd");var g=[];b(Array.prototype.map.call(s,function(u){return m.bind(null,u,"",g)}),function(){g.length&&D(g,p)})}}var D=function(s,p){var g=0,u=a.getOpt(["maxFiles","minFileSize","maxFileSize","maxFilesErrorCallback","minFileSizeErrorCallback","maxFileSizeErrorCallback","fileType","fileTypeErrorCallback"]);if(typeof u.maxFiles<"u"&&u.maxFiles<s.length+a.files.length)if(u.maxFiles===1&&a.files.length===1&&s.length===1)a.removeFile(a.files[0]);else return u.maxFilesErrorCallback(s,g++),!1;var l=[],R=[],T=s.length,F=function(){if(!--T){if(!l.length&&!R.length)return;window.setTimeout(function(){a.fire("filesAdded",l,R)},0)}};r.each(s,function(P){var Y=P.name;if(u.fileType.length>0){var _=!1;for(var K in u.fileType){var N="."+u.fileType[K];if(Y.toLowerCase().indexOf(N.toLowerCase(),Y.length-N.length)!==-1){_=!0;break}}if(!_)return u.fileTypeErrorCallback(P,g++),!1}if(typeof u.minFileSize<"u"&&P.size<u.minFileSize)return u.minFileSizeErrorCallback(P,g++),!1;if(typeof u.maxFileSize<"u"&&P.size>u.maxFileSize)return u.maxFileSizeErrorCallback(P,g++),!1;function se(Z){a.getFromUniqueIdentifier(Z)?R.push(P):function(){P.uniqueIdentifier=Z;var de=new C(a,P,Z);a.files.push(de),l.push(de),de.container=typeof p<"u"?p.srcElement:null,window.setTimeout(function(){a.fire("fileAdded",de,p)},0)}(),F()}var Q=r.generateUniqueIdentifier(P,p);Q&&typeof Q.then=="function"?Q.then(function(Z){se(Z)},function(){F()}):se(Q)})};function C(s,p,g){var u=this;u.opts={},u.getOpt=s.getOpt,u._prevProgress=0,u.resumableObj=s,u.file=p,u.fileName=p.fileName||p.name,u.size=p.size,u.relativePath=p.relativePath||p.webkitRelativePath||u.fileName,u.uniqueIdentifier=g,u._pause=!1,u.container="";var l=g!==void 0,R=function(T,F){switch(T){case"progress":u.resumableObj.fire("fileProgress",u,F);break;case"error":u.abort(),l=!0,u.chunks=[],u.resumableObj.fire("fileError",u,F);break;case"success":if(l)return;u.resumableObj.fire("fileProgress",u),u.isComplete()&&u.resumableObj.fire("fileSuccess",u,F);break;case"retry":u.resumableObj.fire("fileRetry",u);break}};return u.chunks=[],u.abort=function(){var T=0;r.each(u.chunks,function(F){F.status()=="uploading"&&(F.abort(),T++)}),T>0&&u.resumableObj.fire("fileProgress",u)},u.cancel=function(){var T=u.chunks;u.chunks=[],r.each(T,function(F){F.status()=="uploading"&&(F.abort(),u.resumableObj.uploadNextChunk())}),u.resumableObj.removeFile(u),u.resumableObj.fire("fileProgress",u)},u.retry=function(){u.bootstrap();var T=!1;u.resumableObj.on("chunkingComplete",function(){T||u.resumableObj.upload(),T=!0})},u.bootstrap=function(){u.abort(),l=!1,u.chunks=[],u._prevProgress=0;for(var T=u.getOpt("forceChunkSize")?Math.ceil:Math.floor,F=Math.max(T(u.file.size/u.getOpt("chunkSize")),1),P=0;P<F;P++)(function(Y){window.setTimeout(function(){u.chunks.push(new I(u.resumableObj,u,Y,R)),u.resumableObj.fire("chunkingProgress",u,Y/F)},0)})(P);window.setTimeout(function(){u.resumableObj.fire("chunkingComplete",u)},0)},u.progress=function(){if(l)return 1;var T=0,F=!1;return r.each(u.chunks,function(P){P.status()=="error"&&(F=!0),T+=P.progress(!0)}),T=F||T>.99999?1:T,T=Math.max(u._prevProgress,T),u._prevProgress=T,T},u.isUploading=function(){var T=!1;return r.each(u.chunks,function(F){if(F.status()=="uploading")return T=!0,!1}),T},u.isComplete=function(){var T=!1;return r.each(u.chunks,function(F){var P=F.status();if(P=="pending"||P=="uploading"||F.preprocessState===1)return T=!0,!1}),!T},u.pause=function(T){typeof T>"u"?u._pause=!u._pause:u._pause=T},u.isPaused=function(){return u._pause},u.resumableObj.fire("chunkingStart",u),u.bootstrap(),this}function I(s,p,g,u){var l=this;l.opts={},l.getOpt=s.getOpt,l.resumableObj=s,l.fileObj=p,l.fileObjSize=p.size,l.fileObjType=p.file.type,l.offset=g,l.callback=u,l.lastProgressCallback=new Date,l.tested=!1,l.retries=0,l.pendingRetry=!1,l.preprocessState=0;var R=l.getOpt("chunkSize");return l.loaded=0,l.startByte=l.offset*R,l.endByte=Math.min(l.fileObjSize,(l.offset+1)*R),l.fileObjSize-l.endByte<R&&!l.getOpt("forceChunkSize")&&(l.endByte=l.fileObjSize),l.xhr=null,l.test=function(){l.xhr=new XMLHttpRequest;var T=function(K){l.tested=!0;var N=l.status();N=="success"?(l.callback(N,l.message()),l.resumableObj.uploadNextChunk()):l.send()};l.xhr.addEventListener("load",T,!1),l.xhr.addEventListener("error",T,!1),l.xhr.addEventListener("timeout",T,!1);var F=[],P=l.getOpt("parameterNamespace"),Y=l.getOpt("query");typeof Y=="function"&&(Y=Y(l.fileObj,l)),r.each(Y,function(K,N){F.push([encodeURIComponent(P+K),encodeURIComponent(N)].join("="))}),F=F.concat([["chunkNumberParameterName",l.offset+1],["chunkSizeParameterName",l.getOpt("chunkSize")],["currentChunkSizeParameterName",l.endByte-l.startByte],["totalSizeParameterName",l.fileObjSize],["typeParameterName",l.fileObjType],["identifierParameterName",l.fileObj.uniqueIdentifier],["fileNameParameterName",l.fileObj.fileName],["relativePathParameterName",l.fileObj.relativePath],["totalChunksParameterName",l.fileObj.chunks.length]].filter(function(K){return l.getOpt(K[0])}).map(function(K){return[P+l.getOpt(K[0]),encodeURIComponent(K[1])].join("=")})),l.xhr.open(l.getOpt("testMethod"),r.getTarget("test",F)),l.xhr.timeout=l.getOpt("xhrTimeout"),l.xhr.withCredentials=l.getOpt("withCredentials");var _=l.getOpt("headers");typeof _=="function"&&(_=_(l.fileObj,l)),r.each(_,function(K,N){l.xhr.setRequestHeader(K,N)}),l.xhr.send(null)},l.preprocessFinished=function(){l.preprocessState=2,l.send()},l.send=function(){var T=l.getOpt("preprocess");if(typeof T=="function")switch(l.preprocessState){case 0:l.preprocessState=1,T(l);return;case 1:return}if(l.getOpt("testChunks")&&!l.tested){l.test();return}l.xhr=new XMLHttpRequest,l.xhr.upload.addEventListener("progress",function(W){new Date-l.lastProgressCallback>l.getOpt("throttleProgressCallbacks")*1e3&&(l.callback("progress"),l.lastProgressCallback=new Date),l.loaded=W.loaded||0},!1),l.loaded=0,l.pendingRetry=!1,l.callback("progress");var F=function(W){var J=l.status();if(J=="success"||J=="error")l.callback(J,l.message()),l.resumableObj.uploadNextChunk();else{l.callback("retry",l.message()),l.abort(),l.retries++;var xe=l.getOpt("chunkRetryInterval");xe!==void 0?(l.pendingRetry=!0,setTimeout(l.send,xe)):l.send()}};l.xhr.addEventListener("load",F,!1),l.xhr.addEventListener("error",F,!1),l.xhr.addEventListener("timeout",F,!1);var P=[["chunkNumberParameterName",l.offset+1],["chunkSizeParameterName",l.getOpt("chunkSize")],["currentChunkSizeParameterName",l.endByte-l.startByte],["totalSizeParameterName",l.fileObjSize],["typeParameterName",l.fileObjType],["identifierParameterName",l.fileObj.uniqueIdentifier],["fileNameParameterName",l.fileObj.fileName],["relativePathParameterName",l.fileObj.relativePath],["totalChunksParameterName",l.fileObj.chunks.length]].filter(function(W){return l.getOpt(W[0])}).reduce(function(W,J){return W[l.getOpt(J[0])]=J[1],W},{}),Y=l.getOpt("query");typeof Y=="function"&&(Y=Y(l.fileObj,l)),r.each(Y,function(W,J){P[W]=J});var _=l.fileObj.file.slice?"slice":l.fileObj.file.mozSlice?"mozSlice":l.fileObj.file.webkitSlice?"webkitSlice":"slice",K=l.fileObj.file[_](l.startByte,l.endByte,l.getOpt("setChunkTypeFromFile")?l.fileObj.file.type:""),N=null,se=[],Q=l.getOpt("parameterNamespace");if(l.getOpt("method")==="octet")N=K,r.each(P,function(W,J){se.push([encodeURIComponent(Q+W),encodeURIComponent(J)].join("="))});else if(N=new FormData,r.each(P,function(W,J){N.append(Q+W,J),se.push([encodeURIComponent(Q+W),encodeURIComponent(J)].join("="))}),l.getOpt("chunkFormat")=="blob")N.append(Q+l.getOpt("fileParameterName"),K,l.fileObj.fileName);else if(l.getOpt("chunkFormat")=="base64"){var Z=new FileReader;Z.onload=function(W){N.append(Q+l.getOpt("fileParameterName"),Z.result),l.xhr.send(N)},Z.readAsDataURL(K)}var de=r.getTarget("upload",se),Me=l.getOpt("uploadMethod");l.xhr.open(Me,de),l.getOpt("method")==="octet"&&l.xhr.setRequestHeader("Content-Type","application/octet-stream"),l.xhr.timeout=l.getOpt("xhrTimeout"),l.xhr.withCredentials=l.getOpt("withCredentials");var ge=l.getOpt("headers");typeof ge=="function"&&(ge=ge(l.fileObj,l)),r.each(ge,function(W,J){l.xhr.setRequestHeader(W,J)}),l.getOpt("chunkFormat")=="blob"&&l.xhr.send(N)},l.abort=function(){l.xhr&&l.xhr.abort(),l.xhr=null},l.status=function(){return l.pendingRetry?"uploading":l.xhr?l.xhr.readyState<4?"uploading":l.xhr.status==200||l.xhr.status==201?"success":r.contains(l.getOpt("permanentErrors"),l.xhr.status)||l.retries>=l.getOpt("maxChunkRetries")?"error":(l.abort(),"pending"):"pending"},l.message=function(){return l.xhr?l.xhr.responseText:""},l.progress=function(T){typeof T>"u"&&(T=!1);var F=T?(l.endByte-l.startByte)/l.fileObjSize:1;if(l.pendingRetry)return 0;(!l.xhr||!l.xhr.status)&&(F*=.95);var P=l.status();switch(P){case"success":case"error":return 1*F;case"pending":return 0*F;default:return l.loaded/(l.endByte-l.startByte)*F}},this}return a.uploadNextChunk=function(){var s=!1;if(a.getOpt("prioritizeFirstAndLastChunk")&&(r.each(a.files,function(g){if(g.chunks.length&&g.chunks[0].status()=="pending"&&g.chunks[0].preprocessState===0)return g.chunks[0].send(),s=!0,!1;if(g.chunks.length>1&&g.chunks[g.chunks.length-1].status()=="pending"&&g.chunks[g.chunks.length-1].preprocessState===0)return g.chunks[g.chunks.length-1].send(),s=!0,!1}),s)||(r.each(a.files,function(g){if(g.isPaused()===!1&&r.each(g.chunks,function(u){if(u.status()=="pending"&&u.preprocessState===0)return u.send(),s=!0,!1}),s)return!1}),s))return!0;var p=!1;return r.each(a.files,function(g){if(!g.isComplete())return p=!0,!1}),p||a.fire("complete"),!1},a.assignBrowse=function(s,p){typeof s.length>"u"&&(s=[s]),r.each(s,function(g){var u;g.tagName==="INPUT"&&g.type==="file"?u=g:(u=document.createElement("input"),u.setAttribute("type","file"),u.style.display="none",g.addEventListener("click",function(){u.style.opacity=0,u.style.display="block",u.focus(),u.click(),u.style.display="none"},!1),g.appendChild(u));var l=a.getOpt("maxFiles");typeof l>"u"||l!=1?u.setAttribute("multiple","multiple"):u.removeAttribute("multiple"),p?u.setAttribute("webkitdirectory","webkitdirectory"):u.removeAttribute("webkitdirectory");var R=a.getOpt("fileType");typeof R<"u"&&R.length>=1?u.setAttribute("accept",R.map(function(T){return"."+T}).join(",")):u.removeAttribute("accept"),u.addEventListener("change",function(T){D(T.target.files,T);var F=a.getOpt("clearInput");F&&(T.target.value="")},!1)})},a.assignDrop=function(s){typeof s.length>"u"&&(s=[s]),r.each(s,function(p){p.addEventListener("dragover",h,!1),p.addEventListener("dragenter",h,!1),p.addEventListener("drop",c,!1)})},a.unAssignDrop=function(s){typeof s.length>"u"&&(s=[s]),r.each(s,function(p){p.removeEventListener("dragover",h),p.removeEventListener("dragenter",h),p.removeEventListener("drop",c)})},a.isUploading=function(){var s=!1;return r.each(a.files,function(p){if(p.isUploading())return s=!0,!1}),s},a.upload=function(){if(!a.isUploading()){a.fire("uploadStart");for(var s=1;s<=a.getOpt("simultaneousUploads");s++)a.uploadNextChunk()}},a.pause=function(){r.each(a.files,function(s){s.abort()}),a.fire("pause")},a.cancel=function(){a.fire("beforeCancel");for(var s=a.files.length-1;s>=0;s--)a.files[s].cancel();a.fire("cancel")},a.progress=function(){var s=0,p=0;return r.each(a.files,function(g){s+=g.progress()*g.size,p+=g.size}),p>0?s/p:0},a.addFile=function(s,p){D([s],p)},a.addFiles=function(s,p){D(s,p)},a.removeFile=function(s){for(var p=a.files.length-1;p>=0;p--)a.files[p]===s&&a.files.splice(p,1)},a.getFromUniqueIdentifier=function(s){var p=!1;return r.each(a.files,function(g){g.uniqueIdentifier==s&&(p=g)}),p},a.getSize=function(){var s=0;return r.each(a.files,function(p){s+=p.size}),s},a.handleDropEvent=function(s){c(s)},a.handleChangeEvent=function(s){D(s.target.files,s),s.target.value=""},a.updateQuery=function(s){a.opts.query=s},this};o.exports=t})()})(ot);var Yt=ot.exports;const Bt=It(Yt);class qt{constructor(t,e={}){S(this,"resumable");S(this,"currentFileItem",null);S(this,"chunkedConfig");S(this,"callbacks");S(this,"uploadCompleteResolve");S(this,"uploadCompleteReject");this.chunkedConfig=t,this.callbacks=e}async upload(t){try{console.info("[ChunkedUploader] 开始分片上传流程...");const e=await this.chunkedConfig.initUpload(t.file.name,t.file.size);return console.info("[ChunkedUploader] 初始化完成:",e),t.uploadSessionId=e.uploadSessionId,this.currentFileItem=t,this.initResumable(e),this.resumable.addFile(t.file),await this.waitForUploadComplete()}catch(e){throw console.error("[ChunkedUploader] 上传失败:",e),e instanceof Error?e:new Error(String(e))}}waitForUploadComplete(){return new Promise((t,e)=>{this.uploadCompleteResolve=t,this.uploadCompleteReject=e})}initResumable(t){console.log("[ChunkedUploader] 初始化 Resumable...",t),this.resumable&&this.resumable.cancel();const e=this.chunkedConfig.getResumableConfig(t),r={...{chunkSize:t.partSize,simultaneousUploads:3,testChunks:!1,method:"multipart",chunkNumberParameterName:"partNumber",totalChunksParameterName:"totalParts",fileParameterName:"file",withCredentials:!0,maxChunkRetries:3,chunkRetryInterval:1e3,forceChunkSize:!0},...e};console.info("[ChunkedUploader] Resumable 配置:",r),this.resumable=new Bt(r),this.bindResumableEvents()}bindResumableEvents(){this.resumable.on("progress",()=>{var e,a,r,c;const t=Math.floor(this.resumable.progress()*100);console.log(`[ChunkedUploader] 上传进度: ${t}%`),this.currentFileItem&&(this.currentFileItem.progress=Math.min(t,90),(a=(e=this.callbacks).onProgress)==null||a.call(e,this.currentFileItem,this.currentFileItem.progress)),(c=(r=this.callbacks).onUpdate)==null||c.call(r)}),this.resumable.on("fileSuccess",()=>{console.log("[ChunkedUploader] 所有分片上传完成,开始合并..."),this.handleResumableComplete()}),this.resumable.on("error",t=>{console.error("[ChunkedUploader] 上传错误:",t),this.handleResumableError(t)}),this.resumable.on("fileAdded",()=>{console.info("[ChunkedUploader] 文件已添加,开始上传分片..."),this.resumable.upload()})}async handleResumableComplete(){if(!(!this.currentFileItem||!this.uploadCompleteResolve||!this.uploadCompleteReject))try{const t=await this.chunkedConfig.mergeChunks(this.currentFileItem.uploadSessionId);this.currentFileItem&&(this.currentFileItem.progress=100),this.uploadCompleteResolve(t),console.log("合并分片成功>>>uploadCompleteResolve",t),this.cleanup()}catch(t){const e=t instanceof Error?t:new Error(String(t));this.handleResumableError(e.message)}}handleResumableError(t){var e,a;this.currentFileItem&&(this.currentFileItem.status="error",this.currentFileItem.errorMessage=t),this.uploadCompleteReject&&(this.uploadCompleteReject(new Error(t)),this.cleanup()),(a=(e=this.callbacks).onUpdate)==null||a.call(e)}cleanup(){this.uploadCompleteResolve=void 0,this.uploadCompleteReject=void 0}pause(){this.resumable&&this.resumable.pause()}resume(){this.resumable&&this.resumable.upload()}cancel(){this.resumable&&(this.resumable.cancel(),this.resumable=null),this.currentFileItem=null,this.cleanup()}}const Kt=()=>`file_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;class Wt{constructor(t,e={}){S(this,"config");S(this,"callbacks");S(this,"chunkedUploader",null);S(this,"uploadFileList",[]);S(this,"fileList",[]);S(this,"uploadProgress",0);S(this,"isUploading",!1);S(this,"uploadMessage","");S(this,"uploadMessageType","info");this.config=t,this.callbacks=e,this.initUploaders()}initUploaders(){const t=this.config.uploadConfig;t!=null&&t.chunkedUpload&&!this.config.multiple&&(this.chunkedUploader=new qt(t.chunkedUpload,{onProgress:(e,a)=>{var r,c,h,m;(c=(r=this.callbacks).onUploadProgress)==null||c.call(r,e,a),(m=(h=this.callbacks).onUpdate)==null||m.call(h)},onUpdate:()=>{var e,a;(a=(e=this.callbacks).onUpdate)==null||a.call(e)}}))}shouldUseChunkedUpload(){const t=this.config.uploadConfig;return!!(t!=null&&t.chunkedUpload&&!this.config.multiple)}updateConfig(t){this.config={...this.config,...t},this.initUploaders()}updateCallbacks(t){this.callbacks={...this.callbacks,...t}}reset(){this.cancelUpload(),this.uploadFileList=[],this.fileList=[],this.uploadProgress=0,this.isUploading=!1,this.uploadMessage="",this.uploadMessageType="info"}convertToBytes(t,e="MB"){return t*{KB:1024,MB:1048576,GB:1073741824}[e]}formatFileSize(t,e="MB"){return`${(t/this.convertToBytes(1,e)).toFixed(2)}${e}`}isValidFileType(t,e){if(!e)return!0;const a=t.name.toLowerCase(),r=a.substring(a.lastIndexOf("."));return e.toLowerCase().split(",").map(h=>h.trim()).some(h=>{if(h.startsWith("."))return r===h;if(h.includes("/")){const[m,b]=h.split("/");return b==="*"?t.type.startsWith(m+"/"):t.type===h}return!1})}beforeUpload(t){var c,h,m,b,M,y,D,C,I,s,p,g;const e=Array.isArray(t)?t:[t];if(!e.length)return(h=(c=this.callbacks).onMessage)==null||h.call(c,L("pleaseSelectFile"),"warning"),!1;if(this.config.multiple&&this.uploadFileList.length+e.length>this.config.maxFiles)return(b=(m=this.callbacks).onMessage)==null||b.call(m,L("maxFilesLimit",{max:this.config.maxFiles}),"warning"),!1;for(const u of e)if(!this.isValidFileType(u,this.config.acceptTypes)){const l=this.config.acceptTypes||"";return(y=(M=this.callbacks).onMessage)==null||y.call(M,L("fileFormatNotSupported",{name:u.name,types:l}),"warning"),!1}const a=this.config.maxFileSizeUnit||"MB",r=this.convertToBytes(this.config.maxFileSize,a);for(const u of e)if(u.size>r)return(C=(D=this.callbacks).onMessage)==null||C.call(D,L("fileSizeExceeded",{name:u.name,size:this.config.maxFileSize,unit:a}),"warning"),!1;for(const u of e){const l={id:Kt(),file:u,name:u.name,size:u.size,progress:0,status:"pending"};this.config.multiple?(this.uploadFileList.unshift(l),this.fileList.unshift(u)):(this.uploadFileList=[l],this.fileList=[u])}return(s=(I=this.callbacks).onUpdate)==null||s.call(I),(g=(p=this.callbacks).onFileChange)==null||g.call(p,this.uploadFileList),this.shouldUseChunkedUpload()?this.processChunkedUpload():this.processFilesWithCustomUpload(),!0}async processChunkedUpload(){var t;if(((t=this.config.uploadConfig)==null?void 0:t.autoUpload)===!0){console.info("[ImportDialogUploader] 自动上传模式,立即开始分片上传");const e=this.uploadFileList.filter(a=>a.status==="pending");for(const a of e)await this.uploadSingleFile(a)}else console.info("[ImportDialogUploader] 延迟上传模式,等待用户点击确认")}async processFilesWithCustomUpload(){var a;if(!((a=this.config.uploadConfig)==null?void 0:a.customUpload))return;const e=this.uploadFileList.filter(r=>r.status==="pending");for(const r of e)await this.processFileWithCustomUpload(r)}async processFileWithCustomUpload(t){var a,r,c,h,m,b,M,y,D;const e=(a=this.config.uploadConfig)==null?void 0:a.customUpload;if(e){t.status="uploading",t.progress=0,this.isUploading=!0,(c=(r=this.callbacks).onUpdate)==null||c.call(r);try{const C={fileList:[...this.uploadFileList],removeFile:I=>{this.removeFile(I)}};t.response=await e(t.file,C,I=>{var s,p,g,u;t.progress=I,(p=(s=this.callbacks).onUploadProgress)==null||p.call(s,t,I),(u=(g=this.callbacks).onUpdate)==null||u.call(g)}),t.status="success",t.progress=100,(m=(h=this.callbacks).onUploadSuccess)==null||m.call(h,t,t.response)}catch(C){t.status="error",t.errorMessage=C instanceof Error?C.message:L("processingFailed"),(M=(b=this.callbacks).onUploadError)==null||M.call(b,t,C)}this.isUploading=this.uploadFileList.some(C=>C.status==="uploading"),(D=(y=this.callbacks).onUpdate)==null||D.call(y),this.updateOverallProgress()}}removeFile(t){var a,r,c,h,m,b,M,y,D;const e=this.shouldUseChunkedUpload()&&((a=this.config.uploadConfig)==null?void 0:a.autoUpload)!==!1;if(t!==void 0&&t>=0&&t<this.uploadFileList.length){const C=this.uploadFileList[t];if(e&&C.status==="uploading")return(c=(r=this.callbacks).onMessage)==null||c.call(r,L("fileUploadingCannotDelete"),"warning"),!1;this.uploadFileList.splice(t,1),this.fileList.splice(t,1)}else{if(e&&this.uploadFileList.some(I=>I.status==="uploading"))return(m=(h=this.callbacks).onMessage)==null||m.call(h,L("filesUploadingCannotClear"),"warning"),!1;this.uploadFileList=[],this.fileList=[]}return this.uploadProgress=0,this.uploadMessage="",this.uploadMessageType="info",this.isUploading=this.uploadFileList.some(C=>C.status==="uploading"),(M=(b=this.callbacks).onFileChange)==null||M.call(b,this.uploadFileList),(D=(y=this.callbacks).onUpdate)==null||D.call(y),!0}async uploadSingleFile(t){var e,a,r,c,h,m,b,M;t.status="uploading",t.progress=0,this.isUploading=!0,(a=(e=this.callbacks).onUpdate)==null||a.call(e);try{return t.response=await this.uploadFileChunked(t),t.status="success",t.progress=100,(c=(r=this.callbacks).onUploadSuccess)==null||c.call(r,t,t.response),t.response}catch(y){throw t.status="error",t.errorMessage=y instanceof Error?y.message:L("uploadFailed"),(m=(h=this.callbacks).onUploadError)==null||m.call(h,t,y),y}finally{this.isUploading=this.uploadFileList.some(y=>y.status==="uploading"),(M=(b=this.callbacks).onUpdate)==null||M.call(b),this.updateOverallProgress()}}async uploadFileChunked(t){if(!this.chunkedUploader)throw new Error(L("chunkedUploadConfigRequired"));return await this.chunkedUploader.upload(t)}async startUpload(){if(!this.shouldUseChunkedUpload())return;const t=this.uploadFileList.filter(a=>a.status==="pending");if(t.length===0)return;const e=[];for(const a of t)try{const r=await this.uploadSingleFile(a);r&&e.push(r)}catch(r){console.error(`文件 ${a.file.name} 上传失败:`,r)}return e}pauseUpload(){var t;(t=this.chunkedUploader)==null||t.pause()}resumeUpload(){var t;(t=this.chunkedUploader)==null||t.resume()}cancelUpload(){var t,e,a;(t=this.chunkedUploader)==null||t.cancel(),this.isUploading=!1,this.uploadMessage="上传已取消",this.uploadMessageType="info",(a=(e=this.callbacks).onUpdate)==null||a.call(e)}updateOverallProgress(){if(this.uploadFileList.length===0){this.uploadProgress=0;return}const t=this.uploadFileList.reduce((e,a)=>e+a.progress,0);this.uploadProgress=Math.round(t/this.uploadFileList.length)}hasUploadingFiles(){return this.uploadFileList.some(t=>t.status==="uploading")}hasPendingFiles(){return this.uploadFileList.some(t=>t.status==="pending")}hasAllFilesUploaded(){return this.uploadFileList.length>0&&this.uploadFileList.every(t=>t.status==="success")}getFailedFiles(){return this.uploadFileList.filter(t=>t.status==="error")}}const rt={success:"icon-success",error:"icon-cuowu",warning:"icon-warning",info:"icon-info"},Te=new Set;function Jt(o){const{message:t,type:e,duration:a=3e3,closable:r=!0}=o,c=document.createElement("div");c.className=`import-dialog-vanilla-toast ${e}`;const h=rt[e]||rt.info;c.innerHTML=`
1627
+ `}}var ot={exports:{}};(function(o){(function(){var t=function(e){if(!(this instanceof t))return new t(e);if(this.version=1,this.support=typeof File<"u"&&typeof Blob<"u"&&typeof FileList<"u"&&(!!Blob.prototype.webkitSlice||!!Blob.prototype.mozSlice||!!Blob.prototype.slice||!1),!this.support)return!1;var a=this;a.files=[],a.defaults={chunkSize:1048576,forceChunkSize:!1,simultaneousUploads:3,fileParameterName:"file",chunkNumberParameterName:"resumableChunkNumber",chunkSizeParameterName:"resumableChunkSize",currentChunkSizeParameterName:"resumableCurrentChunkSize",totalSizeParameterName:"resumableTotalSize",typeParameterName:"resumableType",identifierParameterName:"resumableIdentifier",fileNameParameterName:"resumableFilename",relativePathParameterName:"resumableRelativePath",totalChunksParameterName:"resumableTotalChunks",throttleProgressCallbacks:.5,query:{},headers:{},preprocess:null,method:"multipart",uploadMethod:"POST",testMethod:"GET",prioritizeFirstAndLastChunk:!1,target:"/",testTarget:null,parameterNamespace:"",testChunks:!0,generateUniqueIdentifier:null,getTarget:null,maxChunkRetries:100,chunkRetryInterval:void 0,permanentErrors:[400,404,415,500,501],maxFiles:void 0,withCredentials:!1,xhrTimeout:0,clearInput:!0,chunkFormat:"blob",setChunkTypeFromFile:!1,maxFilesErrorCallback:function(s,p){var g=a.getOpt("maxFiles");alert("Please upload no more than "+g+" file"+(g===1?"":"s")+" at a time.")},minFileSize:1,minFileSizeErrorCallback:function(s,p){alert(s.fileName||s.name+" is too small, please upload files larger than "+r.formatSize(a.getOpt("minFileSize"))+".")},maxFileSize:void 0,maxFileSizeErrorCallback:function(s,p){alert(s.fileName||s.name+" is too large, please upload files less than "+r.formatSize(a.getOpt("maxFileSize"))+".")},fileType:[],fileTypeErrorCallback:function(s,p){alert(s.fileName||s.name+" has type not allowed, please upload files of type "+a.getOpt("fileType")+".")}},a.opts=e||{},a.getOpt=function(s){var p=this;if(s instanceof Array){var g={};return r.each(s,function(u){g[u]=p.getOpt(u)}),g}if(p instanceof I){if(typeof p.opts[s]<"u")return p.opts[s];p=p.fileObj}if(p instanceof C){if(typeof p.opts[s]<"u")return p.opts[s];p=p.resumableObj}if(p instanceof t)return typeof p.opts[s]<"u"?p.opts[s]:p.defaults[s]},a.events=[],a.on=function(s,p){a.events.push(s.toLowerCase(),p)},a.fire=function(){for(var s=[],p=0;p<arguments.length;p++)s.push(arguments[p]);for(var g=s[0].toLowerCase(),p=0;p<=a.events.length;p+=2)a.events[p]==g&&a.events[p+1].apply(a,s.slice(1)),a.events[p]=="catchall"&&a.events[p+1].apply(null,s);g=="fileerror"&&a.fire("error",s[2],s[1]),g=="fileprogress"&&a.fire("progress")};var r={stopEvent:function(s){s.stopPropagation(),s.preventDefault()},each:function(s,p){if(typeof s.length<"u"){for(var g=0;g<s.length;g++)if(p(s[g])===!1)return}else for(g in s)if(p(g,s[g])===!1)return},generateUniqueIdentifier:function(s,p){var g=a.getOpt("generateUniqueIdentifier");if(typeof g=="function")return g(s,p);var u=s.webkitRelativePath||s.fileName||s.name,l=s.size;return l+"-"+u.replace(/[^0-9a-zA-Z_-]/img,"")},contains:function(s,p){var g=!1;return r.each(s,function(u){return u==p?(g=!0,!1):!0}),g},formatSize:function(s){return s<1024?s+" bytes":s<1024*1024?(s/1024).toFixed(0)+" KB":s<1024*1024*1024?(s/1024/1024).toFixed(1)+" MB":(s/1024/1024/1024).toFixed(1)+" GB"},getTarget:function(s,p){var g=a.getOpt("target");if(s==="test"&&a.getOpt("testTarget")&&(g=a.getOpt("testTarget")==="/"?a.getOpt("target"):a.getOpt("testTarget")),typeof g=="function")return g(p);var u=g.indexOf("?")<0?"?":"&",l=p.join("&");return g+u+l}},c=function(s){r.stopEvent(s),s.dataTransfer&&s.dataTransfer.items?y(s.dataTransfer.items,s):s.dataTransfer&&s.dataTransfer.files&&y(s.dataTransfer.files,s)},h=function(s){s.preventDefault()};function m(s,p,g,u){var l;if(s.isFile)return s.file(function(R){R.relativePath=p+R.name,g.push(R),u()});if(s.isDirectory?l=s:s instanceof File&&g.push(s),typeof s.webkitGetAsEntry=="function"&&(l=s.webkitGetAsEntry()),l&&l.isDirectory)return M(l,p+l.name+"/",g,u);typeof s.getAsFile=="function"&&(s=s.getAsFile(),s instanceof File&&(s.relativePath=p+s.name,g.push(s))),u()}function b(s,p){if(!s||s.length===0)return p();s[0](function(){b(s.slice(1),p)})}function M(s,p,g,u){var l=s.createReader();l.readEntries(function(R){if(!R.length)return u();b(R.map(function(T){return m.bind(null,T,p,g)}),u)})}function y(s,p){if(s.length){a.fire("beforeAdd");var g=[];b(Array.prototype.map.call(s,function(u){return m.bind(null,u,"",g)}),function(){g.length&&D(g,p)})}}var D=function(s,p){var g=0,u=a.getOpt(["maxFiles","minFileSize","maxFileSize","maxFilesErrorCallback","minFileSizeErrorCallback","maxFileSizeErrorCallback","fileType","fileTypeErrorCallback"]);if(typeof u.maxFiles<"u"&&u.maxFiles<s.length+a.files.length)if(u.maxFiles===1&&a.files.length===1&&s.length===1)a.removeFile(a.files[0]);else return u.maxFilesErrorCallback(s,g++),!1;var l=[],R=[],T=s.length,F=function(){if(!--T){if(!l.length&&!R.length)return;window.setTimeout(function(){a.fire("filesAdded",l,R)},0)}};r.each(s,function(P){var Y=P.name;if(u.fileType.length>0){var _=!1;for(var K in u.fileType){var N="."+u.fileType[K];if(Y.toLowerCase().indexOf(N.toLowerCase(),Y.length-N.length)!==-1){_=!0;break}}if(!_)return u.fileTypeErrorCallback(P,g++),!1}if(typeof u.minFileSize<"u"&&P.size<u.minFileSize)return u.minFileSizeErrorCallback(P,g++),!1;if(typeof u.maxFileSize<"u"&&P.size>u.maxFileSize)return u.maxFileSizeErrorCallback(P,g++),!1;function se(Z){a.getFromUniqueIdentifier(Z)?R.push(P):function(){P.uniqueIdentifier=Z;var de=new C(a,P,Z);a.files.push(de),l.push(de),de.container=typeof p<"u"?p.srcElement:null,window.setTimeout(function(){a.fire("fileAdded",de,p)},0)}(),F()}var Q=r.generateUniqueIdentifier(P,p);Q&&typeof Q.then=="function"?Q.then(function(Z){se(Z)},function(){F()}):se(Q)})};function C(s,p,g){var u=this;u.opts={},u.getOpt=s.getOpt,u._prevProgress=0,u.resumableObj=s,u.file=p,u.fileName=p.fileName||p.name,u.size=p.size,u.relativePath=p.relativePath||p.webkitRelativePath||u.fileName,u.uniqueIdentifier=g,u._pause=!1,u.container="";var l=g!==void 0,R=function(T,F){switch(T){case"progress":u.resumableObj.fire("fileProgress",u,F);break;case"error":u.abort(),l=!0,u.chunks=[],u.resumableObj.fire("fileError",u,F);break;case"success":if(l)return;u.resumableObj.fire("fileProgress",u),u.isComplete()&&u.resumableObj.fire("fileSuccess",u,F);break;case"retry":u.resumableObj.fire("fileRetry",u);break}};return u.chunks=[],u.abort=function(){var T=0;r.each(u.chunks,function(F){F.status()=="uploading"&&(F.abort(),T++)}),T>0&&u.resumableObj.fire("fileProgress",u)},u.cancel=function(){var T=u.chunks;u.chunks=[],r.each(T,function(F){F.status()=="uploading"&&(F.abort(),u.resumableObj.uploadNextChunk())}),u.resumableObj.removeFile(u),u.resumableObj.fire("fileProgress",u)},u.retry=function(){u.bootstrap();var T=!1;u.resumableObj.on("chunkingComplete",function(){T||u.resumableObj.upload(),T=!0})},u.bootstrap=function(){u.abort(),l=!1,u.chunks=[],u._prevProgress=0;for(var T=u.getOpt("forceChunkSize")?Math.ceil:Math.floor,F=Math.max(T(u.file.size/u.getOpt("chunkSize")),1),P=0;P<F;P++)(function(Y){window.setTimeout(function(){u.chunks.push(new I(u.resumableObj,u,Y,R)),u.resumableObj.fire("chunkingProgress",u,Y/F)},0)})(P);window.setTimeout(function(){u.resumableObj.fire("chunkingComplete",u)},0)},u.progress=function(){if(l)return 1;var T=0,F=!1;return r.each(u.chunks,function(P){P.status()=="error"&&(F=!0),T+=P.progress(!0)}),T=F||T>.99999?1:T,T=Math.max(u._prevProgress,T),u._prevProgress=T,T},u.isUploading=function(){var T=!1;return r.each(u.chunks,function(F){if(F.status()=="uploading")return T=!0,!1}),T},u.isComplete=function(){var T=!1;return r.each(u.chunks,function(F){var P=F.status();if(P=="pending"||P=="uploading"||F.preprocessState===1)return T=!0,!1}),!T},u.pause=function(T){typeof T>"u"?u._pause=!u._pause:u._pause=T},u.isPaused=function(){return u._pause},u.resumableObj.fire("chunkingStart",u),u.bootstrap(),this}function I(s,p,g,u){var l=this;l.opts={},l.getOpt=s.getOpt,l.resumableObj=s,l.fileObj=p,l.fileObjSize=p.size,l.fileObjType=p.file.type,l.offset=g,l.callback=u,l.lastProgressCallback=new Date,l.tested=!1,l.retries=0,l.pendingRetry=!1,l.preprocessState=0;var R=l.getOpt("chunkSize");return l.loaded=0,l.startByte=l.offset*R,l.endByte=Math.min(l.fileObjSize,(l.offset+1)*R),l.fileObjSize-l.endByte<R&&!l.getOpt("forceChunkSize")&&(l.endByte=l.fileObjSize),l.xhr=null,l.test=function(){l.xhr=new XMLHttpRequest;var T=function(K){l.tested=!0;var N=l.status();N=="success"?(l.callback(N,l.message()),l.resumableObj.uploadNextChunk()):l.send()};l.xhr.addEventListener("load",T,!1),l.xhr.addEventListener("error",T,!1),l.xhr.addEventListener("timeout",T,!1);var F=[],P=l.getOpt("parameterNamespace"),Y=l.getOpt("query");typeof Y=="function"&&(Y=Y(l.fileObj,l)),r.each(Y,function(K,N){F.push([encodeURIComponent(P+K),encodeURIComponent(N)].join("="))}),F=F.concat([["chunkNumberParameterName",l.offset+1],["chunkSizeParameterName",l.getOpt("chunkSize")],["currentChunkSizeParameterName",l.endByte-l.startByte],["totalSizeParameterName",l.fileObjSize],["typeParameterName",l.fileObjType],["identifierParameterName",l.fileObj.uniqueIdentifier],["fileNameParameterName",l.fileObj.fileName],["relativePathParameterName",l.fileObj.relativePath],["totalChunksParameterName",l.fileObj.chunks.length]].filter(function(K){return l.getOpt(K[0])}).map(function(K){return[P+l.getOpt(K[0]),encodeURIComponent(K[1])].join("=")})),l.xhr.open(l.getOpt("testMethod"),r.getTarget("test",F)),l.xhr.timeout=l.getOpt("xhrTimeout"),l.xhr.withCredentials=l.getOpt("withCredentials");var _=l.getOpt("headers");typeof _=="function"&&(_=_(l.fileObj,l)),r.each(_,function(K,N){l.xhr.setRequestHeader(K,N)}),l.xhr.send(null)},l.preprocessFinished=function(){l.preprocessState=2,l.send()},l.send=function(){var T=l.getOpt("preprocess");if(typeof T=="function")switch(l.preprocessState){case 0:l.preprocessState=1,T(l);return;case 1:return}if(l.getOpt("testChunks")&&!l.tested){l.test();return}l.xhr=new XMLHttpRequest,l.xhr.upload.addEventListener("progress",function(W){new Date-l.lastProgressCallback>l.getOpt("throttleProgressCallbacks")*1e3&&(l.callback("progress"),l.lastProgressCallback=new Date),l.loaded=W.loaded||0},!1),l.loaded=0,l.pendingRetry=!1,l.callback("progress");var F=function(W){var J=l.status();if(J=="success"||J=="error")l.callback(J,l.message()),l.resumableObj.uploadNextChunk();else{l.callback("retry",l.message()),l.abort(),l.retries++;var xe=l.getOpt("chunkRetryInterval");xe!==void 0?(l.pendingRetry=!0,setTimeout(l.send,xe)):l.send()}};l.xhr.addEventListener("load",F,!1),l.xhr.addEventListener("error",F,!1),l.xhr.addEventListener("timeout",F,!1);var P=[["chunkNumberParameterName",l.offset+1],["chunkSizeParameterName",l.getOpt("chunkSize")],["currentChunkSizeParameterName",l.endByte-l.startByte],["totalSizeParameterName",l.fileObjSize],["typeParameterName",l.fileObjType],["identifierParameterName",l.fileObj.uniqueIdentifier],["fileNameParameterName",l.fileObj.fileName],["relativePathParameterName",l.fileObj.relativePath],["totalChunksParameterName",l.fileObj.chunks.length]].filter(function(W){return l.getOpt(W[0])}).reduce(function(W,J){return W[l.getOpt(J[0])]=J[1],W},{}),Y=l.getOpt("query");typeof Y=="function"&&(Y=Y(l.fileObj,l)),r.each(Y,function(W,J){P[W]=J});var _=l.fileObj.file.slice?"slice":l.fileObj.file.mozSlice?"mozSlice":l.fileObj.file.webkitSlice?"webkitSlice":"slice",K=l.fileObj.file[_](l.startByte,l.endByte,l.getOpt("setChunkTypeFromFile")?l.fileObj.file.type:""),N=null,se=[],Q=l.getOpt("parameterNamespace");if(l.getOpt("method")==="octet")N=K,r.each(P,function(W,J){se.push([encodeURIComponent(Q+W),encodeURIComponent(J)].join("="))});else if(N=new FormData,r.each(P,function(W,J){N.append(Q+W,J),se.push([encodeURIComponent(Q+W),encodeURIComponent(J)].join("="))}),l.getOpt("chunkFormat")=="blob")N.append(Q+l.getOpt("fileParameterName"),K,l.fileObj.fileName);else if(l.getOpt("chunkFormat")=="base64"){var Z=new FileReader;Z.onload=function(W){N.append(Q+l.getOpt("fileParameterName"),Z.result),l.xhr.send(N)},Z.readAsDataURL(K)}var de=r.getTarget("upload",se),Me=l.getOpt("uploadMethod");l.xhr.open(Me,de),l.getOpt("method")==="octet"&&l.xhr.setRequestHeader("Content-Type","application/octet-stream"),l.xhr.timeout=l.getOpt("xhrTimeout"),l.xhr.withCredentials=l.getOpt("withCredentials");var ge=l.getOpt("headers");typeof ge=="function"&&(ge=ge(l.fileObj,l)),r.each(ge,function(W,J){l.xhr.setRequestHeader(W,J)}),l.getOpt("chunkFormat")=="blob"&&l.xhr.send(N)},l.abort=function(){l.xhr&&l.xhr.abort(),l.xhr=null},l.status=function(){return l.pendingRetry?"uploading":l.xhr?l.xhr.readyState<4?"uploading":l.xhr.status==200||l.xhr.status==201?"success":r.contains(l.getOpt("permanentErrors"),l.xhr.status)||l.retries>=l.getOpt("maxChunkRetries")?"error":(l.abort(),"pending"):"pending"},l.message=function(){return l.xhr?l.xhr.responseText:""},l.progress=function(T){typeof T>"u"&&(T=!1);var F=T?(l.endByte-l.startByte)/l.fileObjSize:1;if(l.pendingRetry)return 0;(!l.xhr||!l.xhr.status)&&(F*=.95);var P=l.status();switch(P){case"success":case"error":return 1*F;case"pending":return 0*F;default:return l.loaded/(l.endByte-l.startByte)*F}},this}return a.uploadNextChunk=function(){var s=!1;if(a.getOpt("prioritizeFirstAndLastChunk")&&(r.each(a.files,function(g){if(g.chunks.length&&g.chunks[0].status()=="pending"&&g.chunks[0].preprocessState===0)return g.chunks[0].send(),s=!0,!1;if(g.chunks.length>1&&g.chunks[g.chunks.length-1].status()=="pending"&&g.chunks[g.chunks.length-1].preprocessState===0)return g.chunks[g.chunks.length-1].send(),s=!0,!1}),s)||(r.each(a.files,function(g){if(g.isPaused()===!1&&r.each(g.chunks,function(u){if(u.status()=="pending"&&u.preprocessState===0)return u.send(),s=!0,!1}),s)return!1}),s))return!0;var p=!1;return r.each(a.files,function(g){if(!g.isComplete())return p=!0,!1}),p||a.fire("complete"),!1},a.assignBrowse=function(s,p){typeof s.length>"u"&&(s=[s]),r.each(s,function(g){var u;g.tagName==="INPUT"&&g.type==="file"?u=g:(u=document.createElement("input"),u.setAttribute("type","file"),u.style.display="none",g.addEventListener("click",function(){u.style.opacity=0,u.style.display="block",u.focus(),u.click(),u.style.display="none"},!1),g.appendChild(u));var l=a.getOpt("maxFiles");typeof l>"u"||l!=1?u.setAttribute("multiple","multiple"):u.removeAttribute("multiple"),p?u.setAttribute("webkitdirectory","webkitdirectory"):u.removeAttribute("webkitdirectory");var R=a.getOpt("fileType");typeof R<"u"&&R.length>=1?u.setAttribute("accept",R.map(function(T){return"."+T}).join(",")):u.removeAttribute("accept"),u.addEventListener("change",function(T){D(T.target.files,T);var F=a.getOpt("clearInput");F&&(T.target.value="")},!1)})},a.assignDrop=function(s){typeof s.length>"u"&&(s=[s]),r.each(s,function(p){p.addEventListener("dragover",h,!1),p.addEventListener("dragenter",h,!1),p.addEventListener("drop",c,!1)})},a.unAssignDrop=function(s){typeof s.length>"u"&&(s=[s]),r.each(s,function(p){p.removeEventListener("dragover",h),p.removeEventListener("dragenter",h),p.removeEventListener("drop",c)})},a.isUploading=function(){var s=!1;return r.each(a.files,function(p){if(p.isUploading())return s=!0,!1}),s},a.upload=function(){if(!a.isUploading()){a.fire("uploadStart");for(var s=1;s<=a.getOpt("simultaneousUploads");s++)a.uploadNextChunk()}},a.pause=function(){r.each(a.files,function(s){s.abort()}),a.fire("pause")},a.cancel=function(){a.fire("beforeCancel");for(var s=a.files.length-1;s>=0;s--)a.files[s].cancel();a.fire("cancel")},a.progress=function(){var s=0,p=0;return r.each(a.files,function(g){s+=g.progress()*g.size,p+=g.size}),p>0?s/p:0},a.addFile=function(s,p){D([s],p)},a.addFiles=function(s,p){D(s,p)},a.removeFile=function(s){for(var p=a.files.length-1;p>=0;p--)a.files[p]===s&&a.files.splice(p,1)},a.getFromUniqueIdentifier=function(s){var p=!1;return r.each(a.files,function(g){g.uniqueIdentifier==s&&(p=g)}),p},a.getSize=function(){var s=0;return r.each(a.files,function(p){s+=p.size}),s},a.handleDropEvent=function(s){c(s)},a.handleChangeEvent=function(s){D(s.target.files,s),s.target.value=""},a.updateQuery=function(s){a.opts.query=s},this};o.exports=t})()})(ot);var Yt=ot.exports;const Bt=It(Yt);class qt{constructor(t,e={}){S(this,"resumable");S(this,"currentFileItem",null);S(this,"chunkedConfig");S(this,"callbacks");S(this,"uploadCompleteResolve");S(this,"uploadCompleteReject");this.chunkedConfig=t,this.callbacks=e}async upload(t){try{console.info("[ChunkedUploader] 开始分片上传流程...");const e=await this.chunkedConfig.initUpload(t.file.name,t.file.size);return console.info("[ChunkedUploader] 初始化完成:",e),t.uploadSessionId=e.uploadSessionId,this.currentFileItem=t,this.initResumable(e),this.resumable.addFile(t.file),await this.waitForUploadComplete()}catch(e){throw console.error("[ChunkedUploader] 上传失败:",e),e instanceof Error?e:new Error(String(e))}}waitForUploadComplete(){return new Promise((t,e)=>{this.uploadCompleteResolve=t,this.uploadCompleteReject=e})}initResumable(t){console.log("[ChunkedUploader] 初始化 Resumable...",t),this.resumable&&this.resumable.cancel();const e=this.chunkedConfig.getResumableConfig(t),r={...{chunkSize:t.partSize,simultaneousUploads:3,testChunks:!1,method:"multipart",chunkNumberParameterName:"partNumber",totalChunksParameterName:"totalParts",fileParameterName:"file",withCredentials:!0,maxChunkRetries:3,chunkRetryInterval:1e3,forceChunkSize:!0},...e};console.info("[ChunkedUploader] Resumable 配置:",r),this.resumable=new Bt(r),this.bindResumableEvents()}bindResumableEvents(){this.resumable.on("progress",()=>{var e,a,r,c;const t=Math.floor(this.resumable.progress()*100);console.log(`[ChunkedUploader] 上传进度: ${t}%`),this.currentFileItem&&(this.currentFileItem.progress=Math.min(t,90),(a=(e=this.callbacks).onProgress)==null||a.call(e,this.currentFileItem,this.currentFileItem.progress)),(c=(r=this.callbacks).onUpdate)==null||c.call(r)}),this.resumable.on("fileSuccess",()=>{console.log("[ChunkedUploader] 所有分片上传完成,开始合并..."),this.handleResumableComplete()}),this.resumable.on("error",t=>{console.error("[ChunkedUploader] 上传错误:",t),this.handleResumableError(t)}),this.resumable.on("fileAdded",()=>{console.info("[ChunkedUploader] 文件已添加,开始上传分片..."),this.resumable.upload()})}async handleResumableComplete(){if(!(!this.currentFileItem||!this.uploadCompleteResolve||!this.uploadCompleteReject))try{const t=await this.chunkedConfig.mergeChunks(this.currentFileItem.uploadSessionId);this.currentFileItem&&(this.currentFileItem.progress=100),this.uploadCompleteResolve(t),console.log("合并分片成功>>>uploadCompleteResolve",t),this.cleanup()}catch(t){const e=t instanceof Error?t:new Error(String(t));this.handleResumableError(e.message)}}handleResumableError(t){var e,a;this.currentFileItem&&(this.currentFileItem.status="error",this.currentFileItem.errorMessage=t),this.uploadCompleteReject&&(this.uploadCompleteReject(new Error(t)),this.cleanup()),(a=(e=this.callbacks).onUpdate)==null||a.call(e)}cleanup(){this.uploadCompleteResolve=void 0,this.uploadCompleteReject=void 0}pause(){this.resumable&&this.resumable.pause()}resume(){this.resumable&&this.resumable.upload()}cancel(){this.resumable&&(this.resumable.cancel(),this.resumable=null),this.currentFileItem=null,this.cleanup()}}const Kt=()=>`file_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;class Wt{constructor(t,e={}){S(this,"config");S(this,"callbacks");S(this,"chunkedUploader",null);S(this,"uploadFileList",[]);S(this,"fileList",[]);S(this,"uploadProgress",0);S(this,"isUploading",!1);S(this,"uploadMessage","");S(this,"uploadMessageType","info");this.config=t,this.callbacks=e,this.initUploaders()}initUploaders(){const t=this.config.uploadConfig;t!=null&&t.chunkedUpload&&!this.config.multiple&&(this.chunkedUploader=new qt(t.chunkedUpload,{onProgress:(e,a)=>{var r,c,h,m;(c=(r=this.callbacks).onUploadProgress)==null||c.call(r,e,a),(m=(h=this.callbacks).onUpdate)==null||m.call(h)},onUpdate:()=>{var e,a;(a=(e=this.callbacks).onUpdate)==null||a.call(e)}}))}shouldUseChunkedUpload(){const t=this.config.uploadConfig;return!!(t!=null&&t.chunkedUpload&&!this.config.multiple)}updateConfig(t){this.config={...this.config,...t},this.initUploaders()}updateCallbacks(t){this.callbacks={...this.callbacks,...t}}reset(){this.cancelUpload(),this.uploadFileList=[],this.fileList=[],this.uploadProgress=0,this.isUploading=!1,this.uploadMessage="",this.uploadMessageType="info"}convertToBytes(t,e="MB"){return t*{KB:1024,MB:1048576,GB:1073741824}[e]}isValidFileType(t,e){if(!e)return!0;const a=t.name.toLowerCase(),r=a.substring(a.lastIndexOf("."));return e.toLowerCase().split(",").map(h=>h.trim()).some(h=>{if(h.startsWith("."))return r===h;if(h.includes("/")){const[m,b]=h.split("/");return b==="*"?t.type.startsWith(m+"/"):t.type===h}return!1})}beforeUpload(t){var a,r,c,h,m,b,M,y,D,C,I,s;const e=Array.isArray(t)?t:[t];if(!e.length)return(r=(a=this.callbacks).onMessage)==null||r.call(a,L("pleaseSelectFile"),"warning"),!1;if(this.config.multiple&&this.config.maxFiles!=null&&this.uploadFileList.length+e.length>this.config.maxFiles)return(h=(c=this.callbacks).onMessage)==null||h.call(c,L("maxFilesLimit",{max:this.config.maxFiles}),"warning"),!1;for(const p of e)if(!this.isValidFileType(p,this.config.acceptTypes)){const g=this.config.acceptTypes||"";return(b=(m=this.callbacks).onMessage)==null||b.call(m,L("fileFormatNotSupported",{name:p.name,types:g}),"warning"),!1}if(this.config.maxFileSize!=null){const p=this.config.maxFileSizeUnit||"MB",g=this.convertToBytes(this.config.maxFileSize,p);for(const u of e)if(u.size>g)return(y=(M=this.callbacks).onMessage)==null||y.call(M,L("fileSizeExceeded",{name:u.name,size:this.config.maxFileSize,unit:p}),"warning"),!1}for(const p of e){const g={id:Kt(),file:p,name:p.name,size:p.size,progress:0,status:"pending"};this.config.multiple?(this.uploadFileList.unshift(g),this.fileList.unshift(p)):(this.uploadFileList=[g],this.fileList=[p])}return(C=(D=this.callbacks).onUpdate)==null||C.call(D),(s=(I=this.callbacks).onFileChange)==null||s.call(I,this.uploadFileList),this.shouldUseChunkedUpload()?this.processChunkedUpload():this.processFilesWithCustomUpload(),!0}async processChunkedUpload(){var t;if(((t=this.config.uploadConfig)==null?void 0:t.autoUpload)===!0){console.info("[ImportDialogUploader] 自动上传模式,立即开始分片上传");const e=this.uploadFileList.filter(a=>a.status==="pending");for(const a of e)await this.uploadSingleFile(a)}else console.info("[ImportDialogUploader] 延迟上传模式,等待用户点击确认")}async processFilesWithCustomUpload(){var a;if(!((a=this.config.uploadConfig)==null?void 0:a.customUpload))return;const e=this.uploadFileList.filter(r=>r.status==="pending");for(const r of e)await this.processFileWithCustomUpload(r)}async processFileWithCustomUpload(t){var a,r,c,h,m,b,M,y,D;const e=(a=this.config.uploadConfig)==null?void 0:a.customUpload;if(e){t.status="uploading",t.progress=0,this.isUploading=!0,(c=(r=this.callbacks).onUpdate)==null||c.call(r);try{const C={fileList:[...this.uploadFileList],removeFile:I=>{this.removeFile(I)}};t.response=await e(t.file,C,I=>{var s,p,g,u;t.progress=I,(p=(s=this.callbacks).onUploadProgress)==null||p.call(s,t,I),(u=(g=this.callbacks).onUpdate)==null||u.call(g)}),t.status="success",t.progress=100,(m=(h=this.callbacks).onUploadSuccess)==null||m.call(h,t,t.response)}catch(C){t.status="error",t.errorMessage=C instanceof Error?C.message:L("processingFailed"),(M=(b=this.callbacks).onUploadError)==null||M.call(b,t,C)}this.isUploading=this.uploadFileList.some(C=>C.status==="uploading"),(D=(y=this.callbacks).onUpdate)==null||D.call(y),this.updateOverallProgress()}}removeFile(t){var a,r,c,h,m,b,M,y,D;const e=this.shouldUseChunkedUpload()&&((a=this.config.uploadConfig)==null?void 0:a.autoUpload)!==!1;if(t!==void 0&&t>=0&&t<this.uploadFileList.length){const C=this.uploadFileList[t];if(e&&C.status==="uploading")return(c=(r=this.callbacks).onMessage)==null||c.call(r,L("fileUploadingCannotDelete"),"warning"),!1;this.uploadFileList.splice(t,1),this.fileList.splice(t,1)}else{if(e&&this.uploadFileList.some(I=>I.status==="uploading"))return(m=(h=this.callbacks).onMessage)==null||m.call(h,L("filesUploadingCannotClear"),"warning"),!1;this.uploadFileList=[],this.fileList=[]}return this.uploadProgress=0,this.uploadMessage="",this.uploadMessageType="info",this.isUploading=this.uploadFileList.some(C=>C.status==="uploading"),(M=(b=this.callbacks).onFileChange)==null||M.call(b,this.uploadFileList),(D=(y=this.callbacks).onUpdate)==null||D.call(y),!0}async uploadSingleFile(t){var e,a,r,c,h,m,b,M;t.status="uploading",t.progress=0,this.isUploading=!0,(a=(e=this.callbacks).onUpdate)==null||a.call(e);try{return t.response=await this.uploadFileChunked(t),t.status="success",t.progress=100,(c=(r=this.callbacks).onUploadSuccess)==null||c.call(r,t,t.response),t.response}catch(y){throw t.status="error",t.errorMessage=y instanceof Error?y.message:L("uploadFailed"),(m=(h=this.callbacks).onUploadError)==null||m.call(h,t,y),y}finally{this.isUploading=this.uploadFileList.some(y=>y.status==="uploading"),(M=(b=this.callbacks).onUpdate)==null||M.call(b),this.updateOverallProgress()}}async uploadFileChunked(t){if(!this.chunkedUploader)throw new Error(L("chunkedUploadConfigRequired"));return await this.chunkedUploader.upload(t)}async startUpload(){if(!this.shouldUseChunkedUpload())return;const t=this.uploadFileList.filter(a=>a.status==="pending");if(t.length===0)return;const e=[];for(const a of t)try{const r=await this.uploadSingleFile(a);r&&e.push(r)}catch(r){console.error(`文件 ${a.file.name} 上传失败:`,r)}return e}pauseUpload(){var t;(t=this.chunkedUploader)==null||t.pause()}resumeUpload(){var t;(t=this.chunkedUploader)==null||t.resume()}cancelUpload(){var t,e,a;(t=this.chunkedUploader)==null||t.cancel(),this.isUploading=!1,this.uploadMessage="上传已取消",this.uploadMessageType="info",(a=(e=this.callbacks).onUpdate)==null||a.call(e)}updateOverallProgress(){if(this.uploadFileList.length===0){this.uploadProgress=0;return}const t=this.uploadFileList.reduce((e,a)=>e+a.progress,0);this.uploadProgress=Math.round(t/this.uploadFileList.length)}hasUploadingFiles(){return this.uploadFileList.some(t=>t.status==="uploading")}hasPendingFiles(){return this.uploadFileList.some(t=>t.status==="pending")}hasAllFilesUploaded(){return this.uploadFileList.length>0&&this.uploadFileList.every(t=>t.status==="success")}getFailedFiles(){return this.uploadFileList.filter(t=>t.status==="error")}}const rt={success:"icon-success",error:"icon-cuowu",warning:"icon-warning",info:"icon-info"},Te=new Set;function Jt(o){const{message:t,type:e,duration:a=3e3,closable:r=!0}=o,c=document.createElement("div");c.className=`import-dialog-vanilla-toast ${e}`;const h=rt[e]||rt.info;c.innerHTML=`
1627
1628
  <div class="import-dialog-vanilla-toast-content">
1628
1629
  <i class="iconfont ${h} import-dialog-vanilla-toast-icon"></i>
1629
1630
  <span class="import-dialog-vanilla-toast-message">${t}</span>
@@ -1631,4 +1632,4 @@
1631
1632
  ${r?`<button class="import-dialog-vanilla-toast-close" data-action="close-toast">
1632
1633
  <i class="iconfont icon-guanbi"></i>
1633
1634
  </button>`:""}
1634
- `,document.body.appendChild(c);const m=[],b=()=>{c.classList.add("fade-out");const y=window.setTimeout(()=>{c.remove(),Te.delete(M)},3e3);m.push(y)},M={element:c,timers:m,close:b};if(Te.add(M),r){const y=c.querySelector('[data-action="close-toast"]');y&&y.addEventListener("click",b)}if(a>0){const y=window.setTimeout(b,a);m.push(y)}return M}function Gt(){Te.forEach(o=>{o.timers.forEach(t=>{window.clearTimeout(t)}),o.element.remove()}),Te.clear()}const q=class q{constructor(t){S(this,"container",null);S(this,"modalElement",null);S(this,"styleElement",null);S(this,"dateRangePicker",null);S(this,"activeTabIndex",0);S(this,"brandList",[]);S(this,"brandLoading",!1);S(this,"confirmLoading",!1);S(this,"formData",{brandId:void 0,imageRatio:"original",month:1,dateRange:[null,null]});S(this,"modalOptions",{});S(this,"renderer");S(this,"uploader");S(this,"onTabChangeCallback");S(this,"onBrandChangeCallback");S(this,"handleDocumentClick",t=>{const e=t.target;Array.from(document.querySelectorAll(".import-dialog-vanilla-custom-select")).some(r=>r.contains(e))||this.closeAllSelects()});this.container=t||document.body,this.injectStyles(),this.initUploader()}injectStyles(){document.getElementById("import-dialog-vanilla-styles")||(this.styleElement=document.createElement("style"),this.styleElement.id="import-dialog-vanilla-styles",this.styleElement.textContent=Ct(),document.head.appendChild(this.styleElement))}initUploader(){this.uploader=new Wt({multiple:!1,maxFiles:10,maxFileSize:100,maxFileSizeUnit:"MB"},{onUpdate:()=>this.updateModal(),onMessage:(t,e)=>this.showMessage(t,e),onFileChange:t=>{var e,a;return(a=(e=this.modalOptions.uploadConfig)==null?void 0:e.onFileChange)==null?void 0:a.call(e,t)},onUploadProgress:(t,e)=>{var a,r;return(r=(a=this.modalOptions.uploadConfig)==null?void 0:a.onProgress)==null?void 0:r.call(a,t,e)},onUploadSuccess:(t,e)=>{var a,r;return(r=(a=this.modalOptions.uploadConfig)==null?void 0:a.onSuccess)==null?void 0:r.call(a,t,e)},onUploadError:(t,e)=>{var a,r;return(r=(a=this.modalOptions.uploadConfig)==null?void 0:a.onError)==null?void 0:r.call(a,t,e)}})}get currentConfig(){const t=this.modalOptions.templateType||H.BASE,e=Oe(L),a=e[t]||e[H.BASE],r=this.modalOptions;return{...a,tabs:r.tabs||a.tabs,showBrand:r.showBrand!=null?r.showBrand:a.showBrand,showImageRatio:r.showImageRatio!=null?r.showImageRatio:a.showImageRatio,showMonth:r.showMonth!=null?r.showMonth:a.showMonth,showDateRange:r.showDateRange!=null?r.showDateRange:a.showDateRange,uploadTitle:r.uploadTitle||a.uploadTitle,uploadLinkText:r.uploadLinkText||a.uploadLinkText,uploadHint:r.uploadHint||a.uploadHint,acceptTypes:r.acceptTypes||a.acceptTypes,tips:r.tips||a.tips,templateUrl:r.templateUrl||a.templateUrl}}get dialogTitle(){return this.modalOptions.title||L("batchImport")}get dialogWidth(){return this.modalOptions.width||"480px"}getRenderContext(){var t,e;return{currentConfig:this.currentConfig,modalOptions:this.modalOptions,dialogTitle:this.dialogTitle,width:this.dialogWidth,activeTabIndex:this.activeTabIndex,brandList:this.brandList,brandLoading:this.brandLoading,brandPlaceholder:this.modalOptions.brandPlaceholder||L("defaultBrand"),formData:this.formData,uploadFileList:this.uploader.uploadFileList,multiple:((t=this.modalOptions.uploadConfig)==null?void 0:t.multiple)!=null?this.modalOptions.uploadConfig.multiple:!1,maxFiles:((e=this.modalOptions.uploadConfig)==null?void 0:e.maxFiles)!=null?this.modalOptions.uploadConfig.maxFiles:10,confirmLoading:this.confirmLoading,isUploading:this.uploader.isUploading,uploadProgress:this.uploader.uploadProgress,uploadMessage:this.uploader.uploadMessage,uploadMessageType:this.uploader.uploadMessageType}}createModal(){var t;this.modalElement&&this.modalElement.remove(),this.renderer=new Ht(this.getRenderContext()),this.modalElement=document.createElement("div"),this.modalElement.className="import-dialog-vanilla-wrapper",this.modalElement.innerHTML=this.renderer.render(),(t=this.container)==null||t.appendChild(this.modalElement),this.bindEvents(),this.initDateRangePicker()}updateModal(){var e;if(!this.modalElement)return;const t=(e=this.dateRangePicker)==null?void 0:e.getDates();this.renderer.updateContext(this.getRenderContext()),this.modalElement.innerHTML=this.renderer.render(),this.bindEvents(),this.currentConfig.showDateRange&&(t&&(this.formData.dateRange=t),this.initDateRangePicker())}initDateRangePicker(){var e;if(!this.modalElement)return;const t=this.modalElement.querySelector('[data-field="dateRange"]');t&&((e=this.dateRangePicker)==null||e.destroy(),this.dateRangePicker=new Ot({container:t,defaultDates:[this.formData.dateRange[0],this.formData.dateRange[1]],placeholder:[L("startDate"),L("endDate")],shortcuts:this.modalOptions.dateRangeShortcuts,disabledDate:this.modalOptions.disabledDate,onChange:a=>{this.formData.dateRange[0]=a[0],this.formData.dateRange[1]=a[1]?new Date(a[1].getFullYear(),a[1].getMonth(),a[1].getDate(),23,59,59):null}}))}bindEvents(){if(!this.modalElement)return;const t=this.modalElement.querySelector(".import-dialog-vanilla-overlay");t==null||t.addEventListener("click",D=>D.stopPropagation());const e=this.modalElement.querySelector(".import-dialog-vanilla-modal");e==null||e.addEventListener("click",D=>D.stopPropagation());const a=this.modalElement.querySelector("#import-dialog-close-btn");a==null||a.addEventListener("click",()=>this.handleCancel()),this.modalElement.querySelectorAll(".import-dialog-vanilla-tab").forEach(D=>{D.addEventListener("click",C=>{const I=parseInt(C.currentTarget.dataset.tabIndex||"0");this.handleTabChange(I)})});const c=this.modalElement.querySelector(".import-dialog-vanilla-upload-area"),h=this.modalElement.querySelector(".import-dialog-vanilla-file-input");c==null||c.addEventListener("click",()=>{this.uploader.isUploading||h==null||h.click()}),h==null||h.addEventListener("change",D=>{var I;const C=D.target.files;C&&C.length>0&&((((I=this.modalOptions.uploadConfig)==null?void 0:I.multiple)!=null?this.modalOptions.uploadConfig.multiple:!1)?this.uploader.beforeUpload(Array.from(C)):this.uploader.beforeUpload(C[0]))}),c==null||c.addEventListener("dragover",D=>{D.preventDefault(),c.classList.add("dragover")}),c==null||c.addEventListener("dragleave",()=>{c.classList.remove("dragover")}),c==null||c.addEventListener("drop",D=>{var I,s;D.preventDefault(),c.classList.remove("dragover");const C=(I=D.dataTransfer)==null?void 0:I.files;C&&C.length>0&&!this.uploader.isUploading&&((((s=this.modalOptions.uploadConfig)==null?void 0:s.multiple)!=null?this.modalOptions.uploadConfig.multiple:!1)?this.uploader.beforeUpload(Array.from(C)):this.uploader.beforeUpload(C[0]))}),this.modalElement.querySelectorAll(".import-dialog-vanilla-file-remove-btn").forEach(D=>{D.addEventListener("click",C=>{C.stopPropagation();const I=D.getAttribute("data-file-index");I!==null?this.uploader.removeFile(parseInt(I)):this.uploader.removeFile()})}),this.bindFormEvents();const b=this.modalElement.querySelector("#import-dialog-confirm-btn");b==null||b.addEventListener("click",()=>this.handleConfirm());const M=this.modalElement.querySelector("#import-dialog-cancel-btn");M==null||M.addEventListener("click",()=>this.handleCancel());const y=this.modalElement.querySelector("#import-dialog-download-btn");y==null||y.addEventListener("click",D=>{D.preventDefault(),this.handleDownloadTemplate()})}bindFormEvents(){if(!this.modalElement)return;this.bindCustomSelectEvents(),this.modalElement.querySelectorAll('[data-field="imageRatio"]').forEach(e=>{e.addEventListener("change",a=>{this.formData.imageRatio=a.target.value})})}bindCustomSelectEvents(){if(!this.modalElement)return;this.modalElement.querySelectorAll(".import-dialog-vanilla-custom-select").forEach(e=>{const a=e.querySelector(".import-dialog-vanilla-select-trigger"),r=e.querySelector(".import-dialog-vanilla-select-dropdown"),c=e.querySelectorAll(".import-dialog-vanilla-select-option"),h=e.getAttribute("data-field");a==null||a.addEventListener("click",m=>{m.stopPropagation(),!a.classList.contains("disabled")&&(this.closeAllSelects(e),a.classList.toggle("active"),r==null||r.classList.toggle("show"))}),c.forEach(m=>{m.addEventListener("click",b=>{var C;b.stopPropagation();const M=m.getAttribute("data-value"),y=m.textContent||"",D=a.querySelector(".import-dialog-vanilla-select-value");D&&(D.textContent=y,D.classList.remove("import-dialog-vanilla-select-placeholder")),c.forEach(I=>I.classList.remove("selected")),m.classList.add("selected"),a.classList.remove("active"),r==null||r.classList.remove("show"),h==="brandId"?(this.formData.brandId=M||void 0,(C=this.onBrandChangeCallback)==null||C.call(this,M||"")):h==="month"&&(this.formData.month=parseInt(M||"1"))})})}),document.addEventListener("click",this.handleDocumentClick)}closeAllSelects(t){if(!this.modalElement)return;this.modalElement.querySelectorAll(".import-dialog-vanilla-custom-select").forEach(a=>{if(t&&a===t)return;const r=a.querySelector(".import-dialog-vanilla-select-trigger"),c=a.querySelector(".import-dialog-vanilla-select-dropdown");r==null||r.classList.remove("active"),c==null||c.classList.remove("show")})}resetForm(){const t=new Date,e=t.getMonth()+1,a=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0,23,59,59);this.formData={brandId:void 0,imageRatio:"original",month:e,dateRange:[a,r]},this.uploader.reset()}async loadBrandData(){if(!this.currentConfig.showBrand)return;const t=this.modalOptions.brandData;if(Array.isArray(t))this.brandList=t,this.updateModal();else if(typeof t=="function"){this.brandLoading=!0,this.updateModal();try{this.brandList=await t()}catch{this.brandList=[]}finally{this.brandLoading=!1,this.updateModal()}}}handleTabChange(t){var a,r,c;this.activeTabIndex=t;const e={index:t,tab:this.currentConfig.tabs[t]};(a=this.onTabChangeCallback)==null||a.call(this,e),(c=(r=this.modalOptions).onTabChange)==null||c.call(r,e),this.updateModal()}async handleCancel(){this.modalOptions.onBeforeCancel&&await this.modalOptions.onBeforeCancel(),this.hide(),this.modalOptions.onCancel&&await this.modalOptions.onCancel()}async handleConfirm(){var c,h,m,b;if(this.uploader.uploadFileList.length===0){this.showMessage(L("fileTypeError"),"warning");return}if(this.uploader.hasUploadingFiles()){this.showMessage(L("filesUploading"),"warning");return}if(this.uploader.hasPendingFiles()){const M=((c=this.modalOptions.uploadConfig)==null?void 0:c.confirmLoading)!=null?this.modalOptions.uploadConfig.confirmLoading:!0;M&&(this.confirmLoading=!0,this.updateModal());try{const y=await this.uploader.startUpload();console.log("[分片上传] 分片上传结果:",y)}catch(y){console.error("[ImportDialog] 上传失败:",y),this.showMessage(L("uploadFailedRetry"),"error"),M&&(this.confirmLoading=!1,this.updateModal());return}}const t=this.uploader.getFailedFiles();if(console.log("[ImportDialog] 上传失败的文件数:",t),t.length>0){this.showMessage(L("filesUploadFailed",{count:t.length}),"warning"),(((h=this.modalOptions.uploadConfig)==null?void 0:h.confirmLoading)!=null?this.modalOptions.uploadConfig.confirmLoading:!0)&&(this.confirmLoading=!1,this.updateModal());return}if(!this.uploader.hasAllFilesUploaded()){this.showMessage("请等待所有文件上传完成","warning"),(((m=this.modalOptions.uploadConfig)==null?void 0:m.confirmLoading)!=null?this.modalOptions.uploadConfig.confirmLoading:!0)&&(this.confirmLoading=!1,this.updateModal());return}const a={files:this.uploader.uploadFileList.map(M=>M.response||M.file),formData:{...this.formData},activeTab:this.currentConfig.tabs[this.activeTabIndex],activeTabIndex:this.activeTabIndex},r=((b=this.modalOptions.uploadConfig)==null?void 0:b.confirmLoading)!=null?this.modalOptions.uploadConfig.confirmLoading:!0;r&&(this.confirmLoading=!0,this.updateModal());try{if(this.modalOptions.onBeforeConfirm&&await this.modalOptions.onBeforeConfirm(a),this.modalOptions.onConfirm){const M=await this.modalOptions.onConfirm(a);M!=null&&M.success?this.hide():M!=null&&M.message&&this.showMessage(M.message,"error")}}finally{r&&(this.confirmLoading=!1,this.updateModal())}}showMessage(t,e){Jt({message:t,type:e,duration:3e3})}_openModalCore(t){this.modalOptions=t||{},t!=null&&t.locale&&it(t.locale);const e=t==null?void 0:t.uploadConfig;this.uploader.updateConfig({multiple:(e==null?void 0:e.multiple)!=null?e.multiple:!1,maxFiles:(e==null?void 0:e.maxFiles)!=null?e.maxFiles:10,maxFileSize:(e==null?void 0:e.maxFileSize)!=null?e.maxFileSize:100,maxFileSizeUnit:(e==null?void 0:e.maxFileSizeUnit)!=null?e.maxFileSizeUnit:"MB",acceptTypes:this.currentConfig.acceptTypes,uploadConfig:e}),this.activeTabIndex=(t==null?void 0:t.defaultActiveTab)||0,this.resetForm(),this.createModal(),this.loadBrandData()}openModal(t){this._openModalCore(t)}closeModal(){this.handleCancel()}handleDownloadTemplate(){var t;if(this.modalOptions.onDownloadTemplate)this.modalOptions.onDownloadTemplate({url:this.currentConfig.templateUrl||"",activeTab:(t=this.modalOptions.tabs)==null?void 0:t[this.activeTabIndex]});else if(this.currentConfig.templateUrl){const e=document.createElement("a");e.href=this.currentConfig.templateUrl,e.download="",document.body.appendChild(e),e.click(),document.body.removeChild(e)}}setConfirmLoading(t){this.confirmLoading=t,this.updateModal()}hide(){var t;(t=this.dateRangePicker)==null||t.destroy(),this.dateRangePicker=null,this.modalElement&&(this.modalElement.remove(),this.modalElement=null),document.removeEventListener("click",this.handleDocumentClick)}destroy(){this.hide(),Gt(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null),document.removeEventListener("click",this.handleDocumentClick)}onTabChange(t){this.onTabChangeCallback=t}onBrandChange(t){this.onBrandChangeCallback=t}static getInstance(){return q.instance||(q.instance=new q(document.body)),q.instance}static open(t){return new Promise(e=>{const a=q.getInstance(),r={...t,onBeforeConfirm:async c=>{t!=null&&t.onBeforeConfirm&&await t.onBeforeConfirm(c)},onConfirm:async c=>{if(t!=null&&t.onConfirm){const h=await t.onConfirm(c);return h!=null&&h.success&&e(c),h}e(c)},onBeforeCancel:async()=>{t!=null&&t.onBeforeCancel&&await t.onBeforeCancel()},onCancel:()=>{t!=null&&t.onCancel&&t.onCancel(),e(null)}};a._openModalCore(r)})}static close(){var t;(t=q.instance)==null||t.closeModal()}static setLoading(t){var e;(e=q.instance)==null||e.setConfirmLoading(t)}static isReady(){return q.instance!==null}static setLocale(t){it(t),q.instance&&q.instance.updateModal()}static getLocale(){return qe.getLocale()}static destroyInstance(){q.instance&&(q.instance.destroy(),q.instance=null)}static install(){typeof window<"u"&&(window.addEventListener("message",t=>{const{type:e,data:a}=t.data||{};e==="OPEN_IMPORT_DIALOG"?q.open(a).catch(()=>{}):e==="CLOSE_IMPORT_DIALOG"&&q.close()}),window.$importDialog=q)}};S(q,"instance",null);let le=q;const lt=le,st=()=>le.install();typeof window<"u"&&(window.SlImport={ImportDialog:le,importDialogService:lt,installImportDialog:st,types:Qe,default:le}),G.ImportDialog=le,G.default=le,G.importDialogService=lt,G.installImportDialog=st,G.types=Qe,Object.defineProperties(G,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1635
+ `,document.body.appendChild(c);const m=[],b=()=>{c.classList.add("fade-out");const y=window.setTimeout(()=>{c.remove(),Te.delete(M)},3e3);m.push(y)},M={element:c,timers:m,close:b};if(Te.add(M),r){const y=c.querySelector('[data-action="close-toast"]');y&&y.addEventListener("click",b)}if(a>0){const y=window.setTimeout(b,a);m.push(y)}return M}function Gt(){Te.forEach(o=>{o.timers.forEach(t=>{window.clearTimeout(t)}),o.element.remove()}),Te.clear()}const q=class q{constructor(t){S(this,"container",null);S(this,"modalElement",null);S(this,"styleElement",null);S(this,"dateRangePicker",null);S(this,"activeTabIndex",0);S(this,"brandList",[]);S(this,"brandLoading",!1);S(this,"confirmLoading",!1);S(this,"formData",{brandId:void 0,imageRatio:"original",month:1,dateRange:[null,null]});S(this,"modalOptions",{});S(this,"renderer");S(this,"uploader");S(this,"onTabChangeCallback");S(this,"onBrandChangeCallback");S(this,"handleDocumentClick",t=>{const e=t.target;Array.from(document.querySelectorAll(".import-dialog-vanilla-custom-select")).some(r=>r.contains(e))||this.closeAllSelects()});this.container=t||document.body,this.injectStyles(),this.initUploader()}injectStyles(){document.getElementById("import-dialog-vanilla-styles")||(this.styleElement=document.createElement("style"),this.styleElement.id="import-dialog-vanilla-styles",this.styleElement.textContent=Ct(),document.head.appendChild(this.styleElement))}initUploader(){this.uploader=new Wt({multiple:!1,maxFileSizeUnit:"MB"},{onUpdate:()=>this.updateModal(),onMessage:(t,e)=>this.showMessage(t,e),onFileChange:t=>{var e,a;return(a=(e=this.modalOptions.uploadConfig)==null?void 0:e.onFileChange)==null?void 0:a.call(e,t)},onUploadProgress:(t,e)=>{var a,r;return(r=(a=this.modalOptions.uploadConfig)==null?void 0:a.onProgress)==null?void 0:r.call(a,t,e)},onUploadSuccess:(t,e)=>{var a,r;return(r=(a=this.modalOptions.uploadConfig)==null?void 0:a.onSuccess)==null?void 0:r.call(a,t,e)},onUploadError:(t,e)=>{var a,r;return(r=(a=this.modalOptions.uploadConfig)==null?void 0:a.onError)==null?void 0:r.call(a,t,e)}})}get currentConfig(){const t=this.modalOptions.templateType||H.BASE,e=Oe(L),a=e[t]||e[H.BASE],r=this.modalOptions;return{...a,tabs:r.tabs||a.tabs,showBrand:r.showBrand!=null?r.showBrand:a.showBrand,showImageRatio:r.showImageRatio!=null?r.showImageRatio:a.showImageRatio,showMonth:r.showMonth!=null?r.showMonth:a.showMonth,showDateRange:r.showDateRange!=null?r.showDateRange:a.showDateRange,uploadTitle:r.uploadTitle||a.uploadTitle,uploadLinkText:r.uploadLinkText||a.uploadLinkText,uploadHint:r.uploadHint||a.uploadHint,acceptTypes:r.acceptTypes||a.acceptTypes,tips:r.tips||a.tips,templateUrl:r.templateUrl||a.templateUrl}}get dialogTitle(){return this.modalOptions.title||L("batchImport")}get dialogWidth(){return this.modalOptions.width||"480px"}getRenderContext(){var t,e;return{currentConfig:this.currentConfig,modalOptions:this.modalOptions,dialogTitle:this.dialogTitle,width:this.dialogWidth,activeTabIndex:this.activeTabIndex,brandList:this.brandList,brandLoading:this.brandLoading,brandPlaceholder:this.modalOptions.brandPlaceholder||L("defaultBrand"),formData:this.formData,uploadFileList:this.uploader.uploadFileList,multiple:((t=this.modalOptions.uploadConfig)==null?void 0:t.multiple)!=null?this.modalOptions.uploadConfig.multiple:!1,maxFiles:(e=this.modalOptions.uploadConfig)==null?void 0:e.maxFiles,confirmLoading:this.confirmLoading,isUploading:this.uploader.isUploading,uploadProgress:this.uploader.uploadProgress,uploadMessage:this.uploader.uploadMessage,uploadMessageType:this.uploader.uploadMessageType}}createModal(){var t;this.modalElement&&this.modalElement.remove(),this.renderer=new Ht(this.getRenderContext()),this.modalElement=document.createElement("div"),this.modalElement.className="import-dialog-vanilla-wrapper",this.modalElement.innerHTML=this.renderer.render(),(t=this.container)==null||t.appendChild(this.modalElement),this.bindEvents(),this.initDateRangePicker()}updateModal(){var e;if(!this.modalElement)return;const t=(e=this.dateRangePicker)==null?void 0:e.getDates();this.renderer.updateContext(this.getRenderContext()),this.modalElement.innerHTML=this.renderer.render(),this.bindEvents(),this.currentConfig.showDateRange&&(t&&(this.formData.dateRange=t),this.initDateRangePicker())}initDateRangePicker(){var e;if(!this.modalElement)return;const t=this.modalElement.querySelector('[data-field="dateRange"]');t&&((e=this.dateRangePicker)==null||e.destroy(),this.dateRangePicker=new Ot({container:t,defaultDates:[this.formData.dateRange[0],this.formData.dateRange[1]],placeholder:[L("startDate"),L("endDate")],shortcuts:this.modalOptions.dateRangeShortcuts,disabledDate:this.modalOptions.disabledDate,onChange:a=>{this.formData.dateRange[0]=a[0],this.formData.dateRange[1]=a[1]?new Date(a[1].getFullYear(),a[1].getMonth(),a[1].getDate(),23,59,59):null}}))}bindEvents(){if(!this.modalElement)return;const t=this.modalElement.querySelector(".import-dialog-vanilla-overlay");t==null||t.addEventListener("click",D=>D.stopPropagation());const e=this.modalElement.querySelector(".import-dialog-vanilla-modal");e==null||e.addEventListener("click",D=>D.stopPropagation());const a=this.modalElement.querySelector("#import-dialog-close-btn");a==null||a.addEventListener("click",()=>this.handleCancel()),this.modalElement.querySelectorAll(".import-dialog-vanilla-tab").forEach(D=>{D.addEventListener("click",C=>{const I=parseInt(C.currentTarget.dataset.tabIndex||"0");this.handleTabChange(I)})});const c=this.modalElement.querySelector(".import-dialog-vanilla-upload-area"),h=this.modalElement.querySelector(".import-dialog-vanilla-file-input");c==null||c.addEventListener("click",()=>{this.uploader.isUploading||h==null||h.click()}),h==null||h.addEventListener("change",D=>{var I;const C=D.target.files;C&&C.length>0&&((((I=this.modalOptions.uploadConfig)==null?void 0:I.multiple)!=null?this.modalOptions.uploadConfig.multiple:!1)?this.uploader.beforeUpload(Array.from(C)):this.uploader.beforeUpload(C[0]))}),c==null||c.addEventListener("dragover",D=>{D.preventDefault(),c.classList.add("dragover")}),c==null||c.addEventListener("dragleave",()=>{c.classList.remove("dragover")}),c==null||c.addEventListener("drop",D=>{var I,s;D.preventDefault(),c.classList.remove("dragover");const C=(I=D.dataTransfer)==null?void 0:I.files;C&&C.length>0&&!this.uploader.isUploading&&((((s=this.modalOptions.uploadConfig)==null?void 0:s.multiple)!=null?this.modalOptions.uploadConfig.multiple:!1)?this.uploader.beforeUpload(Array.from(C)):this.uploader.beforeUpload(C[0]))}),this.modalElement.querySelectorAll(".import-dialog-vanilla-file-remove-btn").forEach(D=>{D.addEventListener("click",C=>{C.stopPropagation();const I=D.getAttribute("data-file-index");I!==null?this.uploader.removeFile(parseInt(I)):this.uploader.removeFile()})}),this.bindFormEvents();const b=this.modalElement.querySelector("#import-dialog-confirm-btn");b==null||b.addEventListener("click",()=>this.handleConfirm());const M=this.modalElement.querySelector("#import-dialog-cancel-btn");M==null||M.addEventListener("click",()=>this.handleCancel());const y=this.modalElement.querySelector("#import-dialog-download-btn");y==null||y.addEventListener("click",D=>{D.preventDefault(),this.handleDownloadTemplate()})}bindFormEvents(){if(!this.modalElement)return;this.bindCustomSelectEvents(),this.modalElement.querySelectorAll('[data-field="imageRatio"]').forEach(e=>{e.addEventListener("change",a=>{this.formData.imageRatio=a.target.value})})}bindCustomSelectEvents(){if(!this.modalElement)return;this.modalElement.querySelectorAll(".import-dialog-vanilla-custom-select").forEach(e=>{const a=e.querySelector(".import-dialog-vanilla-select-trigger"),r=e.querySelector(".import-dialog-vanilla-select-dropdown"),c=e.querySelectorAll(".import-dialog-vanilla-select-option"),h=e.getAttribute("data-field");a==null||a.addEventListener("click",m=>{m.stopPropagation(),!a.classList.contains("disabled")&&(this.closeAllSelects(e),a.classList.toggle("active"),r==null||r.classList.toggle("show"))}),c.forEach(m=>{m.addEventListener("click",b=>{var C;b.stopPropagation();const M=m.getAttribute("data-value"),y=m.textContent||"",D=a.querySelector(".import-dialog-vanilla-select-value");D&&(D.textContent=y,D.classList.remove("import-dialog-vanilla-select-placeholder")),c.forEach(I=>I.classList.remove("selected")),m.classList.add("selected"),a.classList.remove("active"),r==null||r.classList.remove("show"),h==="brandId"?(this.formData.brandId=M||void 0,(C=this.onBrandChangeCallback)==null||C.call(this,M||"")):h==="month"&&(this.formData.month=parseInt(M||"1"))})})}),document.addEventListener("click",this.handleDocumentClick)}closeAllSelects(t){if(!this.modalElement)return;this.modalElement.querySelectorAll(".import-dialog-vanilla-custom-select").forEach(a=>{if(t&&a===t)return;const r=a.querySelector(".import-dialog-vanilla-select-trigger"),c=a.querySelector(".import-dialog-vanilla-select-dropdown");r==null||r.classList.remove("active"),c==null||c.classList.remove("show")})}resetForm(){const t=new Date,e=t.getMonth()+1,a=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0,23,59,59);this.formData={brandId:void 0,imageRatio:"original",month:e,dateRange:[a,r]},this.uploader.reset()}async loadBrandData(){if(!this.currentConfig.showBrand)return;const t=this.modalOptions.brandData;if(Array.isArray(t))this.brandList=t,this.updateModal();else if(typeof t=="function"){this.brandLoading=!0,this.updateModal();try{this.brandList=await t()}catch{this.brandList=[]}finally{this.brandLoading=!1,this.updateModal()}}}handleTabChange(t){var a,r,c;this.activeTabIndex=t;const e={index:t,tab:this.currentConfig.tabs[t]};(a=this.onTabChangeCallback)==null||a.call(this,e),(c=(r=this.modalOptions).onTabChange)==null||c.call(r,e),this.updateModal()}async handleCancel(){this.modalOptions.onBeforeCancel&&await this.modalOptions.onBeforeCancel(),this.hide(),this.modalOptions.onCancel&&await this.modalOptions.onCancel()}async handleConfirm(){var c,h,m,b;if(this.uploader.uploadFileList.length===0){this.showMessage(L("fileTypeError"),"warning");return}if(this.uploader.hasUploadingFiles()){this.showMessage(L("filesUploading"),"warning");return}if(this.uploader.hasPendingFiles()){const M=((c=this.modalOptions.uploadConfig)==null?void 0:c.confirmLoading)!=null?this.modalOptions.uploadConfig.confirmLoading:!0;M&&(this.confirmLoading=!0,this.updateModal());try{const y=await this.uploader.startUpload();console.log("[分片上传] 分片上传结果:",y)}catch(y){console.error("[ImportDialog] 上传失败:",y),this.showMessage(L("uploadFailedRetry"),"error"),M&&(this.confirmLoading=!1,this.updateModal());return}}const t=this.uploader.getFailedFiles();if(console.log("[ImportDialog] 上传失败的文件数:",t),t.length>0){this.showMessage(L("filesUploadFailed",{count:t.length}),"warning"),(((h=this.modalOptions.uploadConfig)==null?void 0:h.confirmLoading)!=null?this.modalOptions.uploadConfig.confirmLoading:!0)&&(this.confirmLoading=!1,this.updateModal());return}if(!this.uploader.hasAllFilesUploaded()){this.showMessage("请等待所有文件上传完成","warning"),(((m=this.modalOptions.uploadConfig)==null?void 0:m.confirmLoading)!=null?this.modalOptions.uploadConfig.confirmLoading:!0)&&(this.confirmLoading=!1,this.updateModal());return}const a={files:this.uploader.uploadFileList.map(M=>M.response||M.file),formData:{...this.formData},activeTab:this.currentConfig.tabs[this.activeTabIndex],activeTabIndex:this.activeTabIndex},r=((b=this.modalOptions.uploadConfig)==null?void 0:b.confirmLoading)!=null?this.modalOptions.uploadConfig.confirmLoading:!0;r&&(this.confirmLoading=!0,this.updateModal());try{if(this.modalOptions.onBeforeConfirm&&await this.modalOptions.onBeforeConfirm(a),this.modalOptions.onConfirm){const M=await this.modalOptions.onConfirm(a);M!=null&&M.success?this.hide():M!=null&&M.message&&this.showMessage(M.message,"error")}}finally{r&&(this.confirmLoading=!1,this.updateModal())}}showMessage(t,e){Jt({message:t,type:e,duration:3e3})}_openModalCore(t){this.modalOptions=t||{},t!=null&&t.locale&&it(t.locale);const e=t==null?void 0:t.uploadConfig;this.uploader.updateConfig({multiple:(e==null?void 0:e.multiple)!=null?e.multiple:!1,maxFiles:e==null?void 0:e.maxFiles,maxFileSize:e==null?void 0:e.maxFileSize,maxFileSizeUnit:(e==null?void 0:e.maxFileSizeUnit)!=null?e.maxFileSizeUnit:"MB",acceptTypes:this.currentConfig.acceptTypes,uploadConfig:e}),this.activeTabIndex=(t==null?void 0:t.defaultActiveTab)||0,this.resetForm(),this.createModal(),this.loadBrandData()}openModal(t){this._openModalCore(t)}closeModal(){this.handleCancel()}handleDownloadTemplate(){var t;if(this.modalOptions.onDownloadTemplate)this.modalOptions.onDownloadTemplate({url:this.currentConfig.templateUrl||"",activeTab:(t=this.modalOptions.tabs)==null?void 0:t[this.activeTabIndex]});else if(this.currentConfig.templateUrl){const e=document.createElement("a");e.href=this.currentConfig.templateUrl,e.download="",document.body.appendChild(e),e.click(),document.body.removeChild(e)}}setConfirmLoading(t){this.confirmLoading=t,this.updateModal()}hide(){var t;(t=this.dateRangePicker)==null||t.destroy(),this.dateRangePicker=null,this.modalElement&&(this.modalElement.remove(),this.modalElement=null),document.removeEventListener("click",this.handleDocumentClick)}destroy(){this.hide(),Gt(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null),document.removeEventListener("click",this.handleDocumentClick)}onTabChange(t){this.onTabChangeCallback=t}onBrandChange(t){this.onBrandChangeCallback=t}static getInstance(){return q.instance||(q.instance=new q(document.body)),q.instance}static open(t){return new Promise(e=>{const a=q.getInstance(),r={...t,onBeforeConfirm:async c=>{t!=null&&t.onBeforeConfirm&&await t.onBeforeConfirm(c)},onConfirm:async c=>{if(t!=null&&t.onConfirm){const h=await t.onConfirm(c);return h!=null&&h.success&&e(c),h}e(c)},onBeforeCancel:async()=>{t!=null&&t.onBeforeCancel&&await t.onBeforeCancel()},onCancel:()=>{t!=null&&t.onCancel&&t.onCancel(),e(null)}};a._openModalCore(r)})}static close(){var t;(t=q.instance)==null||t.closeModal()}static setLoading(t){var e;(e=q.instance)==null||e.setConfirmLoading(t)}static isReady(){return q.instance!==null}static setLocale(t){it(t),q.instance&&q.instance.updateModal()}static getLocale(){return qe.getLocale()}static destroyInstance(){q.instance&&(q.instance.destroy(),q.instance=null)}static install(){typeof window<"u"&&(window.addEventListener("message",t=>{const{type:e,data:a}=t.data||{};e==="OPEN_IMPORT_DIALOG"?q.open(a).catch(()=>{}):e==="CLOSE_IMPORT_DIALOG"&&q.close()}),window.$importDialog=q)}};S(q,"instance",null);let le=q;const lt=le,st=()=>le.install();typeof window<"u"&&(window.SlImport={ImportDialog:le,importDialogService:lt,installImportDialog:st,types:Qe,default:le}),G.ImportDialog=le,G.default=le,G.importDialogService=lt,G.installImportDialog=st,G.types=Qe,Object.defineProperties(G,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});