import{C as Au,Ca as dA,Fn as MV,Gn as NV,Ja as g,Nr as S$,Ns as rh,Or as Rhe,Ra as f5,Rr as Si,S as Ahe,So as jV,V as CI,X as D$,Zi as aA,Zs as th,_s as ph,ai as Vj,et as DI,gt as Ex,jt as Gj,k as Bb,n as $B,nn as J$,nr as O3,s as $a,ss as o5,vc as wf,ya as ci,yc as wp,za as fA}from"./chunk-b0nJCs5_.js";import{t as X1}from"./chunk-CDRFWLLW.js";import{A as qn,O as ln,o as Je,r as D,s as Jn}from"./chunk-Cmet2Nw-.js";import{k as tf,u as Jp}from"./chunk-DcB590Yc.js";import{n as ce}from"./chunk-DwtxXnIx2.js";var r=class o{label=Rhe(void 0);title=Rhe(void 0);responsiveLabel=ph(!1);disabled=ph(void 0);theme=ph(`secondary`);ngOnChanges(){let t=this.label();t===void 0&&!this.title()&&this.title.set("刪除"),t===``&&this.label.set("刪除")}static ɵfac=function(n){return new(n||o)};static ɵcmp=$a({type:o,selectors:[[`my-delete-button`]],inputs:{label:[1,`label`],title:[1,`title`],responsiveLabel:[1,`responsiveLabel`],disabled:[1,`disabled`],theme:[1,`theme`]},outputs:{label:`labelChange`,title:`titleChange`},features:[ci],decls:1,vars:5,consts:[[`icon`,`delete`,`theme`,`secondary`,3,`disabled`,`label`,`title`,`responsiveLabel`,`theme`]],template:function(n,e){n&1&&th(0,`my-button`,0),n&2&&Ex(`disabled`,e.disabled())(`label`,e.label())(`title`,e.title())(`responsiveLabel`,e.responsiveLabel())(`theme`,e.theme())},dependencies:[ce],encapsulation:2})};function B(t,n){if(t&1&&th(0,`my-global-icon`,3),t&2)Ex(`iconName`,D$().icon())}function X(t,n){if(t&1&&(wp(0,`div`,5),J$(1),Bb()),t&2){let i=D$();$B(),aA(i.filename)}}function U(t,n){if(t&1){let i=jV();wp(0,`button`,7),rh(`click`,function(){CI(i);return DI(D$().reset())}),S$(1,0),Bb()}}var j=class t{notifier=g(Si);theme=ph(`secondary`);inputLabel=ph(void 0);inputName=ph(void 0);extensions=ph([]);maxFileSize=ph(void 0);displayFilename=ph(!1);displayReset=ph(!1);icon=ph(void 0);buttonTooltip=ph(void 0);fileChanged=Ahe();classes={};allowedExtensionsMessage=``;fileInputValue;file;get filename(){return this.file?this.file.name:``}ngOnInit(){this.allowedExtensionsMessage=this.extensions().join(`, `),this.buildClasses()}ngOnChanges(){this.buildClasses()}buildClasses(){this.classes={"with-icon":!!this.icon(),"primary-button":this.theme()===`primary`,"secondary-button":this.theme()===`secondary`,"icon-only":!this.inputLabel()}}fileChange(n){if(n.target.files?.length){let[i]=n.target.files;if(i.size>this.maxFileSize()){this.notifier.error("這個檔案太大了。");return}let e=`.`+i.name.split(`.`).pop();if(this.extensions().includes(e.toLowerCase())===!1){let r=`此輸入無法處理此類檔案。接受的副檔名包括：${this.allowedExtensionsMessage}。`;this.notifier.error(r);return}this.file=i,this.propagateChange(this.file)}this.fileChanged.emit(this.file)}reset(){this.writeValue(void 0),this.propagateChange(void 0),this.fileChanged.emit(void 0)}propagateChange=n=>{};writeValue(n){this.file=n,this.file||(this.fileInputValue=null)}registerOnChange(n){this.propagateChange=n}registerOnTouched(){}static ɵfac=function(i){return new(i||t)};static ɵcmp=$a({type:t,selectors:[[`my-reactive-file`]],inputs:{theme:[1,`theme`],inputLabel:[1,`inputLabel`],inputName:[1,`inputName`],extensions:[1,`extensions`],maxFileSize:[1,`maxFileSize`],displayFilename:[1,`displayFilename`],displayReset:[1,`displayReset`],icon:[1,`icon`],buttonTooltip:[1,`buttonTooltip`]},outputs:{fileChanged:`fileChanged`},features:[f5([{provide:D,useExisting:wf(()=>t),multi:!0}]),ci],decls:8,vars:10,consts:()=>{let n;return n="重設",[n,[1,`root`],[1,`button-file`,3,`ngClass`,`ngbTooltip`],[3,`iconName`],[`type`,`file`,3,`change`,`ngModelChange`,`name`,`id`,`accept`,`ngModel`],[1,`filename`,`ellipsis`],[1,`reset-button`,`reset-button-small`,`ms-2`],[1,`reset-button`,`reset-button-small`,`ms-2`,3,`click`]]},template:function(i,e){i&1&&(wp(0,`div`,1)(1,`div`,2),NV(2,B,1,1,`my-global-icon`,3),wp(3,`span`),J$(4),Bb(),wp(5,`input`,4),rh(`change`,function(d){return e.fileChange(d)}),fA(`ngModelChange`,function(d){return o5(e.fileInputValue,d)||(e.fileInputValue=d),d}),Bb(),Vj(),Bb(),NV(6,X,2,1,`div`,5),NV(7,U,2,0,`button`,6),Bb()),i&2&&($B(),Ex(`ngClass`,e.classes)(`ngbTooltip`,e.buttonTooltip()),$B(),MV(e.icon()?2:-1),$B(2),aA(e.inputLabel()),$B(),Ex(`name`,e.inputName())(`id`,e.inputName())(`accept`,e.extensions()),dA(`ngModel`,e.fileInputValue),Gj(),$B(),MV(e.displayFilename()===!0&&e.filename?6:-1),$B(),MV(e.displayReset()&&e.file?7:-1))},dependencies:[Au,O3,tf,Jp,Jn,Je,qn,ln,X1],styles:[`.root[_ngcontent-%COMP%]{height:auto;display:flex;align-items:center}.root[_ngcontent-%COMP%]   .button-file.with-icon[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]{position:relative;top:-1px;right:0;display:inline-block;width:24px;height:24px;line-height:24px}.root[_ngcontent-%COMP%]   .button-file.with-icon[_ngcontent-%COMP%]:not(.icon-only)   my-global-icon[_ngcontent-%COMP%]{margin-inline-end:.1875rem}.root[_ngcontent-%COMP%]   .filename[_ngcontent-%COMP%]{font-weight:600;margin-inline-start:.3125rem}`],changeDetection:1})};export{r as n,j as t};
//# debugId=06e37c08-3c2b-5024-b4be-96c331e037ca
//# sourceMappingURL=chunk-DsKBogZp.js.map